Skip to content
This repository has been archived by the owner on Dec 15, 2023. It is now read-only.

Introduce forking #328

Merged
merged 53 commits into from
Nov 17, 2022
Merged

Introduce forking #328

merged 53 commits into from
Nov 17, 2022

Conversation

FabijanC
Copy link
Collaborator

@FabijanC FabijanC commented Oct 28, 2022

Usage related changes

  • Close Mainnet forking #18
  • Introduce --fork-network <NETWORK>
    • Specify the sequencer API to be used for fallback calls, e.g. https://alpha4-2.starknet.io; can be:
      • Network name: alpha-goerli, alpha-goerli2, alpha-mainnet (maybe testnet and mainnet would be better choices)
      • Network URL, e.g. https://alpha4-2.starknet.io
  • Introduce --fork-block <BLOCK_NUMBER>
    • Specify the block to be forked from (and to which all fallback calls will be done)
    • Defaults to latest (latest block number is fetched on forked-devnet startup and used throughout)
  • Change fee token address to 0x49D36570D4E46F48E99674BD3FCC84644DDD6B96F7C741B1562B82F9E004DC7 (same as mainnet and testnet)
    • BREAKING
  • Add cool yellow warnings.

Development related changes

  • Reduce methods in Origin
  • Remove special lite mode deployment (and corresponding classes):
    • Turns out the "lite" deployment was slower than normal deployment.
  • Add gateway url specifier to some test functions (invoke, call, run_starknet) - needed to perform calls on fork origins.
  • Add lint suppression to direct access of starknet.state.state.cache._class_hash_writes
  • Fee token and udc test bodies are extracted so they can be imported to fork tests.
  • Tests now depend on a third-party network: StarkNet's sequencer server, but only its feeder gateway, so no transactions are awaited and all requests ideally resolve instantly (simple GET requests).
  • Suppress deprecation warnings in tests
  • Suppress linting error about too many public methods in starknet_wrapper.py
  • Add scripts that help local testing.
  • Some methods had to become async (e.g. origin.py), which then propagated.
  • Make some methods in test/util.py accept target URL (feeder_gateway_url).

Checklist:

  • Applied formatting - ./scripts/format.sh
  • No linter errors - ./scripts/lint.sh
  • Performed code self-review
  • Rebased to the last commit of the target branch (or merged it into my branch)
  • Documented the changes
  • Linked the issues which this PR resolves
  • Updated the tests
  • All tests are passing

@FabijanC FabijanC marked this pull request as ready for review November 17, 2022 15:58
@FabijanC FabijanC merged commit a7b572b into master Nov 17, 2022
@FabijanC FabijanC deleted the forking branch November 17, 2022 16:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mainnet forking
2 participants