Skip to content
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

[rpc] support for eip-1898 - support block number or hash on state-related methods #4181

Merged
merged 3 commits into from
May 31, 2022

Conversation

peekpi
Copy link
Contributor

@peekpi peekpi commented May 28, 2022

merge ethereum/go-ethereum#19491 to harmony.

@peekpi peekpi requested a review from rlan35 May 28, 2022 13:29
if header == nil && err != nil {
return
}
state, err := s.hmy.BeaconChain.StateAt(header.Root())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rlan35 do you know why here use BeaconChain but BlockChain? what's the difference between them?

@peekpi peekpi requested a review from LuttyYang May 28, 2022 14:42
@@ -69,7 +69,7 @@ func (s *AccountAPI) AccountBalance(
return nil, rosettaError
}
} else {
balance, err = s.hmy.GetBalance(ctx, addr, blockNum)
balance, err = s.hmy.GetBalance(ctx, addr, rpc.BlockNumberOrHashWithNumber(blockNum))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LuttyYang please help to check the change of rosetta

@sophoah
Copy link
Contributor

sophoah commented May 30, 2022

@peekpi can you attach rpc call result test in the PR showing we still support the old way along with the new ones

@peekpi
Copy link
Contributor Author

peekpi commented May 30, 2022

@peekpi can you attach rpc call result test in the PR showing we still support the old way along with the new ones

travis_rpc_test already has some tests for the old RPC.

@sophoah
Copy link
Contributor

sophoah commented May 31, 2022

Tested on mainnet archival node

by block number

curl -s -L -X POST $URL --header 'Content-Type: application/json' --data-raw "{\"jsonrpc\":\"2.\":\"eth_call\", \"params\":[{\"to\": \"0xcf664087a5bb0237a0bad6742852ec6c8d69a27a\",\"data\": \"0x70a0823100000000000000000000000083652856fc0431f6f735fdb271c468d0dd41fd4c\"}, \"0x19BE6C2\"],\"id\":1}"
{"jsonrpc":"2.0","id":1,"result":"0x0000000000000000000000000000000000000000000000011bada83bc6ed2c45"}

by blockhash inside an object

curl -s -L -X POST $URL --header 'Content-Type: application/json' --data-raw "{\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\":[{\"to\": \"0xcf664087a5bb0237a0bad6742852ec6c8d69a27a\",\"data\": \"0x70a0823100000000000000000000000083652856fc0431f6f735fdb271c468d0dd41fd4c\"}, {\"blockHash\":\"0xc03e94bf147b041afe181aef60fcdffec30d8fa794359f5f8d89c1bd9ea9e65e\"}],\"id\":1}"
{"jsonrpc":"2.0","id":1,"result":"0x0000000000000000000000000000000000000000000000011bada83bc6ed2c45"}

@rlan35 rlan35 merged commit 2367a0d into harmony-one:main May 31, 2022
@sophoah sophoah changed the title align eip-1898: support block number or hash on state-related methods [rpc ] support for eip-1898 - support block number or hash on state-related methods Jun 2, 2022
@sophoah sophoah changed the title [rpc ] support for eip-1898 - support block number or hash on state-related methods [rpc] support for eip-1898 - support block number or hash on state-related methods Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants