Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions op-service/sources/eth_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,14 @@ func (s *EthClient) GetStorageAt(ctx context.Context, address common.Address, st
// ReadStorageAt is a convenience method to read a single storage value at the given slot in the given account.
// The storage slot value is verified against the state-root of the given block if we do not trust the RPC provider, or directly retrieved without proof if we do trust the RPC.
func (s *EthClient) ReadStorageAt(ctx context.Context, address common.Address, storageSlot common.Hash, blockHash common.Hash) (common.Hash, error) {
chainId, err := s.ChainID(ctx)
if err != nil {
return common.Hash{}, fmt.Errorf("failed to fetch chain id: %w", err)
}
// BSC Testnet doesn't support fetching the storage based on block hash
if chainId.Cmp(big.NewInt(97)) == 0 {
return s.GetStorageAt(ctx, address, storageSlot, "latest")
}
if s.trustRPC {
return s.GetStorageAt(ctx, address, storageSlot, blockHash.String())
}
Expand Down