-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: ethrpc: implement call, estimateGas, getTransactionCount #9306
Conversation
I’m a little concerned that the gas estimation result is slightly different from
It seems to me that the difference is the execution context (e.g. the state of stmgr). @raulk any idea about this? |
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 have no idea what's causing the gas difference, but the code looks correct (I have some nits, but they're really not important.
node/impl/full/eth.go
Outdated
receipt := api.NewEthTxReceipt(tx) | ||
err = receipt.PopulateReceipt(msgLookup, replay) | ||
if err != nil { | ||
return api.EthTxReceipt{}, err | ||
} |
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.
Nit: splitting these into two methods doesn't really seem necessary.
api/eth_types.go
Outdated
func CheckContractCreation(lookup *MsgLookup) (*EthAddress, error) { | ||
var result init8.ExecReturn | ||
ret := bytes.NewReader(lookup.Receipt.Return) | ||
if err := result.UnmarshalCBOR(ret); lookup.Receipt.ExitCode.IsSuccess() && err == nil { |
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.
Shouldn't we check IsSuccess first (no need to decode?)?
BlockNumber EthInt `json:"blockNumber"` | ||
TransactionIndex EthInt `json:"transacionIndex"` | ||
From EthAddress `json:"from"` | ||
To *EthAddress `json:"to"` |
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 is this a pointer? I believe that from
is optional because the node would use its default account in that case, but didn't know that to
can be optional?
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.
@raulk to
should be optional, because if the tx creates a contract, ethereum's behavior is to return "to": null for both the tx and the tx receipt
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.
Ah, true, I had forgotten about that edge case.
var result init8.ExecReturn | ||
ret := bytes.NewReader(lookup.Receipt.Return) | ||
if err := result.UnmarshalCBOR(ret); err == nil { | ||
contractAddr, err := EthAddressFromFilecoinIDAddress(result.IDAddress) |
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.
nit (can save for a future PR): should probably return a specific error message instead of letting it fall through to the "not a contract creation tx" error.
Related Issues
ref-fvm #854
Proposed Changes
Additional Info
Checklist
Before you mark the PR ready for review, please make sure that:
<PR type>: <area>: <change being made>
fix: mempool: Introduce a cache for valid signatures
PR type
: fix, feat, INTERFACE BREAKING CHANGE, CONSENSUS BREAKING, build, chore, ci, docs,perf, refactor, revert, style, testarea
: api, chain, state, vm, data transfer, market, mempool, message, block production, multisig, networking, paychan, proving, sealing, wallet, deps