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

BigInteger check should throw not assert #407

Open
fulldecent opened this issue Aug 9, 2019 · 2 comments
Open

BigInteger check should throw not assert #407

fulldecent opened this issue Aug 9, 2019 · 2 comments

Comments

@fulldecent
Copy link
Contributor

fulldecent commented Aug 9, 2019

https://github.com/aionnetwork/AVM/blob/master/org.aion.avm.userlib/src/org/aion/avm/userlib/AionBuffer.java#L388

Because BigIntegers are possible to get to this point which are large.

It also says

// BigInteger instances can't be larger than 32-bytes, in AVM.

If this is true I'm wrong, please reference proof for that statement

@jeff-aion
Copy link
Contributor

This is a restriction imposed by AVM, specifically:

In standard Java, these are unbounded, but the limit is imposed by the AVM to constrain the effort expended for constant cost.

@fulldecent
Copy link
Contributor Author

fulldecent commented Aug 16, 2019

Ah, so the Aion BigInteger implementation shadows java.math.BigInteger.

What is the primary documentation I should cite for that?

Can I get a BigInteger.MAX_VALUE and BigInteger.MIN_VALUE?

Is BigInteger.MAX_VALUE.add(BigInteger.ONE) undefined? Is that documented?

Right now AIP-040 was expecting BigInteger.MAX_VALUE == 2^256 but that is not the case.

This is where I checked for documentation

Screen Shot 2019-08-16 at 21 13 38

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

No branches or pull requests

2 participants