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

POC Support ZkEvm #7

Merged
merged 7 commits into from
Jan 19, 2024
Merged

POC Support ZkEvm #7

merged 7 commits into from
Jan 19, 2024

Conversation

catalyst17
Copy link
Collaborator

Detecting ZK EVM contracts deployment is done similar to the OP stack way. In short:

  • for all the contracts we check for the new contract deployed with the specific hash of a code_change
  • 3 of those deployments are done through the ZkEVMDeployerContract, so for these we additionally check the NewDeterministicDeployment event emittance
  • 2 contracts are deployed under a usual TransparentUpgradeableProxy so for these there is extra logic
    • for the main PolygonZkEvm under a proxy we are checking that there is a set of very specific events along the deployment
    • for the PolygonZkEVMGlobalExitRoot under the same proxy type we are even doing an RPC read call to the implementation address to make sure we detected the correct proxy address

Again, I think one of the next steps should probably be to start using Substreams store modules in order to make sure we are correctly enriching one rollup entity instead of creating a new one, because right now we're relying on the separate sink logic to merge the data when updating data in Postgres, which doesn't seem to work well (we miss a lot of contracts' addresses for OP).

Another improvement I figured at the very end of this PR's work is to use RPC read calls in substreams to actually query the majority of the periphery contracts' addresses from one of the main contracts which can hold [almost] all of them.

Copy link

linear bot commented Jan 10, 2024

Copy link
Contributor

@tomedalya tomedalya left a comment

Choose a reason for hiding this comment

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

Overall it looks pretty straight forward.
there are method ids and some other constants that would be better to have them either commented with names or with proper names as statics so will be easier to understand what are we searching .

pretty high level review so would be good to have second pair of eyes

src/abi/rollups/zk_evm/polygon_zk_evm.rs Show resolved Hide resolved
@catalyst17 catalyst17 merged commit c12ca89 into main Jan 19, 2024
1 check passed
@catalyst17 catalyst17 deleted the block-1340-poc-support-zkevm branch January 19, 2024 12:52
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