Factor out a bad storage diff for testing
This commit is contained in:
parent
6869330bd3
commit
f315988507
@ -146,17 +146,8 @@ var _ = Describe("Geth RPC Storage Fetcher", func() {
|
||||
})
|
||||
|
||||
It("adds errors to error channel if formatting the diff as a StateDiff object fails", func(done Done) {
|
||||
badStorageDiffs := []statediff.StorageDiff{{
|
||||
Key: test_data.StorageKey,
|
||||
Value: []byte{1, 2, 3},
|
||||
// this storage value will fail to be decoded as an RLP with the following error message:
|
||||
// "input contains more than one value"
|
||||
Path: test_data.StoragePath,
|
||||
Proof: [][]byte{},
|
||||
}}
|
||||
|
||||
accountDiffs := test_data.CreatedAccountDiffs
|
||||
accountDiffs[0].Storage = badStorageDiffs
|
||||
accountDiffs[0].Storage = []statediff.StorageDiff{test_data.StorageWithBadValue}
|
||||
|
||||
stateDiff := statediff.StateDiff{
|
||||
BlockNumber: test_data.BlockNumber,
|
||||
|
@ -113,12 +113,7 @@ var _ = Describe("Storage row parsing", func() {
|
||||
})
|
||||
|
||||
It("returns an err if decoding the storage value Rlp fails", func() {
|
||||
storageDiff := statediff.StorageDiff{
|
||||
Key: []byte{0, 9, 8, 7, 6, 5, 4, 3, 2, 1},
|
||||
Value: test_data.StorageKey,
|
||||
}
|
||||
|
||||
_, err := utils.FromGethStateDiff(accountDiff, stateDiff, storageDiff)
|
||||
_, err := utils.FromGethStateDiff(accountDiff, stateDiff, test_data.StorageWithBadValue)
|
||||
Expect(err).To(HaveOccurred())
|
||||
Expect(err).To(MatchError("rlp: input contains more than one value"))
|
||||
})
|
||||
|
@ -52,6 +52,12 @@ var (
|
||||
Proof: [][]byte{},
|
||||
}}
|
||||
EmptyStorage = make([]statediff.StorageDiff, 0)
|
||||
StorageWithBadValue = statediff.StorageDiff{
|
||||
Key: StorageKey,
|
||||
Value: []byte{0, 1, 2},
|
||||
// this storage value will fail to be decoded as an RLP with the following error message:
|
||||
// "input contains more than one value"
|
||||
}
|
||||
contractAddress = common.HexToAddress("0xaE9BEa628c4Ce503DcFD7E305CaB4e29E7476592")
|
||||
ContractLeafKey = crypto.Keccak256Hash(contractAddress[:])
|
||||
anotherContractAddress = common.HexToAddress("0xaE9BEa628c4Ce503DcFD7E305CaB4e29E7476593")
|
||||
|
Loading…
Reference in New Issue
Block a user