From b2828a814f3912b108bd428b0e9308b42b7273d6 Mon Sep 17 00:00:00 2001 From: Ashwin Phatak Date: Thu, 27 May 2021 16:36:06 +0530 Subject: [PATCH] Compute leaf key from slot. --- pkg/graphql/graphql.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/graphql/graphql.go b/pkg/graphql/graphql.go index 11cc226d..52a1f5cc 100644 --- a/pkg/graphql/graphql.go +++ b/pkg/graphql/graphql.go @@ -27,6 +27,7 @@ import ( "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/eth/filters" "github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rpc" @@ -980,7 +981,8 @@ func (r *Resolver) GetStorageAt(ctx context.Context, args struct { Contract common.Address Slot common.Hash }) (*StorageResult, error) { - cid, ipldBlock, rlpValue, err := r.backend.IPLDRetriever.RetrieveStorageAtByAddressAndStorageKeyAndBlockHash(args.Contract, args.Slot, args.BlockHash) + storageLeafKey := crypto.Keccak256Hash(args.Slot.Bytes()) + cid, ipldBlock, rlpValue, err := r.backend.IPLDRetriever.RetrieveStorageAtByAddressAndStorageKeyAndBlockHash(args.Contract, storageLeafKey, args.BlockHash) if err != nil { return nil, err