Skip to content
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

AccountState constructor failure #1005

Closed
Qiao-Jin opened this issue Aug 6, 2019 · 1 comment · Fixed by #1006
Closed

AccountState constructor failure #1005

Qiao-Jin opened this issue Aug 6, 2019 · 1 comment · Fixed by #1006

Comments

@Qiao-Jin
Copy link
Contributor

Qiao-Jin commented Aug 6, 2019

Code below will throw unexpected Exception:

byte[] value = new AccountState()
{
    Votes = new ECPoint[] { ECCurve.Secp256r1.G }
}.ToByteArray();
AccountState state = new AccountState(value);

System.FormatException
StackTrace:
at Neo.IO.Helper.ReadVarInt(BinaryReader reader, UInt64 max)
at Neo.IO.Helper.ReadVarBytes(BinaryReader reader, Int32 max)
at Neo.SmartContract.Helper.DeserializeStackItem(BinaryReader reader, UInt32 maxArraySize, UInt32 maxItemSize)
at Neo.SmartContract.Helper.DeserializeStackItem(Byte[] data, UInt32 maxArraySize, UInt32 maxItemSize)
at Neo.SmartContract.Native.Tokens.Nep5AccountState.FromByteArray(Byte[] data)
at Neo.SmartContract.Native.Tokens.Nep5AccountState..ctor(Byte[] data)
at Neo.SmartContract.Native.Tokens.NeoToken.AccountState..ctor(Byte[] data)
at Neo.UnitTests.SmartContract.Native.Tokens.UT_NeoToken.TestVote()

Test case can be found here:
https://github.com/eryeer/neoUT/blob/1e503440a818c64078f82c3fabcf914994698abe/neo.UnitTests/SmartContract/Native/Tokens/UT_NeoToken.cs#L464-L468

@shargon
Copy link
Member

shargon commented Aug 6, 2019

Please review this fix #1006

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants