hypercore-one / znn_sdk_csharp Goto Github PK
View Code? Open in Web Editor NEWZenon SDK for .NET
License: MIT License
Zenon SDK for .NET
License: MIT License
Describe the bug
The commands bridge.unwrap.list
and bridge.unwrap.listUnredeemed
cause the following error when deserializing the JSON-RPC result.
Error! Deserializing JSON-RPC result to type JUnwrapTokenRequestList failed with JsonReaderException: Could not convert to integer: 4000000204. Path 'result.list[5].logIndex'.
To Reproduce
Execute the bridge.unwrap.list
or bridge.unwrap.listUnredeemed
command.
Expected behavior
The unwrap token request results are shown.
Actual behaviour
The deserialization of type JUnwrapTokenRequestList
causes an error.
Describe the bug
The ABI impl. differs between C# and Go when encoding an ABI function with empty strings arguments.
To Reproduce
// Encoded empty string
1b043f54000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
// Encoded "Hello World!" string
1b043f540000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000c48656c6c6f20576f726c64210000000000000000000000000000000000000000
// The code to reproduce the results
using Zenon.Abi;
using Zenon.Abi.Json;
using Zenon.Utils;
Future<void> main() async {
var definition = Abi.ParseEntries(new JEntry[]
{
new JEntry() { type = "function", name = "Test", inputs = new JParam[]
{
new JParam() { name = "value", type = "string" }
} }
});
Console.WriteLine(BytesUtils.ToHexString(definition.EncodeFunction("Test", "")));
Console.WriteLine(BytesUtils.ToHexString(definition.EncodeFunction("Test", "Hello World!")));
}
// Encoded empty string
1b043f5400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000
// Encoded "Hello World!" string
1b043f540000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000c48656c6c6f20576f726c64210000000000000000000000000000000000000000
// The code to reproduce the results
package main
import (
"encoding/hex"
"fmt"
"strings"
"github.com/zenon-network/go-zenon/vm/abi"
)
const (
jsonPack = `
[{"type":"function","name":"Test","inputs":[
{"name":"value","type":"string"}
]}
]`
)
var (
ABIMock = abi.JSONToABIContract(strings.NewReader(jsonPack))
)
func main() {
data1, _ := ABIMock.PackMethod("Test", "")
data2, _ := ABIMock.PackMethod("Test", "Hello World!")
fmt.Println(hex.EncodeToString(data1))
fmt.Println(hex.EncodeToString(data2))
}
Expected behavior
The Go implementation uses a more efficient way of handling empty strings. The Dart impl. needs to be adjusted to match the same behaviour as the Go impl.
Additional context
Reading the latest version of the Formal Specification of the Encoding it looks like empty strings should be padded with trailing zero-bytes to a length of 32 bytes.
But, these two Online ABI Encoders yield the same result as the Go impl.
Although I cannot exactly find it in the Formal Specification of the Encoding, the Go impl is probably the correct one.
Is your feature request related to a problem?
The Zenon SDK does not have a library for connecting to the Zenon Ledger App.
Describe the solution you'd like
With the introduction and implementation of the Wallet abstraction it is now possible to introduce plug-in libraries with different wallet implementations.
The first library will be offering a cross-platform solution for the Ledger Nano S/X/SP and Stax on Windows/Linux/OSX.
Additional context
This work will be required to enable Zenon Ledger App support for the Zenon CLI for .NET.
Describe the bug
The SHA3.Net.BouncyCastle.KeccakDigest
class throws an InvalidOperationException
when generation PoW concurrently.
To Reproduce
Generate PoW between two or more threads concurrently.
Expected behavior
PoW is generated on each thread.
Actual behavior
An System.InvalidOperationException: attempt to absorb while squeezing
is thrown on the second thread.
Library
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.