2020)
2121from ethereum_test_types .block_access_list import (
2222 BalAccountChange ,
23+ BalAccountExpectation ,
2324 BalBalanceChange ,
2425 BalNonceChange ,
2526 BalStorageChange ,
@@ -73,12 +74,11 @@ def test_bal_invalid_missing_nonce(
7374 txs = [tx ],
7475 exception = BlockException .INCORRECT_BLOCK_FORMAT ,
7576 expected_block_access_list = BlockAccessListExpectation (
76- account_changes = [
77- BalAccountChange (
78- address = sender ,
77+ account_expectations = {
78+ sender : BalAccountExpectation (
7979 nonce_changes = [BalNonceChange (tx_index = 1 , post_nonce = 1 )],
8080 ),
81- ]
81+ }
8282 ).modify (remove_nonces (sender )),
8383 )
8484 ],
@@ -113,12 +113,11 @@ def test_bal_invalid_nonce_value(
113113 txs = [tx ],
114114 exception = BlockException .INCORRECT_BLOCK_FORMAT ,
115115 expected_block_access_list = BlockAccessListExpectation (
116- account_changes = [
117- BalAccountChange (
118- address = sender ,
116+ account_expectations = {
117+ sender : BalAccountExpectation (
119118 nonce_changes = [BalNonceChange (tx_index = 1 , post_nonce = 1 )],
120119 ),
121- ]
120+ }
122121 ).modify (modify_nonce (sender , tx_index = 1 , nonce = 42 )),
123122 )
124123 ],
@@ -158,9 +157,8 @@ def test_bal_invalid_storage_value(
158157 txs = [tx ],
159158 exception = BlockException .INCORRECT_BLOCK_FORMAT ,
160159 expected_block_access_list = BlockAccessListExpectation (
161- account_changes = [
162- BalAccountChange (
163- address = contract ,
160+ account_expectations = {
161+ contract : BalAccountExpectation (
164162 storage_changes = [
165163 BalStorageSlot (
166164 slot = 0x01 ,
@@ -176,7 +174,7 @@ def test_bal_invalid_storage_value(
176174 ),
177175 ],
178176 ),
179- ]
177+ }
180178 ).modify (
181179 # Corrupt storage value for slot 0x02
182180 modify_storage (contract , tx_index = 1 , slot = 0x02 , value = 0xFF )
@@ -223,23 +221,20 @@ def test_bal_invalid_tx_order(
223221 txs = [tx1 , tx2 ],
224222 exception = BlockException .INCORRECT_BLOCK_FORMAT ,
225223 expected_block_access_list = BlockAccessListExpectation (
226- account_changes = [
227- BalAccountChange (
228- address = sender1 ,
224+ account_expectations = {
225+ sender1 : BalAccountExpectation (
229226 nonce_changes = [BalNonceChange (tx_index = 1 , post_nonce = 1 )],
230227 ),
231- BalAccountChange (
232- address = sender2 ,
228+ sender2 : BalAccountExpectation (
233229 nonce_changes = [BalNonceChange (tx_index = 2 , post_nonce = 1 )],
234230 ),
235- BalAccountChange (
236- address = receiver ,
231+ receiver : BalAccountExpectation (
237232 balance_changes = [
238233 BalBalanceChange (tx_index = 1 , post_balance = 10 ** 15 ),
239234 BalBalanceChange (tx_index = 2 , post_balance = 3 * 10 ** 15 ),
240235 ],
241236 ),
242- ]
237+ }
243238 ).modify (swap_tx_indices (1 , 2 )),
244239 )
245240 ],
@@ -276,12 +271,11 @@ def test_bal_invalid_account(
276271 txs = [tx ],
277272 exception = BlockException .INCORRECT_BLOCK_FORMAT ,
278273 expected_block_access_list = BlockAccessListExpectation (
279- account_changes = [
280- BalAccountChange (
281- address = sender ,
274+ account_expectations = {
275+ sender : BalAccountExpectation (
282276 nonce_changes = [BalNonceChange (tx_index = 1 , post_nonce = 1 )],
283277 ),
284- ]
278+ }
285279 ).modify (
286280 append_account (
287281 BalAccountChange (
@@ -323,16 +317,14 @@ def test_bal_invalid_duplicate_account(
323317 txs = [tx ],
324318 exception = BlockException .INCORRECT_BLOCK_FORMAT ,
325319 expected_block_access_list = BlockAccessListExpectation (
326- account_changes = [
327- BalAccountChange (
328- address = sender ,
320+ account_expectations = {
321+ sender : BalAccountExpectation (
329322 nonce_changes = [BalNonceChange (tx_index = 1 , post_nonce = 1 )],
330323 ),
331- BalAccountChange (
332- address = receiver ,
324+ receiver : BalAccountExpectation (
333325 balance_changes = [BalBalanceChange (tx_index = 1 , post_balance = 10 ** 15 )],
334326 ),
335- ]
327+ }
336328 ).modify (duplicate_account (sender )),
337329 )
338330 ],
@@ -367,16 +359,14 @@ def test_bal_invalid_account_order(
367359 txs = [tx ],
368360 exception = BlockException .INCORRECT_BLOCK_FORMAT ,
369361 expected_block_access_list = BlockAccessListExpectation (
370- account_changes = [
371- BalAccountChange (
372- address = sender ,
362+ account_expectations = {
363+ sender : BalAccountExpectation (
373364 nonce_changes = [BalNonceChange (tx_index = 1 , post_nonce = 1 )],
374365 ),
375- BalAccountChange (
376- address = receiver ,
366+ receiver : BalAccountExpectation (
377367 balance_changes = [BalBalanceChange (tx_index = 1 , post_balance = 10 ** 15 )],
378368 ),
379- ]
369+ }
380370 ).modify (reverse_accounts ()),
381371 )
382372 ],
@@ -424,16 +414,14 @@ def test_bal_invalid_complex_corruption(
424414 txs = [tx1 , tx2 ],
425415 exception = BlockException .INCORRECT_BLOCK_FORMAT ,
426416 expected_block_access_list = BlockAccessListExpectation (
427- account_changes = [
428- BalAccountChange (
429- address = sender ,
417+ account_expectations = {
418+ sender : BalAccountExpectation (
430419 nonce_changes = [
431420 BalNonceChange (tx_index = 1 , post_nonce = 1 ),
432421 BalNonceChange (tx_index = 2 , post_nonce = 2 ),
433422 ],
434423 ),
435- BalAccountChange (
436- address = contract ,
424+ contract : BalAccountExpectation (
437425 storage_changes = [
438426 BalStorageSlot (
439427 slot = 0x01 ,
@@ -445,11 +433,10 @@ def test_bal_invalid_complex_corruption(
445433 ),
446434 ],
447435 ),
448- BalAccountChange (
449- address = receiver ,
436+ receiver : BalAccountExpectation (
450437 balance_changes = [BalBalanceChange (tx_index = 2 , post_balance = 10 ** 15 )],
451438 ),
452- ]
439+ }
453440 ).modify (
454441 remove_nonces (sender ),
455442 modify_storage (contract , tx_index = 1 , slot = 0x01 , value = 0xFF ),
@@ -489,16 +476,14 @@ def test_bal_invalid_missing_account(
489476 txs = [tx ],
490477 exception = BlockException .INCORRECT_BLOCK_FORMAT ,
491478 expected_block_access_list = BlockAccessListExpectation (
492- account_changes = [
493- BalAccountChange (
494- address = sender ,
479+ account_expectations = {
480+ sender : BalAccountExpectation (
495481 nonce_changes = [BalNonceChange (tx_index = 1 , post_nonce = 1 )],
496482 ),
497- BalAccountChange (
498- address = receiver ,
483+ receiver : BalAccountExpectation (
499484 balance_changes = [BalBalanceChange (tx_index = 1 , post_balance = 10 ** 15 )],
500485 ),
501- ]
486+ }
502487 ).modify (remove_accounts (receiver )),
503488 )
504489 ],
@@ -533,12 +518,11 @@ def test_bal_invalid_balance_value(
533518 txs = [tx ],
534519 exception = BlockException .INCORRECT_BLOCK_FORMAT ,
535520 expected_block_access_list = BlockAccessListExpectation (
536- account_changes = [
537- BalAccountChange (
538- address = receiver ,
521+ account_expectations = {
522+ receiver : BalAccountExpectation (
539523 balance_changes = [BalBalanceChange (tx_index = 1 , post_balance = 10 ** 15 )],
540524 ),
541- ]
525+ }
542526 ).modify (modify_balance (receiver , tx_index = 1 , balance = 999999 )),
543527 )
544528 ],
0 commit comments