New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difference in BigInteger causing fork (neo-python vs neo-cli C#) #49

Closed
igormcoelho opened this Issue May 29, 2018 · 5 comments

Comments

Projects
None yet
4 participants
@igormcoelho
Copy link
Contributor

igormcoelho commented May 29, 2018

  • neo-python-core version: master
  • Python version: 3
  • Operating System: Deepin

Description

I deployed this contract (in C#) and tested storage "size" and "value":

using Neo.SmartContract.Framework.Services.Neo;
using System;
using System.Numerics;
namespace NeoContract1
{
    public class Contract1 : SmartContract
    {
        public static int Main()
        {
            Runtime.Notify("oi");
            BigInteger bi = 1;
            Runtime.Notify(bi);
            bi -= 1;
            byte[] ba = bi.ToByteArray();
            Runtime.Notify(ba.Length);
            if(ba.Length > 0)
                Runtime.Notify(ba[0]);
            Storage.Put(Storage.CurrentContext, "size", ba.Length+10);
            Storage.Put(Storage.CurrentContext, "value", ba);
            
            return 3;
        }
    }
}

According to Python RPC, "size is 10" (because Bigint 0 to bytearray is empty), but according to C# RPC, "size is 11" (because BigInt 0 in C# is b'\x00', not empty).

What I Did

I used neocompiler.io Eco platform, that already integrates full neo-python and neo-cli + neo C# ecosystem.
It's easy to change the RPC node (on top of the screen), python is localhost:10332 and C# is localhost:30335 (if doing locally). Online is https://node1.neocompiler.io and https://eco.neocompiler.io (a current workaround for python rpc... will receive a better name in a few days :D)

It's worth mentioning that theses tests are part of the fork competition Vitor and I are promoting at NeoResearch, with the goal of fixing differences in Neo ecosystem modules that could cause future forks in the blockchain.

@localhuman

This comment has been minimized.

Copy link
Collaborator

localhuman commented May 29, 2018

Thanks for the bug report! We will look into it!

@localhuman

This comment has been minimized.

Copy link
Collaborator

localhuman commented May 29, 2018

See your PR now, taking a look 👍

@igormcoelho

This comment has been minimized.

@metachris

This comment has been minimized.

Copy link
Collaborator

metachris commented May 30, 2018

Merged the PR and triggered a new PyPI build. After v0.4.7 is up on PyPI, we need an update to the neo-python dependencies to get this into neo-python.

https://travis-ci.org/CityOfZion/neo-python-core/builds/385872559

Will close this ticket once neo-python is updated

@metachris

This comment has been minimized.

Copy link
Collaborator

metachris commented May 31, 2018

For reference: CityOfZion/neo-python#446

@ixje ixje closed this Aug 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment