-
Notifications
You must be signed in to change notification settings - Fork 20.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eth: make debug_StorageRangeAt take a block hash or number #27328
eth: make debug_StorageRangeAt take a block hash or number #27328
Conversation
eth/api.go
Outdated
block := api.eth.blockchain.GetBlockByHash(blockHash) | ||
func (api *DebugAPI) StorageRangeAt(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash, txIndex int, contractAddress common.Address, keyStart hexutil.Bytes, maxResult int) (StorageRangeResult, error) { | ||
var block *types.Block | ||
if number, ok := blockNrOrHash.Number(); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or use api.eth.APIBackend.BlockByNumberOrHash
. I'm not sure why we don't use backend so much in this file and directly use blockchain 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that looks like a good alternative
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved APIBackend.BlockByNumberOrHash/BlockByNumber
methods into the Ethereum
object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. that was uneccesary. Ethereum
has a pointer to the APIBackend
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. should be good now.
6fc46c4
to
0c367b5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, I bitrotted this PR a bit, needs to apply the change against the file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Although I think it's a breaking change, originally users send hash 0x1234
now {"blockHash": "0x1234"} is required. But it's a debug API anyway, it's totally fine to change it.
36b4b4b
to
d19a1a7
Compare
Co-authored-by: Martin Holst Swende <[email protected]> Co-authored-by: Sina Mahmoodi <[email protected]>
d19a1a7
to
97d00ba
Compare
No it's not a breaking change.
|
…27328) eth: make StorageRangeAt take a block hash or number Co-authored-by: Martin Holst Swende <[email protected]> Co-authored-by: Sina Mahmoodi <[email protected]>
…thereum#27328)" This reverts commit 52775d5.
…thereum#27328)" This reverts commit 52775d5.
No description provided.