Update eth_call code. #105
No reviewers
Labels
No Label
bug
critical
documentation
duplicate
enhancement
Epic
good first issue
help wanted
Integration tests
invalid
question
v5
wontfix
Copied from Github
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cerc-io/ipld-eth-server#105
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "update-eth-call"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Made some comments, this eth_call stuff just keeps getting more complex huh. Especially with our proxy calling, which as an aside we may want to generally consider refactoring/cleaning up at some point if possible as in the current approach it does make the error handling even more confusing.
Echoing what I said in slack: since it is not feasible to be certain whether or not the call was reverted due to incomplete state in our Postgres ETH-IPLD database or due to the nature of the call itself (that is, that it would fail on complete state), the safest thing to do is assume it was the former and not return the revert error and instead set the err var as it is being set currently such that we then call out to the proxy client to try and satisfy the request there.
If it is the former case, the proxy client will be able to satisfy the call (assuming it has the required state) and we will potentially fill in the missing data (with the call to
pea.writeStateDiffAtOrFor
, although that will only fill in the missing data if the missing nodes are in the statediff at this height/hash). If it is the later case, the proxy client will run into the same revert reason and the revert error will bubble up.As far as I can see,
result.Err
could be non-nil due to our IPLD-ETH database being incomplete. As such, if we make it down to here with a non-nilresult.Err
- and haven't already tried calling out to a proxy- we should do so. Particularly sinceresult.Return()
will only ever return nil ifresult.Err
is non-nil:f2491c5ed7/core/state_transition.go (L101)
.This
err
when not nil, causing us to enter this block, is being overshadowed on the return at end of the method since we returnresult.Err
instead. In otherwords, thiserr
that causes us to enter this proxy call block has no way of ever bubbling up. If theerr
returned by the proxyCallContext
call is not nil we fall through and returnresult.Err
instead of theerr
that originally caused us to enter the proxy call block. This is problematic becauseresult.Err
could very well be nil in that case, so we would be returning a nil error from this method even though there was one (actually two, one that caused us to call out to the proxy- the one we want to return- and the one due to the proxy call failing- which we can ignore).So I think when the
err
returned byDoCall
is not nil, and we hit another non-nilerr
on the proxy call, we need to return the originalerr
instead ofresult.Err
.I have updated the error logic.
@ -902,0 +909,4 @@
//
// Note, this function doesn't make and changes in the state/blockchain and is
// useful to execute and retrieve values.
func (pea *PublicEthAPI) Call(ctx context.Context, args CallArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *StateOverride) (hexutil.Bytes, error) {
For now this should be left as
err :=
, if we hit an error on the proxy call we'd prefer to return the original error that caused us to call out to the proxy rather than the proxy error.What we really should do, but we can make this a separate issue, is track all the errors in an
[]error
and then when we return from this method we concatenate all those error messages into a single error.@ -902,0 +909,4 @@
//
// Note, this function doesn't make and changes in the state/blockchain and is
// useful to execute and retrieve values.
func (pea *PublicEthAPI) Call(ctx context.Context, args CallArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *StateOverride) (hexutil.Bytes, error) {
Done
Created an issue https://github.com/vulcanize/ipld-eth-server/issues/109
@ -902,0 +909,4 @@
//
// Note, this function doesn't make and changes in the state/blockchain and is
// useful to execute and retrieve values.
func (pea *PublicEthAPI) Call(ctx context.Context, args CallArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *StateOverride) (hexutil.Bytes, error) {
Thanks! Sorry, I should have mentioned I already created an issue so I closed yours.
LGTM!