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

Handle MAX_INT_256 and malicious ER20 sends #44

Closed
zmanian opened this issue Jun 14, 2021 · 5 comments
Closed

Handle MAX_INT_256 and malicious ER20 sends #44

zmanian opened this issue Jun 14, 2021 · 5 comments

Comments

@zmanian
Copy link
Contributor

zmanian commented Jun 14, 2021

  1. We need a pull request on the Cosmos SDK upstream to increase the maxBitLength of SDK.Int to 257 bits to ensure and a test the check the SDK.Int can deserialize the max ERC20 value.
`_, err := sdk.NewIntFromString("115792089237316195423570985008687907853269984665640564039457584007913129639935")`

should be in the test case.

We need a check in

func (a EthereumEventProcessor) Handle to ensure that adding the amount send to Cosmos doesn't overflow the max size of SDK.Int.

If it does overflow we should increment the event nonce but ignore the amount sent.

@jtremback
Copy link
Contributor

If it does overflow we should increment the event nonce but ignore the amount sent.

I think it already does work this way, as a natural outcome of ctx.CacheContext on https://github.com/PeggyJV/gravity-bridge/blob/main/module/x/gravity/keeper/ethereum_event_vote.go#L120

@albertchon
Copy link
Contributor

cosmos/cosmos-sdk#9511 closes this issue

@zmanian
Copy link
Contributor Author

zmanian commented Jun 15, 2021

I don't see anything in ctx.CacheContext that will catch a panic. I think this only handles an error and not a panic.

@zmanian
Copy link
Contributor Author

zmanian commented Jun 15, 2021

We need a panic handler here. Not just an error handler.

@albertchon
Copy link
Contributor

albertchon commented Jun 16, 2021

FYI we fixed this in our fork without a panic handler
image

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.

3 participants