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

l2geth: docall protect nil block #736

Merged
merged 2 commits into from
May 3, 2021
Merged

l2geth: docall protect nil block #736

merged 2 commits into from
May 3, 2021

Conversation

tynes
Copy link
Contributor

@tynes tynes commented May 3, 2021

Description
Protects a nil reference of the block during eth_call. This is a problem because some of the L2 EVM context is based on L1 values. In particular the block number and timestamp are not the L2 values but instead are the L1 values. During eth_call, the correct block number and timestamp must be set. The current approach reads a historical block from the db and pulls out the timestamp and blocknumber from that block. The L1 timestamp and L1 blocknumber are serialized as part of the TransactionMeta in the db.

@changeset-bot
Copy link

changeset-bot bot commented May 3, 2021

🦋 Changeset detected

Latest commit: 8aac154

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@eth-optimism/l2geth Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment on lines 938 to 940
if err != nil {
return nil, 0, false, err
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This should still be checked every time, independently of the block not being nil

@tynes tynes force-pushed the fix/docall-protect-nil branch from a78e38a to 8aac154 Compare May 3, 2021 21:53
@gakonst gakonst merged commit 20df745 into master May 3, 2021
@gakonst gakonst deleted the fix/docall-protect-nil branch May 3, 2021 22:32
InoMurko pushed a commit to omgnetwork/optimism that referenced this pull request May 25, 2021
* l2geth: protect nil in eth_call

* chore: add changeset
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.

2 participants