Skip to content

Commit 7ab558b

Browse files
committed
fix(tests): follow through on the Aave and precondition changes
Two consequences of the previous two commits that CI caught: - the frozen reference blob for 'aave-v3-supply' changed, because the contract address inside it changed. Regenerated locally; exactly one of the 51 flows moved and its length is unchanged at 246, which is what a same-length address substitution should do. - test_rejects_dynamic_format expected AssertionError from serialize_schema_metadata, which now raises ValueError so the check survives python -O. The earlier claim that no test depended on AssertionError from these paths was wrong: the grep behind it excluded lines containing 'self.assert', which also excluded 'self.assertRaises(AssertionError)'.
1 parent 1db9da2 commit 7ab558b

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

tests/test_msg_ethereum_clear_signing.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ def test_keccak256_known_vectors(self):
599599
# [print(f['key'], hashlib.sha256(t.flow_blob(f, timestamp=t.REFERENCE_TIMESTAMP)).hexdigest())
600600
# for f in t.CLEARSIGN_FLOWS]"
601601
REFERENCE_BLOB_SNAPSHOTS = {
602-
'aave-v3-supply': ('434ee7389f099e8ab77a4274fd7da40918a74c719dd0bdb4a81c6259846bda2d', 246),
602+
'aave-v3-supply': ('710dc044c914a7320c91774ae5193f5b6509b00eb14e17719f7b31d0274d4892', 246),
603603
'erc20-transfer': ('adbd1e054f8b59b1bb86af046951df53510c10dcc0ec0e3e46b19eaf6410cf05', 205),
604604
'erc20-approve': ('75e5108f578f27d60c572d12072fb4cf0455321c6f39445e1d59fe4d99713c91', 193),
605605
'erc20-approve-unlimited': ('a5c043a60da8f317975ee8f1b9f3a0718186f6bdce625b605ce71973b3fa3811', 221),
@@ -803,8 +803,12 @@ def test_calldata_matches_schema_shape(self):
803803

804804
def test_rejects_dynamic_format(self):
805805
"""v2 only encodes fixed single-word types; STRING/BYTES are rejected by
806-
the serializer (they have no fixed on-chain word)."""
807-
with self.assertRaises(AssertionError):
806+
the serializer (they have no fixed on-chain word).
807+
808+
ValueError, not AssertionError: this is a precondition on a function
809+
that builds SIGNED bytes, so it must survive `python -O`.
810+
"""
811+
with self.assertRaises(ValueError):
808812
serialize_schema_metadata(
809813
chain_id=1, contract_address=USDC_ADDRESS,
810814
selector=ERC20_TRANSFER_SELECTOR, method_name='x',

0 commit comments

Comments
 (0)