-
Notifications
You must be signed in to change notification settings - Fork 12
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
prototype to support web3 provider connection #956
Draft
anvacaru
wants to merge
22
commits into
master
Choose a base branch
from
fork-testing-experimental
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+7,752
−86
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR enhances the KEVM semantics by integrating support for forking state via a remote web3 provider. With the new
--fork-url
and--fork-block-number
options, users can now run proofs against real network state, and the updated custom steps properly fetch account and storage data on demand. The new web3 RPC utilities and refactoring reduce duplication and improve code maintainability.Limitations:
1.Running multiple proofs in parallel might throw a
Max retries exceeded with url
due to the number of requests at startup. Will be fixed by caching responses in a future PR.2. Fork management using cheatcodes (i.e.
vm.createFork
,vm.selectFork
) not yet supported.Summary
pyproject.toml
: added web3 module as a dependencyIn
src/kontrol/cli.py
:--fork-url
. This option allows users to specify a remote web3 provider URL so that state can be fetched from a live network.--fork-block-number
. This option allows users to specify a block number from which the provider reads information. The number is set in the configuration's<number>
cell.In
src/kontrol/foundry.py
, theKontrolSemantics
class constructor now accepts an optionalprovider_url
. When provided, it retrieves a web3 provider via the newWeb3Providers
registry.New custom step definitions have been added (using the new
CustomStep
wrapper) for fetching account data and storage from the web3 provider. These custom steps include:_fetch_storage_pattern
with_exec_fetch_storage_custom_step
_fetch_account_pattern
with_exec_fetch_account_custom_step
Helper functions such as
update_forked_accounts_cell
,get_set_from_cterm
, andadd_storage_slot_to_account
have been added/refactored to remove duplicated logic when updating the forked accounts cell or adding storage data to an account.Proof Initialization Updates:
get_block_metadata
. These values are injected into the configuration.src/kontrol/web3_rpc.py
. This module contains:Web3Providers
class, which caches and reuses Web3 instances per unique URL.foundry.md
:-
<forkedAccounts> .Set </forkedAccounts>
- to keep track of accounts read from a provider.-
<allowWeb3Connection> false </allowWeb3Connection>
- flag to allow web3 connections.#accountInState
and#accountHasStorageSlot
(can be upstreamed to kevm).FETCH_ACCOUNT
andFETCH_ACCOUNT_STORAGE
added together with rules that add them at the top of the K_CELL when there is a need to fetch informantion from a Web3 provider.