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

Eth2-to-Near-relay: don't panic on MerkleProof verification #815

Open
sept-en opened this issue Sep 19, 2022 · 2 comments
Open

Eth2-to-Near-relay: don't panic on MerkleProof verification #815

sept-en opened this issue Sep 19, 2022 · 2 comments
Assignees
Labels
bug relayers rust Pull requests that update Rust code

Comments

@sept-en
Copy link
Contributor

sept-en commented Sep 19, 2022

ExecutionBlockProof::merkle_root_from_branch contains an assertion statement outside of a test block:
assert_eq!(branch.len(), depth, "proof length should equal depth");. This assertion encodes an invariant which should not occur during runtime based on the inputs to the call. However, the relay will panic if this property should ever be broken.

It would be preferable to return an error, providing the same guarantees that the function will not verify invalid data but will not crash the program.

@olga24912
Copy link
Contributor

It is not a bug. I use this code only in tests.

@sept-en
Copy link
Contributor Author

sept-en commented Sep 25, 2022

@olga24912 this is actually a bug. If the specific part of the code is intended to be used only in tests, it should have been protected with an appropriate feature flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug relayers rust Pull requests that update Rust code
Projects
None yet
Development

No branches or pull requests

2 participants