From 9dbf8c634ec69f65cc9449a382e38c5712afad14 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 bd3d1187..6d5fbf71 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" @@ -976,7 +977,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