1717// Contains a batch of utility type declarations used by the tests. As the node
1818// operates on unique types, a lot of them are needed to check various features.
1919
20- package statediff_test
20+ package builder_test
2121
2222import (
2323 "github.com/onsi/ginkgo"
@@ -29,8 +29,8 @@ import (
2929 "github.com/ethereum/go-ethereum/consensus/ethash"
3030 "math/big"
3131 "github.com/ethereum/go-ethereum/crypto"
32- "github.com/ethereum/go-ethereum/statediff"
3332 "github.com/onsi/gomega"
33+ b "github.com/ethereum/go-ethereum/statediff/builder"
3434)
3535
3636
5050 contractCode = common .Hex2Bytes ("606060405260cc8060106000396000f360606040526000357c01000000000000000000000000000000000000000000000000000000009004806360cd2685146041578063c16431b914606b57603f565b005b6055600480803590602001909190505060a9565b6040518082815260200191505060405180910390f35b60886004808035906020019091908035906020019091905050608a565b005b80600060005083606481101560025790900160005b50819055505b5050565b6000600060005082606481101560025790900160005b5054905060c7565b91905056" )
5151 contractAddr common.Address
5252
53- emptyAccountDiffEventualMap = make (map [common.Address ]statediff .AccountDiffEventual )
54- emptyAccountDiffIncrementalMap = make (map [common.Address ]statediff .AccountDiffIncremental )
53+ emptyAccountDiffEventualMap = make (map [common.Address ]b .AccountDiffEventual )
54+ emptyAccountDiffIncrementalMap = make (map [common.Address ]b .AccountDiffIncremental )
5555)
5656/*
5757contract test {
@@ -121,10 +121,10 @@ var _ = ginkgo.FDescribe("", func() {
121121 var (
122122 block0Hash , block1Hash , block2Hash , block3Hash common.Hash
123123 block0 , block1 , block2 , block3 * types.Block
124- builder statediff .Builder
124+ builder b .Builder
125125 miningReward = int64 (3000000000000000000 )
126126 burnAddress = common .HexToAddress ("0x0" )
127- diff * statediff .StateDiff
127+ diff * b .StateDiff
128128 err error
129129 )
130130
@@ -139,11 +139,11 @@ var _ = ginkgo.FDescribe("", func() {
139139 block1 = blocks [block1Hash ]
140140 block2 = blocks [block2Hash ]
141141 block3 = blocks [block3Hash ]
142- builder = statediff .NewBuilder (testdb )
142+ builder = b .NewBuilder (testdb )
143143 })
144144
145145 ginkgo .It ("returns empty account diff collections when the state root hasn't changed" , func () {
146- expectedDiff := statediff .StateDiff {
146+ expectedDiff := b .StateDiff {
147147 BlockNumber : block0 .Number ().Int64 (),
148148 BlockHash : block0Hash ,
149149 CreatedAccounts : emptyAccountDiffEventualMap ,
@@ -177,7 +177,7 @@ var _ = ginkgo.FDescribe("", func() {
177177 })
178178
179179 ginkgo .It ("returns balance diffs for updated accounts" , func () {
180- expectedBankBalanceDiff := statediff .DiffBigInt {
180+ expectedBankBalanceDiff := b .DiffBigInt {
181181 NewValue : big .NewInt (testBankFunds .Int64 () - balanceChange ),
182182 OldValue : testBankFunds ,
183183 }
@@ -187,12 +187,12 @@ var _ = ginkgo.FDescribe("", func() {
187187 })
188188
189189 ginkgo .It ("returns balance diffs for new accounts" , func () {
190- expectedAccount1BalanceDiff := statediff .DiffBigInt {
190+ expectedAccount1BalanceDiff := b .DiffBigInt {
191191 NewValue : big .NewInt (balanceChange ),
192192 OldValue : nil ,
193193 }
194194
195- expectedBurnAddrBalanceDiff := statediff .DiffBigInt {
195+ expectedBurnAddrBalanceDiff := b .DiffBigInt {
196196 NewValue : big .NewInt (miningReward ),
197197 OldValue : nil ,
198198 }
@@ -228,17 +228,17 @@ var _ = ginkgo.FDescribe("", func() {
228228 })
229229
230230 ginkgo .It ("returns balance diffs for updated accounts" , func () {
231- expectedBankBalanceDiff := statediff .DiffBigInt {
231+ expectedBankBalanceDiff := b .DiffBigInt {
232232 NewValue : big .NewInt (block1BankBalance - balanceChange ),
233233 OldValue : big .NewInt (block1BankBalance ),
234234 }
235235
236- expectedAccount1BalanceDiff := statediff .DiffBigInt {
236+ expectedAccount1BalanceDiff := b .DiffBigInt {
237237 NewValue : big .NewInt (block1Account1Balance - balanceChange + balanceChange ),
238238 OldValue : big .NewInt (block1Account1Balance ),
239239 }
240240
241- expectedBurnBalanceDiff := statediff .DiffBigInt {
241+ expectedBurnBalanceDiff := b .DiffBigInt {
242242 NewValue : big .NewInt (miningReward + miningReward ),
243243 OldValue : big .NewInt (miningReward ),
244244 }
@@ -250,12 +250,12 @@ var _ = ginkgo.FDescribe("", func() {
250250 })
251251
252252 ginkgo .It ("returns balance diffs for new accounts" , func () {
253- expectedAccount2BalanceDiff := statediff .DiffBigInt {
253+ expectedAccount2BalanceDiff := b .DiffBigInt {
254254 NewValue : big .NewInt (balanceChange ),
255255 OldValue : nil ,
256256 }
257257
258- expectedContractBalanceDiff := statediff .DiffBigInt {
258+ expectedContractBalanceDiff := b .DiffBigInt {
259259 NewValue : big .NewInt (0 ),
260260 OldValue : nil ,
261261 }
@@ -290,23 +290,23 @@ var _ = ginkgo.FDescribe("", func() {
290290
291291 ginkgo .It ("returns balance, storage and nonce diffs for updated accounts" , func () {
292292 block2Account2Balance := int64 (1000 )
293- expectedAcct2BalanceDiff := statediff .DiffBigInt {
293+ expectedAcct2BalanceDiff := b .DiffBigInt {
294294 NewValue : big .NewInt (block2Account2Balance + miningReward ),
295295 OldValue : big .NewInt (block2Account2Balance ),
296296 }
297297
298- expectedContractStorageDiff := make (map [string ]statediff .DiffString )
298+ expectedContractStorageDiff := make (map [string ]b .DiffString )
299299 newVal := "0x03"
300300 oldVal := "0x0"
301301 path := "0x405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace"
302- expectedContractStorageDiff [path ] = statediff .DiffString {
302+ expectedContractStorageDiff [path ] = b .DiffString {
303303 NewValue : & newVal ,
304304 OldValue : & oldVal ,
305305 }
306306
307307 oldNonce := uint64 (2 )
308308 newNonce := uint64 (3 )
309- expectedBankNonceDiff := statediff .DiffUint64 {
309+ expectedBankNonceDiff := b .DiffUint64 {
310310 NewValue : & newNonce ,
311311 OldValue : & oldNonce ,
312312 }
0 commit comments