1414 unittest2,
1515 ../ execution_chain/ block_access_list/ block_access_list_builder
1616
17+ template toBytes32 (slot: UInt256 ): Bytes32 =
18+ Bytes32 (slot.toBytesBE ())
1719
1820suite " Block access list builder" :
1921 const
@@ -61,12 +63,12 @@ suite "Block access list builder":
6163 bal.len () == 2
6264 bal[0 ].address == address1
6365 bal[0 ].storageChanges.len () == 3
64- bal[0 ].storageChanges[0 ] == (slot1, @ [(1 .BlockAccessIndex , 1 .u256)])
65- bal[0 ].storageChanges[1 ] == (slot2, @ [(2 .BlockAccessIndex , 2 .u256)])
66- bal[0 ].storageChanges[2 ] == (slot3, @ [(0 .BlockAccessIndex , 3 .u256) , (3 .BlockAccessIndex , 5 .u256)])
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 () )])
6769 bal[1 ].address == address2
6870 bal[1 ].storageChanges.len () == 1
69- bal[1 ].storageChanges[0 ] == (slot1, @ [(1 .BlockAccessIndex , 1 .u256)])
71+ bal[1 ].storageChanges[0 ] == (slot1. toBytes32 () , @ [(1 .BlockAccessIndex , 1 .u256. toBytes32 () )])
7072
7173 test " Add storage read" :
7274 builder.addStorageRead (address2, slot3)
@@ -79,11 +81,11 @@ suite "Block access list builder":
7981 check:
8082 bal.len () == 3
8183 bal[0 ].address == address1
82- bal[0 ].storageReads == @ [slot1]
84+ bal[0 ].storageReads == @ [slot1. toBytes32 () ]
8385 bal[1 ].address == address2
84- bal[1 ].storageReads == @ [slot2, slot3]
86+ bal[1 ].storageReads == @ [slot2. toBytes32 () , slot3. toBytes32 () ]
8587 bal[2 ].address == address3
86- bal[2 ].storageReads == @ [slot3]
88+ bal[2 ].storageReads == @ [slot3. toBytes32 () ]
8789
8890 test " Add balance change" :
8991 builder.addBalanceChange (address2, 1 , 0 .u256)
@@ -175,23 +177,23 @@ suite "Block access list builder":
175177
176178 bal[0 ].address == address1
177179 bal[0 ].storageChanges.len () == 3
178- bal[0 ].storageChanges[0 ] == (slot1, @ [(1 .BlockAccessIndex , 1 .u256)])
179- bal[0 ].storageChanges[1 ] == (slot2, @ [(2 .BlockAccessIndex , 2 .u256)])
180- bal[0 ].storageChanges[2 ] == (slot3, @ [(0 .BlockAccessIndex , 3 .u256) , (3 .BlockAccessIndex , 5 .u256)])
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 () )])
181183 bal[0 ].storageReads.len () == 0 # read removed by storage change with the same slot
182184 bal[0 ].balanceChanges == @ [(2 .BlockAccessIndex , 10 .u256)]
183185 bal[0 ].nonceChanges == @ [(3 .BlockAccessIndex , 3 .AccountNonce )]
184186 bal[0 ].codeChanges == @ [(3 .BlockAccessIndex , @ [0x 4 .byte ])]
185187
186188 bal[1 ].address == address2
187189 bal[1 ].storageChanges.len () == 1
188- bal[1 ].storageChanges[0 ] == (slot1, @ [(1 .BlockAccessIndex , 1 .u256)])
189- bal[1 ].storageReads == @ [slot2, slot3]
190+ bal[1 ].storageChanges[0 ] == (slot1. toBytes32 () , @ [(1 .BlockAccessIndex , 1 .u256. toBytes32 () )])
191+ bal[1 ].storageReads == @ [slot2. toBytes32 () , slot3. toBytes32 () ]
190192 bal[1 ].balanceChanges == @ [(0 .BlockAccessIndex , 1 .u256), (1 .BlockAccessIndex , 0 .u256)]
191193 bal[1 ].nonceChanges == @ [(1 .BlockAccessIndex , 1 .AccountNonce ), (2 .BlockAccessIndex , 2 .AccountNonce )]
192194 bal[1 ].codeChanges == @ [(0 .BlockAccessIndex , @ [0x 1 .byte ]), (1 .BlockAccessIndex , @ [0x 2 .byte ])]
193195
194196 bal[2 ].address == address3
195- bal[2 ].storageReads == @ [slot3]
197+ bal[2 ].storageReads == @ [slot3. toBytes32 () ]
196198 bal[2 ].balanceChanges == @ [(3 .BlockAccessIndex , 3 .u256)]
197199 bal[2 ].nonceChanges == @ [(1 .BlockAccessIndex , 10 .AccountNonce )]
0 commit comments