Skip to content

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

Description

@sept-en

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugrelayersrustPull requests that update Rust code

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions