Coder Social home page Coder Social logo

znn_sdk_csharp's People

Contributors

kinggorrin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

0x3639 kinggorrin

znn_sdk_csharp's Issues

Type `JUnwrapTokenRequestList` fails to deserialize

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.

ABI impl. difference between encoding empty strings in C# vs Go

Describe the bug

The ABI impl. differs between C# and Go when encoding an ABI function with empty strings arguments.

To Reproduce

C#

// 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!")));
}

Go

// 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.

Feature: Ledger Wallet

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.

InvalidOperationException when generating PoW concurrently

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

  • OS: Windows 10
  • Version: v0.6.10
  • Commit hash: a97c2c1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.