Update eth_call code. #105
Merged
arijitAD
merged 3 commits from 2021-09-30 14:44:24 +00:00
update-eth-call into master
Dismiss Review
Are you sure you want to dismiss this review?
Labels
Clear labels
Epic
Integration tests
bug
critical
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
v5
wontfix
Copied from Github
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Something isn't working
Improvements or additions to documentation
This issue or pull request already exists
New feature or request
Good for newcomers
Extra attention is needed
This doesn't seem right
Further information is requested
This will not be worked on
An issue or PR manually copied from GitHub.
Breaking change that won't be backward compatible
Something is not working
Documentation changes
Improve existing functionality
New functionality
This is security issue
Issue or pull request related to testing
Priority
Critical
The priority is critical
Priority
High
The priority is high
Priority
Low
The priority is low
Priority
Medium
The priority is medium
Reviewed
Confirmed
Issue has been confirmed
Reviewed
Duplicate
This issue or pull request already exists
Reviewed
Invalid
Invalid issue
Reviewed
Won't Fix
This issue won't be fixed
Status
Abandoned
Somebody has started to work on this but abandoned work
Status
Blocked
Something is blocking this issue or pull request
Status
Need More Info
Feedback is required to reproduce issue or to continue work
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cerc-io/ipld-eth-server#105
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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.Errcould 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.Erris non-nil: https://github.com/ethereum/go-ethereum/blob/f2491c5ed77b9554bd979a426db741a99acf6fa4/core/state_transition.go#L101.This
errwhen not nil, causing us to enter this block, is being overshadowed on the return at end of the method since we returnresult.Errinstead. In otherwords, thiserrthat causes us to enter this proxy call block has no way of ever bubbling up. If theerrreturned by the proxyCallContextcall is not nil we fall through and returnresult.Errinstead of theerrthat originally caused us to enter the proxy call block. This is problematic becauseresult.Errcould 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
errreturned byDoCallis not nil, and we hit another non-nilerron the proxy call, we need to return the originalerrinstead 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
[]errorand 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!