Skip to content

Commit ac6ebba

Browse files
winsvegamarioevz
andauthored
feat(framework): disallow assign of fixedbytes of size X to bytes of size Y when X != Y (ethereum#1010)
* unit tests * fix after rebase * fix(types): Transaction `to` validation fix * refactor(base_types): replace left_pad_zeros_up_to_size with fixed bytes constructor parameter --------- Co-authored-by: Mario Vega <[email protected]>
1 parent cba3d63 commit ac6ebba

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

cancun/eip1153_tstore/test_tstorage_execution_contexts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def tx(pre: Alloc, caller_address: Address, callee_address: Address) -> Transact
308308
return Transaction(
309309
sender=pre.fund_eoa(),
310310
to=caller_address,
311-
data=Hash(callee_address),
311+
data=Hash(callee_address, left_padding=True),
312312
gas_limit=1_000_000,
313313
)
314314

cancun/eip1153_tstore/test_tstorage_selfdestruct.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,10 @@ def test_reentrant_selfdestructing_call(
230230

231231
caller_address = pre.deploy_contract(code=caller_bytecode)
232232

233-
data: Hash | Bytecode
233+
data: bytes | Bytecode
234234
if pre_existing_contract:
235235
callee_address = pre.deploy_contract(code=callee_bytecode)
236-
data = Hash(callee_address)
236+
data = Hash(callee_address, left_padding=True)
237237
else:
238238
callee_address = compute_create_address(address=caller_address, nonce=1)
239239
data = Initcode(deploy_code=callee_bytecode)

shanghai/eip4895_withdrawals/test_withdrawals.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def test_balance_within_block(blockchain_test: BlockchainTestFiller, pre: Alloc)
201201
sender=sender,
202202
gas_limit=100000,
203203
to=contract_address,
204-
data=Hash(recipient),
204+
data=Hash(recipient, left_padding=True),
205205
)
206206
],
207207
withdrawals=[
@@ -219,7 +219,7 @@ def test_balance_within_block(blockchain_test: BlockchainTestFiller, pre: Alloc)
219219
sender=sender,
220220
gas_limit=100000,
221221
to=contract_address,
222-
data=Hash(recipient),
222+
data=Hash(recipient, left_padding=True),
223223
)
224224
]
225225
),
@@ -373,7 +373,7 @@ def test_self_destructing_account(
373373
sender=sender,
374374
gas_limit=100000,
375375
to=self_destruct_contract_address,
376-
data=Hash(recipient),
376+
data=Hash(recipient, left_padding=True),
377377
)
378378

379379
withdrawal = Withdrawal(

0 commit comments

Comments
 (0)