Skip to content

Commit

Permalink
add two examples that raise
Browse files Browse the repository at this point in the history
  • Loading branch information
Eikix committed Feb 7, 2025
1 parent c0c6608 commit e2868e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cairo/ethereum/cancun/trie.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,8 @@ func encode_node{range_check_ptr, bitwise_ptr: BitwiseBuiltin*, keccak_ptr: Kecc
return encoded;

uint:
// Uint defined for type Node but actually not supported in the EELS
// Node is Union[Account, Bytes, LegacyTransaction, Receipt, Uint, U256, Withdrawal, None]
// but encode_node(Uint) will raise AssertionError in EELS
with_attr error_message("AssertionError") {
assert 0 = 1;

Check warning on line 421 in cairo/ethereum/cancun/trie.cairo

View check run for this annotation

Codecov / codecov/patch

cairo/ethereum/cancun/trie.cairo#L421

Added line #L421 was not covered by tests
}
Expand Down
4 changes: 3 additions & 1 deletion cairo/tests/ethereum/cancun/test_trie.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
)
from ethereum_types.bytes import Bytes, Bytes32
from ethereum_types.numeric import U256, Uint
from hypothesis import given
from hypothesis import example, given
from hypothesis import strategies as st

from cairo_addons.testing.hints import patch_hint
Expand All @@ -39,6 +39,8 @@ def test_encode_internal_node(self, cairo_run, node: Optional[InternalNode]):
)

@given(node=..., storage_root=...)
@example(node=None, storage_root=None)
@example(node=Uint(145), storage_root=None)
def test_encode_node(self, cairo_run, node: Node, storage_root: Optional[Bytes]):
try:
cairo_result = cairo_run("encode_node", node, storage_root)
Expand Down

0 comments on commit e2868e6

Please sign in to comment.