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

Complex bug with Eth prover and Eth client #140

Closed
MaksymZavershynskyi opened this issue Jul 6, 2020 · 0 comments · Fixed by #141
Closed

Complex bug with Eth prover and Eth client #140

MaksymZavershynskyi opened this issue Jul 6, 2020 · 0 comments · Fixed by #141

Comments

@MaksymZavershynskyi
Copy link
Contributor

Update: The cause is found and a simple fix should be submitted by EOD July 6, 2020.

Currently, transfer-eth-erc20-to-near command waits until Eth2NearClient catches up with the necessary block before proceeding with minting. However, it does not wait for the block to be confirmed, instead it simply waits for it to appear on the canonical chain: https://github.com/near/rainbow-bridge/blob/master/environment/commands/transfer-eth-erc20-to-near.js#L146

This bug went uncaught by the tests because of another bug described in here: #114 Specifically:

In Eth2NearProver contract the verification of the proof should be before the cross contract call to the client: https://github.com/near/rainbow-bridge/blob/c42defee097d2e4ac6d86777ae1c374e728402e1/libs-rs/eth-prover/src/lib.rs#L143

Fortunately, it is an easy fix, however a naive fix breaks the tests. This happens because of another bug in https://github.com/zmitton/eth-object that we are using (and probably shouldn't). When tests are run with Ganache the difficulty is set to 0, however eth-object incorrectly serializes Ethereum header with RLP, because 0 is a special case, see: https://ethereum.stackexchange.com/questions/67055/block-header-hash-verification Incorrect serialization results in incorrect header passed with the proof to the minting function, which causes it to crash.

MaksymZavershynskyi added a commit that referenced this issue Jul 6, 2020
* Fix prover promise and header encoding. Fixes #114 . Fixes #140

* Rebuild contract

* Typo
karim-en pushed a commit that referenced this issue Dec 20, 2021
* Fix prover promise and header encoding. Fixes #114 . Fixes #140

* Rebuild contract

* Typo
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.

1 participant