1414 unittest2,
1515 ../ execution_chain/ block_access_list/ block_access_list_builder
1616
17- template toBytes32 (slot: UInt256 ): Bytes32 =
18- Bytes32 (slot.toBytesBE ())
19-
2017suite " Block access list builder" :
2118 const
2219 address1 = address " 0x10007bc31cedb7bfb8a345f31e668033056b2728"
@@ -63,12 +60,12 @@ suite "Block access list builder":
6360 bal.len () == 2
6461 bal[0 ].address == address1
6562 bal[0 ].storageChanges.len () == 3
66- bal[0 ].storageChanges[0 ] == (slot1. toBytes32 () , @ [(1 .BlockAccessIndex , 1 .u256. toBytes32 () )])
67- bal[0 ].storageChanges[1 ] == (slot2. toBytes32 () , @ [(2 .BlockAccessIndex , 2 .u256. toBytes32 () )])
68- bal[0 ].storageChanges[2 ] == (slot3. toBytes32 () , @ [(0 .BlockAccessIndex , 3 .u256. toBytes32 ()) , (3 .BlockAccessIndex , 5 .u256. toBytes32 () )])
63+ bal[0 ].storageChanges[0 ] == (slot1, @ [(1 .BlockAccessIndex , 1 .u256)])
64+ bal[0 ].storageChanges[1 ] == (slot2, @ [(2 .BlockAccessIndex , 2 .u256)])
65+ bal[0 ].storageChanges[2 ] == (slot3, @ [(0 .BlockAccessIndex , 3 .u256) , (3 .BlockAccessIndex , 5 .u256)])
6966 bal[1 ].address == address2
7067 bal[1 ].storageChanges.len () == 1
71- bal[1 ].storageChanges[0 ] == (slot1. toBytes32 () , @ [(1 .BlockAccessIndex , 1 .u256. toBytes32 () )])
68+ bal[1 ].storageChanges[0 ] == (slot1, @ [(1 .BlockAccessIndex , 1 .u256)])
7269
7370 test " Add storage read" :
7471 builder.addStorageRead (address2, slot3)
@@ -81,11 +78,11 @@ suite "Block access list builder":
8178 check:
8279 bal.len () == 3
8380 bal[0 ].address == address1
84- bal[0 ].storageReads == @ [slot1. toBytes32 () ]
81+ bal[0 ].storageReads == @ [slot1]
8582 bal[1 ].address == address2
86- bal[1 ].storageReads == @ [slot2. toBytes32 () , slot3. toBytes32 () ]
83+ bal[1 ].storageReads == @ [slot2, slot3]
8784 bal[2 ].address == address3
88- bal[2 ].storageReads == @ [slot3. toBytes32 () ]
85+ bal[2 ].storageReads == @ [slot3]
8986
9087 test " Add balance change" :
9188 builder.addBalanceChange (address2, 1 , 0 .u256)
@@ -177,23 +174,23 @@ suite "Block access list builder":
177174
178175 bal[0 ].address == address1
179176 bal[0 ].storageChanges.len () == 3
180- bal[0 ].storageChanges[0 ] == (slot1. toBytes32 () , @ [(1 .BlockAccessIndex , 1 .u256. toBytes32 () )])
181- bal[0 ].storageChanges[1 ] == (slot2. toBytes32 () , @ [(2 .BlockAccessIndex , 2 .u256. toBytes32 () )])
182- bal[0 ].storageChanges[2 ] == (slot3. toBytes32 () , @ [(0 .BlockAccessIndex , 3 .u256. toBytes32 ()) , (3 .BlockAccessIndex , 5 .u256. toBytes32 () )])
177+ bal[0 ].storageChanges[0 ] == (slot1, @ [(1 .BlockAccessIndex , 1 .u256)])
178+ bal[0 ].storageChanges[1 ] == (slot2, @ [(2 .BlockAccessIndex , 2 .u256)])
179+ bal[0 ].storageChanges[2 ] == (slot3, @ [(0 .BlockAccessIndex , 3 .u256) , (3 .BlockAccessIndex , 5 .u256)])
183180 bal[0 ].storageReads.len () == 0 # read removed by storage change with the same slot
184181 bal[0 ].balanceChanges == @ [(2 .BlockAccessIndex , 10 .u256)]
185182 bal[0 ].nonceChanges == @ [(3 .BlockAccessIndex , 3 .AccountNonce )]
186183 bal[0 ].codeChanges == @ [(3 .BlockAccessIndex , @ [0x 4 .byte ])]
187184
188185 bal[1 ].address == address2
189186 bal[1 ].storageChanges.len () == 1
190- bal[1 ].storageChanges[0 ] == (slot1. toBytes32 () , @ [(1 .BlockAccessIndex , 1 .u256. toBytes32 () )])
191- bal[1 ].storageReads == @ [slot2. toBytes32 () , slot3. toBytes32 () ]
187+ bal[1 ].storageChanges[0 ] == (slot1, @ [(1 .BlockAccessIndex , 1 .u256)])
188+ bal[1 ].storageReads == @ [slot2, slot3]
192189 bal[1 ].balanceChanges == @ [(0 .BlockAccessIndex , 1 .u256), (1 .BlockAccessIndex , 0 .u256)]
193190 bal[1 ].nonceChanges == @ [(1 .BlockAccessIndex , 1 .AccountNonce ), (2 .BlockAccessIndex , 2 .AccountNonce )]
194191 bal[1 ].codeChanges == @ [(0 .BlockAccessIndex , @ [0x 1 .byte ]), (1 .BlockAccessIndex , @ [0x 2 .byte ])]
195192
196193 bal[2 ].address == address3
197- bal[2 ].storageReads == @ [slot3. toBytes32 () ]
194+ bal[2 ].storageReads == @ [slot3]
198195 bal[2 ].balanceChanges == @ [(3 .BlockAccessIndex , 3 .u256)]
199196 bal[2 ].nonceChanges == @ [(1 .BlockAccessIndex , 10 .AccountNonce )]
0 commit comments