4040 emptyStorage = make ([]sdtypes.StorageNode , 0 )
4141 block0 , block1 , block2 , block3 , block4 , block5 , block6 * types.Block
4242 builder statediff.Builder
43- miningReward = int64 (2000000000000000000 )
4443 minerAddress = common .HexToAddress ("0x0" )
4544 minerLeafKey = testhelpers .AddressToLeafKey (minerAddress )
4645
47- balanceChange10000 = int64 (10000 )
48- balanceChange1000 = int64 (1000 )
49- block1BankBalance = int64 (99990000 )
50- block1Account1Balance = int64 (10000 )
51- block2Account2Balance = int64 (1000 )
52-
5346 slot0 = common .HexToHash ("0" )
5447 slot1 = common .HexToHash ("1" )
5548 slot2 = common .HexToHash ("2" )
@@ -129,7 +122,7 @@ var (
129122
130123 minerAccountAtBlock1 , _ = rlp .EncodeToBytes (state.Account {
131124 Nonce : 0 ,
132- Balance : big .NewInt (miningReward ),
125+ Balance : big .NewInt (2000002625000000000 ),
133126 CodeHash : testhelpers .NullCodeHash .Bytes (),
134127 Root : testhelpers .EmptyContractRoot ,
135128 })
@@ -139,7 +132,7 @@ var (
139132 })
140133 minerAccountAtBlock2 , _ = rlp .EncodeToBytes (state.Account {
141134 Nonce : 0 ,
142- Balance : big .NewInt (miningReward + miningReward ),
135+ Balance : big .NewInt (4000111203461610525 ),
143136 CodeHash : testhelpers .NullCodeHash .Bytes (),
144137 Root : testhelpers .EmptyContractRoot ,
145138 })
@@ -150,7 +143,7 @@ var (
150143
151144 account1AtBlock1 , _ = rlp .EncodeToBytes (state.Account {
152145 Nonce : 0 ,
153- Balance : big . NewInt ( balanceChange10000 ) ,
146+ Balance : testhelpers . Block1Account1Balance ,
154147 CodeHash : testhelpers .NullCodeHash .Bytes (),
155148 Root : testhelpers .EmptyContractRoot ,
156149 })
@@ -160,7 +153,7 @@ var (
160153 })
161154 account1AtBlock2 , _ = rlp .EncodeToBytes (state.Account {
162155 Nonce : 2 ,
163- Balance : big .NewInt (block1Account1Balance - balanceChange1000 + balanceChange1000 ),
156+ Balance : big .NewInt (999555797000009000 ),
164157 CodeHash : testhelpers .NullCodeHash .Bytes (),
165158 Root : testhelpers .EmptyContractRoot ,
166159 })
@@ -170,7 +163,7 @@ var (
170163 })
171164 account1AtBlock5 , _ = rlp .EncodeToBytes (state.Account {
172165 Nonce : 2 ,
173- Balance : big .NewInt (block1Account1Balance - balanceChange1000 + balanceChange1000 + miningReward ),
166+ Balance : big .NewInt (2999566008847709960 ),
174167 CodeHash : testhelpers .NullCodeHash .Bytes (),
175168 Root : testhelpers .EmptyContractRoot ,
176169 })
@@ -180,7 +173,7 @@ var (
180173 })
181174 account1AtBlock6 , _ = rlp .EncodeToBytes (state.Account {
182175 Nonce : 3 ,
183- Balance : big .NewInt (block1Account1Balance - balanceChange1000 + balanceChange1000 + miningReward ),
176+ Balance : big .NewInt (2999537516847709960 ),
184177 CodeHash : testhelpers .NullCodeHash .Bytes (),
185178 Root : testhelpers .EmptyContractRoot ,
186179 })
@@ -191,7 +184,7 @@ var (
191184
192185 account2AtBlock2 , _ = rlp .EncodeToBytes (state.Account {
193186 Nonce : 0 ,
194- Balance : big .NewInt (balanceChange1000 ),
187+ Balance : big .NewInt (1000 ),
195188 CodeHash : testhelpers .NullCodeHash .Bytes (),
196189 Root : testhelpers .EmptyContractRoot ,
197190 })
@@ -201,7 +194,7 @@ var (
201194 })
202195 account2AtBlock3 , _ = rlp .EncodeToBytes (state.Account {
203196 Nonce : 0 ,
204- Balance : big .NewInt (block2Account2Balance + miningReward ),
197+ Balance : big .NewInt (2000013574009435976 ),
205198 CodeHash : testhelpers .NullCodeHash .Bytes (),
206199 Root : testhelpers .EmptyContractRoot ,
207200 })
@@ -211,7 +204,7 @@ var (
211204 })
212205 account2AtBlock4 , _ = rlp .EncodeToBytes (state.Account {
213206 Nonce : 0 ,
214- Balance : big .NewInt (block2Account2Balance + miningReward * 2 ),
207+ Balance : big .NewInt (4000048088163070348 ),
215208 CodeHash : testhelpers .NullCodeHash .Bytes (),
216209 Root : testhelpers .EmptyContractRoot ,
217210 })
@@ -221,7 +214,7 @@ var (
221214 })
222215 account2AtBlock6 , _ = rlp .EncodeToBytes (state.Account {
223216 Nonce : 0 ,
224- Balance : big .NewInt (block2Account2Balance + miningReward * 3 ),
217+ Balance : big .NewInt (6000063293259748636 ),
225218 CodeHash : testhelpers .NullCodeHash .Bytes (),
226219 Root : testhelpers .EmptyContractRoot ,
227220 })
@@ -240,19 +233,23 @@ var (
240233 common .Hex2Bytes ("2000bf49f440a1cd0527e4d06e2765654c0f56452257516d793a9b8d604dcfdf2a" ),
241234 bankAccountAtBlock0 ,
242235 })
236+
237+ block1BankBalance = big .NewInt (testhelpers .TestBankFunds .Int64 () - testhelpers .BalanceChange10000 - testhelpers .GasFees )
243238 bankAccountAtBlock1 , _ = rlp .EncodeToBytes (state.Account {
244239 Nonce : 1 ,
245- Balance : big . NewInt ( testhelpers . TestBankFunds . Int64 () - balanceChange10000 ) ,
240+ Balance : block1BankBalance ,
246241 CodeHash : testhelpers .NullCodeHash .Bytes (),
247242 Root : testhelpers .EmptyContractRoot ,
248243 })
249244 bankAccountAtBlock1LeafNode , _ = rlp .EncodeToBytes ([]interface {}{
250245 common .Hex2Bytes ("30bf49f440a1cd0527e4d06e2765654c0f56452257516d793a9b8d604dcfdf2a" ),
251246 bankAccountAtBlock1 ,
252247 })
248+
249+ block2BankBalance = block1BankBalance .Int64 () - testhelpers .BalanceChange1Ether - testhelpers .GasFees
253250 bankAccountAtBlock2 , _ = rlp .EncodeToBytes (state.Account {
254251 Nonce : 2 ,
255- Balance : big .NewInt (block1BankBalance - balanceChange1000 ),
252+ Balance : big .NewInt (block2BankBalance ),
256253 CodeHash : testhelpers .NullCodeHash .Bytes (),
257254 Root : testhelpers .EmptyContractRoot ,
258255 })
@@ -262,7 +259,7 @@ var (
262259 })
263260 bankAccountAtBlock3 , _ = rlp .EncodeToBytes (state.Account {
264261 Nonce : 3 ,
265- Balance : big .NewInt (99989000 ),
262+ Balance : big .NewInt (999914255999990000 ),
266263 CodeHash : testhelpers .NullCodeHash .Bytes (),
267264 Root : testhelpers .EmptyContractRoot ,
268265 })
@@ -272,7 +269,7 @@ var (
272269 })
273270 bankAccountAtBlock4 , _ = rlp .EncodeToBytes (state.Account {
274271 Nonce : 6 ,
275- Balance : big .NewInt (99989000 ),
272+ Balance : big .NewInt (999826859999990000 ),
276273 CodeHash : testhelpers .NullCodeHash .Bytes (),
277274 Root : testhelpers .EmptyContractRoot ,
278275 })
@@ -282,7 +279,7 @@ var (
282279 })
283280 bankAccountAtBlock5 , _ = rlp .EncodeToBytes (state.Account {
284281 Nonce : 7 ,
285- Balance : big .NewInt (99989000 ),
282+ Balance : big .NewInt (999805027999990000 ),
286283 CodeHash : testhelpers .NullCodeHash .Bytes (),
287284 Root : testhelpers .EmptyContractRoot ,
288285 })
@@ -1706,10 +1703,12 @@ func TestBuilderWithRemovedAccountAndStorageWithoutIntermediateNodes(t *testing.
17061703 if err != nil {
17071704 t .Error (err )
17081705 }
1706+
17091707 expectedStateDiffRlp , err := rlp .EncodeToBytes (test .expected )
17101708 if err != nil {
17111709 t .Error (err )
17121710 }
1711+
17131712 sort .Slice (receivedStateDiffRlp , func (i , j int ) bool { return receivedStateDiffRlp [i ] < receivedStateDiffRlp [j ] })
17141713 sort .Slice (expectedStateDiffRlp , func (i , j int ) bool { return expectedStateDiffRlp [i ] < expectedStateDiffRlp [j ] })
17151714 if ! bytes .Equal (receivedStateDiffRlp , expectedStateDiffRlp ) {
@@ -1740,7 +1739,7 @@ var (
17401739
17411740 bankAccountAtBlock01 , _ = rlp .EncodeToBytes (state.Account {
17421741 Nonce : 1 ,
1743- Balance : big .NewInt (testhelpers . TestBankFunds . Int64 () + miningReward ),
1742+ Balance : big .NewInt (3999629697375000000 ),
17441743 CodeHash : testhelpers .NullCodeHash .Bytes (),
17451744 Root : testhelpers .EmptyContractRoot ,
17461745 })
@@ -1750,7 +1749,7 @@ var (
17501749 })
17511750 bankAccountAtBlock02 , _ = rlp .EncodeToBytes (state.Account {
17521751 Nonce : 2 ,
1753- Balance : big .NewInt (testhelpers . TestBankFunds . Int64 () + miningReward * 2 ),
1752+ Balance : big .NewInt (5999607323457344852 ),
17541753 CodeHash : testhelpers .NullCodeHash .Bytes (),
17551754 Root : testhelpers .EmptyContractRoot ,
17561755 })
@@ -1926,6 +1925,7 @@ func TestBuilderWithMovedAccount(t *testing.T) {
19261925 if err != nil {
19271926 t .Error (err )
19281927 }
1928+
19291929 sort .Slice (receivedStateDiffRlp , func (i , j int ) bool { return receivedStateDiffRlp [i ] < receivedStateDiffRlp [j ] })
19301930 sort .Slice (expectedStateDiffRlp , func (i , j int ) bool { return expectedStateDiffRlp [i ] < expectedStateDiffRlp [j ] })
19311931 if ! bytes .Equal (receivedStateDiffRlp , expectedStateDiffRlp ) {
0 commit comments