-
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
internal/ethapi: use RPCBlock,RPCHeader instead of interface #27305
Conversation
Signed-off-by: jsvisa <[email protected]>
Signed-off-by: jsvisa <[email protected]>
Signed-off-by: jsvisa <[email protected]>
Signed-off-by: jsvisa <[email protected]>
Signed-off-by: jsvisa <[email protected]>
Signed-off-by: jsvisa <[email protected]>
Signed-off-by: jsvisa <[email protected]>
Signed-off-by: jsvisa <[email protected]>
e93b9d3
to
0fa178e
Compare
Signed-off-by: jsvisa <[email protected]>
Signed-off-by: jsvisa <[email protected]>
Signed-off-by: jsvisa <[email protected]>
Signed-off-by: jsvisa <[email protected]>
Signed-off-by: jsvisa <[email protected]>
Signed-off-by: jsvisa <[email protected]>
Signed-off-by: jsvisa <[email protected]>
…le block Signed-off-by: jsvisa <[email protected]>
Signed-off-by: jsvisa <[email protected]>
Signed-off-by: jsvisa <[email protected]>
…null Signed-off-by: jsvisa <[email protected]>
Signed-off-by: jsvisa <[email protected]>
ReceiptHash common.Hash `json:"receiptsRoot"` | ||
BaseFee *hexutil.Big `json:"baseFeePerGas,omitempty"` | ||
WithdrawalsHash *common.Hash `json:"withdrawalsRoot,omitempty"` | ||
TotalDifficulty *hexutil.Big `json:"totalDifficulty"` |
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.
TotalDifficulty *hexutil.Big `json:"totalDifficulty"` | |
TotalDifficulty *hexutil.Big `json:"totalDifficulty,omitEmpty"` |
Why not omit empty and get rid of the null values?
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.
want, have := tc.want, string(out) | ||
require.JSONEqf(t, want, have, "test %d: json not match, want: %s, have: %s", i, want, have) |
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.
Why changing the raw string comparison into a json-equality check?
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.
seems the JSON serialization order is differ
We've discussed this PR in triage, and decided not to include it: the addition of these new types does not seem to bring sufficient advantages. |
@holiman anyway, thanks for your reply.
I want to declare them first in the internal package, if this PR was merged, I'm considering moving them out into some package like rpc/jsonrpc or other names. do you think this is feasible? |
rpc is a generic rpc package so I don't think it would be good to move the eth-specific definitions into that package. What use would exporting these values serve though? We generally use ethclient as the go interface for rpc values? |
Here is a transaction example, in ethclient we did can retrieve the transaction body via For this case seems we can make this struct into a public one: go-ethereum/ethclient/ethclient.go Line 208 in aa47d01
or this
BTW, does anyone know why we return this function as |
This is a follow-up PR by #27265, If it's OK I'll add more test cases for
getXXX
's response to ensure no alter the spec of RPC's response.