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.
ExecutionBlockProof::merkle_root_from_branchcontains 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.