├── .circleci └── scripts │ └── cache.sh ├── .clippy.toml ├── .coderabbit.yaml ├── .devcontainer ├── Dockerfile ├── bashrc └── devcontainer.json ├── .dockerignore ├── .github ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE │ └── bug_report.md ├── actions │ ├── get-version-info │ │ └── action.yml │ └── load-config │ │ └── action.yml ├── pull_request_template.md ├── release.yml ├── workflow-config.yml └── workflows │ ├── build-and-publish.yml │ └── build-and-test.yml ├── .gitignore ├── .gitmodules ├── .vscode └── launch.json ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── RELEASE.md ├── _typos.toml ├── contracts ├── generate_artifacts.sh ├── l1-l2-artifacts │ ├── L1L2Example.json │ ├── cairo_l1_l2.contract_class.sierra │ └── cairo_l1_l2_lib.contract_class.sierra ├── l1-l2-messaging │ ├── .env │ ├── .tool-versions │ ├── README.md │ ├── cairo │ │ ├── .gitignore │ │ ├── .tool-versions │ │ ├── README.md │ │ ├── Scarb.lock │ │ ├── Scarb.toml │ │ ├── account-0-42.json │ │ └── src │ │ │ ├── l1_l2.cairo │ │ │ ├── l1_l2_lib.cairo │ │ │ └── lib.cairo │ ├── run_e2e.sh │ └── solidity │ │ ├── .github │ │ └── workflows │ │ │ └── test.yml │ │ ├── .gitignore │ │ ├── README.md │ │ ├── foundry.toml │ │ ├── script │ │ └── L1L2.s.sol │ │ └── src │ │ ├── IStarknetMessaging.sol │ │ ├── IStarknetMessagingEvents.sol │ │ ├── L1L2.sol │ │ ├── MockStarknetMessaging.sol │ │ ├── NamedStorage.sol │ │ └── StarknetMessaging.sol └── test_artifacts │ ├── cairo0 │ ├── ERC20_Mintable_OZ_0.2.0.json │ ├── ERC20_starknet_js.json │ ├── account.json │ ├── account_without_validations │ │ ├── account.cairo │ │ └── account.json │ ├── l1l2.json │ └── simple_contract.json │ └── cairo1 │ ├── block_reader │ ├── block_reader.cairo │ ├── block_reader.sierra │ └── compilation_info.txt │ ├── cairo_1_test.sierra │ ├── events │ ├── events.cairo │ └── events_2.0.1_compiler.sierra │ ├── invalid_account │ ├── compilation_info.txt │ ├── invalid_account.cairo │ └── invalid_account.sierra │ ├── panicking_contract │ ├── compilation_info.txt │ ├── panicking_contract.cairo │ └── panicking_contract.sierra │ ├── simple_contract │ ├── compilation_info.txt │ ├── contract.cairo │ └── output.sierra │ ├── timestamp_asserter │ ├── Scarb.lock │ ├── Scarb.toml │ ├── src │ │ ├── lib.cairo │ │ └── timestamp_asserter.cairo │ └── target │ │ ├── CACHEDIR.TAG │ │ └── dev │ │ ├── cairo.starknet_artifacts.json │ │ └── cairo_TimestampAsserter.contract_class.json │ ├── too_big │ ├── compilation_info.txt │ ├── generate_contract.sh │ └── too_big.sierra │ └── version_asserter │ ├── compilation_info.txt │ ├── version_asserter.cairo │ └── version_asserter.sierra ├── crates ├── starknet-devnet-core │ ├── Cargo.toml │ ├── contracts │ │ ├── accounts_artifacts │ │ │ ├── Argent │ │ │ │ ├── argent_0.4.0.sierra │ │ │ │ └── argent_multisig_0.2.0.sierra │ │ │ └── OpenZeppelin │ │ │ │ ├── 0.5.1 │ │ │ │ └── Account.cairo │ │ │ │ │ └── Account.json │ │ │ │ ├── 0.8.0 │ │ │ │ └── Account.cairo │ │ │ │ │ └── Account.sierra │ │ │ │ └── 1.0.0 │ │ │ │ └── Account.cairo │ │ │ │ ├── Account.sierra │ │ │ │ └── compilation_info.txt │ │ ├── l1-l2-artifacts │ │ │ └── MockStarknetMessaging.json │ │ └── system_artifacts │ │ │ ├── UDC_OZ_0.5.0.json │ │ │ ├── erc20_eth.sierra │ │ │ ├── erc20_strk.sierra │ │ │ └── udc_2.sierra │ └── src │ │ ├── account.rs │ │ ├── blocks │ │ └── mod.rs │ │ ├── constants.rs │ │ ├── contract_class_choice.rs │ │ ├── error.rs │ │ ├── lib.rs │ │ ├── messaging │ │ ├── ethereum.rs │ │ └── mod.rs │ │ ├── predeployed_accounts.rs │ │ ├── starknet │ │ ├── add_declare_transaction.rs │ │ ├── add_deploy_account_transaction.rs │ │ ├── add_invoke_transaction.rs │ │ ├── add_l1_handler_transaction.rs │ │ ├── cheats.rs │ │ ├── defaulter.rs │ │ ├── estimations.rs │ │ ├── events.rs │ │ ├── get_class_impls.rs │ │ ├── mod.rs │ │ ├── predeployed.rs │ │ ├── starknet_config.rs │ │ ├── state_update.rs │ │ └── transaction_trace.rs │ │ ├── state │ │ ├── mod.rs │ │ ├── state_diff.rs │ │ └── state_readers.rs │ │ ├── system_contract.rs │ │ ├── traits.rs │ │ ├── transactions.rs │ │ └── utils.rs ├── starknet-devnet-server │ ├── Cargo.toml │ ├── src │ │ ├── api │ │ │ ├── account_helpers.rs │ │ │ ├── endpoints.rs │ │ │ ├── endpoints_ws.rs │ │ │ ├── error.rs │ │ │ ├── json_rpc_handler.rs │ │ │ ├── mod.rs │ │ │ ├── models │ │ │ │ ├── json_rpc_request.rs │ │ │ │ ├── json_rpc_response.rs │ │ │ │ └── mod.rs │ │ │ ├── origin_forwarder.rs │ │ │ ├── serde_helpers.rs │ │ │ ├── spec_reader │ │ │ │ ├── data_generator.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── spec_modifier.rs │ │ │ │ └── spec_schemas │ │ │ │ │ ├── all_of_schema.rs │ │ │ │ │ ├── array_primitive.rs │ │ │ │ │ ├── boolean_primitive.rs │ │ │ │ │ ├── integer_primitive.rs │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── object_primitive.rs │ │ │ │ │ ├── one_of_schema.rs │ │ │ │ │ ├── ref_schema.rs │ │ │ │ │ ├── string_primitive.rs │ │ │ │ │ └── tuple_schema.rs │ │ │ └── write_endpoints.rs │ │ ├── config.rs │ │ ├── dump_util.rs │ │ ├── error.rs │ │ ├── lib.rs │ │ ├── restrictive_mode.rs │ │ ├── rpc_core │ │ │ ├── error.rs │ │ │ ├── mod.rs │ │ │ ├── request.rs │ │ │ └── response.rs │ │ ├── rpc_handler.rs │ │ ├── server.rs │ │ ├── subscribe.rs │ │ └── test_utils.rs │ └── test_data │ │ └── spec │ │ └── 0.9.0 │ │ ├── edit_spec_instructions.yaml │ │ ├── starknet_api_openrpc.json │ │ ├── starknet_executables.json │ │ ├── starknet_trace_api_openrpc.json │ │ ├── starknet_write_api.json │ │ └── starknet_ws_api.json ├── starknet-devnet-types │ ├── Cargo.toml │ ├── src │ │ ├── chain_id.rs │ │ ├── constants.rs │ │ ├── contract_storage_key.rs │ │ ├── error.rs │ │ ├── lib.rs │ │ ├── patricia_key.rs │ │ ├── rpc.rs │ │ ├── rpc │ │ │ ├── block.rs │ │ │ ├── contract_address.rs │ │ │ ├── contract_class.rs │ │ │ ├── contract_class │ │ │ │ └── deprecated │ │ │ │ │ ├── abi_entry.rs │ │ │ │ │ ├── json_contract_class.rs │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── rpc_contract_class.rs │ │ │ ├── emitted_event.rs │ │ │ ├── estimate_message_fee.rs │ │ │ ├── eth_address.rs │ │ │ ├── felt.rs │ │ │ ├── gas_modification.rs │ │ │ ├── macro_utils.rs │ │ │ ├── messaging.rs │ │ │ ├── state.rs │ │ │ ├── transaction_receipt.rs │ │ │ ├── transactions.rs │ │ │ └── transactions │ │ │ │ ├── broadcasted_declare_transaction_v3.rs │ │ │ │ ├── broadcasted_deploy_account_transaction_v3.rs │ │ │ │ ├── broadcasted_invoke_transaction_v3.rs │ │ │ │ ├── declare_transaction_v3.rs │ │ │ │ ├── deploy_account_transaction_v3.rs │ │ │ │ ├── deploy_transaction.rs │ │ │ │ ├── invoke_transaction_v3.rs │ │ │ │ └── l1_handler_transaction.rs │ │ ├── serde_helpers.rs │ │ ├── traits.rs │ │ └── utils.rs │ └── test_data │ │ ├── cairo_0_rpc.json │ │ └── sierra_contract_class_with_abi_as_string.json └── starknet-devnet │ ├── Cargo.toml │ └── src │ ├── cli.rs │ ├── initial_balance_wrapper.rs │ ├── ip_addr_wrapper.rs │ └── main.rs ├── docker ├── Dockerfile ├── image_build.sh ├── seed0.Dockerfile └── tag_images_and_create_joint_image_manifests.sh ├── rust-toolchain.toml ├── rustfmt.toml ├── scripts ├── benchmark │ ├── command_stat_test.py │ ├── mint_benchmark.sh │ └── startup_test.py ├── check_crate_changes.sh ├── check_spelling.sh ├── check_unused_deps.sh ├── clippy_check.sh ├── compile_binary.sh ├── fetch_ci_binaries.py ├── format.sh ├── format_check.sh ├── install_foundry.sh ├── publish_cratesio_new_versions.sh ├── publish_docs.sh └── requirements.txt ├── tests └── integration │ ├── Cargo.toml │ ├── common │ ├── assertions.rs │ ├── background_anvil.rs │ ├── background_devnet.rs │ ├── background_server.rs │ ├── constants.rs │ ├── errors.rs │ ├── fees.rs │ ├── mod.rs │ ├── reqwest_client.rs │ ├── safe_child.rs │ └── utils.rs │ ├── general_integration_tests.rs │ ├── general_rpc_tests.rs │ ├── get_transaction_by_block_id_and_index.rs │ ├── get_transaction_by_hash.rs │ ├── get_transaction_receipt_by_hash.rs │ ├── lib.rs │ ├── test_abort_blocks.rs │ ├── test_accepting_blocks_on_l1.rs │ ├── test_account_impersonation.rs │ ├── test_account_selection.rs │ ├── test_advancing_time.rs │ ├── test_advancing_time_on_fork.rs │ ├── test_balance.rs │ ├── test_blocks_generation.rs │ ├── test_call.rs │ ├── test_deploy.rs │ ├── test_dump_and_load.rs │ ├── test_estimate_fee.rs │ ├── test_estimate_message_fee.rs │ ├── test_fork.rs │ ├── test_gas_modification.rs │ ├── test_get_block_txs_count.rs │ ├── test_get_class.rs │ ├── test_get_class_hash_at.rs │ ├── test_get_events.rs │ ├── test_messaging.rs │ ├── test_minting.rs │ ├── test_old_state.rs │ ├── test_restart.rs │ ├── test_restrictive_mode.rs │ ├── test_simulate_transactions.rs │ ├── test_subscription_to_blocks.rs │ ├── test_subscription_to_events.rs │ ├── test_subscription_to_new_tx_receipts.rs │ ├── test_subscription_to_new_txs.rs │ ├── test_subscription_to_reorg.rs │ ├── test_subscription_to_tx_status.rs │ ├── test_subscription_with_invalid_block_id.rs │ ├── test_trace.rs │ ├── test_transaction_handling.rs │ ├── test_v3_transactions.rs │ └── test_websocket.rs └── website ├── .gitignore ├── .prettierignore ├── README.md ├── babel.config.js ├── docs ├── account-impersonation.md ├── api.md ├── balance.md ├── blocks.md ├── dump-load-restart.md ├── examples.md ├── forking.md ├── gas.md ├── historic-state.md ├── intro.md ├── lite.md ├── postman.md ├── predeployed.md ├── restrictive.md ├── running │ ├── _category_.json │ ├── cli.md │ ├── docker.md │ └── install.md ├── server-config.md └── starknet-time.md ├── docusaurus.config.ts ├── package-lock.json ├── package.json ├── sidebars.ts ├── src ├── components │ └── HomepageFeatures │ │ ├── index.tsx │ │ └── styles.module.css ├── css │ └── custom.css └── pages │ ├── index.module.css │ └── index.tsx ├── static ├── .nojekyll ├── devnet_api.json └── img │ ├── devnet-logo.png │ └── favicon.ico ├── tsconfig.json ├── versioned_docs ├── version-0.3.0 │ ├── account-impersonation.md │ ├── api.md │ ├── balance.md │ ├── blocks.md │ ├── dump-load-restart.md │ ├── examples.md │ ├── forking.md │ ├── gas.md │ ├── historic-state.md │ ├── intro.md │ ├── lite.md │ ├── postman.md │ ├── predeployed.md │ ├── restrictive.md │ ├── running │ │ ├── _category_.json │ │ ├── cli.md │ │ ├── docker.md │ │ └── install.md │ ├── server-config.md │ └── starknet-time.md ├── version-0.4.0 │ ├── account-impersonation.md │ ├── api.md │ ├── balance.md │ ├── blocks.md │ ├── dump-load-restart.md │ ├── examples.md │ ├── forking.md │ ├── gas.md │ ├── historic-state.md │ ├── intro.md │ ├── lite.md │ ├── postman.md │ ├── predeployed.md │ ├── restrictive.md │ ├── running │ │ ├── _category_.json │ │ ├── cli.md │ │ ├── docker.md │ │ └── install.md │ ├── server-config.md │ └── starknet-time.md ├── version-0.4.1 │ ├── account-impersonation.md │ ├── api.md │ ├── balance.md │ ├── blocks.md │ ├── dump-load-restart.md │ ├── examples.md │ ├── forking.md │ ├── gas.md │ ├── historic-state.md │ ├── intro.md │ ├── lite.md │ ├── postman.md │ ├── predeployed.md │ ├── restrictive.md │ ├── running │ │ ├── _category_.json │ │ ├── cli.md │ │ ├── docker.md │ │ └── install.md │ ├── server-config.md │ └── starknet-time.md ├── version-0.4.2 │ ├── account-impersonation.md │ ├── api.md │ ├── balance.md │ ├── blocks.md │ ├── dump-load-restart.md │ ├── examples.md │ ├── forking.md │ ├── gas.md │ ├── historic-state.md │ ├── intro.md │ ├── lite.md │ ├── postman.md │ ├── predeployed.md │ ├── restrictive.md │ ├── running │ │ ├── _category_.json │ │ ├── cli.md │ │ ├── docker.md │ │ └── install.md │ ├── server-config.md │ └── starknet-time.md ├── version-0.4.3 │ ├── account-impersonation.md │ ├── api.md │ ├── balance.md │ ├── blocks.md │ ├── dump-load-restart.md │ ├── examples.md │ ├── forking.md │ ├── gas.md │ ├── historic-state.md │ ├── intro.md │ ├── lite.md │ ├── postman.md │ ├── predeployed.md │ ├── restrictive.md │ ├── running │ │ ├── _category_.json │ │ ├── cli.md │ │ ├── docker.md │ │ └── install.md │ ├── server-config.md │ └── starknet-time.md ├── version-0.5.0 │ ├── account-impersonation.md │ ├── api.md │ ├── balance.md │ ├── blocks.md │ ├── dump-load-restart.md │ ├── examples.md │ ├── forking.md │ ├── gas.md │ ├── historic-state.md │ ├── intro.md │ ├── lite.md │ ├── postman.md │ ├── predeployed.md │ ├── restrictive.md │ ├── running │ │ ├── _category_.json │ │ ├── cli.md │ │ ├── docker.md │ │ └── install.md │ ├── server-config.md │ └── starknet-time.md ├── version-0.5.1 │ ├── account-impersonation.md │ ├── api.md │ ├── balance.md │ ├── blocks.md │ ├── dump-load-restart.md │ ├── examples.md │ ├── forking.md │ ├── gas.md │ ├── historic-state.md │ ├── intro.md │ ├── lite.md │ ├── postman.md │ ├── predeployed.md │ ├── restrictive.md │ ├── running │ │ ├── _category_.json │ │ ├── cli.md │ │ ├── docker.md │ │ └── install.md │ ├── server-config.md │ └── starknet-time.md ├── version-0.6.0 │ ├── account-impersonation.md │ ├── api.md │ ├── balance.md │ ├── blocks.md │ ├── dump-load-restart.md │ ├── examples.md │ ├── forking.md │ ├── gas.md │ ├── historic-state.md │ ├── intro.md │ ├── lite.md │ ├── postman.md │ ├── predeployed.md │ ├── restrictive.md │ ├── running │ │ ├── _category_.json │ │ ├── cli.md │ │ ├── docker.md │ │ └── install.md │ ├── server-config.md │ └── starknet-time.md └── version-0.6.1 │ ├── account-impersonation.md │ ├── api.md │ ├── balance.md │ ├── blocks.md │ ├── dump-load-restart.md │ ├── examples.md │ ├── forking.md │ ├── gas.md │ ├── historic-state.md │ ├── intro.md │ ├── lite.md │ ├── postman.md │ ├── predeployed.md │ ├── restrictive.md │ ├── running │ ├── _category_.json │ ├── cli.md │ ├── docker.md │ └── install.md │ ├── server-config.md │ └── starknet-time.md ├── versioned_sidebars ├── version-0.0.6-sidebars.json ├── version-0.0.7-sidebars.json ├── version-0.1.1-sidebars.json ├── version-0.1.2-sidebars.json ├── version-0.2.0-sidebars.json ├── version-0.2.1-sidebars.json ├── version-0.2.2-sidebars.json ├── version-0.2.3-sidebars.json ├── version-0.2.4-sidebars.json ├── version-0.3.0-sidebars.json ├── version-0.4.0-sidebars.json ├── version-0.4.1-sidebars.json ├── version-0.4.2-sidebars.json ├── version-0.4.3-sidebars.json ├── version-0.5.0-sidebars.json ├── version-0.5.1-sidebars.json ├── version-0.6.0-sidebars.json └── version-0.6.1-sidebars.json └── versions.json /.circleci/scripts/cache.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | # Cache is available only on our custom runner 5 | if [ "$CIRCLECI_RUNNER_CLASS" != "spaceshard/ax41" ]; then 6 | echo "Custom cache available only on self-hosted spaceshard/ax41 runner" 7 | exit 0 8 | fi 9 | 10 | if [ $# -ne 1 ]; then 11 | echo "Please provide cache action as an argument. (save, load or cleanup)" 12 | exit 1 13 | fi 14 | 15 | action="$1" 16 | 17 | # VARIABLES 18 | # Files to use as cache key 19 | cache_key_files=("Cargo.lock" "rust-toolchain.toml") 20 | 21 | # Directories to cache 22 | cached_dirs=("target/release/.fingerprint target/release/build target/release/deps") 23 | 24 | # Cache files that are accessed more than $cache_cleanup_interval days ago will be removed in cleanup step 25 | cache_cleanup_interval=7 26 | 27 | 28 | cache_base_dir="/cache" # dependent on runner architecture 29 | cache_file="$cache_base_dir/$(cat ${cache_key_files[@]} | shasum | awk '{print $1}').tar.gz" 30 | 31 | case "$action" in 32 | "load") 33 | echo "Loading cache..." 34 | if [ ! -f "$cache_file" ]; then 35 | echo "Cache does not exist." 36 | exit 0 37 | fi 38 | tar xvf "$cache_file" 39 | ;; 40 | "save") 41 | echo "Creating cache..." 42 | if [ -f "$cache_file" ]; then 43 | echo "Cache already exists." 44 | exit 0 45 | fi 46 | tmpfile="$(mktemp -p $cache_base_dir)" 47 | tar czvf "$tmpfile" ${cached_dirs[@]} # This is to handle race condition. One runner might be loading cache while another isn't done saving it. Or multple runners might be saving cache at the same time. 48 | mv "$tmpfile" "$cache_file" 49 | ;; 50 | "cleanup") 51 | echo "Cleaning up cache..." 52 | find "$cache_base_dir" -amin +30 -not -name '*.gz' -exec rm {} \; # Remove temporary cache files if they are leftover (older than 30 minutes, for race condition) 53 | find "$cache_base_dir" -atime "+$cache_cleanup_interval" -name '*.gz' -exec rm {} \; # Remove nonactive cache files 54 | exit 0 55 | ;; 56 | *) 57 | echo "Invalid action $action. Valid actions are save, load, and cleanup". 58 | exit 1 59 | ;; 60 | esac 61 | -------------------------------------------------------------------------------- /.clippy.toml: -------------------------------------------------------------------------------- 1 | allow-unwrap-in-tests = true 2 | allow-expect-in-tests = true 3 | -------------------------------------------------------------------------------- /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:22.04 2 | 3 | RUN apt update && apt upgrade -y 4 | 5 | # install packages to the container 6 | RUN apt install -y gcc curl wget git vim zip sqlite3 libdigest-sha-perl zsh build-essential make 7 | 8 | RUN apt update 9 | RUN apt -y install pkg-config libssl-dev 10 | 11 | # set variable 12 | ARG USER=local_dev 13 | 14 | # create user 15 | RUN adduser \ 16 | --system \ 17 | --shell /bin/bash \ 18 | --gecos $USER \ 19 | --group \ 20 | --disabled-password \ 21 | --home /home/$USER \ 22 | $USER 23 | 24 | 25 | # # Set up Rust 26 | USER $USER 27 | 28 | # copy local bashrc to user home directory 29 | COPY ./bashrc /home/$USER/.bashrc 30 | 31 | # install rust from website 32 | RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y --no-modify-path 33 | 34 | # apply bashrc file 35 | SHELL ["/bin/bash", "-c"] 36 | RUN source $HOME/.bashrc 37 | 38 | USER root 39 | 40 | EXPOSE 8000 8080 -------------------------------------------------------------------------------- /.devcontainer/bashrc: -------------------------------------------------------------------------------- 1 | alias gs="git status" 2 | alias ga="git add" 3 | alias gu="git add -u" 4 | alias gm="git commit -m" 5 | alias gp="git push" 6 | 7 | source $HOME/.cargo/env -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "dockerFile": "Dockerfile", 3 | "forwardPorts": [ 4 | 8000, 5 | 8080 6 | ], 7 | "containerUser": "local_dev", 8 | "customizations": { 9 | "vscode": { 10 | "extensions": [ 11 | "rust-lang.rust-analyzer", 12 | "vadimcn.vscode-lldb" 13 | ] 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore git related 2 | .git 3 | .gitignore 4 | .github 5 | .cache 6 | 7 | # Generated by Cargo 8 | # will have compiled files and executables 9 | debug/ 10 | target/ 11 | 12 | # These are backup files generated by rustfmt 13 | **/*.rs.bk 14 | 15 | # MSVC Windows builds of rustc generate these, which store debugging information 16 | *.pdb 17 | 18 | # DS_Store MacOS file 19 | **/.DS_Store 20 | 21 | # IntelliJ settings 22 | .idea/ 23 | 24 | .circleci 25 | .vscode 26 | .devcontainer 27 | 28 | # Prevent changes in Dockerfile to cause layer rebuilding 29 | **/*Dockerfile 30 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "" 5 | labels: "" 6 | assignees: "" 7 | --- 8 | 9 | **Describe the bug (observed vs expected behavior)** 10 | 11 | A clear and concise description of what the bug is. If applicable, add screenshots to help explain your problem. However, prefer providing plain text. 12 | 13 | **Not reproducible on testnet** 14 | 15 | - [ ] This issue is only present on Devnet and cannot be reproduced on the alpha-sepolia testnet (check the box if true). 16 | 17 | **Steps to reproduce the behavior** 18 | 19 | 1. Start Devnet with ... 20 | 2. ... 21 | ... 22 | 23 | **Devnet version** 24 | 25 | - I am using Devnet version: 26 | - I have found that this issue is not present in Devnet version: 27 | 28 | **System specifications** 29 | 30 | - OS: 31 | -------------------------------------------------------------------------------- /.github/actions/load-config/action.yml: -------------------------------------------------------------------------------- 1 | name: 'Load Common Configuration' 2 | description: 'Loads common configuration values and sets them as outputs' 3 | 4 | outputs: 5 | rust_stable_version: 6 | description: 'Stable Rust version to use' 7 | value: '1.86.0' 8 | rust_nightly_version: 9 | description: 'Nightly Rust version to use' 10 | value: 'nightly-2025-02-20' 11 | docker_registry: 12 | description: 'Docker registry to use' 13 | value: 'docker.io' 14 | docker_namespace: 15 | description: 'Docker namespace to use' 16 | value: 'shardlabs' 17 | image_name: 18 | description: 'Docker image name to use' 19 | value: 'starknet-devnet-rs' 20 | 21 | runs: 22 | using: 'composite' 23 | steps: 24 | - run: echo "Configuration loaded" 25 | shell: bash -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Usage related changes 2 | 3 | 4 | 5 | ## Development related changes 6 | 7 | 8 | 9 | ## Checklist: 10 | 11 | 12 | 13 | - [ ] Checked out the [contribution guidelines](https://github.com/0xSpaceShard/starknet-devnet/blob/main/.github/CONTRIBUTING.md) 14 | - [ ] Applied formatting - `./scripts/format.sh` 15 | - [ ] No linter errors - `./scripts/clippy_check.sh` 16 | - [ ] No unused dependencies - `./scripts/check_unused_deps.sh` 17 | - [ ] No spelling errors - `./scripts/check_spelling.sh` 18 | - [ ] Performed code self-review 19 | - [ ] Rebased to the latest commit of the target branch (or merged it into my branch) 20 | - Once you make the PR reviewable, please avoid force-pushing 21 | - [ ] Updated the docs if needed - `./website/README.md` 22 | - [ ] Linked the [issues](https://github.com/0xSpaceShard/starknet-devnet/issues) resolvable by this PR - [linking info](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) 23 | - [ ] Updated the tests if needed; all passing - [execution info](https://github.com/0xSpaceShard/starknet-devnet/blob/main/.github/CONTRIBUTING.md#test-execution) 24 | -------------------------------------------------------------------------------- /.github/release.yml: -------------------------------------------------------------------------------- 1 | # .github/release.yml 2 | 3 | changelog: 4 | categories: 5 | - title: Breaking Changes 🛑 6 | labels: 7 | - breaking-change 8 | - title: New Features 🚀 9 | labels: 10 | - enhancement 11 | - feature 12 | - title: Bug Fixes 🐛 13 | labels: 14 | - bug 15 | - fix 16 | - title: Documentation 📚 17 | labels: 18 | - documentation 19 | - title: Dependencies & Maintenance 🔧 20 | labels: 21 | - dependencies 22 | - maintenance 23 | - title: Other Changes 24 | labels: 25 | - "*" -------------------------------------------------------------------------------- /.github/workflow-config.yml: -------------------------------------------------------------------------------- 1 | # This file contains reusable configurations for GitHub Actions workflows 2 | # It defines common environments, permissions, concurrency settings, etc. 3 | 4 | name: Common Config 5 | 6 | # Environment variables used across workflows 7 | env: 8 | RUST_STABLE_VERSION: 1.86.0 9 | RUST_NIGHTLY_VERSION: nightly-2025-02-20 10 | DOCKER_REGISTRY: docker.io 11 | DOCKER_NAMESPACE: 0xspaceshard 12 | IMAGE_NAME: starknet-devnet 13 | 14 | # Default permissions required for workflows 15 | permissions: 16 | contents: read 17 | 18 | # Define concurrency groups to avoid running redundant workflows 19 | concurrency: 20 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} 21 | cancel-in-progress: true -------------------------------------------------------------------------------- /.github/workflows/build-and-test.yml: -------------------------------------------------------------------------------- 1 | name: Build and Test 2 | 3 | on: 4 | push: 5 | workflow_dispatch: 6 | 7 | permissions: 8 | contents: read 9 | 10 | concurrency: 11 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} 12 | cancel-in-progress: true 13 | 14 | jobs: 15 | build-and-test: 16 | name: Build and Test 17 | runs-on: self-hosted 18 | steps: 19 | - name: Checkout repository 20 | uses: actions/checkout@v4 21 | 22 | - name: Load common configuration 23 | id: config 24 | uses: ./.github/actions/load-config 25 | 26 | - name: Set up Rust stable 27 | uses: dtolnay/rust-toolchain@master 28 | with: 29 | toolchain: ${{ steps.config.outputs.rust_stable_version }} 30 | components: clippy, rustfmt 31 | 32 | - name: Set up Rust nightly 33 | uses: dtolnay/rust-toolchain@master 34 | with: 35 | toolchain: ${{ steps.config.outputs.rust_nightly_version }} 36 | components: rustfmt 37 | 38 | - name: Install Foundry 39 | uses: foundry-rs/foundry-toolchain@v1.1.0 40 | with: 41 | version: nightly-5b7e4cb3c882b28f3c32ba580de27ce7381f415a 42 | 43 | - name: Verify lockfile 44 | run: cargo update -w --locked 45 | 46 | - name: Run cargo check 47 | run: cargo check --workspace --all-targets 48 | 49 | - name: Run clippy check 50 | run: | 51 | cargo clippy --workspace -- -Dwarnings 52 | cargo clippy --workspace --all-features -- -Dwarnings 53 | cargo clippy --workspace --tests -- -Dwarnings 54 | 55 | - name: Check code formatting 56 | run: | 57 | cargo +${{ steps.config.outputs.rust_nightly_version }} fmt --all --check 58 | cd website && npm ci && npm run format-check 59 | 60 | - name: Check spelling 61 | run: | 62 | cargo +${{ steps.config.outputs.rust_nightly_version }} install typos-cli --version 1.36.2 --locked 63 | typos && echo "No spelling errors!" 64 | 65 | - name: Build in release mode 66 | run: cargo build --release 67 | 68 | - name: Run tests 69 | run: RUST_BACKTRACE=full cargo test --no-fail-fast -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | debug/ 4 | /target/ 5 | 6 | # These are backup files generated by rustfmt 7 | **/*.rs.bk 8 | 9 | # MSVC Windows builds of rustc generate these, which store debugging information 10 | *.pdb 11 | 12 | # DS_Store MacOS file 13 | **/.DS_Store 14 | 15 | # IntelliJ settings 16 | .idea/ 17 | 18 | # VSCode settings 19 | .vscode/settings.json 20 | 21 | # Artifacts of spec testing 22 | failed_request.json 23 | failed_response.json 24 | failed_spec.json 25 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "contracts/l1-l2-messaging/solidity/lib/forge-std"] 2 | path = contracts/l1-l2-messaging/solidity/lib/forge-std 3 | url = https://github.com/foundry-rs/forge-std 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 SpaceShard 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /RELEASE.md: -------------------------------------------------------------------------------- 1 | # Version release 2 | 3 | To release a new Devnet version, follow these steps: 4 | 5 | 1. Increment the semver in Cargo.toml of those Devnet crates that have changed. Use `scripts/check_crate_changes.sh` for this. 6 | 7 | 2. Add a documentation entry for the incoming version (without the v- prefix) by running: 8 | 9 | ``` 10 | $ npm --prefix website run docusaurus docs:version 11 | ``` 12 | 13 | - Feel free to delete documentation entries of old release candidates. E.g. if releasing 0.5.0, delete all files containing in them or in their names references to 0.5.0-rc.2. Or if releasing 0.5.0-rc.2, delete the entry of 0.5.0-rc.1. 14 | 15 | 3. Create a PR styled after [this one](https://github.com/0xSpaceShard/starknet-devnet-rs/pull/473). 16 | 17 | 4. The publishing of crates, Docker images and documentation website is done automatically in the CI when the PR is merged into the main branch. 18 | 19 | - This relies on the `CRATES_IO_API_KEY` environment variable to contain a crates.io token with write access. 20 | - If you are creating a pre-release, possibly from a side branch of a PR, CircleCI sets an environment variable indicating that the workflow is a part of a pull request. The documentation framework (Docusaurus) recognizes this and prevents the documentation from being deployed. Either deploy from your local machine (`npm run deploy`), or try manipulating the env var. 21 | 22 | 5. When the CI workflow is done, create a git tag of the form `v`, push it and create a GitHub release with notes describing changes since the last release. 23 | 24 | 6. Attach the [binary artifacts built in CI](https://circleci.com/docs/artifacts/#artifacts-overview) to the release. Use `scripts/fetch_ci_binaries.py` to fetch all artifacts of a CI workflow. 25 | 26 | 7. Adapt [starknet-devnet-js](https://github.com/0xSpaceShard/starknet-devnet-js) to the newly released Devnet. Check out one of the [old adaptation PRs](https://github.com/0xSpaceShard/starknet-devnet-js/pulls?q=is%3Apr+is%3Aclosed) for reference. 27 | 28 | 8. Update `starknet-foundry` to use the latest Devnet, if possible. Use [this PR](https://github.com/foundry-rs/starknet-foundry/pull/3434) for reference. 29 | -------------------------------------------------------------------------------- /_typos.toml: -------------------------------------------------------------------------------- 1 | [files] 2 | extend-exclude = [ 3 | # exclude submodule 4 | "contracts/l1-l2-messaging/solidity", 5 | "crates/**/test_data" 6 | ] 7 | ignore-vcs = true 8 | 9 | [default] 10 | # Don't correct hexadecimal string 11 | extend-ignore-re = [ 12 | # prevent false positives (e.g. "ede" being reported as needing to be "edge") 13 | "0x[0-9a-fA-F]+", 14 | ] 15 | -------------------------------------------------------------------------------- /contracts/generate_artifacts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu 3 | 4 | # Bash script to generate the artifacts required by Devnet to compile. 5 | mkdir -p l1-l2-artifacts 6 | mkdir -p ../crates/starknet-devnet-core/contracts/l1-l2-artifacts 7 | 8 | # L1-L2 messaging: 9 | ## SOLIDITY 10 | forge build --root ./l1-l2-messaging/solidity 11 | cp ./l1-l2-messaging/solidity/out/L1L2.sol/L1L2Example.json ./l1-l2-artifacts/ 12 | cp ./l1-l2-messaging/solidity/out/MockStarknetMessaging.sol/MockStarknetMessaging.json ../crates/starknet-devnet-core/contracts/l1-l2-artifacts/ 13 | 14 | ## CAIRO 15 | scarb --manifest-path ./l1-l2-messaging/cairo/Scarb.toml build 16 | cp ./l1-l2-messaging/cairo/target/dev/cairo_l1_l2.contract_class.json ./l1-l2-artifacts/cairo_l1_l2.contract_class.sierra 17 | cp ./l1-l2-messaging/cairo/target/dev/cairo_l1_l2_lib.contract_class.json ./l1-l2-artifacts/cairo_l1_l2_lib.contract_class.sierra 18 | -------------------------------------------------------------------------------- /contracts/l1-l2-messaging/.env: -------------------------------------------------------------------------------- 1 | ## Starknet 2 | export STARKNET_RPC=http://127.0.0.1:5050 3 | export STARKNET_ACCOUNT=./cairo/account-0-42.json 4 | export STARKNET_PRIVATE_KEY=0xb137668388dbe9acdfa3bc734cc2c469 5 | 6 | ## Ethereum 7 | export ETH_RPC_URL=http://127.0.0.1:8545 8 | export ETHERSCAN_API_KEY=0x1 9 | # Account related variables (EOA account). 10 | export ACCOUNT_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 11 | export ACCOUNT_ADDRESS=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 12 | # Starknet messaging. 13 | export STARKNET_MESSAGING_ADDRESS=0x5fbdb2315678afecb367f032d93f642f64180aa3 14 | -------------------------------------------------------------------------------- /contracts/l1-l2-messaging/.tool-versions: -------------------------------------------------------------------------------- 1 | scarb 2.3.1 2 | -------------------------------------------------------------------------------- /contracts/l1-l2-messaging/cairo/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | -------------------------------------------------------------------------------- /contracts/l1-l2-messaging/cairo/.tool-versions: -------------------------------------------------------------------------------- 1 | scarb 2.3.1 2 | -------------------------------------------------------------------------------- /contracts/l1-l2-messaging/cairo/README.md: -------------------------------------------------------------------------------- 1 | # Cairo Contracts 2 | 3 | This folder contains a Scarb package to compile and deploy Cairo 1 4 | contracts on Devnet for development purposes. 5 | 6 | ## Work with Scarb 7 | 8 | Start by installing Scarb (with `asdf` **highly** recommended) [from the tutorial](https://docs.swmansion.com/scarb/). 9 | Ensure you've at least version `2.3.1` installed. 10 | 11 | ### Build 12 | 13 | To build contracts, use: 14 | ```bash 15 | scarb build 16 | ``` 17 | 18 | The contracts artifacts are generated into `target/dev` folder. 19 | Two files can be found there: 20 | * The Sierra class file: `package_contract.contract_class.json` 21 | * The compiled CASM file: `package_contract.compiled_contract_class.json` 22 | 23 | ### Interact with Devnet 24 | 25 | To interact with Devnet, [Starkli](https://book.starkli.rs/) is the easiest CLI tool to use. 26 | To work with Starkli, you need two files: 27 | * The keystore file with the private key being encrypted there. This file can also be replaced by the private 28 | key in plain text, which is totally fine for testing. 29 | * The account file with the account definition and address. 30 | -------------------------------------------------------------------------------- /contracts/l1-l2-messaging/cairo/Scarb.lock: -------------------------------------------------------------------------------- 1 | # Code generated by scarb DO NOT EDIT. 2 | version = 1 3 | 4 | [[package]] 5 | name = "cairo" 6 | version = "0.1.0" 7 | -------------------------------------------------------------------------------- /contracts/l1-l2-messaging/cairo/Scarb.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "cairo" 3 | version = "0.1.0" 4 | 5 | # See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html 6 | 7 | [dependencies] 8 | starknet = ">=2.3.1" 9 | 10 | [[target.starknet-contract]] 11 | sierra = true 12 | casm = true 13 | -------------------------------------------------------------------------------- /contracts/l1-l2-messaging/cairo/account-0-42.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "variant": { 4 | "type": "open_zeppelin", 5 | "version": 1, 6 | "public_key": "0x5a5e37c60e77a0318643b111f88413a76af6233c891a0cfb2804106372006d4" 7 | }, 8 | "deployment": { 9 | "status": "deployed", 10 | "class_hash": "0x4d07e40e93398ed3c76981e72dd1fd22557a78ce36c0515f679e27f0bb5bc5f", 11 | "address": "0x34ba56f92265f0868c57d3fe72ecab144fc96f97954bbbc4252cef8e8a979ba" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /contracts/l1-l2-messaging/cairo/src/l1_l2_lib.cairo: -------------------------------------------------------------------------------- 1 | //! L1 L2 messaging contract, aims at being use as a library. 2 | 3 | #[starknet::contract] 4 | mod l1_l2_lib { 5 | const MESSAGE_WITHDRAW: felt252 = 0; 6 | 7 | #[storage] 8 | struct Storage {} 9 | 10 | #[external(v0)] 11 | fn send_withdraw_message( 12 | ref self: ContractState, user: felt252, amount: felt252, l1_address: felt252 13 | ) { 14 | let payload = array![MESSAGE_WITHDRAW, user, amount,]; 15 | 16 | starknet::send_message_to_l1_syscall(l1_address, payload.span()).unwrap(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /contracts/l1-l2-messaging/cairo/src/lib.cairo: -------------------------------------------------------------------------------- 1 | mod l1_l2; 2 | mod l1_l2_lib; 3 | -------------------------------------------------------------------------------- /contracts/l1-l2-messaging/solidity/.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | on: workflow_dispatch 4 | 5 | env: 6 | FOUNDRY_PROFILE: ci 7 | 8 | jobs: 9 | check: 10 | strategy: 11 | fail-fast: true 12 | 13 | name: Foundry project 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v3 17 | with: 18 | submodules: recursive 19 | 20 | - name: Install Foundry 21 | uses: foundry-rs/foundry-toolchain@v1 22 | with: 23 | version: nightly 24 | 25 | - name: Run Forge build 26 | run: | 27 | forge --version 28 | forge build --sizes 29 | id: build 30 | 31 | - name: Run Forge tests 32 | run: | 33 | forge test -vvv 34 | id: test 35 | -------------------------------------------------------------------------------- /contracts/l1-l2-messaging/solidity/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiler files 2 | cache/ 3 | out/ 4 | 5 | # Ignores development broadcast logs 6 | !/broadcast 7 | /broadcast/*/31337/ 8 | /broadcast/**/dry-run/ 9 | 10 | # Docs 11 | docs/ 12 | 13 | # Dotenv file 14 | .env 15 | -------------------------------------------------------------------------------- /contracts/l1-l2-messaging/solidity/README.md: -------------------------------------------------------------------------------- 1 | ## Foundry 2 | 3 | **Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.** 4 | 5 | Foundry consists of: 6 | 7 | - **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools). 8 | - **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data. 9 | - **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network. 10 | - **Chisel**: Fast, utilitarian, and verbose solidity REPL. 11 | 12 | ## Documentation 13 | 14 | https://book.getfoundry.sh/ 15 | 16 | ## Usage 17 | 18 | ### Build 19 | 20 | ```shell 21 | $ forge build 22 | ``` 23 | 24 | ### Test 25 | 26 | ```shell 27 | $ forge test 28 | ``` 29 | 30 | ### Format 31 | 32 | ```shell 33 | $ forge fmt 34 | ``` 35 | 36 | ### Gas Snapshots 37 | 38 | ```shell 39 | $ forge snapshot 40 | ``` 41 | 42 | ### Anvil 43 | 44 | ```shell 45 | $ anvil 46 | ``` 47 | 48 | ### Deploy 49 | 50 | ```shell 51 | $ forge script script/Counter.s.sol:CounterScript --rpc-url --private-key 52 | ``` 53 | 54 | ### Cast 55 | 56 | ```shell 57 | $ cast 58 | ``` 59 | 60 | ### Help 61 | 62 | ```shell 63 | $ forge --help 64 | $ anvil --help 65 | $ cast --help 66 | ``` 67 | -------------------------------------------------------------------------------- /contracts/l1-l2-messaging/solidity/foundry.toml: -------------------------------------------------------------------------------- 1 | [profile.default] 2 | src = "src" 3 | out = "out" 4 | libs = ["lib"] 5 | 6 | # See more config options https://github.com/foundry-rs/foundry/tree/master/crates/config 7 | -------------------------------------------------------------------------------- /contracts/l1-l2-messaging/solidity/script/L1L2.s.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.6.12; 3 | 4 | import "forge-std/Script.sol"; 5 | import "forge-std/console.sol"; 6 | 7 | import "src/MockStarknetMessaging.sol"; 8 | import "src/L1L2.sol"; 9 | 10 | contract Deploy is Script { 11 | 12 | function setUp() public { 13 | } 14 | 15 | function run() public { 16 | // .env file is automatically sourced by forge. 17 | uint256 deployerPrivateKey = vm.envUint("ACCOUNT_PRIVATE_KEY"); 18 | MockStarknetMessaging snMessaging = MockStarknetMessaging(vm.envAddress("STARKNET_MESSAGING_ADDRESS")); 19 | 20 | vm.startBroadcast(deployerPrivateKey); 21 | 22 | address addr = address(new L1L2Example(snMessaging)); 23 | 24 | console.log(addr); 25 | 26 | vm.stopBroadcast(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /contracts/l1-l2-messaging/solidity/src/IStarknetMessaging.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0. 2 | pragma solidity ^0.6.12; 3 | 4 | import "./IStarknetMessagingEvents.sol"; 5 | 6 | interface IStarknetMessaging is IStarknetMessagingEvents { 7 | /** 8 | Returns the max fee (in Wei) that StarkNet will accept per single message. 9 | */ 10 | function getMaxL1MsgFee() external pure returns (uint256); 11 | 12 | /** 13 | Sends a message to an L2 contract. 14 | This function is payable, the paid amount is the message fee. 15 | 16 | Returns the hash of the message and the nonce of the message. 17 | */ 18 | function sendMessageToL2( 19 | uint256 toAddress, 20 | uint256 selector, 21 | uint256[] calldata payload 22 | ) external payable returns (bytes32, uint256); 23 | 24 | /** 25 | Consumes a message that was sent from an L2 contract. 26 | 27 | Returns the hash of the message. 28 | */ 29 | function consumeMessageFromL2(uint256 fromAddress, uint256[] calldata payload) 30 | external 31 | returns (bytes32); 32 | 33 | /** 34 | Starts the cancellation of an L1 to L2 message. 35 | A message can be canceled messageCancellationDelay() seconds after this function is called. 36 | 37 | Note: This function may only be called for a message that is currently pending and the caller 38 | must be the sender of the that message. 39 | */ 40 | function startL1ToL2MessageCancellation( 41 | uint256 toAddress, 42 | uint256 selector, 43 | uint256[] calldata payload, 44 | uint256 nonce 45 | ) external returns (bytes32); 46 | 47 | /** 48 | Cancels an L1 to L2 message, this function should be called at least 49 | messageCancellationDelay() seconds after the call to startL1ToL2MessageCancellation(). 50 | A message may only be cancelled by its sender. 51 | If the message is missing, the call will revert. 52 | 53 | Note that the message fee is not refunded. 54 | */ 55 | function cancelL1ToL2Message( 56 | uint256 toAddress, 57 | uint256 selector, 58 | uint256[] calldata payload, 59 | uint256 nonce 60 | ) external returns (bytes32); 61 | } 62 | -------------------------------------------------------------------------------- /contracts/l1-l2-messaging/solidity/src/IStarknetMessagingEvents.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0. 2 | pragma solidity ^0.6.12; 3 | 4 | interface IStarknetMessagingEvents { 5 | // This event needs to be compatible with the one defined in Output.sol. 6 | event LogMessageToL1(uint256 indexed fromAddress, address indexed toAddress, uint256[] payload); 7 | 8 | // An event that is raised when a message is sent from L1 to L2. 9 | event LogMessageToL2( 10 | address indexed fromAddress, 11 | uint256 indexed toAddress, 12 | uint256 indexed selector, 13 | uint256[] payload, 14 | uint256 nonce, 15 | uint256 fee 16 | ); 17 | 18 | // An event that is raised when a message from L2 to L1 is consumed. 19 | event ConsumedMessageToL1( 20 | uint256 indexed fromAddress, 21 | address indexed toAddress, 22 | uint256[] payload 23 | ); 24 | 25 | // An event that is raised when a message from L1 to L2 is consumed. 26 | event ConsumedMessageToL2( 27 | address indexed fromAddress, 28 | uint256 indexed toAddress, 29 | uint256 indexed selector, 30 | uint256[] payload, 31 | uint256 nonce 32 | ); 33 | 34 | // An event that is raised when a message from L1 to L2 Cancellation is started. 35 | event MessageToL2CancellationStarted( 36 | address indexed fromAddress, 37 | uint256 indexed toAddress, 38 | uint256 indexed selector, 39 | uint256[] payload, 40 | uint256 nonce 41 | ); 42 | 43 | // An event that is raised when a message from L1 to L2 is canceled. 44 | event MessageToL2Canceled( 45 | address indexed fromAddress, 46 | uint256 indexed toAddress, 47 | uint256 indexed selector, 48 | uint256[] payload, 49 | uint256 nonce 50 | ); 51 | } 52 | -------------------------------------------------------------------------------- /contracts/l1-l2-messaging/solidity/src/MockStarknetMessaging.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0. 2 | pragma solidity ^0.6.12; 3 | 4 | import "./StarknetMessaging.sol"; 5 | 6 | contract MockStarknetMessaging is StarknetMessaging { 7 | constructor(uint256 MessageCancellationDelay) public { 8 | messageCancellationDelay(MessageCancellationDelay); 9 | } 10 | 11 | /** 12 | Mocks a message from L2 to L1. 13 | */ 14 | function mockSendMessageFromL2( 15 | uint256 fromAddress, 16 | uint256 toAddress, 17 | uint256[] calldata payload 18 | ) external { 19 | bytes32 msgHash = keccak256( 20 | abi.encodePacked(fromAddress, toAddress, payload.length, payload) 21 | ); 22 | l2ToL1Messages()[msgHash] += 1; 23 | 24 | // Devnet-specific modification to trigger the event 25 | emit LogMessageToL1(fromAddress, address(toAddress), payload); 26 | } 27 | 28 | /** 29 | Mocks consumption of a message from L2 to L1. 30 | */ 31 | function mockConsumeMessageFromL2( 32 | uint256 fromAddress, 33 | uint256 toAddress, 34 | uint256[] calldata payload 35 | ) external { 36 | bytes32 msgHash = keccak256( 37 | abi.encodePacked(fromAddress, toAddress, payload.length, payload) 38 | ); 39 | 40 | require(l2ToL1Messages()[msgHash] > 0, "INVALID_MESSAGE_TO_CONSUME"); 41 | emit ConsumedMessageToL1(fromAddress, msg.sender, payload); 42 | l2ToL1Messages()[msgHash] -= 1; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /contracts/test_artifacts/cairo0/account_without_validations/account.cairo: -------------------------------------------------------------------------------- 1 | // A dummy account contract without any validations. 2 | 3 | %lang starknet 4 | 5 | from starkware.cairo.common.bool import TRUE 6 | from starkware.cairo.common.cairo_builtins import HashBuiltin 7 | from starkware.starknet.common.syscalls import ( 8 | call_contract, 9 | deploy, 10 | get_caller_address, 11 | get_contract_address, 12 | ) 13 | 14 | @event 15 | func ContractDeployed( 16 | address: felt, deployer: felt, classHash: felt, calldata_len: felt, calldata: felt*, salt: felt 17 | ) { 18 | } 19 | 20 | @external 21 | func __validate_declare__(class_hash: felt) { 22 | return (); 23 | } 24 | 25 | @external 26 | func __validate_deploy__(class_hash: felt, contract_address_salt: felt) { 27 | return (); 28 | } 29 | 30 | @external 31 | func __validate__(contract_address, selector: felt, calldata_len: felt, calldata: felt*) { 32 | return (); 33 | } 34 | 35 | @external 36 | @raw_output 37 | func __execute__{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}( 38 | contract_address, selector: felt, calldata_len: felt, calldata: felt* 39 | ) -> (retdata_size: felt, retdata: felt*) { 40 | let (retdata_size: felt, retdata: felt*) = call_contract( 41 | contract_address=contract_address, 42 | function_selector=selector, 43 | calldata_size=calldata_len, 44 | calldata=calldata, 45 | ); 46 | return (retdata_size=calldata_len, retdata=calldata); 47 | } 48 | 49 | @external 50 | func deploy_contract{syscall_ptr: felt*, range_check_ptr}( 51 | class_hash: felt, 52 | contract_address_salt: felt, 53 | constructor_calldata_len: felt, 54 | constructor_calldata: felt*, 55 | ) -> (contract_address: felt) { 56 | let (contract_address) = deploy( 57 | class_hash=class_hash, 58 | contract_address_salt=contract_address_salt, 59 | constructor_calldata_size=constructor_calldata_len, 60 | constructor_calldata=constructor_calldata, 61 | deploy_from_zero=TRUE, 62 | ); 63 | ContractDeployed.emit( 64 | address=contract_address, 65 | deployer=0, 66 | classHash=class_hash, 67 | calldata_len=constructor_calldata_len, 68 | calldata=constructor_calldata, 69 | salt=contract_address_salt, 70 | ); 71 | return (contract_address=0); 72 | } 73 | -------------------------------------------------------------------------------- /contracts/test_artifacts/cairo1/block_reader/block_reader.cairo: -------------------------------------------------------------------------------- 1 | #[starknet::interface] 2 | trait IBlockReader { 3 | fn get_timestamp(self: @TContractState) -> u64; 4 | fn get_storage_timestamp(self: @TContractState) -> u64; 5 | fn set_current_timestamp(ref self: TContractState); 6 | fn set_storage_timestamp(ref self: TContractState, timestamp: u64); 7 | fn get_block_number(self: @TContractState) -> u64; 8 | } 9 | 10 | #[starknet::contract] 11 | mod BlockReaderContract { 12 | use starknet::{get_block_timestamp, get_block_number}; 13 | 14 | #[storage] 15 | struct Storage { 16 | timestamp: u64 17 | } 18 | 19 | #[constructor] 20 | fn constructor(ref self: ContractState) { 21 | self.timestamp.write(get_block_timestamp()); 22 | } 23 | 24 | #[abi(embed_v0)] 25 | impl BlockReader of super::IBlockReader { 26 | fn get_timestamp(self: @ContractState) -> u64 { 27 | get_block_timestamp() 28 | } 29 | 30 | fn get_storage_timestamp(self: @ContractState) -> u64 { 31 | self.timestamp.read() 32 | } 33 | 34 | fn set_current_timestamp(ref self: ContractState) { 35 | self.timestamp.write(get_block_timestamp()); 36 | } 37 | 38 | fn set_storage_timestamp(ref self: ContractState, timestamp: u64) { 39 | self.timestamp.write(timestamp); 40 | } 41 | 42 | fn get_block_number(self: @ContractState) -> u64 { 43 | get_block_number() 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /contracts/test_artifacts/cairo1/block_reader/compilation_info.txt: -------------------------------------------------------------------------------- 1 | Compiled using cairo 2.5.1 -------------------------------------------------------------------------------- /contracts/test_artifacts/cairo1/events/events.cairo: -------------------------------------------------------------------------------- 1 | use core::debug::PrintTrait; 2 | use core::traits::Into; 3 | use core::result::ResultTrait; 4 | use starknet::syscalls::{deploy_syscall, get_block_hash_syscall}; 5 | use traits::TryInto; 6 | use option::OptionTrait; 7 | use starknet::SyscallResultTrait; 8 | use starknet::class_hash::Felt252TryIntoClassHash; 9 | use array::ArrayTrait; 10 | use array::SpanTrait; 11 | 12 | #[starknet::interface] 13 | trait IContractWithEvent { 14 | fn emit_event(ref self: T, incremental: bool); 15 | } 16 | 17 | #[starknet::contract] 18 | mod contract_with_event { 19 | use traits::Into; 20 | use starknet::info::get_contract_address; 21 | #[storage] 22 | struct Storage { 23 | value: u128, 24 | } 25 | 26 | #[derive(Copy, Drop, PartialEq, starknet::Event)] 27 | struct IncrementalEvent { 28 | value: u128, 29 | } 30 | 31 | #[derive(Copy, Drop, PartialEq, starknet::Event)] 32 | struct StaticEvent {} 33 | 34 | #[event] 35 | #[derive(Copy, Drop, PartialEq, starknet::Event)] 36 | enum Event { 37 | IncrementalEvent: IncrementalEvent, 38 | StaticEvent: StaticEvent, 39 | } 40 | 41 | #[constructor] 42 | fn constructor(ref self: ContractState) { 43 | self.value.write(0); 44 | } 45 | 46 | #[external(v0)] 47 | fn emit_event(ref self: ContractState, incremental: bool) { 48 | if incremental { 49 | self.emit(Event::IncrementalEvent(IncrementalEvent { value: self.value.read() })); 50 | self.value.write(self.value.read() + 1); 51 | } else { 52 | self.emit(Event::StaticEvent(StaticEvent {})); 53 | } 54 | } 55 | } 56 | 57 | use contract_with_event::{Event, IncrementalEvent, StaticEvent}; -------------------------------------------------------------------------------- /contracts/test_artifacts/cairo1/invalid_account/compilation_info.txt: -------------------------------------------------------------------------------- 1 | Compiled using cairo 2.4.0 -------------------------------------------------------------------------------- /contracts/test_artifacts/cairo1/panicking_contract/compilation_info.txt: -------------------------------------------------------------------------------- 1 | Compiled using cairo 2.8.0 -------------------------------------------------------------------------------- /contracts/test_artifacts/cairo1/panicking_contract/panicking_contract.cairo: -------------------------------------------------------------------------------- 1 | use core::starknet::ContractAddress; 2 | 3 | #[starknet::interface] 4 | trait IPanickingContract { 5 | fn create_panic(self: @TContractState, panic_reason: felt252); 6 | fn create_panic_in_another_contract(self: @TContractState, address: ContractAddress, panic_reason: felt252); 7 | } 8 | 9 | #[starknet::contract] 10 | mod PanickingContract { 11 | use core::starknet::{ContractAddress, call_contract_syscall}; 12 | 13 | #[storage] 14 | struct Storage {} 15 | 16 | #[abi(embed_v0)] 17 | impl PanickingContract of super::IPanickingContract { 18 | fn create_panic(self: @ContractState, panic_reason: felt252) { 19 | panic_with_felt252(panic_reason); 20 | } 21 | 22 | fn create_panic_in_another_contract(self: @ContractState, address: ContractAddress, panic_reason: felt252) { 23 | call_contract_syscall( 24 | address, 25 | selector!("create_panic"), 26 | array![panic_reason].span() 27 | ).unwrap(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /contracts/test_artifacts/cairo1/simple_contract/compilation_info.txt: -------------------------------------------------------------------------------- 1 | Compiled with cairo version tag/v1.1.0 2 | -------------------------------------------------------------------------------- /contracts/test_artifacts/cairo1/simple_contract/contract.cairo: -------------------------------------------------------------------------------- 1 | #[contract] 2 | mod Contract { 3 | struct Storage { 4 | balance: felt252, 5 | } 6 | 7 | #[constructor] 8 | fn constructor(initial_balance: felt252) { 9 | balance::write(initial_balance); 10 | } 11 | 12 | #[external] 13 | fn increase_balance(amount1: felt252, amount2: felt252) { 14 | balance::write(balance::read() + amount1 + amount2); 15 | } 16 | 17 | #[view] 18 | fn get_balance() -> felt252 { 19 | balance::read() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /contracts/test_artifacts/cairo1/timestamp_asserter/Scarb.lock: -------------------------------------------------------------------------------- 1 | # Code generated by scarb DO NOT EDIT. 2 | version = 1 3 | 4 | [[package]] 5 | name = "cairo" 6 | version = "0.1.0" 7 | -------------------------------------------------------------------------------- /contracts/test_artifacts/cairo1/timestamp_asserter/Scarb.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "cairo" 3 | version = "0.1.0" 4 | edition = "2024_07" 5 | 6 | # See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html 7 | 8 | [dependencies] 9 | starknet = ">=2.9.2" 10 | 11 | [[target.starknet-contract]] 12 | sierra = true 13 | casm = false 14 | -------------------------------------------------------------------------------- /contracts/test_artifacts/cairo1/timestamp_asserter/src/lib.cairo: -------------------------------------------------------------------------------- 1 | mod timestamp_asserter; 2 | -------------------------------------------------------------------------------- /contracts/test_artifacts/cairo1/timestamp_asserter/src/timestamp_asserter.cairo: -------------------------------------------------------------------------------- 1 | #[starknet::contract] 2 | pub mod TimestampAsserter { 3 | use core::starknet::storage::{StoragePointerReadAccess, StoragePointerWriteAccess}; 4 | use core::starknet::get_execution_info; 5 | 6 | 7 | #[constructor] 8 | fn constructor(ref self: ContractState, lock_interval: u64) { 9 | let current_time: u64 = get_execution_info().block_info.block_timestamp; 10 | self.deployment_time.write(current_time); 11 | self.lock_interval.write(lock_interval); 12 | } 13 | 14 | #[storage] 15 | pub struct Storage { 16 | deployment_time: u64, 17 | lock_interval: u64, 18 | } 19 | 20 | #[external(v0)] 21 | pub fn check_time(ref self: ContractState) { 22 | let current_time: u64 = get_execution_info().block_info.block_timestamp; 23 | let unlock_time: u64 = self.deployment_time.read() + self.lock_interval.read(); 24 | assert(current_time >= unlock_time, 'Wait a bit more'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /contracts/test_artifacts/cairo1/timestamp_asserter/target/CACHEDIR.TAG: -------------------------------------------------------------------------------- 1 | Signature: 8a477f597d28d172789f06886806bc55 2 | # This file is a cache directory tag created by scarb. 3 | # For information about cache directory tags see https://bford.info/cachedir/ 4 | -------------------------------------------------------------------------------- /contracts/test_artifacts/cairo1/timestamp_asserter/target/dev/cairo.starknet_artifacts.json: -------------------------------------------------------------------------------- 1 | {"version":1,"contracts":[{"id":"b9jocr0sq8ide","package_name":"cairo","contract_name":"TimestampAsserter","module_path":"cairo::timestamp_asserter::TimestampAsserter","artifacts":{"sierra":"cairo_TimestampAsserter.contract_class.json","casm":null}}]} -------------------------------------------------------------------------------- /contracts/test_artifacts/cairo1/too_big/compilation_info.txt: -------------------------------------------------------------------------------- 1 | Compiled with: 2 | scarb 2.9.2 (5070ff374 2024-12-11) 3 | cairo: 2.9.2 (https://crates.io/crates/cairo-lang-compiler/2.9.2) 4 | sierra: 1.6.0 5 | 6 | Intercepted declaration, logged; this exceeds bytecode size, but not the serialized class size 7 | -------------------------------------------------------------------------------- /contracts/test_artifacts/cairo1/too_big/generate_contract.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | if [ $# -ne 1 ]; then 6 | echo >&2 "Error! Usage: $0 " 7 | exit 1 8 | fi 9 | 10 | N="$1" 11 | 12 | echo '#[starknet::contract]' 13 | echo 'pub mod Dummy {' 14 | echo ' use core::starknet::storage::{StoragePointerReadAccess, StoragePointerWriteAccess};' 15 | echo '' 16 | echo ' #[storage]' 17 | echo ' pub struct Storage {' 18 | 19 | for i in $(seq 1 $N); do 20 | echo " balance_$i: felt252," 21 | done 22 | 23 | echo ' }' 24 | echo '' 25 | 26 | for i in $(seq 1 $N); do 27 | echo ' #[external(v0)]' 28 | echo " pub fn increment_balance_$i(ref self: ContractState) {" 29 | echo " self.balance_$i.write(self.balance_$i.read() + 1)" 30 | echo ' }' 31 | echo '' 32 | echo ' #[external(v0)]' 33 | echo " pub fn get_balance_$i(self: @ContractState) -> felt252 {" 34 | echo " self.balance_$i.read()" 35 | echo ' }' 36 | echo '' 37 | done 38 | 39 | echo '}' 40 | -------------------------------------------------------------------------------- /contracts/test_artifacts/cairo1/version_asserter/compilation_info.txt: -------------------------------------------------------------------------------- 1 | Compiled using cairo 2.2.0 -------------------------------------------------------------------------------- /contracts/test_artifacts/cairo1/version_asserter/version_asserter.cairo: -------------------------------------------------------------------------------- 1 | #[starknet::interface] 2 | trait IVersionAsserter { 3 | fn assert_version(self: @TContractState, expected_version: felt252); 4 | } 5 | 6 | #[starknet::contract] 7 | mod VersionAsserter { 8 | use starknet::syscalls::get_execution_info_syscall; 9 | use starknet::SyscallResultTrait; 10 | 11 | #[storage] 12 | struct Storage {} 13 | 14 | #[external(v0)] 15 | impl VersionAsserter of super::IVersionAsserter { 16 | fn assert_version(self: @ContractState, expected_version: felt252) { 17 | let exec_info = get_execution_info_syscall().unwrap_syscall().unbox(); 18 | let tx_info = exec_info.tx_info.unbox(); 19 | let version = tx_info.version; 20 | assert(version == expected_version, 'Version should be equal'); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /crates/starknet-devnet-core/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "starknet-devnet-core" 3 | version = "0.6.1" 4 | edition.workspace = true 5 | repository.workspace = true 6 | license-file.workspace = true 7 | description = "Starknet core logic for devnet" 8 | 9 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | blockifier = { workspace = true, features = ["transaction_serde"] } 16 | cairo-lang-starknet-classes = { workspace = true } 17 | clap = { workspace = true } 18 | ethers = { workspace = true } 19 | starknet_api = { workspace = true } 20 | thiserror = { workspace = true } 21 | reqwest = { workspace = true } 22 | serde = { workspace = true } 23 | serde_json = { workspace = true } 24 | starknet-types-core = { workspace = true } 25 | starknet-rs-signers = { workspace = true } 26 | starknet-rs-core = { workspace = true } 27 | starknet-types = { workspace = true } 28 | rand = { workspace = true } 29 | rand_mt = { workspace = true } 30 | tracing = { workspace = true } 31 | indexmap = { workspace = true } 32 | url = { workspace = true } 33 | nonzero_ext = { workspace = true } 34 | parking_lot = { workspace = true } 35 | tokio = { workspace = true } 36 | 37 | # necessary for installing reqwest in Docker 38 | openssl = { workspace = true } 39 | 40 | cargo-platform = { workspace = true } 41 | 42 | [dev-dependencies] 43 | hex = { workspace = true } 44 | starknet-types = { workspace = true, features = ["testing"] } 45 | 46 | [features] 47 | test_utils = [] 48 | 49 | [package.metadata.cargo-machete] 50 | ignored = [ 51 | # read note above 52 | "openssl", 53 | "cargo-platform", 54 | ] 55 | -------------------------------------------------------------------------------- /crates/starknet-devnet-core/contracts/accounts_artifacts/OpenZeppelin/1.0.0/Account.cairo/compilation_info.txt: -------------------------------------------------------------------------------- 1 | The exact version as in OpenZeppelin/cairo-contracts v1.0.0 2 | Compiled with scarb 2.9.4 3 | -------------------------------------------------------------------------------- /crates/starknet-devnet-core/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod account; 2 | mod blocks; 3 | pub mod constants; 4 | pub mod contract_class_choice; 5 | pub mod error; 6 | pub mod messaging; 7 | mod predeployed_accounts; 8 | pub mod starknet; 9 | mod state; 10 | mod system_contract; 11 | mod traits; 12 | mod transactions; 13 | pub use utils::random_number_generator; 14 | #[cfg(not(feature = "test_utils"))] 15 | mod utils; 16 | #[cfg(feature = "test_utils")] 17 | pub mod utils; 18 | 19 | pub use blocks::StarknetBlock; 20 | pub use cairo_lang_starknet_classes::casm_contract_class::CasmContractClass; 21 | -------------------------------------------------------------------------------- /crates/starknet-devnet-core/src/starknet/cheats.rs: -------------------------------------------------------------------------------- 1 | use std::collections::HashSet; 2 | 3 | use starknet_types::contract_address::ContractAddress; 4 | 5 | #[derive(Default, Clone)] 6 | pub(crate) struct Cheats { 7 | impersonated_accounts: HashSet, 8 | auto_impersonate: bool, 9 | } 10 | 11 | impl Cheats { 12 | pub(crate) fn impersonate_account(&mut self, account: ContractAddress) { 13 | self.impersonated_accounts.insert(account); 14 | } 15 | pub(crate) fn stop_impersonating_account(&mut self, account: &ContractAddress) { 16 | self.impersonated_accounts.remove(account); 17 | } 18 | pub(crate) fn is_impersonated(&self, account: &ContractAddress) -> bool { 19 | self.auto_impersonate || self.impersonated_accounts.contains(account) 20 | } 21 | pub(crate) fn set_auto_impersonate(&mut self, auto_impersonation: bool) { 22 | self.auto_impersonate = auto_impersonation; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /crates/starknet-devnet-server/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "starknet-devnet-server" 3 | version = "0.6.1" 4 | edition = "2021" 5 | repository.workspace = true 6 | license-file.workspace = true 7 | description = "Server component of devnet" 8 | 9 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | 16 | # axum 17 | axum = { workspace = true } 18 | http-body-util = { workspace = true } 19 | reqwest = { workspace = true } 20 | tower-http = { workspace = true } 21 | 22 | # tracing 23 | tracing = { workspace = true } 24 | 25 | # async 26 | futures = { workspace = true } 27 | async-trait = { workspace = true } 28 | tokio = { workspace = true, features = ["sync"] } 29 | 30 | # misc 31 | serde_json = { workspace = true } 32 | serde = { workspace = true } 33 | thiserror = { workspace = true } 34 | anyhow = { workspace = true } 35 | enum-helper-macros = { workspace = true } 36 | rand = { workspace = true } 37 | starknet-rs-core = { workspace = true } 38 | 39 | # forking 40 | starknet-rs-providers = { workspace = true } 41 | url = { workspace = true } 42 | 43 | # devnet 44 | starknet-core = { workspace = true } 45 | starknet-types = { workspace = true } 46 | 47 | [dev-dependencies] 48 | rand_chacha = { workspace = true } 49 | regex_generate = { workspace = true } 50 | serde_yaml = { workspace = true } 51 | starknet-types = { workspace = true, features = ["testing"] } 52 | 53 | [features] 54 | test_utils = [] 55 | -------------------------------------------------------------------------------- /crates/starknet-devnet-server/src/api/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod serde_helpers; 2 | 3 | use std::sync::Arc; 4 | 5 | use starknet_core::starknet::Starknet; 6 | use starknet_core::starknet::starknet_config::StarknetConfig; 7 | use tokio::sync::Mutex; 8 | use tracing::error; 9 | 10 | use crate::ServerConfig; 11 | use crate::dump_util::DumpEvent; 12 | use crate::subscribe::SocketCollection; 13 | 14 | mod account_helpers; 15 | mod endpoints; 16 | mod endpoints_ws; 17 | pub mod error; 18 | pub mod json_rpc_handler; 19 | pub mod models; 20 | pub(crate) mod origin_forwarder; 21 | #[cfg(test)] 22 | mod spec_reader; 23 | mod write_endpoints; 24 | 25 | pub use json_rpc_handler::JsonRpcHandler; 26 | pub const RPC_SPEC_VERSION: &str = "0.9.0"; 27 | 28 | use error::ApiError; 29 | 30 | /// Data that can be shared between threads with read write lock access 31 | /// Whatever needs to be accessed as information outside of Starknet could be added to this struct 32 | #[derive(Clone)] 33 | pub struct Api { 34 | pub config: Arc, 35 | pub server_config: Arc, 36 | pub starknet: Arc>, 37 | pub dumpable_events: Arc>>, 38 | pub sockets: Arc>, 39 | } 40 | 41 | impl Api { 42 | pub fn new(starknet: Starknet, server_config: ServerConfig) -> Self { 43 | Self { 44 | config: Arc::new(starknet.config.clone()), 45 | server_config: Arc::new(server_config), 46 | starknet: Arc::new(Mutex::new(starknet)), 47 | dumpable_events: Default::default(), 48 | sockets: Arc::new(Mutex::new(SocketCollection::default())), 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /crates/starknet-devnet-server/src/api/spec_reader/spec_schemas/all_of_schema.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | 3 | use super::{Common, Schema}; 4 | use crate::api::spec_reader::data_generator::{Acceptor, Visitor}; 5 | 6 | #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] 7 | #[serde(deny_unknown_fields, rename_all = "camelCase")] 8 | pub struct AllOf { 9 | #[serde(flatten)] 10 | pub common: Common, 11 | pub all_of: Vec, 12 | } 13 | 14 | impl Acceptor for AllOf { 15 | fn accept(&self, visitor: &impl Visitor) -> Result { 16 | visitor.do_for_all_of(self) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /crates/starknet-devnet-server/src/api/spec_reader/spec_schemas/array_primitive.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | 3 | use super::{Common, Schema}; 4 | use crate::api::spec_reader::data_generator::{Acceptor, Visitor}; 5 | 6 | #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] 7 | #[serde(deny_unknown_fields, rename_all = "camelCase")] 8 | pub struct ArrayPrimitive { 9 | #[serde(flatten)] 10 | pub common: Common, 11 | pub items: Box, 12 | pub min_items: Option, 13 | pub max_items: Option, 14 | } 15 | impl Acceptor for ArrayPrimitive { 16 | fn accept(&self, visitor: &impl Visitor) -> Result { 17 | visitor.do_for_array_primitive(self) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /crates/starknet-devnet-server/src/api/spec_reader/spec_schemas/boolean_primitive.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | 3 | use super::Common; 4 | use crate::api::spec_reader::data_generator::{Acceptor, Visitor}; 5 | 6 | #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] 7 | #[serde(deny_unknown_fields, rename_all = "camelCase")] 8 | pub struct BooleanPrimitive { 9 | #[serde(flatten)] 10 | pub common: Common, 11 | #[serde(skip)] 12 | pub generated_value: Option, 13 | } 14 | 15 | impl Acceptor for BooleanPrimitive { 16 | fn accept(&self, visitor: &impl Visitor) -> Result { 17 | visitor.do_for_boolean_primitive() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /crates/starknet-devnet-server/src/api/spec_reader/spec_schemas/integer_primitive.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | 3 | use super::Common; 4 | use crate::api::spec_reader::data_generator::{Acceptor, Visitor}; 5 | 6 | #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] 7 | #[serde(deny_unknown_fields, rename_all = "camelCase")] 8 | pub struct IntegerPrimitive { 9 | #[serde(flatten)] 10 | pub common: Common, 11 | #[serde(skip_serializing_if = "Option::is_none")] 12 | pub minimum: Option, 13 | #[serde(skip_serializing_if = "Option::is_none")] 14 | pub maximum: Option, 15 | } 16 | 17 | impl Acceptor for IntegerPrimitive { 18 | fn accept(&self, visitor: &impl Visitor) -> Result { 19 | visitor.do_for_integer_primitive(self) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /crates/starknet-devnet-server/src/api/spec_reader/spec_schemas/mod.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | use tuple_schema::Tuple; 3 | 4 | use self::all_of_schema::AllOf; 5 | use self::array_primitive::ArrayPrimitive; 6 | use self::boolean_primitive::BooleanPrimitive; 7 | use self::integer_primitive::IntegerPrimitive; 8 | use self::object_primitive::ObjectPrimitive; 9 | use self::one_of_schema::OneOf; 10 | use self::ref_schema::Reference; 11 | use self::string_primitive::StringPrimitive; 12 | 13 | pub mod all_of_schema; 14 | pub mod array_primitive; 15 | pub mod boolean_primitive; 16 | pub mod integer_primitive; 17 | pub mod object_primitive; 18 | pub mod one_of_schema; 19 | pub mod ref_schema; 20 | pub mod string_primitive; 21 | pub mod tuple_schema; 22 | 23 | #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] 24 | #[serde(deny_unknown_fields, rename_all = "camelCase")] 25 | pub struct Common { 26 | #[serde(skip_serializing_if = "Option::is_none")] 27 | pub title: Option, 28 | #[serde(skip_serializing_if = "Option::is_none")] 29 | pub description: Option, 30 | #[serde(skip_serializing_if = "Option::is_none")] 31 | pub additional_properties: Option, 32 | #[serde(rename = "type")] 33 | pub t: Option, 34 | #[serde(skip_serializing_if = "Option::is_none")] 35 | pub name: Option, 36 | pub not: Option, 37 | } 38 | 39 | #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] 40 | #[serde(tag = "type", rename_all = "lowercase")] 41 | pub enum Primitive { 42 | Array(ArrayPrimitive), 43 | Boolean(BooleanPrimitive), 44 | Integer(IntegerPrimitive), 45 | Number(IntegerPrimitive), 46 | Object(ObjectPrimitive), 47 | String(StringPrimitive), 48 | } 49 | 50 | #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] 51 | #[serde(untagged)] 52 | pub enum Schema { 53 | Ref(Reference), 54 | OneOf(OneOf), 55 | AllOf(AllOf), 56 | Primitive(Primitive), 57 | Tuple(Tuple), 58 | } 59 | -------------------------------------------------------------------------------- /crates/starknet-devnet-server/src/api/spec_reader/spec_schemas/object_primitive.rs: -------------------------------------------------------------------------------- 1 | use std::collections::HashMap; 2 | 3 | use serde::{Deserialize, Serialize}; 4 | 5 | use super::{Common, Schema}; 6 | use crate::api::spec_reader::data_generator::{Acceptor, Visitor}; 7 | 8 | #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] 9 | #[serde(deny_unknown_fields, rename_all = "camelCase")] 10 | pub struct ObjectPrimitive { 11 | #[serde(flatten)] 12 | pub common: Common, 13 | #[serde(skip_serializing_if = "Option::is_none")] 14 | pub summary: Option, 15 | pub properties: HashMap, 16 | #[serde(skip_serializing_if = "Option::is_none")] 17 | pub required: Option>, 18 | } 19 | 20 | impl Acceptor for ObjectPrimitive { 21 | fn accept(&self, visitor: &impl Visitor) -> Result { 22 | visitor.do_for_object_primitive(self) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /crates/starknet-devnet-server/src/api/spec_reader/spec_schemas/one_of_schema.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | 3 | use super::{Common, Schema}; 4 | use crate::api::spec_reader::data_generator::{Acceptor, Visitor}; 5 | 6 | #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] 7 | #[serde(deny_unknown_fields, rename_all = "camelCase")] 8 | pub struct OneOf { 9 | #[serde(flatten)] 10 | pub common: Common, 11 | pub one_of: Vec, 12 | } 13 | 14 | impl Acceptor for OneOf { 15 | fn accept(&self, visitor: &impl Visitor) -> Result { 16 | visitor.do_for_one_of(self) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /crates/starknet-devnet-server/src/api/spec_reader/spec_schemas/ref_schema.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | 3 | use super::Common; 4 | use crate::api::spec_reader::data_generator::{Acceptor, Visitor}; 5 | 6 | #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] 7 | #[serde(deny_unknown_fields, rename_all = "camelCase")] 8 | pub struct Reference { 9 | #[serde(rename = "$comment")] 10 | #[serde(skip_serializing_if = "Option::is_none")] 11 | pub comment: Option, 12 | #[serde(rename = "$ref")] 13 | pub ref_field: String, 14 | #[serde(flatten)] 15 | pub common: Common, 16 | } 17 | 18 | impl Acceptor for Reference { 19 | fn accept(&self, visitor: &impl Visitor) -> Result { 20 | visitor.do_for_ref(self) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /crates/starknet-devnet-server/src/api/spec_reader/spec_schemas/string_primitive.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | 3 | use super::Common; 4 | use crate::api::spec_reader::data_generator::{Acceptor, Visitor}; 5 | 6 | #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] 7 | #[serde(deny_unknown_fields, rename_all = "camelCase")] 8 | pub struct StringPrimitive { 9 | #[serde(flatten)] 10 | pub common: Common, 11 | #[serde(rename = "$comment")] 12 | #[serde(skip_serializing_if = "Option::is_none")] 13 | pub comment: Option, 14 | #[serde(skip_serializing_if = "Option::is_none")] 15 | #[serde(rename = "enum")] 16 | pub possible_enums: Option>, 17 | #[serde(skip_serializing_if = "Option::is_none")] 18 | pub pattern: Option, 19 | } 20 | 21 | impl Acceptor for StringPrimitive { 22 | fn accept(&self, visitor: &impl Visitor) -> Result { 23 | visitor.do_for_string_primitive(self) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /crates/starknet-devnet-server/src/api/spec_reader/spec_schemas/tuple_schema.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | 3 | use super::{Common, Schema}; 4 | use crate::api::spec_reader::data_generator::{Acceptor, Visitor}; 5 | 6 | #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] 7 | #[serde(deny_unknown_fields, rename_all = "camelCase")] 8 | pub struct Tuple { 9 | #[serde(flatten)] 10 | pub common: Common, 11 | #[serde(rename = "tuple")] 12 | pub variants: Vec, 13 | } 14 | 15 | impl Acceptor for Tuple { 16 | fn accept(&self, visitor: &impl Visitor) -> Result { 17 | visitor.do_for_tuple(self) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /crates/starknet-devnet-server/src/config.rs: -------------------------------------------------------------------------------- 1 | use std::net::IpAddr; 2 | 3 | use serde::Serialize; 4 | use starknet_core::starknet::starknet_config::StarknetConfig; 5 | 6 | #[derive(Debug, Clone, Serialize)] 7 | pub struct ServerConfig { 8 | pub host: IpAddr, 9 | pub port: u16, 10 | pub timeout: u16, 11 | #[serde(skip)] 12 | pub log_request: bool, 13 | #[serde(skip)] 14 | pub log_response: bool, 15 | pub restricted_methods: Option>, 16 | } 17 | 18 | #[derive(Serialize)] 19 | pub struct DevnetConfig { 20 | #[serde(flatten)] 21 | pub(crate) starknet_config: StarknetConfig, 22 | pub(crate) server_config: ServerConfig, 23 | } 24 | -------------------------------------------------------------------------------- /crates/starknet-devnet-server/src/error.rs: -------------------------------------------------------------------------------- 1 | #[derive(thiserror::Error, Debug)] 2 | pub enum Error { 3 | #[error(transparent)] 4 | AxumError(#[from] axum::Error), 5 | #[error("Failed conversion: {0}")] 6 | ConversionError(String), 7 | } 8 | 9 | pub type ServerResult = Result; 10 | -------------------------------------------------------------------------------- /crates/starknet-devnet-server/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod api; 2 | mod config; 3 | pub mod dump_util; 4 | pub mod error; 5 | pub mod restrictive_mode; 6 | pub mod rpc_core; 7 | /// handlers for axum server 8 | pub mod rpc_handler; 9 | pub mod server; 10 | pub mod subscribe; 11 | #[cfg(any(test, feature = "test_utils"))] 12 | pub mod test_utils; 13 | 14 | pub use config::ServerConfig; 15 | -------------------------------------------------------------------------------- /crates/starknet-devnet-server/src/restrictive_mode.rs: -------------------------------------------------------------------------------- 1 | pub static DEFAULT_RESTRICTED_JSON_RPC_METHODS: &[&str] = &[ 2 | "devnet_mint", 3 | "devnet_load", 4 | "devnet_restart", 5 | "devnet_createBlock", 6 | "devnet_abortBlocks", 7 | "devnet_impersonateAccount", 8 | "devnet_autoImpersonate", 9 | "devnet_getPredeployedAccounts", 10 | ]; 11 | 12 | pub(crate) fn is_json_rpc_method_restricted, U: AsRef>( 13 | json_rpc_method: T, 14 | restricted_methods: &[U], 15 | ) -> bool { 16 | restricted_methods.iter().any(|method| method.as_ref() == json_rpc_method.as_ref()) 17 | } 18 | 19 | #[cfg(test)] 20 | mod tests { 21 | use super::DEFAULT_RESTRICTED_JSON_RPC_METHODS; 22 | use crate::api::models::JsonRpcRequest; 23 | use crate::restrictive_mode::is_json_rpc_method_restricted; 24 | #[test] 25 | fn test_provided_method_is_restricted() { 26 | assert_is_restricted("devnet_mint", DEFAULT_RESTRICTED_JSON_RPC_METHODS); 27 | assert_is_restricted("devnet_impersonateAccount", DEFAULT_RESTRICTED_JSON_RPC_METHODS); 28 | assert_is_restricted( 29 | "devnet_mint", 30 | &["devnet_abortBlocks", "devnet_CreateBlocks", "devnet_mint"], 31 | ); 32 | } 33 | 34 | #[test] 35 | fn test_provided_method_is_not_restricted() { 36 | assert_is_not_restricted("devnet_getConfig", DEFAULT_RESTRICTED_JSON_RPC_METHODS); 37 | assert_is_not_restricted("devnet_getAccountBalance", DEFAULT_RESTRICTED_JSON_RPC_METHODS); 38 | } 39 | 40 | #[test] 41 | fn test_default_restricted_exist() { 42 | let json_rpc_methods = JsonRpcRequest::all_variants_serde_renames(); 43 | for method in DEFAULT_RESTRICTED_JSON_RPC_METHODS { 44 | assert!(json_rpc_methods.contains(&method.to_string())); 45 | } 46 | } 47 | 48 | fn assert_is_restricted(method: &str, restricted_methods: &[&str]) { 49 | assert!(is_json_rpc_method_restricted(method, restricted_methods)); 50 | } 51 | 52 | fn assert_is_not_restricted(method: &str, restricted_methods: &[&str]) { 53 | assert!(!is_json_rpc_method_restricted(method, restricted_methods)); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /crates/starknet-devnet-server/src/rpc_core/mod.rs: -------------------------------------------------------------------------------- 1 | /// JSON-RPC request bindings 2 | pub mod request; 3 | 4 | /// JSON-RPC response bindings 5 | pub mod response; 6 | 7 | /// JSON-RPC error bindings 8 | pub mod error; 9 | -------------------------------------------------------------------------------- /crates/starknet-devnet-server/src/test_utils.rs: -------------------------------------------------------------------------------- 1 | /// Returns Err if `text` does not contain `pattern` 2 | pub fn assert_contains(text: &str, pattern: &str) -> Result<(), anyhow::Error> { 3 | if !text.contains(pattern) { 4 | anyhow::bail!( 5 | "Failed content assertion! 6 | Pattern: '{pattern}' 7 | not present in 8 | Text: '{text}'" 9 | ); 10 | } 11 | 12 | Ok(()) 13 | } 14 | 15 | pub const EXPECTED_INVALID_BLOCK_ID_MSG: &str = "Invalid block ID. Expected object with key \ 16 | (block_hash or block_number) or tag \ 17 | ('pre_confirmed' or 'latest' or 'l1_accepted')."; 18 | -------------------------------------------------------------------------------- /crates/starknet-devnet-types/src/constants.rs: -------------------------------------------------------------------------------- 1 | use starknet_rs_core::types::Felt; 2 | 3 | // copied from starknet-rs, because it is not exposed as public type 4 | pub const QUERY_VERSION_OFFSET: Felt = 5 | Felt::from_raw([576460752142434320, 18446744073709551584, 17407, 18446744073700081665]); 6 | 7 | /// Cairo string for "l1_handler" 8 | pub(crate) const PREFIX_L1_HANDLER: Felt = Felt::from_raw([ 9 | 157895833347907735, 10 | 18446744073709551615, 11 | 18446744073708665300, 12 | 1365666230910873368, 13 | ]); 14 | -------------------------------------------------------------------------------- /crates/starknet-devnet-types/src/contract_storage_key.rs: -------------------------------------------------------------------------------- 1 | use std::fmt::Display; 2 | 3 | use super::contract_address::ContractAddress; 4 | use crate::patricia_key::StorageKey; 5 | 6 | #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)] 7 | pub struct ContractStorageKey(ContractAddress, StorageKey); 8 | 9 | impl ContractStorageKey { 10 | pub fn new(address: ContractAddress, storage_key: StorageKey) -> Self { 11 | Self(address, storage_key) 12 | } 13 | 14 | pub fn get_contract_address(&self) -> &ContractAddress { 15 | &self.0 16 | } 17 | 18 | pub fn get_storage_key(&self) -> &StorageKey { 19 | &self.1 20 | } 21 | } 22 | 23 | impl Display for ContractStorageKey { 24 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 25 | f.write_fmt(format_args!("({0:x}, {1:x})", self.0, self.1.0)) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /crates/starknet-devnet-types/src/error.rs: -------------------------------------------------------------------------------- 1 | use blockifier::transaction::errors::TransactionExecutionError; 2 | use thiserror::Error; 3 | 4 | #[derive(Error, Debug)] 5 | pub enum Error { 6 | #[error(transparent)] 7 | StarknetApiError(#[from] starknet_api::StarknetApiError), 8 | #[error("Conversion error: {0}")] 9 | ConversionError(#[from] ConversionError), 10 | #[error(transparent)] 11 | JsonError(#[from] JsonError), 12 | #[error(transparent)] 13 | IoError(#[from] std::io::Error), 14 | #[error(transparent)] 15 | FromHexError(#[from] starknet_rs_core::types::eth_address::FromHexError), 16 | #[error(transparent)] 17 | TransactionExecutionError(#[from] TransactionExecutionError), 18 | // TODO import cairo-lang-starknet to the project so this error could be created with its 19 | // variants 20 | #[error("Sierra compilation error: {reason}")] 21 | SierraCompilationError { reason: String }, 22 | #[error("Program error")] 23 | ProgramError, 24 | } 25 | 26 | #[derive(Error, Debug)] 27 | pub enum ConversionError { 28 | #[error("Byte array invalid")] 29 | FromByteArrayError, 30 | #[error("Invalid format")] 31 | InvalidFormat, 32 | #[error("Invalid internal structure: {0}")] 33 | InvalidInternalStructure(String), 34 | #[error("Value is out of range: {0}")] 35 | OutOfRangeError(String), 36 | #[error("Error converting from hex string: {0}")] 37 | CustomFromHexError(String), 38 | } 39 | 40 | #[derive(Error, Debug)] 41 | pub enum JsonError { 42 | #[error(transparent)] 43 | SerdeJsonError(#[from] serde_json::Error), 44 | #[error("Error: {msg}")] 45 | Custom { msg: String }, 46 | } 47 | 48 | pub type DevnetResult = Result; 49 | -------------------------------------------------------------------------------- /crates/starknet-devnet-types/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod chain_id; 2 | pub mod constants; 3 | pub mod contract_storage_key; 4 | pub mod error; 5 | pub mod patricia_key; 6 | pub mod rpc; 7 | pub mod serde_helpers; 8 | pub mod traits; 9 | mod utils; 10 | 11 | // Re export libraries 12 | pub use rpc::{contract_address, contract_class, emitted_event, felt, messaging}; 13 | pub use utils::{compile_sierra_contract, compile_sierra_contract_json}; 14 | pub use {num_bigint, starknet_api}; 15 | -------------------------------------------------------------------------------- /crates/starknet-devnet-types/src/rpc.rs: -------------------------------------------------------------------------------- 1 | pub mod block; 2 | pub mod contract_address; 3 | pub mod contract_class; 4 | pub mod emitted_event; 5 | pub mod estimate_message_fee; 6 | pub mod eth_address; 7 | pub mod felt; 8 | pub mod gas_modification; 9 | mod macro_utils; 10 | pub mod messaging; 11 | pub mod state; 12 | pub mod transaction_receipt; 13 | pub mod transactions; 14 | -------------------------------------------------------------------------------- /crates/starknet-devnet-types/src/rpc/eth_address.rs: -------------------------------------------------------------------------------- 1 | use std::str::FromStr; 2 | 3 | use starknet_api::core::EthAddress as ApiEthAddress; 4 | use starknet_rs_core::types::{EthAddress, Felt}; 5 | 6 | use crate::error::{DevnetResult, Error}; 7 | use crate::{impl_wrapper_deserialize, impl_wrapper_serialize}; 8 | 9 | #[derive(Debug, Clone)] 10 | pub struct EthAddressWrapper { 11 | pub inner: EthAddress, 12 | } 13 | 14 | impl_wrapper_serialize!(EthAddressWrapper); 15 | impl_wrapper_deserialize!(EthAddressWrapper, EthAddress); 16 | 17 | impl FromStr for EthAddressWrapper { 18 | type Err = Error; 19 | 20 | fn from_str(s: &str) -> DevnetResult { 21 | Ok(EthAddressWrapper { inner: EthAddress::from_str(s)? }) 22 | } 23 | } 24 | 25 | impl From for Felt { 26 | fn from(value: EthAddressWrapper) -> Self { 27 | value.inner.into() 28 | } 29 | } 30 | 31 | impl From for EthAddressWrapper { 32 | fn from(value: ApiEthAddress) -> Self { 33 | EthAddressWrapper { inner: EthAddress::from_bytes(value.0.to_fixed_bytes()) } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /crates/starknet-devnet-types/src/rpc/felt.rs: -------------------------------------------------------------------------------- 1 | use num_bigint::BigUint; 2 | use starknet_types_core::felt::Felt; 3 | 4 | use crate::error::{ConversionError, DevnetResult, Error}; 5 | 6 | /// Returns (high, low) 7 | pub fn split_biguint(biguint: BigUint) -> (Felt, Felt) { 8 | let high = Felt::from(&biguint >> 128); 9 | let low_mask = (BigUint::from(1_u8) << 128) - 1_u8; 10 | let low = Felt::from(biguint & low_mask); 11 | (high, low) 12 | } 13 | 14 | /// Join high and low part of a felt as biguint 15 | pub fn join_felts(high: &Felt, low: &Felt) -> BigUint { 16 | let high = high.to_biguint(); 17 | let low = low.to_biguint(); 18 | (high << 128) + low 19 | } 20 | 21 | pub fn felt_from_prefixed_hex(s: &str) -> DevnetResult { 22 | if !s.starts_with("0x") { 23 | Err(Error::ConversionError(ConversionError::CustomFromHexError(format!( 24 | "Missing prefix 0x in {s}" 25 | )))) 26 | } else { 27 | Felt::from_hex(s) 28 | .map_err(|e| Error::ConversionError(ConversionError::CustomFromHexError(e.to_string()))) 29 | } 30 | } 31 | 32 | pub fn try_felt_to_num>(f: Felt) -> Result>::Error> { 33 | f.to_biguint().try_into() 34 | } 35 | 36 | pub type Nonce = Felt; 37 | pub type TransactionVersion = Felt; 38 | pub type TransactionSignature = Vec; 39 | pub type CompiledClassHash = Felt; 40 | pub type EntryPointSelector = Felt; 41 | pub type Calldata = Vec; 42 | pub type ContractAddressSalt = Felt; 43 | pub type BlockHash = Felt; 44 | pub type TransactionHash = Felt; 45 | pub type ClassHash = Felt; 46 | pub type Key = Felt; 47 | -------------------------------------------------------------------------------- /crates/starknet-devnet-types/src/rpc/gas_modification.rs: -------------------------------------------------------------------------------- 1 | use std::num::NonZeroU128; 2 | 3 | use serde::{Deserialize, Serialize}; 4 | 5 | #[derive(Clone, Debug, Serialize, Deserialize)] 6 | #[serde(deny_unknown_fields)] 7 | pub struct GasModificationRequest { 8 | pub gas_price_wei: Option, 9 | pub data_gas_price_wei: Option, 10 | pub gas_price_fri: Option, 11 | pub data_gas_price_fri: Option, 12 | pub l2_gas_price_wei: Option, 13 | pub l2_gas_price_fri: Option, 14 | pub generate_block: Option, 15 | } 16 | 17 | #[derive(Clone, Debug, Serialize)] 18 | #[cfg_attr(feature = "testing", derive(serde::Deserialize), serde(deny_unknown_fields))] 19 | pub struct GasModification { 20 | pub gas_price_wei: NonZeroU128, 21 | pub data_gas_price_wei: NonZeroU128, 22 | pub gas_price_fri: NonZeroU128, 23 | pub data_gas_price_fri: NonZeroU128, 24 | pub l2_gas_price_wei: NonZeroU128, 25 | pub l2_gas_price_fri: NonZeroU128, 26 | } 27 | 28 | impl GasModification { 29 | pub fn update(&mut self, request: GasModificationRequest) { 30 | if let Some(gas_price_wei) = request.gas_price_wei { 31 | self.gas_price_wei = gas_price_wei; 32 | } 33 | if let Some(data_gas_price_wei) = request.data_gas_price_wei { 34 | self.data_gas_price_wei = data_gas_price_wei; 35 | } 36 | if let Some(gas_price_fri) = request.gas_price_fri { 37 | self.gas_price_fri = gas_price_fri; 38 | } 39 | if let Some(data_gas_price_fri) = request.data_gas_price_fri { 40 | self.data_gas_price_fri = data_gas_price_fri; 41 | } 42 | if let Some(l2_gas_price_wei) = request.l2_gas_price_wei { 43 | self.l2_gas_price_wei = l2_gas_price_wei; 44 | } 45 | if let Some(l2_gas_price_fri) = request.l2_gas_price_fri { 46 | self.l2_gas_price_fri = l2_gas_price_fri; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /crates/starknet-devnet-types/src/rpc/macro_utils.rs: -------------------------------------------------------------------------------- 1 | #[macro_export] 2 | macro_rules! impl_wrapper_serialize { 3 | ($wrapper_name:ident) => { 4 | impl serde::Serialize for $wrapper_name { 5 | fn serialize(&self, serializer: S) -> Result 6 | where 7 | S: serde::Serializer, 8 | { 9 | self.inner.serialize(serializer) 10 | } 11 | } 12 | }; 13 | } 14 | 15 | #[macro_export] 16 | macro_rules! impl_wrapper_deserialize { 17 | ($wrapper_name:ident, $name:ident) => { 18 | impl<'de> serde::Deserialize<'de> for $wrapper_name { 19 | fn deserialize(deserializer: D) -> Result 20 | where 21 | D: serde::Deserializer<'de>, 22 | { 23 | Ok($wrapper_name { inner: $name::deserialize(deserializer)? }) 24 | } 25 | } 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /crates/starknet-devnet-types/src/rpc/transactions/broadcasted_declare_transaction_v3.rs: -------------------------------------------------------------------------------- 1 | use cairo_lang_starknet_classes::contract_class::ContractClass as SierraContractClass; 2 | use serde::Deserialize; 3 | use starknet_rs_core::types::Felt; 4 | 5 | use super::{BroadcastedDeclareTransaction, BroadcastedTransactionCommonV3}; 6 | use crate::contract_address::ContractAddress; 7 | use crate::felt::CompiledClassHash; 8 | use crate::serde_helpers::rpc_sierra_contract_class_to_sierra_contract_class::deserialize_to_sierra_contract_class; 9 | 10 | #[derive(Debug, Clone, Deserialize)] 11 | #[serde(deny_unknown_fields)] 12 | pub struct BroadcastedDeclareTransactionV3 { 13 | #[serde(flatten)] 14 | pub common: BroadcastedTransactionCommonV3, 15 | #[serde(deserialize_with = "deserialize_to_sierra_contract_class")] 16 | pub contract_class: SierraContractClass, 17 | pub sender_address: ContractAddress, 18 | pub compiled_class_hash: CompiledClassHash, 19 | pub account_deployment_data: Vec, 20 | } 21 | 22 | impl From for BroadcastedDeclareTransaction { 23 | fn from(value: BroadcastedDeclareTransactionV3) -> Self { 24 | Self::V3(Box::new(value)) 25 | } 26 | } 27 | 28 | // This file used to contain a test which asserts tx hash calculation. But this is no longer 29 | // Devnet's responsibility, so there are no such tests. 30 | -------------------------------------------------------------------------------- /crates/starknet-devnet-types/src/rpc/transactions/broadcasted_deploy_account_transaction_v3.rs: -------------------------------------------------------------------------------- 1 | use serde::Deserialize; 2 | 3 | use super::BroadcastedTransactionCommonV3; 4 | use crate::felt::{Calldata, ClassHash, ContractAddressSalt}; 5 | 6 | #[derive(Debug, Clone, Deserialize)] 7 | #[serde(deny_unknown_fields)] 8 | pub struct BroadcastedDeployAccountTransactionV3 { 9 | #[serde(flatten)] 10 | pub common: BroadcastedTransactionCommonV3, 11 | pub contract_address_salt: ContractAddressSalt, 12 | pub constructor_calldata: Calldata, 13 | pub class_hash: ClassHash, 14 | } 15 | -------------------------------------------------------------------------------- /crates/starknet-devnet-types/src/rpc/transactions/broadcasted_invoke_transaction_v3.rs: -------------------------------------------------------------------------------- 1 | use std::sync::Arc; 2 | 3 | use serde::Deserialize; 4 | use starknet_rs_core::types::Felt; 5 | 6 | use super::BroadcastedTransactionCommonV3; 7 | use crate::contract_address::ContractAddress; 8 | use crate::error::DevnetResult; 9 | use crate::felt::Calldata; 10 | 11 | #[derive(Debug, Clone, Deserialize)] 12 | #[serde(deny_unknown_fields)] 13 | pub struct BroadcastedInvokeTransactionV3 { 14 | #[serde(flatten)] 15 | pub common: BroadcastedTransactionCommonV3, 16 | pub sender_address: ContractAddress, 17 | pub calldata: Calldata, 18 | pub account_deployment_data: Vec, 19 | } 20 | 21 | impl BroadcastedInvokeTransactionV3 { 22 | pub fn create_sn_api_invoke( 23 | &self, 24 | ) -> DevnetResult { 25 | let sn_api_transaction = starknet_api::transaction::InvokeTransactionV3 { 26 | resource_bounds: (&self.common.resource_bounds).into(), 27 | tip: self.common.tip, 28 | signature: starknet_api::transaction::fields::TransactionSignature(Arc::new( 29 | self.common.signature.clone(), 30 | )), 31 | nonce: starknet_api::core::Nonce(self.common.nonce), 32 | sender_address: self.sender_address.into(), 33 | calldata: starknet_api::transaction::fields::Calldata(Arc::new(self.calldata.clone())), 34 | nonce_data_availability_mode: self.common.nonce_data_availability_mode, 35 | fee_data_availability_mode: self.common.fee_data_availability_mode, 36 | paymaster_data: starknet_api::transaction::fields::PaymasterData( 37 | self.common.paymaster_data.clone(), 38 | ), 39 | account_deployment_data: starknet_api::transaction::fields::AccountDeploymentData( 40 | self.account_deployment_data.clone(), 41 | ), 42 | }; 43 | 44 | Ok(starknet_api::transaction::InvokeTransaction::V3(sn_api_transaction)) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /crates/starknet-devnet-types/src/rpc/transactions/deploy_transaction.rs: -------------------------------------------------------------------------------- 1 | use serde::Serialize; 2 | 3 | use crate::felt::{Calldata, ClassHash, ContractAddressSalt, TransactionVersion}; 4 | 5 | #[derive(Debug, Clone, Default, Serialize)] 6 | #[cfg_attr( 7 | feature = "testing", 8 | derive(serde::Deserialize, PartialEq, Eq), 9 | serde(deny_unknown_fields) 10 | )] 11 | pub struct DeployTransaction { 12 | pub version: TransactionVersion, 13 | pub class_hash: ClassHash, 14 | pub contract_address_salt: ContractAddressSalt, 15 | pub constructor_calldata: Calldata, 16 | } 17 | -------------------------------------------------------------------------------- /crates/starknet-devnet-types/src/traits.rs: -------------------------------------------------------------------------------- 1 | use starknet_types_core::felt::Felt; 2 | 3 | pub trait HashProducer { 4 | type Error; 5 | fn generate_hash(&self) -> Result; 6 | } 7 | -------------------------------------------------------------------------------- /crates/starknet-devnet/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "starknet-devnet" 3 | version = "0.6.1" 4 | edition = "2021" 5 | repository.workspace = true 6 | license-file.workspace = true 7 | readme.workspace = true 8 | documentation.workspace = true 9 | description.workspace = true 10 | 11 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 12 | 13 | [[bin]] 14 | name = "starknet-devnet" 15 | path = "src/main.rs" 16 | 17 | [lints] 18 | workspace = true 19 | 20 | [dependencies] 21 | # devnet 22 | server = { workspace = true } 23 | starknet-core = { workspace = true } 24 | starknet-types = { workspace = true } 25 | starknet-rs-core = { workspace = true } 26 | url = { workspace = true } 27 | 28 | # async 29 | tokio = { workspace = true, features = ["signal"] } 30 | futures = { workspace = true } 31 | 32 | # tracing 33 | tracing = { workspace = true } 34 | tracing-subscriber = { workspace = true } 35 | 36 | # misc 37 | clap = { workspace = true } 38 | serde_json = { workspace = true } 39 | serde = { workspace = true } 40 | anyhow = { workspace = true } 41 | starknet-rs-providers = { workspace = true } 42 | reqwest = { workspace = true } 43 | 44 | [dev-dependencies] 45 | serial_test = { workspace = true } 46 | -------------------------------------------------------------------------------- /crates/starknet-devnet/src/initial_balance_wrapper.rs: -------------------------------------------------------------------------------- 1 | use std::fmt::Display; 2 | use std::str::FromStr; 3 | 4 | use starknet_core::constants::DEVNET_DEFAULT_INITIAL_BALANCE; 5 | use starknet_types::rpc::state::Balance; 6 | 7 | #[derive(Debug, Clone)] 8 | pub(crate) struct InitialBalanceWrapper(pub Balance); 9 | 10 | impl FromStr for InitialBalanceWrapper { 11 | type Err = anyhow::Error; 12 | 13 | fn from_str(s: &str) -> Result { 14 | let balance = Balance::from_str(s)?; 15 | Ok(Self(balance)) 16 | } 17 | } 18 | 19 | impl Display for InitialBalanceWrapper { 20 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 21 | write!(f, "{}", self.0) 22 | } 23 | } 24 | 25 | impl Default for InitialBalanceWrapper { 26 | fn default() -> Self { 27 | Self(Balance::from(DEVNET_DEFAULT_INITIAL_BALANCE)) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /crates/starknet-devnet/src/ip_addr_wrapper.rs: -------------------------------------------------------------------------------- 1 | use std::fmt::Display; 2 | use std::net::{AddrParseError, IpAddr, Ipv4Addr}; 3 | use std::str::FromStr; 4 | 5 | #[derive(Debug, Clone)] 6 | #[cfg_attr(test, derive(PartialEq, Eq))] 7 | pub(crate) struct IpAddrWrapper { 8 | pub(crate) inner: IpAddr, 9 | } 10 | 11 | impl FromStr for IpAddrWrapper { 12 | type Err = AddrParseError; 13 | 14 | fn from_str(s: &str) -> Result { 15 | match s { 16 | "localhost" => Ok(IpAddrWrapper::LOCALHOST), 17 | other => Ok(IpAddrWrapper { inner: IpAddr::V4(Ipv4Addr::from_str(other)?) }), 18 | } 19 | } 20 | } 21 | 22 | impl Display for IpAddrWrapper { 23 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 24 | write!(f, "{}", self.inner) 25 | } 26 | } 27 | 28 | impl Default for IpAddrWrapper { 29 | fn default() -> Self { 30 | Self::LOCALHOST 31 | } 32 | } 33 | 34 | impl IpAddrWrapper { 35 | pub(crate) const LOCALHOST: Self = IpAddrWrapper { inner: IpAddr::V4(Ipv4Addr::LOCALHOST) }; 36 | } 37 | -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust:1.86-alpine3.21 AS builder 2 | 3 | COPY . . 4 | 5 | RUN apk update && \ 6 | apk add --no-cache pkgconfig make musl-dev openssl-dev perl 7 | 8 | RUN cargo build --bin starknet-devnet --release 9 | 10 | FROM alpine:3.21 11 | 12 | # Use tini to avoid hanging process on Ctrl+C 13 | # Use ca-certificates to allow forking from URLs using https scheme 14 | RUN apk add --no-cache tini ca-certificates 15 | 16 | COPY --from=builder /target/release/starknet-devnet /usr/local/bin/starknet-devnet 17 | 18 | # The default port; exposing is beneficial if using Docker GUI 19 | EXPOSE 5050 20 | 21 | ENTRYPOINT [ "tini", "--", "starknet-devnet", "--host", "0.0.0.0" ] 22 | -------------------------------------------------------------------------------- /docker/seed0.Dockerfile: -------------------------------------------------------------------------------- 1 | ARG BASE_IMAGE 2 | 3 | FROM ${BASE_IMAGE} 4 | 5 | ENTRYPOINT [ "tini", "--", "starknet-devnet", "--host", "0.0.0.0", "--seed", "0" ] 6 | -------------------------------------------------------------------------------- /rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel = "1.86.0" 3 | components = ["rustfmt", "clippy"] 4 | profile = "minimal" 5 | -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | edition = "2021" 2 | newline_style = "Unix" 3 | use_field_init_shorthand = true 4 | use_small_heuristics = "Max" 5 | use_try_shorthand = true 6 | max_width = 100 7 | 8 | # Unstable features below 9 | unstable_features = true 10 | style_edition = "2024" 11 | comment_width = 100 12 | format_code_in_doc_comments = true 13 | format_macro_bodies = true 14 | format_macro_matchers = true 15 | format_strings = true 16 | imports_granularity = "Module" 17 | group_imports = "StdExternalCrate" 18 | normalize_comments = true 19 | normalize_doc_attributes = true 20 | wrap_comments = true 21 | -------------------------------------------------------------------------------- /scripts/benchmark/mint_benchmark.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eu 4 | 5 | N=$1 6 | 7 | for _ in $(seq 1 $N); do 8 | curl localhost:5050/ -w "\n" -sSf --json '{ 9 | "jsonrpc": "2.0", 10 | "id": 1, 11 | "method": "devnet_mint", 12 | "params": { 13 | "amount": 1, 14 | "address": "0x1" 15 | } 16 | }' 17 | done 18 | -------------------------------------------------------------------------------- /scripts/benchmark/startup_test.py: -------------------------------------------------------------------------------- 1 | """ 2 | Measures the time needed to spawn Devnet. The program expects two CLI arguments: the path to an 3 | executable binary and N, the number of iterations. The process is killed as soon as Devnet becomes 4 | available via HTTP. The program prints the accumulated time of running Devnet N times. 5 | """ 6 | 7 | import subprocess 8 | import sys 9 | import time 10 | 11 | import requests 12 | 13 | DEVNET_URL = "http://127.0.0.1:5050" 14 | REQUEST_TIMEOUT = 2 15 | 16 | 17 | def ensure_process_started(proc: subprocess.Popen): 18 | """Ensure the process under test is started""" 19 | max_retries = 50 20 | for i in range(max_retries): 21 | if proc.returncode is not None: 22 | raise RuntimeError(f"Process exited with returncode {proc.returncode}") 23 | 24 | try: 25 | resp = requests.get(f"{DEVNET_URL}/is_alive", timeout=REQUEST_TIMEOUT) 26 | if resp.status_code == 200: 27 | print(f"DEBUG returning on i={i}") 28 | return 29 | except requests.exceptions.ConnectionError: 30 | pass 31 | 32 | time.sleep(0.1) 33 | 34 | raise RuntimeError("Could not start process") 35 | 36 | 37 | def terminate_and_wait(proc: subprocess.Popen): 38 | """Terminates the process and waits.""" 39 | proc.terminate() 40 | proc.wait() 41 | 42 | 43 | def main(): 44 | """Spawn Devnet""" 45 | command = sys.argv[1] 46 | iterations = int(sys.argv[2]) 47 | 48 | start_time = time.time() 49 | for _ in range(iterations): 50 | with subprocess.Popen( 51 | command.split(), stdout=subprocess.DEVNULL 52 | ) as command_proc: 53 | ensure_process_started(command_proc) 54 | terminate_and_wait(command_proc) 55 | 56 | print("Time passed:", time.time() - start_time) 57 | 58 | 59 | if __name__ == "__main__": 60 | main() 61 | -------------------------------------------------------------------------------- /scripts/check_crate_changes.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eu 4 | 5 | if [ $# -ne 1 ]; then 6 | >&2 echo "$0: " 7 | exit 1 8 | fi 9 | 10 | version="$1" 11 | 12 | echo "The crates that need a semver increment since git revision '$version' are:" 13 | 14 | git diff "$version" --name-status | grep -o -E 'crates/[^/]*' | uniq 15 | 16 | echo "Note that this does not reflect dependency changes in Cargo.toml or changes that one Devnet crate may have had on another!" 17 | -------------------------------------------------------------------------------- /scripts/check_spelling.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # should skip if already installed 6 | cargo +nightly-2025-02-20 install typos-cli --version 1.36.2 --locked 7 | 8 | typos && echo "No spelling errors!" 9 | -------------------------------------------------------------------------------- /scripts/check_unused_deps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eu 4 | 5 | # should skip if already installed 6 | cargo install cargo-machete --version 0.7.0 --locked 7 | 8 | cargo machete 9 | -------------------------------------------------------------------------------- /scripts/clippy_check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eu 4 | 5 | # `cargo clippy --workspace --all-targets` dont catch clippy errors for unknown to me reason. 6 | # The workaround is to check for production code, production code with all conditional compilation flags enabled and finally for testing code. 7 | 8 | # checks for errors in production code 9 | cargo clippy --workspace -- -Dwarnings 10 | # checks for errors in production code with enabled all features 11 | cargo clippy --workspace --all-features -- -Dwarnings 12 | # checks for errors in testing code 13 | cargo clippy --workspace --tests -- -Dwarnings 14 | -------------------------------------------------------------------------------- /scripts/compile_binary.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | if [ "$#" -ne 1 ]; then 6 | echo >&2 "Error: $0 " 7 | exit 1 8 | fi 9 | TARGET="$1" 10 | 11 | CARGO_CONFIG=~/.cargo/config.toml 12 | 13 | case "$TARGET" in 14 | x86_64-unknown-linux-gnu | x86_64-apple-darwin | aarch64-apple-darwin) 15 | echo "Target requires no extra actions: $TARGET" 16 | ;; 17 | 18 | x86_64-unknown-linux-musl) 19 | sudo apt-get update 20 | sudo apt-get install musl-tools 21 | musl-gcc --version && echo "Musl successfully installed" 22 | ;; 23 | 24 | aarch64-unknown-linux-gnu) 25 | sudo apt-get update 26 | sudo apt-get install gcc-aarch64-linux-gnu 27 | 28 | aarch64-linux-gnu-gcc --version 29 | echo "Cross compiler successfully installed" 30 | 31 | echo '[target.aarch64-unknown-linux-gnu]' >>"$CARGO_CONFIG" 32 | echo 'linker = "aarch64-linux-gnu-gcc"' >>"$CARGO_CONFIG" 33 | ;; 34 | 35 | *) 36 | echo >&2 "Error: Unsupported compilation target: $TARGET" 37 | exit 2 38 | ;; 39 | esac 40 | 41 | rustup target add "$TARGET" 42 | cargo build --release --target="$TARGET" --bin starknet-devnet 43 | -------------------------------------------------------------------------------- /scripts/format.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eu 4 | 5 | cargo +nightly-2025-02-20 fmt --all 6 | 7 | # Format documentation 8 | npm --prefix website run format 9 | -------------------------------------------------------------------------------- /scripts/format_check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | cargo +nightly-2025-02-20 fmt --all --check 6 | 7 | # Format documentation 8 | npm --prefix website run format-check 9 | -------------------------------------------------------------------------------- /scripts/publish_cratesio_new_versions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | cargo install cargo-get --version 1.1.0 --locked 6 | 7 | for workspace_member in $(cargo get --delimiter " " workspace.members); do 8 | package_name=$(cargo get --entry "$workspace_member" package.name) 9 | if [ $package_name = "integration" ]; then 10 | continue 11 | fi 12 | 13 | package_version=$(cargo get --entry "$workspace_member" package.version) 14 | 15 | # if local version not present on crates.io, publish it 16 | crates_io_url="https://crates.io/api/v1/crates/$package_name" 17 | if ! curl -sSLf "$crates_io_url" | jq -r '.versions[].num' | grep -q "^$package_version$"; then 18 | echo "The local version of $package_name is $package_version, which is not present on crates.io" 19 | 20 | cargo login "$CRATES_IO_API_KEY" 21 | cargo publish -p "$package_name" 22 | else 23 | echo "$package_name v$package_version already published" 24 | fi 25 | done 26 | -------------------------------------------------------------------------------- /scripts/publish_docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | cd website && npm ci 6 | 7 | # if [ "$CIRCLECI" = "true" ]; then 8 | # if running on CircleCI, user info needs to be set up; locally you are assumed to have set it 9 | git config --global user.email "0xSpaceShard@users.noreply.github.com" 10 | git config --global user.name "0xSpaceShard" 11 | # fi 12 | 13 | USE_SSH="true" npm run deploy 14 | -------------------------------------------------------------------------------- /scripts/requirements.txt: -------------------------------------------------------------------------------- 1 | certifi==2024.8.30 2 | charset-normalizer==3.3.2 3 | idna==3.7 4 | numpy==1.26.4 5 | psutil==5.9.8 6 | requests==2.32.4 7 | scipy==1.13.0 8 | urllib3==2.5.0 9 | -------------------------------------------------------------------------------- /tests/integration/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "integration" 3 | version = "0.1.0" 4 | edition.workspace = true 5 | repository.workspace = true 6 | license-file.workspace = true 7 | description = "Integration tests for Starknet Devnet" 8 | 9 | [lib] 10 | path = "lib.rs" 11 | 12 | [dependencies] 13 | starknet-core = { workspace = true, features = ["test_utils"] } 14 | 15 | async-trait = { workspace = true } 16 | axum = { workspace = true } 17 | anyhow = { workspace = true } 18 | ethers = { workspace = true } 19 | futures = { workspace = true } 20 | lazy_static = { workspace = true } 21 | listeners = { workspace = true } 22 | rand = { workspace = true } 23 | reqwest = { workspace = true } 24 | serde = { workspace = true } 25 | serde_json = { workspace = true } 26 | starknet-rs-accounts = { workspace = true } 27 | starknet-rs-contract = { workspace = true } 28 | starknet-rs-core = { workspace = true } 29 | starknet-rs-providers = { workspace = true } 30 | starknet-rs-signers = { workspace = true } 31 | thiserror = { workspace = true } 32 | tokio = { workspace = true, features = ["signal"] } 33 | tokio-tungstenite = { workspace = true } 34 | url = { workspace = true } 35 | usc = { workspace = true } 36 | -------------------------------------------------------------------------------- /tests/integration/common/background_server.rs: -------------------------------------------------------------------------------- 1 | use std::time; 2 | 3 | use super::safe_child::SafeChild; 4 | 5 | pub(crate) async fn get_acquired_port( 6 | process: &mut SafeChild, 7 | sleep_time: time::Duration, 8 | max_retries: usize, 9 | ) -> Result { 10 | let pid = process.id(); 11 | for _ in 0..max_retries { 12 | if let Ok(ports) = listeners::get_ports_by_pid(pid) { 13 | if ports.len() == 1 { 14 | return Ok(ports.into_iter().next().unwrap()); 15 | } 16 | } 17 | 18 | if let Ok(Some(status)) = process.process.try_wait() { 19 | return Err(anyhow::anyhow!("Background server process exited with status {status}")); 20 | } 21 | 22 | tokio::time::sleep(sleep_time).await; 23 | } 24 | 25 | Err(anyhow::anyhow!("Could not identify a unique port used by PID {pid}")) 26 | } 27 | -------------------------------------------------------------------------------- /tests/integration/common/errors.rs: -------------------------------------------------------------------------------- 1 | use core::fmt; 2 | use std::borrow::Cow; 3 | 4 | use serde::{self, Deserialize, Serialize}; 5 | use thiserror::Error; 6 | 7 | #[derive(Error, Debug)] 8 | pub enum TestError { 9 | #[error("Could not parse URL")] 10 | UrlParseError(#[from] url::ParseError), 11 | 12 | #[error("Invalid URI")] 13 | InvalidUri(#[from] axum::http::uri::InvalidUri), 14 | 15 | #[error("Could not start Devnet. Make sure you built it with `cargo build --release`: {0}")] 16 | DevnetNotStartable(String), 17 | 18 | #[error("Could not start Anvil: {0}")] 19 | AnvilNotStartable(String), 20 | 21 | #[error("Ethers error: {0}")] 22 | EthersError(String), 23 | } 24 | 25 | #[derive(Error, Debug)] 26 | pub enum ReqwestError { 27 | #[error(transparent)] 28 | Error(#[from] reqwest::Error), 29 | #[error("Error with message: {message}")] 30 | ErrorWithMessage { error: reqwest::Error, message: String }, 31 | } 32 | 33 | impl ReqwestError { 34 | pub fn error_message(&self) -> String { 35 | match self { 36 | ReqwestError::Error(_) => "".to_string(), 37 | ReqwestError::ErrorWithMessage { message, .. } => message.clone(), 38 | } 39 | } 40 | } 41 | 42 | #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] 43 | #[serde(deny_unknown_fields)] 44 | pub struct RpcError { 45 | pub code: i64, 46 | /// error message 47 | pub message: Cow<'static, str>, 48 | #[serde(skip_serializing_if = "Option::is_none")] 49 | pub data: Option, 50 | } 51 | 52 | impl fmt::Display for RpcError { 53 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 54 | write!(f, "{self:?}") 55 | } 56 | } 57 | 58 | impl std::error::Error for RpcError {} 59 | -------------------------------------------------------------------------------- /tests/integration/common/mod.rs: -------------------------------------------------------------------------------- 1 | #![cfg(test)] 2 | 3 | #[macro_use] 4 | pub mod assertions; 5 | pub mod background_anvil; 6 | pub mod background_devnet; 7 | mod background_server; 8 | pub mod constants; 9 | pub mod errors; 10 | pub mod fees; 11 | pub mod reqwest_client; 12 | mod safe_child; 13 | pub mod utils; 14 | -------------------------------------------------------------------------------- /tests/integration/common/safe_child.rs: -------------------------------------------------------------------------------- 1 | use std::process::Child; 2 | 3 | #[derive(Debug)] 4 | pub struct SafeChild { 5 | pub process: Child, 6 | } 7 | 8 | impl SafeChild { 9 | pub fn id(&self) -> u32 { 10 | self.process.id() 11 | } 12 | } 13 | 14 | /// By implementing Drop, we ensure there are no zombie processes in case of early test failure 15 | impl Drop for SafeChild { 16 | fn drop(&mut self) { 17 | self.process.kill().expect("Cannot kill process"); 18 | self.process.wait().expect("Should be dead"); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tests/integration/get_transaction_by_block_id_and_index.rs: -------------------------------------------------------------------------------- 1 | use starknet_rs_core::types::{ 2 | BlockId, BlockTag, Felt, InvokeTransaction, StarknetError, Transaction, 3 | }; 4 | use starknet_rs_providers::{Provider, ProviderError}; 5 | 6 | use crate::common::background_devnet::BackgroundDevnet; 7 | 8 | #[tokio::test] 9 | async fn get_transaction_by_block_id_and_index_happy_path() { 10 | let devnet = BackgroundDevnet::spawn().await.expect("Could not start Devnet"); 11 | let minting_hash = devnet.mint(Felt::ONE, 1).await; 12 | 13 | let result = devnet 14 | .json_rpc_client 15 | .get_transaction_by_block_id_and_index(BlockId::Tag(BlockTag::Latest), 0) 16 | .await 17 | .unwrap(); 18 | 19 | if let Transaction::Invoke(InvokeTransaction::V3(tx)) = result { 20 | assert_eq!(tx.transaction_hash, minting_hash); 21 | } else { 22 | panic!("Could not unpack the transaction from {result:?}"); 23 | } 24 | } 25 | 26 | #[tokio::test] 27 | async fn get_transaction_by_block_id_and_index_wrong_index() { 28 | let devnet = BackgroundDevnet::spawn().await.expect("Could not start Devnet"); 29 | 30 | devnet.mint(Felt::ONE, 1).await; 31 | 32 | let result = devnet 33 | .json_rpc_client 34 | .get_transaction_by_block_id_and_index(BlockId::Tag(BlockTag::Latest), 1) 35 | .await 36 | .unwrap_err(); 37 | 38 | match result { 39 | ProviderError::StarknetError(StarknetError::InvalidTransactionIndex) => (), 40 | _ => panic!("Invalid error: {result:?}"), 41 | } 42 | } 43 | 44 | #[tokio::test] 45 | async fn get_transaction_by_block_id_and_index_wrong_block() { 46 | let devnet = BackgroundDevnet::spawn().await.expect("Could not start Devnet"); 47 | let result = devnet 48 | .json_rpc_client 49 | .get_transaction_by_block_id_and_index(BlockId::Number(1), 1) 50 | .await 51 | .unwrap_err(); 52 | 53 | match result { 54 | ProviderError::StarknetError(StarknetError::BlockNotFound) => (), 55 | _ => panic!("Invalid error: {result:?}"), 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /tests/integration/lib.rs: -------------------------------------------------------------------------------- 1 | #![cfg(test)] 2 | 3 | mod common; 4 | 5 | mod general_integration_tests; 6 | mod general_rpc_tests; 7 | mod get_transaction_by_block_id_and_index; 8 | mod get_transaction_by_hash; 9 | mod get_transaction_receipt_by_hash; 10 | mod test_abort_blocks; 11 | mod test_accepting_blocks_on_l1; 12 | mod test_account_impersonation; 13 | mod test_account_selection; 14 | mod test_advancing_time; 15 | mod test_advancing_time_on_fork; 16 | mod test_balance; 17 | mod test_blocks_generation; 18 | mod test_call; 19 | mod test_deploy; 20 | mod test_dump_and_load; 21 | mod test_estimate_fee; 22 | mod test_estimate_message_fee; 23 | mod test_fork; 24 | mod test_gas_modification; 25 | mod test_get_block_txs_count; 26 | mod test_get_class; 27 | mod test_get_class_hash_at; 28 | mod test_get_events; 29 | mod test_messaging; 30 | mod test_minting; 31 | mod test_old_state; 32 | mod test_restart; 33 | mod test_restrictive_mode; 34 | mod test_simulate_transactions; 35 | mod test_subscription_to_blocks; 36 | mod test_subscription_to_events; 37 | mod test_subscription_to_new_tx_receipts; 38 | mod test_subscription_to_new_txs; 39 | mod test_subscription_to_reorg; 40 | mod test_subscription_to_tx_status; 41 | mod test_subscription_with_invalid_block_id; 42 | mod test_trace; 43 | mod test_transaction_handling; 44 | mod test_v3_transactions; 45 | mod test_websocket; 46 | -------------------------------------------------------------------------------- /tests/integration/test_balance.rs: -------------------------------------------------------------------------------- 1 | use serde_json::json; 2 | use starknet_rs_core::types::Felt; 3 | 4 | use crate::common::background_devnet::BackgroundDevnet; 5 | use crate::common::constants::{PREDEPLOYED_ACCOUNT_ADDRESS, PREDEPLOYED_ACCOUNT_INITIAL_BALANCE}; 6 | use crate::common::utils::FeeUnit; 7 | 8 | #[tokio::test] 9 | async fn getting_balance_of_predeployed_contract() { 10 | let devnet = BackgroundDevnet::spawn().await.expect("Could not start Devnet"); 11 | let contract_address = Felt::from_hex_unchecked(PREDEPLOYED_ACCOUNT_ADDRESS); 12 | 13 | for unit in [FeeUnit::Fri, FeeUnit::Wei] { 14 | let balance = devnet.get_balance_latest(&contract_address, unit).await.unwrap(); 15 | assert_eq!(balance, Felt::from(PREDEPLOYED_ACCOUNT_INITIAL_BALANCE)); 16 | } 17 | } 18 | 19 | #[tokio::test] 20 | /// Tests the same logic that is used by BackgroundDevnet::get_balance 21 | async fn assert_balance_endpoint_response() { 22 | let devnet = BackgroundDevnet::spawn().await.expect("Could not start Devnet"); 23 | 24 | for (address, expected_balance) in [ 25 | ("0x123", "0"), // dummy address expected to have no balance 26 | (PREDEPLOYED_ACCOUNT_ADDRESS, PREDEPLOYED_ACCOUNT_INITIAL_BALANCE.to_string().as_str()), 27 | ] { 28 | for unit in ["WEI", "FRI"] { 29 | let json_resp: serde_json::Value = devnet 30 | .send_custom_rpc( 31 | "devnet_getAccountBalance", 32 | json!({ "address": address, "unit": unit }), 33 | ) 34 | .await 35 | .unwrap(); 36 | 37 | assert_eq!(json_resp["unit"], unit); 38 | assert_eq!(json_resp["amount"], expected_balance); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tests/integration/test_get_block_txs_count.rs: -------------------------------------------------------------------------------- 1 | use starknet_rs_core::types::{BlockId, BlockTag, StarknetError}; 2 | use starknet_rs_providers::{Provider, ProviderError}; 3 | 4 | use crate::common::background_devnet::BackgroundDevnet; 5 | 6 | #[tokio::test] 7 | async fn test_invalid_block() { 8 | let devnet = BackgroundDevnet::spawn().await.expect("Could not start Devnet"); 9 | 10 | let res = devnet 11 | .json_rpc_client 12 | .get_block_transaction_count(BlockId::Number(9000000000)) 13 | .await 14 | .unwrap_err(); 15 | match res { 16 | ProviderError::StarknetError(StarknetError::BlockNotFound) => (), 17 | _ => panic!("Invalid error: {res:?}"), 18 | } 19 | } 20 | 21 | #[tokio::test] 22 | async fn test_valid_block() { 23 | let devnet = BackgroundDevnet::spawn().await.expect("Could not start Devnet"); 24 | 25 | devnet 26 | .json_rpc_client 27 | .get_block_transaction_count(BlockId::Tag(BlockTag::Latest)) 28 | .await 29 | .unwrap(); 30 | } 31 | -------------------------------------------------------------------------------- /tests/integration/test_restrictive_mode.rs: -------------------------------------------------------------------------------- 1 | use serde_json::json; 2 | 3 | use crate::common::background_devnet::BackgroundDevnet; 4 | use crate::common::errors::RpcError; 5 | 6 | #[tokio::test] 7 | async fn restrictive_mode_with_default_methods_doesnt_affect_other_functionality() { 8 | let devnet = BackgroundDevnet::spawn_with_additional_args(&["--restrictive-mode"]) 9 | .await 10 | .expect("Could not start Devnet"); 11 | 12 | devnet.send_custom_rpc("devnet_getConfig", json!({})).await.unwrap(); 13 | } 14 | 15 | #[tokio::test] 16 | async fn restrictive_mode_with_default_methods() { 17 | let devnet = BackgroundDevnet::spawn_with_additional_args(&["--restrictive-mode"]) 18 | .await 19 | .expect("Could not start Devnet"); 20 | 21 | let json_rpc_error = devnet 22 | .send_custom_rpc("devnet_mint", json!({ "address": "0x1", "amount": 1 })) 23 | .await 24 | .unwrap_err(); 25 | 26 | assert_eq!( 27 | json_rpc_error, 28 | RpcError { code: -32604, message: "Method forbidden".into(), data: None } 29 | ); 30 | } 31 | 32 | #[tokio::test] 33 | async fn restrictive_mode_with_custom_methods() { 34 | let devnet = BackgroundDevnet::spawn_with_additional_args(&[ 35 | "--restrictive-mode", 36 | "devnet_load", 37 | "devnet_mint", 38 | ]) 39 | .await 40 | .expect("Could not start Devnet"); 41 | 42 | let json_rpc_error = devnet 43 | .send_custom_rpc("devnet_mint", json!({ "address": "0x1", "amount": 1 })) 44 | .await 45 | .unwrap_err(); 46 | 47 | assert_eq!( 48 | json_rpc_error, 49 | RpcError { code: -32604, message: "Method forbidden".into(), data: None } 50 | ); 51 | } 52 | -------------------------------------------------------------------------------- /website/.gitignore: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | /node_modules 3 | 4 | # Production 5 | /build 6 | 7 | # Generated files 8 | .docusaurus 9 | .cache-loader 10 | 11 | # Misc 12 | .DS_Store 13 | .env.local 14 | .env.development.local 15 | .env.test.local 16 | .env.production.local 17 | 18 | npm-debug.log* 19 | yarn-debug.log* 20 | yarn-error.log* 21 | -------------------------------------------------------------------------------- /website/.prettierignore: -------------------------------------------------------------------------------- 1 | # to avoid conflicts between prettier and docusaurus 2 | versions.json 3 | -------------------------------------------------------------------------------- /website/README.md: -------------------------------------------------------------------------------- 1 | # Website 2 | 3 | This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator. 4 | 5 | ### New content 6 | 7 | Check out the existing pages and categories under `website/docs/`. If the change you wish to make in the documentation is not suitable for any of the existing markdown (.md) files, feel free to create a new one. 8 | 9 | ### Documentation versioning 10 | 11 | A new version of the documentation should be created when releasing a new crate. Check [this](../.github/CONTRIBUTING#new-devnet-version-release) out for more info. 12 | 13 | #### Updating versioned documentation 14 | 15 | Generally, you should only be making changes to the pages in `website/versioned_docs/` if something important is applicable to those historic versions, but is missing in the documentation. 16 | 17 | ### Installation 18 | 19 | ``` 20 | $ npm install 21 | ``` 22 | 23 | ### Format 24 | 25 | Format the website code by running 26 | 27 | ``` 28 | $ npm run format 29 | ``` 30 | 31 | ### Local development 32 | 33 | ``` 34 | $ npm run start 35 | ``` 36 | 37 | This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. 38 | 39 | ### Build 40 | 41 | ``` 42 | $ npm run build 43 | ``` 44 | 45 | This command generates static content into the `build` directory and can be served using any static contents hosting service. 46 | 47 | ### Deployment 48 | 49 | Using SSH: 50 | 51 | ``` 52 | $ USE_SSH=true npm run deploy 53 | ``` 54 | 55 | Not using SSH: 56 | 57 | ``` 58 | $ GIT_USER= npm run deploy 59 | ``` 60 | 61 | If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. 62 | -------------------------------------------------------------------------------- /website/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [require.resolve('@docusaurus/core/lib/babel/preset')], 3 | }; 4 | -------------------------------------------------------------------------------- /website/docs/balance.md: -------------------------------------------------------------------------------- 1 | # Account balance 2 | 3 | Other than using prefunded predeployed accounts, you can also add funds to an account that you deployed yourself. 4 | 5 | Separate tokens use separate ERC20 contracts for minting and charging fees. These are the token contracts predeployed by Devnet and the addresses where they are located: 6 | 7 | - ETH: `0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7` 8 | - STRK: `0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d` 9 | 10 | ## Mint token - Local faucet 11 | 12 | By sending a `JSON-RPC` request with method name `devnet_mint` for a token, you initiate a transaction on that token's ERC20 contract. The response contains the hash of this transaction, as well as the new balance after minting. The token is specified by providing the unit, and defaults to `FRI` (the unit of `STRK`). 13 | 14 | The value of `amount` is in WEI or FRI. The precision is preserved if specifying an integer or a float whose fractional part is zero (e.g. `1000.0`, `1e21`). If the fractional part is non-zero, the amount is truncated to the nearest integer (e.g. `3.9` becomes `3` and `1.23e1` becomes `12`). 15 | 16 | ``` 17 | JSON-RPC 18 | { 19 | "jsonrpc": "2.0", 20 | "id": "1", 21 | "method": "devnet_mint", 22 | "params": { 23 | "address": "0x6e3205f...", 24 | "amount": 500000, 25 | "unit": "WEI" | "FRI" 26 | } 27 | } 28 | ``` 29 | 30 | Result: 31 | 32 | ``` 33 | { 34 | "new_balance": 500000, 35 | "unit": "WEI" | "FRI", 36 | "tx_hash": "0xa24f23..." 37 | } 38 | ``` 39 | 40 | In case of a reverted minting request, an error is returned containing the stringified revert reason and the hex string of the hash of the reverted transaction for further inspection: 41 | 42 | ``` 43 | { 44 | "tx_hash": "0x123..." 45 | "revert_reason": "Something happened" 46 | } 47 | ``` 48 | 49 | ## Check balance 50 | 51 | Check the balance of an address by sending a `JSON-RPC` request. The address should be a 0x-prefixed hex string; `unit` defaults to `FRI` (the unit of `STRK`) and `block_id` to `latest`. 52 | 53 | ``` 54 | JSON-RPC 55 | { 56 | "jsonrpc": "2.0", 57 | "id": "1", 58 | "method": "devnet_getAccountBalance", 59 | "params": { 60 | "address": "0x6e3205f...", 61 | "unit": "WEI" | "FRI", 62 | "block_id": 63 | } 64 | } 65 | ``` 66 | -------------------------------------------------------------------------------- /website/docs/examples.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | Usage examples relying on the [`starknet-devnet-js`](https://github.com/0xspaceShard/starknet-devnet-js) library can be found [here](https://github.com/0xSpaceShard/starknet-devnet-js/tree/master/test). 4 | -------------------------------------------------------------------------------- /website/docs/forking.md: -------------------------------------------------------------------------------- 1 | # Forking 2 | 3 | To interact with contracts deployed on mainnet or testnet, you can use forking. Simulate the origin and experiment with it locally, making no changes to the origin itself. 4 | 5 | ``` 6 | $ starknet-devnet --fork-network [--fork-block ] 7 | ``` 8 | 9 | The value passed to `--fork-network` should be the URL to a Starknet JSON-RPC API provider. Specifying a `--fork-block` is optional; it defaults to the `"latest"` block at the time of Devnet's start-up. All calls will first try Devnet's state and then fall back to the forking block. 10 | 11 | :::note How it works 12 | 13 | When you send a request to a forked Devnet instance, it first queries Devnet's local state, then tries the forking origin. Forking is not a step simply performed on Devnet startup, but happens continuously while the Devnet instance is alive. 14 | 15 | ::: 16 | 17 | ## Forking and ACCEPTED_ON_L1 18 | 19 | Assume you have run Devnet as a fork from an origin at a block that is not yet `ACCEPTED_ON_L1`, but only `ACCEPTED_ON_L2`. If in your state queries you specify `block_id: "l1_accepted"`, and there are no local blocks marked as `ACCEPTED_ON_L1`, Devnet will assume the forking block has become `ACCEPTED_ON_L1`. 20 | 21 | Read more about marking blocks as `ACCEPTED_ON_L1` on Devnet: [link](./blocks#accepting-blocks-on-l1). 22 | 23 | ## Account impersonation 24 | 25 | [Here](./account-impersonation) you can read more about acting as an account deployed on the origin. 26 | 27 | ## Deploying an undeclared account 28 | 29 | [Here](./predeployed#deploying-an-undeclared-account) you can read about deploying an account not declared on Devnet. 30 | 31 | ## Checking forking status 32 | 33 | To see if your Devnet instance is using forking or not, [fetch the current configuration](./api#config-api), and check the `url` property of its `fork_config` property. If Devnet is forked, this property contains the string of the origin URL specified on startup. 34 | -------------------------------------------------------------------------------- /website/docs/gas.md: -------------------------------------------------------------------------------- 1 | # Gas price modification 2 | 3 | ## On Devnet startup - via CLI 4 | 5 | All gas prices (L1 gas, L1 data gas, L2 gas) can be specified on startup, via their respective CLI params. Check `starknet-devnet --help | grep price` for more info. 6 | 7 | ## On a running Devnet - via JSON-RPC 8 | 9 | The `devnet_setGasPrice` RPC method allows users to modify the current gas prices on a running Devnet. This feature is particularly useful for testing purposes and for adjustments needed after forking to align with the forked network's gas prices. All parameters are optional, allowing you to choose which ones you want to set. A boolean flag `generate_block` indicates whether a new block should be generated immediately after setting the gas prices. 10 | 11 | ### Explanation 12 | 13 | The modified gas prices take effect starting with the next block that is generated. 14 | 15 | ### generate_block 16 | 17 | - When set to `true`, a new block will be generated immediately after the gas prices are set. This ensures that the changes take effect right away and are reflected in the devnet state without waiting for the next block generation. 18 | - When set to `false` (or omitted), the gas prices will be set, but the changes will not be immediately committed to the devnet state until the next block is generated through the usual block generation process. 19 | 20 | ### JSON-RPC Request 21 | 22 | The following JSON-RPC request can be used to set gas prices (all properties optional): 23 | 24 | ```json 25 | JSON-RPC 26 | { 27 | "jsonrpc": "2.0", 28 | "id": "1", 29 | "method": "devnet_setGasPrice", 30 | "params": { 31 | "gas_price_wei": 1000000, 32 | "data_gas_price_wei": 10000, 33 | "gas_price_fri": 10000, 34 | "data_gas_price_fri": 10000, 35 | "l2_gas_price_wei": 1000000, 36 | "l2_gas_price_fri": 10000, 37 | "generate_block": false, 38 | } 39 | } 40 | ``` 41 | 42 | ## Response 43 | 44 | The expected response from the server will mirror the request gas parameters, confirming the modification of gas prices: 45 | 46 | ```json 47 | { 48 | "gas_price_wei": 1000000, 49 | "data_gas_price_wei": 10000, 50 | "gas_price_fri": 10000, 51 | "data_gas_price_fri": 10000, 52 | "l2_gas_price_wei": 10000, 53 | "l2_gas_price_fri": 10000 54 | } 55 | ``` 56 | -------------------------------------------------------------------------------- /website/docs/historic-state.md: -------------------------------------------------------------------------------- 1 | # Historic state support 2 | 3 | With state archive capacity set to `full`, Devnet will store full state history, enabling its querying by block hash or number. The default mode is `none`, where no old states are stored and only the latest is available for querying. 4 | 5 | ``` 6 | $ starknet-devnet --state-archive-capacity 7 | ``` 8 | 9 | All RPC endpoints that support querying the state at an old (non-latest) block only work with state archive capacity set to `full`. 10 | -------------------------------------------------------------------------------- /website/docs/lite.md: -------------------------------------------------------------------------------- 1 | # Lite mode 2 | 3 | To run Devnet in a minimal lite mode, provide the flag: 4 | 5 | ``` 6 | $ starknet-devnet --lite-mode 7 | ``` 8 | 9 | Steps skipped in lite mode: 10 | 11 | - calculating block hash 12 | 13 | This is useful if your use-case doesn't need the functionalities above. 14 | 15 | The extent of what is affected by lite mode may be expanded in the future. 16 | -------------------------------------------------------------------------------- /website/docs/restrictive.md: -------------------------------------------------------------------------------- 1 | # Restrictive mode 2 | 3 | The `--restrictive-mode` argument enables a restrictive mode for Devnet, allowing you to specify methods that are forbidden during execution. This option ensures that certain operations are restricted, enhancing control over Devnet's behavior. When a user sends a request to one of the restricted methods, Devnet will return either a JSON-RPC error with code -32604 or, if the method was targeted directly via the HTTP endpoint, a response with status 403. 4 | 5 | ## Default restricted methods 6 | 7 | When no methods are specified, the following default methods will be restricted, together with their HTTP endpoint counterparts (if any): 8 | 9 | - devnet_mint 10 | - devnet_load 11 | - devnet_restart 12 | - devnet_createBlock 13 | - devnet_abortBlocks 14 | - devnet_impersonateAccount 15 | - devnet_autoImpersonate 16 | - devnet_getPredeployedAccounts 17 | 18 | ## Usage 19 | 20 | ### With default methods 21 | 22 | ``` 23 | $ starknet-devnet --restrictive-mode 24 | ``` 25 | 26 | ### With a list of methods 27 | 28 | :::note 29 | 30 | Devnet will fail to start if any of the methods/routes are misspelled. 31 | 32 | ::: 33 | 34 | ``` 35 | $ starknet-devnet --restrictive-mode devnet_dump devnet_config 36 | ``` 37 | -------------------------------------------------------------------------------- /website/docs/running/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Running", 3 | "position": 2, 4 | "link": { 5 | "type": "generated-index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /website/docs/running/cli.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 2.3 3 | --- 4 | 5 | # CLI options 6 | 7 | Configure your Devnet instance by specifying CLI parameters on startup. To read more about HTTP and logging configuration, check out the [server config](../server-config) page. 8 | 9 | ## Help 10 | 11 | Check out all the options with: 12 | 13 | ``` 14 | $ starknet-devnet --help 15 | ``` 16 | 17 | Or if using dockerized Devnet: 18 | 19 | ``` 20 | $ docker run --rm shardlabs/starknet-devnet-rs --help 21 | ``` 22 | 23 | ## Environment variables 24 | 25 | Every CLI option can also be specified via an environment variable: 26 | 27 | ``` 28 | $ = = starknet-devnet 29 | ``` 30 | 31 | To see the exact variable names, use [`--help`](#help). 32 | 33 | ### Precedence 34 | 35 | If both a CLI argument and an environment variable are passed for a parameter, the CLI argument takes precedence. If none are provided, the default value is used. E.g. if running Devnet with the following command, seed value 42 will be used: 36 | 37 | ``` 38 | $ SEED=10 starknet-devnet --seed 42 39 | ``` 40 | 41 | ### Docker 42 | 43 | If using dockerized Devnet, specify the variables like this: 44 | 45 | ``` 46 | $ docker run \ 47 | -e = \ 48 | -e = \ 49 | ... \ 50 | shardlabs/starknet-devnet-rs 51 | ``` 52 | 53 | ## Load configuration from a file 54 | 55 | If providing many configuration parameters in a single command becomes cumbersome, consider loading them from a file. By relying on [environment variables](#environment-variables), prepare your configuration in a file like this: 56 | 57 | ```bash 58 | export SEED=42 59 | export ACCOUNTS=3 60 | ... 61 | ``` 62 | 63 | Assuming the file is called `.my-env-file`, then run: 64 | 65 | ```bash 66 | $ source .my-env-file && starknet-devnet 67 | ``` 68 | 69 | To run in a subshell and prevent environment pollution (i.e. to unset the variables after Devnet exits), use parentheses: 70 | 71 | ```bash 72 | $ ( source .my-env-file && starknet-devnet ) 73 | ``` 74 | 75 | ### Docker 76 | 77 | To load environment variables from `.my-env-file` with Docker, remove the `export` part in each line to have the file look like this: 78 | 79 | ``` 80 | SEED=42 81 | ACCOUNTS=3 82 | ... 83 | ``` 84 | 85 | Then run: 86 | 87 | ``` 88 | $ docker run --env-file .my-env-file shardlabs/starknet-devnet-rs 89 | ``` 90 | -------------------------------------------------------------------------------- /website/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "website", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "docusaurus": "docusaurus", 7 | "start": "docusaurus start", 8 | "build": "docusaurus build", 9 | "swizzle": "docusaurus swizzle", 10 | "deploy": "docusaurus deploy", 11 | "clear": "docusaurus clear", 12 | "serve": "docusaurus serve", 13 | "write-translations": "docusaurus write-translations", 14 | "write-heading-ids": "docusaurus write-heading-ids", 15 | "typecheck": "tsc", 16 | "format-check": "prettier . --check", 17 | "format": "prettier . --write" 18 | }, 19 | "dependencies": { 20 | "@docusaurus/core": "3.3.2", 21 | "@docusaurus/preset-classic": "3.3.2", 22 | "@mdx-js/react": "^3.0.0", 23 | "clsx": "^2.0.0", 24 | "prism-react-renderer": "^2.3.0", 25 | "react": "^18.0.0", 26 | "react-dom": "^18.0.0" 27 | }, 28 | "devDependencies": { 29 | "@docusaurus/module-type-aliases": "3.3.2", 30 | "@docusaurus/tsconfig": "3.3.2", 31 | "@docusaurus/types": "3.3.2", 32 | "prettier": "3.2.5", 33 | "typescript": "~5.2.2" 34 | }, 35 | "browserslist": { 36 | "production": [ 37 | ">0.5%", 38 | "not dead", 39 | "not op_mini all" 40 | ], 41 | "development": [ 42 | "last 3 chrome version", 43 | "last 3 firefox version", 44 | "last 5 safari version" 45 | ] 46 | }, 47 | "engines": { 48 | "node": ">=18.0" 49 | }, 50 | "prettier": { 51 | "singleQuote": true 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /website/sidebars.ts: -------------------------------------------------------------------------------- 1 | import type { SidebarsConfig } from '@docusaurus/plugin-content-docs'; 2 | 3 | /** 4 | * Creating a sidebar enables you to: 5 | - create an ordered group of docs 6 | - render a sidebar for each doc of that group 7 | - provide next/previous navigation 8 | 9 | The sidebars can be generated from the filesystem, or explicitly defined here. 10 | 11 | Create as many sidebars as you want. 12 | */ 13 | const sidebars: SidebarsConfig = { 14 | // By default, Docusaurus generates a sidebar from the docs folder structure 15 | docSidebar: [{ type: 'autogenerated', dirName: '.' }], 16 | 17 | // But you can create a sidebar manually 18 | /* 19 | docSidebar: [ 20 | 'intro', 21 | 'hello', 22 | { 23 | type: 'category', 24 | label: 'Tutorial', 25 | items: ['tutorial-basics/create-a-document'], 26 | }, 27 | ], 28 | */ 29 | }; 30 | 31 | export default sidebars; 32 | -------------------------------------------------------------------------------- /website/src/components/HomepageFeatures/index.tsx: -------------------------------------------------------------------------------- 1 | import clsx from 'clsx'; 2 | import Heading from '@theme/Heading'; 3 | import styles from './styles.module.css'; 4 | 5 | type FeatureItem = { 6 | title: string; 7 | description: JSX.Element; 8 | }; 9 | 10 | const FeatureList: FeatureItem[] = [ 11 | { 12 | title: 'Isolated but connected 🖥️', 13 | description: ( 14 | <> 15 | Simulate{' '} 16 | 21 | Starknet 22 | {' '} 23 | in the comfort of your local network. Fork mainnet/testnet to interact 24 | with real-world smart contracts, while maintaining isolation. 25 | 26 | ), 27 | }, 28 | { 29 | title: 'Configurable and preservable 🔧', 30 | description: ( 31 | <> 32 | Gas price, predeployed accounts, chain ID... All of this and more can be 33 | configured according to your needs. Once your work is done, dump Devnet 34 | into a file and later load it to continue where you left off. 35 | 36 | ), 37 | }, 38 | { 39 | title: 'Built in Rust 🦀', 40 | description: ( 41 | <> 42 | Unlike its{' '} 43 | 48 | Pythonic predecessor 49 | 50 | , this program is built in Rust to ensure a better performance and 51 | overall user experience. 52 | 53 | ), 54 | }, 55 | ]; 56 | 57 | function Feature({ title, description }: FeatureItem) { 58 | return ( 59 |
60 |
61 | {title} 62 |

{description}

63 |
64 |
65 | ); 66 | } 67 | 68 | export default function HomepageFeatures(): JSX.Element { 69 | return ( 70 |
71 |
72 |
73 | {FeatureList.map((props, idx) => ( 74 | 75 | ))} 76 |
77 |
78 |
79 | ); 80 | } 81 | -------------------------------------------------------------------------------- /website/src/components/HomepageFeatures/styles.module.css: -------------------------------------------------------------------------------- 1 | .features { 2 | display: flex; 3 | align-items: center; 4 | padding: 2rem 0; 5 | width: 100%; 6 | } 7 | 8 | .featureSvg { 9 | height: 200px; 10 | width: 200px; 11 | } 12 | -------------------------------------------------------------------------------- /website/src/css/custom.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Any CSS included here will be global. The classic template 3 | * bundles Infima by default. Infima is a CSS framework designed to 4 | * work well for content-centric websites. 5 | */ 6 | 7 | /* You can override the default Infima variables here. */ 8 | :root { 9 | --ifm-color-primary: #2e8555; 10 | --ifm-color-primary-dark: #29784c; 11 | --ifm-color-primary-darker: #277148; 12 | --ifm-color-primary-darkest: #205d3b; 13 | --ifm-color-primary-light: #33925d; 14 | --ifm-color-primary-lighter: #359962; 15 | --ifm-color-primary-lightest: #3cad6e; 16 | --ifm-code-font-size: 95%; 17 | --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1); 18 | } 19 | 20 | /* For readability concerns, you should choose a lighter palette in dark mode. */ 21 | [data-theme='dark'] { 22 | --ifm-color-primary: #25c2a0; 23 | --ifm-color-primary-dark: #21af90; 24 | --ifm-color-primary-darker: #1fa588; 25 | --ifm-color-primary-darkest: #1a8870; 26 | --ifm-color-primary-light: #29d5b0; 27 | --ifm-color-primary-lighter: #32d8b4; 28 | --ifm-color-primary-lightest: #4fddbf; 29 | --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3); 30 | } 31 | -------------------------------------------------------------------------------- /website/src/pages/index.module.css: -------------------------------------------------------------------------------- 1 | /** 2 | * CSS files with the .module.css suffix will be treated as CSS modules 3 | * and scoped locally. 4 | */ 5 | 6 | .heroBanner { 7 | padding: 4rem 0; 8 | text-align: center; 9 | position: relative; 10 | overflow: hidden; 11 | } 12 | 13 | @media screen and (max-width: 996px) { 14 | .heroBanner { 15 | padding: 2rem; 16 | } 17 | } 18 | 19 | .buttons { 20 | display: flex; 21 | align-items: center; 22 | justify-content: center; 23 | } 24 | -------------------------------------------------------------------------------- /website/src/pages/index.tsx: -------------------------------------------------------------------------------- 1 | import clsx from 'clsx'; 2 | import Link from '@docusaurus/Link'; 3 | import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; 4 | import Layout from '@theme/Layout'; 5 | import HomepageFeatures from '@site/src/components/HomepageFeatures'; 6 | import Heading from '@theme/Heading'; 7 | 8 | import styles from './index.module.css'; 9 | 10 | function HomepageHeader() { 11 | const { siteConfig } = useDocusaurusContext(); 12 | return ( 13 |
14 |
15 |
16 | 17 |
18 | 19 | {siteConfig.title} 20 | 21 |

{siteConfig.tagline}

22 |
23 | 27 | Get started 28 | 29 |
30 |
31 |
32 | ); 33 | } 34 | 35 | export default function Home(): JSX.Element { 36 | const { siteConfig } = useDocusaurusContext(); 37 | return ( 38 | 39 | 40 |
41 | 42 |
43 |
44 | ); 45 | } 46 | -------------------------------------------------------------------------------- /website/static/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xSpaceShard/starknet-devnet/9f1da3e419ee7c12dcbe12f605a50b4039e899eb/website/static/.nojekyll -------------------------------------------------------------------------------- /website/static/img/devnet-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xSpaceShard/starknet-devnet/9f1da3e419ee7c12dcbe12f605a50b4039e899eb/website/static/img/devnet-logo.png -------------------------------------------------------------------------------- /website/static/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xSpaceShard/starknet-devnet/9f1da3e419ee7c12dcbe12f605a50b4039e899eb/website/static/img/favicon.ico -------------------------------------------------------------------------------- /website/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | // This file is not used in compilation. It is here just for a nice editor experience. 3 | "extends": "@docusaurus/tsconfig", 4 | "compilerOptions": { 5 | "baseUrl": "." 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.3.0/examples.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | Usage examples relying on the [`starknet-devnet-js`](https://github.com/0xspaceShard/starknet-devnet-js) library can be found [here](https://github.com/0xSpaceShard/starknet-devnet-js/tree/master/test). 4 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.3.0/forking.md: -------------------------------------------------------------------------------- 1 | # Forking 2 | 3 | To interact with contracts deployed on mainnet or testnet, you can use forking. Simulate the origin and experiment with it locally, making no changes to the origin itself. 4 | 5 | ``` 6 | $ starknet-devnet --fork-network [--fork-block ] 7 | ``` 8 | 9 | The value passed to `--fork-network` should be the URL to a Starknet JSON-RPC API provider. Specifying a `--fork-block` is optional; it defaults to the `"latest"` block at the time of Devnet's start-up. All calls will first try Devnet's state and then fall back to the forking block. 10 | 11 | :::note How it works 12 | 13 | When you send a request to a forked Devnet instance, it first queries Devnet's local state, then it tries the forking origin. The forking is not simply performed on Devnet startup, but happens continuously while the Devnet instance is alive. 14 | 15 | ::: 16 | 17 | ## Account impersonation 18 | 19 | [Here](./account-impersonation) you can read more about acting as an account deployed on the origin. 20 | 21 | ## Deploying an undeclared account 22 | 23 | [Here](./predeployed#deploying-an-undeclared-account) you can read about deploying an account not declared on Devnet. 24 | 25 | ## Checking forking status 26 | 27 | To see if your Devnet instance is using forking or not, [fetch the current configuration](./api#config-api), and check the `url` property of its `fork_config` property. If Devnet is forked, this property contains the string of the origin URL specified on startup. 28 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.3.0/gas.md: -------------------------------------------------------------------------------- 1 | # Gas price modification 2 | 3 | ## On Devnet startup - via CLI 4 | 5 | All gas prices (L1 gas, L1 data gas, L2 gas) can be specified on startup, via their respective CLI params. Check `starknet-devnet --help | grep price` for more info. 6 | 7 | ## On a running Devnet - via JSON-RPC 8 | 9 | The `devnet_setGasPrice` RPC method allows users to modify the current gas prices on a running Devnet. This feature is particularly useful for testing purposes and for adjustments needed after forking to align with the forked network's gas prices. All parameters are optional, allowing you to choose which ones you want to set. A boolean flag `generate_block` indicates whether a new block should be generated immediately after setting the gas prices. 10 | 11 | ### Explanation 12 | 13 | The modified gas prices take effect starting with the next block that is generated. 14 | 15 | ### generate_block 16 | 17 | - When set to `true`, a new block will be generated immediately after the gas prices are set. This ensures that the changes take effect right away and are reflected in the devnet state without waiting for the next block generation. 18 | - When set to `false` (or omitted), the gas prices will be set, but the changes will not be immediately committed to the devnet state until the next block is generated through the usual block generation process. 19 | 20 | ### JSON-RPC Request 21 | 22 | The following JSON-RPC request can be used to set gas prices (all properties optional): 23 | 24 | ```json 25 | JSON-RPC 26 | { 27 | "jsonrpc": "2.0", 28 | "id": "1", 29 | "method": "devnet_setGasPrice", 30 | "params": { 31 | "gas_price_wei": 1000000, 32 | "data_gas_price_wei": 10000, 33 | "gas_price_fri": 10000, 34 | "data_gas_price_fri": 10000, 35 | "l2_gas_price_wei": 1000000, 36 | "l2_gas_price_fri": 10000, 37 | "generate_block": false, 38 | } 39 | } 40 | ``` 41 | 42 | ## Response 43 | 44 | The expected response from the server will mirror the request gas parameters, confirming the modification of gas prices: 45 | 46 | ```json 47 | { 48 | "gas_price_wei": 1000000, 49 | "data_gas_price_wei": 10000, 50 | "gas_price_fri": 10000, 51 | "data_gas_price_fri": 10000, 52 | "l2_gas_price_wei": 10000, 53 | "l2_gas_price_fri": 10000 54 | } 55 | ``` 56 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.3.0/historic-state.md: -------------------------------------------------------------------------------- 1 | # Historic state support 2 | 3 | With state archive capacity set to `full`, Devnet will store full state history, enabling its querying by block hash or number. The default mode is `none`, where no old states are stored and only the latest is available for querying. 4 | 5 | ``` 6 | $ starknet-devnet --state-archive-capacity 7 | ``` 8 | 9 | All RPC endpoints that support querying the state at an old (non-latest) block only work with state archive capacity set to `full`. 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.3.0/intro.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 1 3 | --- 4 | 5 | # Intro 6 | 7 | :::danger Difference disclaimer 8 | 9 | - Devnet should not be used as a replacement for official testnets. After testing on Devnet, be sure to test on a testnet (alpha-sepolia)! 10 | - Devnet does not organize state data into Merkle-Patricia tries or similar tree-like structures, so: 11 | - calling the `starknet_getStorageProof` RPC method shall always result in `STORAGE_PROOF_NOT_SUPPORTED` 12 | - block roots are set to 0 13 | - The semantics of `REJECTED` and `REVERTED` status of a transaction is not the same as on the official testnet: 14 | 15 | | Tx status | Official testnet | Devnet | 16 | | ---------- | ----------------------------------------------------------- | ---------------------------------------------------------- | 17 | | `REJECTED` | validation failed; not included in a block | not used | 18 | | `REVERTED` | validation passed but execution failed; included in a block | validation or execution failed; not included in a block`*` | 19 | 20 | `*`: dummy zeroes (0) in tx info for block number and tx index 21 | 22 | ::: 23 | 24 | You may now proceed with [running Devnet](./running/install) and checking out the multitude of features listed in the sidebar on the left. 25 | 26 | # Limits 27 | 28 | As mentioned [here](https://docs.starknet.io/tools/limits-and-triggers/), "Starknet currently has a number of limits in place in order to keep the network stable and optimized for the best performance." Devnet uses the limits defined on that page and, for block-level limits, values defined [here (provided by the Blockifier team)](https://github.com/0xSpaceShard/starknet-devnet/blob/main/crates/starknet-devnet-core/src/utils.rs). The block-level limits are considered only when executing transactions, not when constructing the blocks themselves. I.e. if a transaction's usage of a resource exceeds its defined block-level limit, it will be reverted; but if the cumulative usage of all transactions in a block of one resource exceeds the block limit, the block will still be generated. 29 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.3.0/lite.md: -------------------------------------------------------------------------------- 1 | # Lite mode 2 | 3 | To run Devnet in a minimal lite mode, provide the flag: 4 | 5 | ``` 6 | $ starknet-devnet --lite-mode 7 | ``` 8 | 9 | Steps skipped in lite mode: 10 | 11 | - calculating block hash 12 | 13 | This is useful if your use-case doesn't need the functionalities above. 14 | 15 | The extent of what is affected by lite mode may be expanded in the future. 16 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.3.0/restrictive.md: -------------------------------------------------------------------------------- 1 | # Restrictive mode 2 | 3 | The --restrictive-mode argument enables a restrictive mode for Devnet, allowing you to specify methods that are forbidden during execution. This option ensures that certain operations are restricted, enhancing control over Devnet's behavior. When a user sends a request to one of the restricted methods, Devnet will return either a JSON-RPC error with code -32604 or, if the method was targeted directly via the HTTP endpoint, a response with status 403. 4 | 5 | ## Default restricted methods 6 | 7 | When no methods are specified, the following default methods will be restricted and their HTTP endpoints counterparts (if any): 8 | 9 | - devnet_mint 10 | - devnet_load 11 | - devnet_restart 12 | - devnet_createBlock 13 | - devnet_abortBlocks 14 | - devnet_impersonateAccount 15 | - devnet_autoImpersonate 16 | - devnet_getPredeployedAccounts 17 | 18 | ## Usage 19 | 20 | ### With default methods 21 | 22 | ``` 23 | $ starknet-devnet --restrictive-mode 24 | ``` 25 | 26 | ### With a list of methods 27 | 28 | Note! Devnet will fail to start if any of the methods/routes is misspelled. 29 | 30 | ``` 31 | $ starknet-devnet --restrictive-mode devnet_dump devnet_config 32 | ``` 33 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.3.0/running/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Running", 3 | "position": 2, 4 | "link": { 5 | "type": "generated-index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.0/examples.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | Usage examples relying on the [`starknet-devnet-js`](https://github.com/0xspaceShard/starknet-devnet-js) library can be found [here](https://github.com/0xSpaceShard/starknet-devnet-js/tree/master/test). 4 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.0/forking.md: -------------------------------------------------------------------------------- 1 | # Forking 2 | 3 | To interact with contracts deployed on mainnet or testnet, you can use forking. Simulate the origin and experiment with it locally, making no changes to the origin itself. 4 | 5 | ``` 6 | $ starknet-devnet --fork-network [--fork-block ] 7 | ``` 8 | 9 | The value passed to `--fork-network` should be the URL to a Starknet JSON-RPC API provider. Specifying a `--fork-block` is optional; it defaults to the `"latest"` block at the time of Devnet's start-up. All calls will first try Devnet's state and then fall back to the forking block. 10 | 11 | :::note How it works 12 | 13 | When you send a request to a forked Devnet instance, it first queries Devnet's local state, then it tries the forking origin. The forking is not simply performed on Devnet startup, but happens continuously while the Devnet instance is alive. 14 | 15 | ::: 16 | 17 | ## Account impersonation 18 | 19 | [Here](./account-impersonation) you can read more about acting as an account deployed on the origin. 20 | 21 | ## Deploying an undeclared account 22 | 23 | [Here](./predeployed#deploying-an-undeclared-account) you can read about deploying an account not declared on Devnet. 24 | 25 | ## Checking forking status 26 | 27 | To see if your Devnet instance is using forking or not, [fetch the current configuration](./api#config-api), and check the `url` property of its `fork_config` property. If Devnet is forked, this property contains the string of the origin URL specified on startup. 28 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.0/gas.md: -------------------------------------------------------------------------------- 1 | # Gas price modification 2 | 3 | ## On Devnet startup - via CLI 4 | 5 | All gas prices (L1 gas, L1 data gas, L2 gas) can be specified on startup, via their respective CLI params. Check `starknet-devnet --help | grep price` for more info. 6 | 7 | ## On a running Devnet - via JSON-RPC 8 | 9 | The `devnet_setGasPrice` RPC method allows users to modify the current gas prices on a running Devnet. This feature is particularly useful for testing purposes and for adjustments needed after forking to align with the forked network's gas prices. All parameters are optional, allowing you to choose which ones you want to set. A boolean flag `generate_block` indicates whether a new block should be generated immediately after setting the gas prices. 10 | 11 | ### Explanation 12 | 13 | The modified gas prices take effect starting with the next block that is generated. 14 | 15 | ### generate_block 16 | 17 | - When set to `true`, a new block will be generated immediately after the gas prices are set. This ensures that the changes take effect right away and are reflected in the devnet state without waiting for the next block generation. 18 | - When set to `false` (or omitted), the gas prices will be set, but the changes will not be immediately committed to the devnet state until the next block is generated through the usual block generation process. 19 | 20 | ### JSON-RPC Request 21 | 22 | The following JSON-RPC request can be used to set gas prices (all properties optional): 23 | 24 | ```json 25 | JSON-RPC 26 | { 27 | "jsonrpc": "2.0", 28 | "id": "1", 29 | "method": "devnet_setGasPrice", 30 | "params": { 31 | "gas_price_wei": 1000000, 32 | "data_gas_price_wei": 10000, 33 | "gas_price_fri": 10000, 34 | "data_gas_price_fri": 10000, 35 | "l2_gas_price_wei": 1000000, 36 | "l2_gas_price_fri": 10000, 37 | "generate_block": false, 38 | } 39 | } 40 | ``` 41 | 42 | ## Response 43 | 44 | The expected response from the server will mirror the request gas parameters, confirming the modification of gas prices: 45 | 46 | ```json 47 | { 48 | "gas_price_wei": 1000000, 49 | "data_gas_price_wei": 10000, 50 | "gas_price_fri": 10000, 51 | "data_gas_price_fri": 10000, 52 | "l2_gas_price_wei": 10000, 53 | "l2_gas_price_fri": 10000 54 | } 55 | ``` 56 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.0/historic-state.md: -------------------------------------------------------------------------------- 1 | # Historic state support 2 | 3 | With state archive capacity set to `full`, Devnet will store full state history, enabling its querying by block hash or number. The default mode is `none`, where no old states are stored and only the latest is available for querying. 4 | 5 | ``` 6 | $ starknet-devnet --state-archive-capacity 7 | ``` 8 | 9 | All RPC endpoints that support querying the state at an old (non-latest) block only work with state archive capacity set to `full`. 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.0/intro.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 1 3 | --- 4 | 5 | # Intro 6 | 7 | :::danger Difference disclaimer 8 | 9 | - Devnet should not be used as a replacement for official testnets. After testing on Devnet, be sure to test on a testnet (alpha-sepolia)! 10 | - Devnet does not organize state data into Merkle-Patricia tries or similar tree-like structures, so: 11 | - calling the `starknet_getStorageProof` RPC method shall always result in `STORAGE_PROOF_NOT_SUPPORTED` 12 | - block roots are set to 0 13 | - The semantics of `REJECTED` and `REVERTED` status of a transaction is not the same as on the official testnet: 14 | 15 | | Tx status | Official testnet | Devnet | 16 | | ---------- | ----------------------------------------------------------- | ---------------------------------------------------------- | 17 | | `REJECTED` | validation failed; not included in a block | not used | 18 | | `REVERTED` | validation passed but execution failed; included in a block | validation or execution failed; not included in a block`*` | 19 | 20 | `*`: dummy zeroes (0) in tx info for block number and tx index 21 | 22 | ::: 23 | 24 | You may now proceed with [running Devnet](./running/install) and checking out the multitude of features listed in the sidebar on the left. 25 | 26 | # Limits 27 | 28 | As mentioned [here](https://docs.starknet.io/tools/limits-and-triggers/), "Starknet currently has a number of limits in place in order to keep the network stable and optimized for the best performance." Devnet uses the limits defined on that page and, for block-level limits, values defined [here (provided by the Blockifier team)](https://github.com/0xSpaceShard/starknet-devnet/blob/main/crates/starknet-devnet-core/src/utils.rs). The block-level limits are considered only when executing transactions, not when constructing the blocks themselves. I.e. if a transaction's usage of a resource exceeds its defined block-level limit, it will be reverted; but if the cumulative usage of all transactions in a block of one resource exceeds the block limit, the block will still be generated. 29 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.0/lite.md: -------------------------------------------------------------------------------- 1 | # Lite mode 2 | 3 | To run Devnet in a minimal lite mode, provide the flag: 4 | 5 | ``` 6 | $ starknet-devnet --lite-mode 7 | ``` 8 | 9 | Steps skipped in lite mode: 10 | 11 | - calculating block hash 12 | 13 | This is useful if your use-case doesn't need the functionalities above. 14 | 15 | The extent of what is affected by lite mode may be expanded in the future. 16 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.0/restrictive.md: -------------------------------------------------------------------------------- 1 | # Restrictive mode 2 | 3 | The `--restrictive-mode` argument enables a restrictive mode for Devnet, allowing you to specify methods that are forbidden during execution. This option ensures that certain operations are restricted, enhancing control over Devnet's behavior. When a user sends a request to one of the restricted methods, Devnet will return either a JSON-RPC error with code -32604 or, if the method was targeted directly via the HTTP endpoint, a response with status 403. 4 | 5 | ## Default restricted methods 6 | 7 | When no methods are specified, the following default methods will be restricted, together with their HTTP endpoint counterparts (if any): 8 | 9 | - devnet_mint 10 | - devnet_load 11 | - devnet_restart 12 | - devnet_createBlock 13 | - devnet_abortBlocks 14 | - devnet_impersonateAccount 15 | - devnet_autoImpersonate 16 | - devnet_getPredeployedAccounts 17 | 18 | ## Usage 19 | 20 | ### With default methods 21 | 22 | ``` 23 | $ starknet-devnet --restrictive-mode 24 | ``` 25 | 26 | ### With a list of methods 27 | 28 | :::note 29 | 30 | Devnet will fail to start if any of the methods/routes are misspelled. 31 | 32 | ::: 33 | 34 | ``` 35 | $ starknet-devnet --restrictive-mode devnet_dump devnet_config 36 | ``` 37 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.0/running/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Running", 3 | "position": 2, 4 | "link": { 5 | "type": "generated-index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.1/examples.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | Usage examples relying on the [`starknet-devnet-js`](https://github.com/0xspaceShard/starknet-devnet-js) library can be found [here](https://github.com/0xSpaceShard/starknet-devnet-js/tree/master/test). 4 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.1/forking.md: -------------------------------------------------------------------------------- 1 | # Forking 2 | 3 | To interact with contracts deployed on mainnet or testnet, you can use forking. Simulate the origin and experiment with it locally, making no changes to the origin itself. 4 | 5 | ``` 6 | $ starknet-devnet --fork-network [--fork-block ] 7 | ``` 8 | 9 | The value passed to `--fork-network` should be the URL to a Starknet JSON-RPC API provider. Specifying a `--fork-block` is optional; it defaults to the `"latest"` block at the time of Devnet's start-up. All calls will first try Devnet's state and then fall back to the forking block. 10 | 11 | :::note How it works 12 | 13 | When you send a request to a forked Devnet instance, it first queries Devnet's local state, then it tries the forking origin. The forking is not simply performed on Devnet startup, but happens continuously while the Devnet instance is alive. 14 | 15 | ::: 16 | 17 | ## Account impersonation 18 | 19 | [Here](./account-impersonation) you can read more about acting as an account deployed on the origin. 20 | 21 | ## Deploying an undeclared account 22 | 23 | [Here](./predeployed#deploying-an-undeclared-account) you can read about deploying an account not declared on Devnet. 24 | 25 | ## Checking forking status 26 | 27 | To see if your Devnet instance is using forking or not, [fetch the current configuration](./api#config-api), and check the `url` property of its `fork_config` property. If Devnet is forked, this property contains the string of the origin URL specified on startup. 28 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.1/gas.md: -------------------------------------------------------------------------------- 1 | # Gas price modification 2 | 3 | ## On Devnet startup - via CLI 4 | 5 | All gas prices (L1 gas, L1 data gas, L2 gas) can be specified on startup, via their respective CLI params. Check `starknet-devnet --help | grep price` for more info. 6 | 7 | ## On a running Devnet - via JSON-RPC 8 | 9 | The `devnet_setGasPrice` RPC method allows users to modify the current gas prices on a running Devnet. This feature is particularly useful for testing purposes and for adjustments needed after forking to align with the forked network's gas prices. All parameters are optional, allowing you to choose which ones you want to set. A boolean flag `generate_block` indicates whether a new block should be generated immediately after setting the gas prices. 10 | 11 | ### Explanation 12 | 13 | The modified gas prices take effect starting with the next block that is generated. 14 | 15 | ### generate_block 16 | 17 | - When set to `true`, a new block will be generated immediately after the gas prices are set. This ensures that the changes take effect right away and are reflected in the devnet state without waiting for the next block generation. 18 | - When set to `false` (or omitted), the gas prices will be set, but the changes will not be immediately committed to the devnet state until the next block is generated through the usual block generation process. 19 | 20 | ### JSON-RPC Request 21 | 22 | The following JSON-RPC request can be used to set gas prices (all properties optional): 23 | 24 | ```json 25 | JSON-RPC 26 | { 27 | "jsonrpc": "2.0", 28 | "id": "1", 29 | "method": "devnet_setGasPrice", 30 | "params": { 31 | "gas_price_wei": 1000000, 32 | "data_gas_price_wei": 10000, 33 | "gas_price_fri": 10000, 34 | "data_gas_price_fri": 10000, 35 | "l2_gas_price_wei": 1000000, 36 | "l2_gas_price_fri": 10000, 37 | "generate_block": false, 38 | } 39 | } 40 | ``` 41 | 42 | ## Response 43 | 44 | The expected response from the server will mirror the request gas parameters, confirming the modification of gas prices: 45 | 46 | ```json 47 | { 48 | "gas_price_wei": 1000000, 49 | "data_gas_price_wei": 10000, 50 | "gas_price_fri": 10000, 51 | "data_gas_price_fri": 10000, 52 | "l2_gas_price_wei": 10000, 53 | "l2_gas_price_fri": 10000 54 | } 55 | ``` 56 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.1/historic-state.md: -------------------------------------------------------------------------------- 1 | # Historic state support 2 | 3 | With state archive capacity set to `full`, Devnet will store full state history, enabling its querying by block hash or number. The default mode is `none`, where no old states are stored and only the latest is available for querying. 4 | 5 | ``` 6 | $ starknet-devnet --state-archive-capacity 7 | ``` 8 | 9 | All RPC endpoints that support querying the state at an old (non-latest) block only work with state archive capacity set to `full`. 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.1/intro.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 1 3 | --- 4 | 5 | # Intro 6 | 7 | :::danger Difference disclaimer 8 | 9 | - Devnet should not be used as a replacement for official testnets. After testing on Devnet, be sure to test on a testnet (alpha-sepolia)! 10 | - Devnet does not organize state data into Merkle-Patricia tries or similar tree-like structures, so: 11 | - calling the `starknet_getStorageProof` RPC method shall always result in `STORAGE_PROOF_NOT_SUPPORTED` 12 | - block roots are set to 0 13 | - The semantics of `REJECTED` and `REVERTED` status of a transaction is not the same as on the official testnet: 14 | 15 | | Tx status | Official testnet | Devnet | 16 | | ---------- | ----------------------------------------------------------- | ---------------------------------------------------------- | 17 | | `REJECTED` | validation failed; not included in a block | not used | 18 | | `REVERTED` | validation passed but execution failed; included in a block | validation or execution failed; not included in a block`*` | 19 | 20 | `*`: dummy zeroes (0) in tx info for block number and tx index 21 | 22 | ::: 23 | 24 | You may now proceed with [running Devnet](./running/install) and checking out the multitude of features listed in the sidebar on the left. 25 | 26 | # Limits 27 | 28 | As mentioned [here](https://docs.starknet.io/tools/limits-and-triggers/), "Starknet currently has a number of limits in place in order to keep the network stable and optimized for the best performance." Devnet uses the limits defined on that page and, for block-level limits, values defined [here (provided by the Blockifier team)](https://github.com/0xSpaceShard/starknet-devnet/blob/main/crates/starknet-devnet-core/src/utils.rs). The block-level limits are considered only when executing transactions, not when constructing the blocks themselves. I.e. if a transaction's usage of a resource exceeds its defined block-level limit, it will be reverted; but if the cumulative usage of all transactions in a block of one resource exceeds the block limit, the block will still be generated. 29 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.1/lite.md: -------------------------------------------------------------------------------- 1 | # Lite mode 2 | 3 | To run Devnet in a minimal lite mode, provide the flag: 4 | 5 | ``` 6 | $ starknet-devnet --lite-mode 7 | ``` 8 | 9 | Steps skipped in lite mode: 10 | 11 | - calculating block hash 12 | 13 | This is useful if your use-case doesn't need the functionalities above. 14 | 15 | The extent of what is affected by lite mode may be expanded in the future. 16 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.1/restrictive.md: -------------------------------------------------------------------------------- 1 | # Restrictive mode 2 | 3 | The `--restrictive-mode` argument enables a restrictive mode for Devnet, allowing you to specify methods that are forbidden during execution. This option ensures that certain operations are restricted, enhancing control over Devnet's behavior. When a user sends a request to one of the restricted methods, Devnet will return either a JSON-RPC error with code -32604 or, if the method was targeted directly via the HTTP endpoint, a response with status 403. 4 | 5 | ## Default restricted methods 6 | 7 | When no methods are specified, the following default methods will be restricted, together with their HTTP endpoint counterparts (if any): 8 | 9 | - devnet_mint 10 | - devnet_load 11 | - devnet_restart 12 | - devnet_createBlock 13 | - devnet_abortBlocks 14 | - devnet_impersonateAccount 15 | - devnet_autoImpersonate 16 | - devnet_getPredeployedAccounts 17 | 18 | ## Usage 19 | 20 | ### With default methods 21 | 22 | ``` 23 | $ starknet-devnet --restrictive-mode 24 | ``` 25 | 26 | ### With a list of methods 27 | 28 | :::note 29 | 30 | Devnet will fail to start if any of the methods/routes are misspelled. 31 | 32 | ::: 33 | 34 | ``` 35 | $ starknet-devnet --restrictive-mode devnet_dump devnet_config 36 | ``` 37 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.1/running/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Running", 3 | "position": 2, 4 | "link": { 5 | "type": "generated-index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.2/examples.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | Usage examples relying on the [`starknet-devnet-js`](https://github.com/0xspaceShard/starknet-devnet-js) library can be found [here](https://github.com/0xSpaceShard/starknet-devnet-js/tree/master/test). 4 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.2/forking.md: -------------------------------------------------------------------------------- 1 | # Forking 2 | 3 | To interact with contracts deployed on mainnet or testnet, you can use forking. Simulate the origin and experiment with it locally, making no changes to the origin itself. 4 | 5 | ``` 6 | $ starknet-devnet --fork-network [--fork-block ] 7 | ``` 8 | 9 | The value passed to `--fork-network` should be the URL to a Starknet JSON-RPC API provider. Specifying a `--fork-block` is optional; it defaults to the `"latest"` block at the time of Devnet's start-up. All calls will first try Devnet's state and then fall back to the forking block. 10 | 11 | :::note How it works 12 | 13 | When you send a request to a forked Devnet instance, it first queries Devnet's local state, then it tries the forking origin. The forking is not simply performed on Devnet startup, but happens continuously while the Devnet instance is alive. 14 | 15 | ::: 16 | 17 | ## Account impersonation 18 | 19 | [Here](./account-impersonation) you can read more about acting as an account deployed on the origin. 20 | 21 | ## Deploying an undeclared account 22 | 23 | [Here](./predeployed#deploying-an-undeclared-account) you can read about deploying an account not declared on Devnet. 24 | 25 | ## Checking forking status 26 | 27 | To see if your Devnet instance is using forking or not, [fetch the current configuration](./api#config-api), and check the `url` property of its `fork_config` property. If Devnet is forked, this property contains the string of the origin URL specified on startup. 28 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.2/gas.md: -------------------------------------------------------------------------------- 1 | # Gas price modification 2 | 3 | ## On Devnet startup - via CLI 4 | 5 | All gas prices (L1 gas, L1 data gas, L2 gas) can be specified on startup, via their respective CLI params. Check `starknet-devnet --help | grep price` for more info. 6 | 7 | ## On a running Devnet - via JSON-RPC 8 | 9 | The `devnet_setGasPrice` RPC method allows users to modify the current gas prices on a running Devnet. This feature is particularly useful for testing purposes and for adjustments needed after forking to align with the forked network's gas prices. All parameters are optional, allowing you to choose which ones you want to set. A boolean flag `generate_block` indicates whether a new block should be generated immediately after setting the gas prices. 10 | 11 | ### Explanation 12 | 13 | The modified gas prices take effect starting with the next block that is generated. 14 | 15 | ### generate_block 16 | 17 | - When set to `true`, a new block will be generated immediately after the gas prices are set. This ensures that the changes take effect right away and are reflected in the devnet state without waiting for the next block generation. 18 | - When set to `false` (or omitted), the gas prices will be set, but the changes will not be immediately committed to the devnet state until the next block is generated through the usual block generation process. 19 | 20 | ### JSON-RPC Request 21 | 22 | The following JSON-RPC request can be used to set gas prices (all properties optional): 23 | 24 | ```json 25 | JSON-RPC 26 | { 27 | "jsonrpc": "2.0", 28 | "id": "1", 29 | "method": "devnet_setGasPrice", 30 | "params": { 31 | "gas_price_wei": 1000000, 32 | "data_gas_price_wei": 10000, 33 | "gas_price_fri": 10000, 34 | "data_gas_price_fri": 10000, 35 | "l2_gas_price_wei": 1000000, 36 | "l2_gas_price_fri": 10000, 37 | "generate_block": false, 38 | } 39 | } 40 | ``` 41 | 42 | ## Response 43 | 44 | The expected response from the server will mirror the request gas parameters, confirming the modification of gas prices: 45 | 46 | ```json 47 | { 48 | "gas_price_wei": 1000000, 49 | "data_gas_price_wei": 10000, 50 | "gas_price_fri": 10000, 51 | "data_gas_price_fri": 10000, 52 | "l2_gas_price_wei": 10000, 53 | "l2_gas_price_fri": 10000 54 | } 55 | ``` 56 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.2/historic-state.md: -------------------------------------------------------------------------------- 1 | # Historic state support 2 | 3 | With state archive capacity set to `full`, Devnet will store full state history, enabling its querying by block hash or number. The default mode is `none`, where no old states are stored and only the latest is available for querying. 4 | 5 | ``` 6 | $ starknet-devnet --state-archive-capacity 7 | ``` 8 | 9 | All RPC endpoints that support querying the state at an old (non-latest) block only work with state archive capacity set to `full`. 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.2/intro.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 1 3 | --- 4 | 5 | # Intro 6 | 7 | :::danger Difference disclaimer 8 | 9 | - Devnet should not be used as a replacement for official testnets. After testing on Devnet, be sure to test on a testnet (alpha-sepolia)! 10 | - Devnet does not organize state data into Merkle-Patricia tries or similar tree-like structures, so: 11 | - calling the `starknet_getStorageProof` RPC method shall always result in `STORAGE_PROOF_NOT_SUPPORTED` 12 | - block roots are set to 0 13 | - The semantics of `REJECTED` and `REVERTED` status of a transaction is not the same as on the official testnet: 14 | 15 | | Tx status | Official testnet | Devnet | 16 | | ---------- | ----------------------------------------------------------- | ---------------------------------------------------------- | 17 | | `REJECTED` | validation failed; not included in a block | not used | 18 | | `REVERTED` | validation passed but execution failed; included in a block | validation or execution failed; not included in a block`*` | 19 | 20 | `*`: dummy zeroes (0) in tx info for block number and tx index 21 | 22 | ::: 23 | 24 | You may now proceed with [running Devnet](./running/install) and checking out the multitude of features listed in the sidebar on the left. 25 | 26 | # Limits 27 | 28 | As mentioned [here](https://docs.starknet.io/tools/limits-and-triggers/), "Starknet currently has a number of limits in place in order to keep the network stable and optimized for the best performance." Devnet uses the limits defined on that page and, for block-level limits, values defined [here (provided by the Blockifier team)](https://github.com/0xSpaceShard/starknet-devnet/blob/main/crates/starknet-devnet-core/src/utils.rs). The block-level limits are considered only when executing transactions, not when constructing the blocks themselves. I.e. if a transaction's usage of a resource exceeds its defined block-level limit, it will be reverted; but if the cumulative usage of all transactions in a block of one resource exceeds the block limit, the block will still be generated. 29 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.2/lite.md: -------------------------------------------------------------------------------- 1 | # Lite mode 2 | 3 | To run Devnet in a minimal lite mode, provide the flag: 4 | 5 | ``` 6 | $ starknet-devnet --lite-mode 7 | ``` 8 | 9 | Steps skipped in lite mode: 10 | 11 | - calculating block hash 12 | 13 | This is useful if your use-case doesn't need the functionalities above. 14 | 15 | The extent of what is affected by lite mode may be expanded in the future. 16 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.2/restrictive.md: -------------------------------------------------------------------------------- 1 | # Restrictive mode 2 | 3 | The `--restrictive-mode` argument enables a restrictive mode for Devnet, allowing you to specify methods that are forbidden during execution. This option ensures that certain operations are restricted, enhancing control over Devnet's behavior. When a user sends a request to one of the restricted methods, Devnet will return either a JSON-RPC error with code -32604 or, if the method was targeted directly via the HTTP endpoint, a response with status 403. 4 | 5 | ## Default restricted methods 6 | 7 | When no methods are specified, the following default methods will be restricted, together with their HTTP endpoint counterparts (if any): 8 | 9 | - devnet_mint 10 | - devnet_load 11 | - devnet_restart 12 | - devnet_createBlock 13 | - devnet_abortBlocks 14 | - devnet_impersonateAccount 15 | - devnet_autoImpersonate 16 | - devnet_getPredeployedAccounts 17 | 18 | ## Usage 19 | 20 | ### With default methods 21 | 22 | ``` 23 | $ starknet-devnet --restrictive-mode 24 | ``` 25 | 26 | ### With a list of methods 27 | 28 | :::note 29 | 30 | Devnet will fail to start if any of the methods/routes are misspelled. 31 | 32 | ::: 33 | 34 | ``` 35 | $ starknet-devnet --restrictive-mode devnet_dump devnet_config 36 | ``` 37 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.2/running/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Running", 3 | "position": 2, 4 | "link": { 5 | "type": "generated-index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.3/examples.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | Usage examples relying on the [`starknet-devnet-js`](https://github.com/0xspaceShard/starknet-devnet-js) library can be found [here](https://github.com/0xSpaceShard/starknet-devnet-js/tree/master/test). 4 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.3/forking.md: -------------------------------------------------------------------------------- 1 | # Forking 2 | 3 | To interact with contracts deployed on mainnet or testnet, you can use forking. Simulate the origin and experiment with it locally, making no changes to the origin itself. 4 | 5 | ``` 6 | $ starknet-devnet --fork-network [--fork-block ] 7 | ``` 8 | 9 | The value passed to `--fork-network` should be the URL to a Starknet JSON-RPC API provider. Specifying a `--fork-block` is optional; it defaults to the `"latest"` block at the time of Devnet's start-up. All calls will first try Devnet's state and then fall back to the forking block. 10 | 11 | :::note How it works 12 | 13 | When you send a request to a forked Devnet instance, it first queries Devnet's local state, then it tries the forking origin. The forking is not simply performed on Devnet startup, but happens continuously while the Devnet instance is alive. 14 | 15 | ::: 16 | 17 | ## Account impersonation 18 | 19 | [Here](./account-impersonation) you can read more about acting as an account deployed on the origin. 20 | 21 | ## Deploying an undeclared account 22 | 23 | [Here](./predeployed#deploying-an-undeclared-account) you can read about deploying an account not declared on Devnet. 24 | 25 | ## Checking forking status 26 | 27 | To see if your Devnet instance is using forking or not, [fetch the current configuration](./api#config-api), and check the `url` property of its `fork_config` property. If Devnet is forked, this property contains the string of the origin URL specified on startup. 28 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.3/gas.md: -------------------------------------------------------------------------------- 1 | # Gas price modification 2 | 3 | ## On Devnet startup - via CLI 4 | 5 | All gas prices (L1 gas, L1 data gas, L2 gas) can be specified on startup, via their respective CLI params. Check `starknet-devnet --help | grep price` for more info. 6 | 7 | ## On a running Devnet - via JSON-RPC 8 | 9 | The `devnet_setGasPrice` RPC method allows users to modify the current gas prices on a running Devnet. This feature is particularly useful for testing purposes and for adjustments needed after forking to align with the forked network's gas prices. All parameters are optional, allowing you to choose which ones you want to set. A boolean flag `generate_block` indicates whether a new block should be generated immediately after setting the gas prices. 10 | 11 | ### Explanation 12 | 13 | The modified gas prices take effect starting with the next block that is generated. 14 | 15 | ### generate_block 16 | 17 | - When set to `true`, a new block will be generated immediately after the gas prices are set. This ensures that the changes take effect right away and are reflected in the devnet state without waiting for the next block generation. 18 | - When set to `false` (or omitted), the gas prices will be set, but the changes will not be immediately committed to the devnet state until the next block is generated through the usual block generation process. 19 | 20 | ### JSON-RPC Request 21 | 22 | The following JSON-RPC request can be used to set gas prices (all properties optional): 23 | 24 | ```json 25 | JSON-RPC 26 | { 27 | "jsonrpc": "2.0", 28 | "id": "1", 29 | "method": "devnet_setGasPrice", 30 | "params": { 31 | "gas_price_wei": 1000000, 32 | "data_gas_price_wei": 10000, 33 | "gas_price_fri": 10000, 34 | "data_gas_price_fri": 10000, 35 | "l2_gas_price_wei": 1000000, 36 | "l2_gas_price_fri": 10000, 37 | "generate_block": false, 38 | } 39 | } 40 | ``` 41 | 42 | ## Response 43 | 44 | The expected response from the server will mirror the request gas parameters, confirming the modification of gas prices: 45 | 46 | ```json 47 | { 48 | "gas_price_wei": 1000000, 49 | "data_gas_price_wei": 10000, 50 | "gas_price_fri": 10000, 51 | "data_gas_price_fri": 10000, 52 | "l2_gas_price_wei": 10000, 53 | "l2_gas_price_fri": 10000 54 | } 55 | ``` 56 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.3/historic-state.md: -------------------------------------------------------------------------------- 1 | # Historic state support 2 | 3 | With state archive capacity set to `full`, Devnet will store full state history, enabling its querying by block hash or number. The default mode is `none`, where no old states are stored and only the latest is available for querying. 4 | 5 | ``` 6 | $ starknet-devnet --state-archive-capacity 7 | ``` 8 | 9 | All RPC endpoints that support querying the state at an old (non-latest) block only work with state archive capacity set to `full`. 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.3/intro.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 1 3 | --- 4 | 5 | # Intro 6 | 7 | :::danger Difference disclaimer 8 | 9 | - Devnet should not be used as a replacement for official testnets. After testing on Devnet, be sure to test on a testnet (alpha-sepolia)! 10 | - Devnet does not organize state data into Merkle-Patricia tries or similar tree-like structures, so: 11 | - calling the `starknet_getStorageProof` RPC method shall always result in `STORAGE_PROOF_NOT_SUPPORTED` 12 | - block roots are set to 0 13 | - The semantics of `REJECTED` and `REVERTED` status of a transaction is not the same as on the official testnet: 14 | 15 | | Tx status | Official testnet | Devnet | 16 | | ---------- | ----------------------------------------------------------- | ---------------------------------------------------------- | 17 | | `REJECTED` | validation failed; not included in a block | not used | 18 | | `REVERTED` | validation passed but execution failed; included in a block | validation or execution failed; not included in a block`*` | 19 | 20 | `*`: dummy zeroes (0) in tx info for block number and tx index 21 | 22 | ::: 23 | 24 | You may now proceed with [running Devnet](./running/install) and checking out the multitude of features listed in the sidebar on the left. 25 | 26 | # Limits 27 | 28 | As mentioned [here](https://docs.starknet.io/tools/limits-and-triggers/), "Starknet currently has a number of limits in place in order to keep the network stable and optimized for the best performance." Devnet uses the limits defined on that page and, for block-level limits, values defined [here (provided by the Blockifier team)](https://github.com/0xSpaceShard/starknet-devnet/blob/main/crates/starknet-devnet-core/src/utils.rs). The block-level limits are considered only when executing transactions, not when constructing the blocks themselves. I.e. if a transaction's usage of a resource exceeds its defined block-level limit, it will be reverted; but if the cumulative usage of all transactions in a block of one resource exceeds the block limit, the block will still be generated. 29 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.3/lite.md: -------------------------------------------------------------------------------- 1 | # Lite mode 2 | 3 | To run Devnet in a minimal lite mode, provide the flag: 4 | 5 | ``` 6 | $ starknet-devnet --lite-mode 7 | ``` 8 | 9 | Steps skipped in lite mode: 10 | 11 | - calculating block hash 12 | 13 | This is useful if your use-case doesn't need the functionalities above. 14 | 15 | The extent of what is affected by lite mode may be expanded in the future. 16 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.3/restrictive.md: -------------------------------------------------------------------------------- 1 | # Restrictive mode 2 | 3 | The `--restrictive-mode` argument enables a restrictive mode for Devnet, allowing you to specify methods that are forbidden during execution. This option ensures that certain operations are restricted, enhancing control over Devnet's behavior. When a user sends a request to one of the restricted methods, Devnet will return either a JSON-RPC error with code -32604 or, if the method was targeted directly via the HTTP endpoint, a response with status 403. 4 | 5 | ## Default restricted methods 6 | 7 | When no methods are specified, the following default methods will be restricted, together with their HTTP endpoint counterparts (if any): 8 | 9 | - devnet_mint 10 | - devnet_load 11 | - devnet_restart 12 | - devnet_createBlock 13 | - devnet_abortBlocks 14 | - devnet_impersonateAccount 15 | - devnet_autoImpersonate 16 | - devnet_getPredeployedAccounts 17 | 18 | ## Usage 19 | 20 | ### With default methods 21 | 22 | ``` 23 | $ starknet-devnet --restrictive-mode 24 | ``` 25 | 26 | ### With a list of methods 27 | 28 | :::note 29 | 30 | Devnet will fail to start if any of the methods/routes are misspelled. 31 | 32 | ::: 33 | 34 | ``` 35 | $ starknet-devnet --restrictive-mode devnet_dump devnet_config 36 | ``` 37 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.4.3/running/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Running", 3 | "position": 2, 4 | "link": { 5 | "type": "generated-index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.5.0/examples.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | Usage examples relying on the [`starknet-devnet-js`](https://github.com/0xspaceShard/starknet-devnet-js) library can be found [here](https://github.com/0xSpaceShard/starknet-devnet-js/tree/master/test). 4 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.5.0/forking.md: -------------------------------------------------------------------------------- 1 | # Forking 2 | 3 | To interact with contracts deployed on mainnet or testnet, you can use forking. Simulate the origin and experiment with it locally, making no changes to the origin itself. 4 | 5 | ``` 6 | $ starknet-devnet --fork-network [--fork-block ] 7 | ``` 8 | 9 | The value passed to `--fork-network` should be the URL to a Starknet JSON-RPC API provider. Specifying a `--fork-block` is optional; it defaults to the `"latest"` block at the time of Devnet's start-up. All calls will first try Devnet's state and then fall back to the forking block. 10 | 11 | :::note How it works 12 | 13 | When you send a request to a forked Devnet instance, it first queries Devnet's local state, then tries the forking origin. Forking is not a step simply performed on Devnet startup, but happens continuously while the Devnet instance is alive. 14 | 15 | ::: 16 | 17 | ## Forking and ACCEPTED_ON_L1 18 | 19 | Assume you have run Devnet as a fork from an origin at a block that is not yet `ACCEPTED_ON_L1`, but only `ACCEPTED_ON_L2`. If in your state queries you specify `block_id: "l1_accepted"`, and there are no local blocks marked as `ACCEPTED_ON_L1`, Devnet will assume the forking block has become `ACCEPTED_ON_L1`. 20 | 21 | Read more about marking blocks as `ACCEPTED_ON_L1` on Devnet: [link](./blocks#accepting-blocks-on-l1). 22 | 23 | ## Account impersonation 24 | 25 | [Here](./account-impersonation) you can read more about acting as an account deployed on the origin. 26 | 27 | ## Deploying an undeclared account 28 | 29 | [Here](./predeployed#deploying-an-undeclared-account) you can read about deploying an account not declared on Devnet. 30 | 31 | ## Checking forking status 32 | 33 | To see if your Devnet instance is using forking or not, [fetch the current configuration](./api#config-api), and check the `url` property of its `fork_config` property. If Devnet is forked, this property contains the string of the origin URL specified on startup. 34 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.5.0/gas.md: -------------------------------------------------------------------------------- 1 | # Gas price modification 2 | 3 | ## On Devnet startup - via CLI 4 | 5 | All gas prices (L1 gas, L1 data gas, L2 gas) can be specified on startup, via their respective CLI params. Check `starknet-devnet --help | grep price` for more info. 6 | 7 | ## On a running Devnet - via JSON-RPC 8 | 9 | The `devnet_setGasPrice` RPC method allows users to modify the current gas prices on a running Devnet. This feature is particularly useful for testing purposes and for adjustments needed after forking to align with the forked network's gas prices. All parameters are optional, allowing you to choose which ones you want to set. A boolean flag `generate_block` indicates whether a new block should be generated immediately after setting the gas prices. 10 | 11 | ### Explanation 12 | 13 | The modified gas prices take effect starting with the next block that is generated. 14 | 15 | ### generate_block 16 | 17 | - When set to `true`, a new block will be generated immediately after the gas prices are set. This ensures that the changes take effect right away and are reflected in the devnet state without waiting for the next block generation. 18 | - When set to `false` (or omitted), the gas prices will be set, but the changes will not be immediately committed to the devnet state until the next block is generated through the usual block generation process. 19 | 20 | ### JSON-RPC Request 21 | 22 | The following JSON-RPC request can be used to set gas prices (all properties optional): 23 | 24 | ```json 25 | JSON-RPC 26 | { 27 | "jsonrpc": "2.0", 28 | "id": "1", 29 | "method": "devnet_setGasPrice", 30 | "params": { 31 | "gas_price_wei": 1000000, 32 | "data_gas_price_wei": 10000, 33 | "gas_price_fri": 10000, 34 | "data_gas_price_fri": 10000, 35 | "l2_gas_price_wei": 1000000, 36 | "l2_gas_price_fri": 10000, 37 | "generate_block": false, 38 | } 39 | } 40 | ``` 41 | 42 | ## Response 43 | 44 | The expected response from the server will mirror the request gas parameters, confirming the modification of gas prices: 45 | 46 | ```json 47 | { 48 | "gas_price_wei": 1000000, 49 | "data_gas_price_wei": 10000, 50 | "gas_price_fri": 10000, 51 | "data_gas_price_fri": 10000, 52 | "l2_gas_price_wei": 10000, 53 | "l2_gas_price_fri": 10000 54 | } 55 | ``` 56 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.5.0/historic-state.md: -------------------------------------------------------------------------------- 1 | # Historic state support 2 | 3 | With state archive capacity set to `full`, Devnet will store full state history, enabling its querying by block hash or number. The default mode is `none`, where no old states are stored and only the latest is available for querying. 4 | 5 | ``` 6 | $ starknet-devnet --state-archive-capacity 7 | ``` 8 | 9 | All RPC endpoints that support querying the state at an old (non-latest) block only work with state archive capacity set to `full`. 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.5.0/intro.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 1 3 | --- 4 | 5 | # Intro 6 | 7 | :::danger Difference disclaimer 8 | 9 | - Devnet should not be used as a replacement for the official testnet. After testing on Devnet, be sure to test on testnet (alpha-sepolia)! 10 | - Devnet does not organize state data into Merkle-Patricia tries or similar tree-like structures, so: 11 | - calling the `starknet_getStorageProof` RPC method shall always result in `STORAGE_PROOF_NOT_SUPPORTED` 12 | - block roots are set to 0 13 | - The pre-confirmed block is equivalent to the old pending block, except that its transactions are not `ACCEPTED_ON_L2` but `PRE_CONFIRMED`. 14 | - By default, a new block is mined for each new transactions. 15 | - This can be modified by directing all new transactions into a pre-confirmed block, and at some point triggering block creation. 16 | - Transactions in a pre-confirmed block cannot be replaced by sending a transaction with a higher free from the same account. 17 | - Read more about transitioning a transaction [from `PRE_CONFIRMED` to `ACCEPTED_ON_L2`](./blocks#creating-blocks-on-demand). 18 | - `RECEIVED` and `CANDIDATE` are not used in Devnet. 19 | - Transactions are never automatically `ACCEPTED_ON_L1`, unless the user performs an action. 20 | - Read more about transitioning a transaction [from `ACCEPTED_ON_L2` to `ACCEPTED_ON_L1`](./blocks#accepting-blocks-on-l1). 21 | 22 | ::: 23 | 24 | You may now proceed with [running Devnet](./running/install) and checking out the multitude of features listed in the sidebar on the left. 25 | 26 | # Limits 27 | 28 | As mentioned [here](https://docs.starknet.io/tools/limits-and-triggers/), "Starknet currently has a number of limits in place in order to keep the network stable and optimized for the best performance." Devnet uses the limits defined on that page and, for block-level limits, values defined [here (provided by the Blockifier team)](https://github.com/0xSpaceShard/starknet-devnet/blob/main/crates/starknet-devnet-core/src/utils.rs). The block-level limits are considered only when executing transactions, not when constructing the blocks themselves. I.e. if a transaction's usage of a resource exceeds its defined block-level limit, it will be reverted; but if the cumulative usage of all transactions in a block of one resource exceeds the block limit, the block will still be generated. 29 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.5.0/lite.md: -------------------------------------------------------------------------------- 1 | # Lite mode 2 | 3 | To run Devnet in a minimal lite mode, provide the flag: 4 | 5 | ``` 6 | $ starknet-devnet --lite-mode 7 | ``` 8 | 9 | Steps skipped in lite mode: 10 | 11 | - calculating block hash 12 | 13 | This is useful if your use-case doesn't need the functionalities above. 14 | 15 | The extent of what is affected by lite mode may be expanded in the future. 16 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.5.0/restrictive.md: -------------------------------------------------------------------------------- 1 | # Restrictive mode 2 | 3 | The `--restrictive-mode` argument enables a restrictive mode for Devnet, allowing you to specify methods that are forbidden during execution. This option ensures that certain operations are restricted, enhancing control over Devnet's behavior. When a user sends a request to one of the restricted methods, Devnet will return either a JSON-RPC error with code -32604 or, if the method was targeted directly via the HTTP endpoint, a response with status 403. 4 | 5 | ## Default restricted methods 6 | 7 | When no methods are specified, the following default methods will be restricted, together with their HTTP endpoint counterparts (if any): 8 | 9 | - devnet_mint 10 | - devnet_load 11 | - devnet_restart 12 | - devnet_createBlock 13 | - devnet_abortBlocks 14 | - devnet_impersonateAccount 15 | - devnet_autoImpersonate 16 | - devnet_getPredeployedAccounts 17 | 18 | ## Usage 19 | 20 | ### With default methods 21 | 22 | ``` 23 | $ starknet-devnet --restrictive-mode 24 | ``` 25 | 26 | ### With a list of methods 27 | 28 | :::note 29 | 30 | Devnet will fail to start if any of the methods/routes are misspelled. 31 | 32 | ::: 33 | 34 | ``` 35 | $ starknet-devnet --restrictive-mode devnet_dump devnet_config 36 | ``` 37 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.5.0/running/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Running", 3 | "position": 2, 4 | "link": { 5 | "type": "generated-index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.5.1/examples.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | Usage examples relying on the [`starknet-devnet-js`](https://github.com/0xspaceShard/starknet-devnet-js) library can be found [here](https://github.com/0xSpaceShard/starknet-devnet-js/tree/master/test). 4 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.5.1/forking.md: -------------------------------------------------------------------------------- 1 | # Forking 2 | 3 | To interact with contracts deployed on mainnet or testnet, you can use forking. Simulate the origin and experiment with it locally, making no changes to the origin itself. 4 | 5 | ``` 6 | $ starknet-devnet --fork-network [--fork-block ] 7 | ``` 8 | 9 | The value passed to `--fork-network` should be the URL to a Starknet JSON-RPC API provider. Specifying a `--fork-block` is optional; it defaults to the `"latest"` block at the time of Devnet's start-up. All calls will first try Devnet's state and then fall back to the forking block. 10 | 11 | :::note How it works 12 | 13 | When you send a request to a forked Devnet instance, it first queries Devnet's local state, then tries the forking origin. Forking is not a step simply performed on Devnet startup, but happens continuously while the Devnet instance is alive. 14 | 15 | ::: 16 | 17 | ## Forking and ACCEPTED_ON_L1 18 | 19 | Assume you have run Devnet as a fork from an origin at a block that is not yet `ACCEPTED_ON_L1`, but only `ACCEPTED_ON_L2`. If in your state queries you specify `block_id: "l1_accepted"`, and there are no local blocks marked as `ACCEPTED_ON_L1`, Devnet will assume the forking block has become `ACCEPTED_ON_L1`. 20 | 21 | Read more about marking blocks as `ACCEPTED_ON_L1` on Devnet: [link](./blocks#accepting-blocks-on-l1). 22 | 23 | ## Account impersonation 24 | 25 | [Here](./account-impersonation) you can read more about acting as an account deployed on the origin. 26 | 27 | ## Deploying an undeclared account 28 | 29 | [Here](./predeployed#deploying-an-undeclared-account) you can read about deploying an account not declared on Devnet. 30 | 31 | ## Checking forking status 32 | 33 | To see if your Devnet instance is using forking or not, [fetch the current configuration](./api#config-api), and check the `url` property of its `fork_config` property. If Devnet is forked, this property contains the string of the origin URL specified on startup. 34 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.5.1/gas.md: -------------------------------------------------------------------------------- 1 | # Gas price modification 2 | 3 | ## On Devnet startup - via CLI 4 | 5 | All gas prices (L1 gas, L1 data gas, L2 gas) can be specified on startup, via their respective CLI params. Check `starknet-devnet --help | grep price` for more info. 6 | 7 | ## On a running Devnet - via JSON-RPC 8 | 9 | The `devnet_setGasPrice` RPC method allows users to modify the current gas prices on a running Devnet. This feature is particularly useful for testing purposes and for adjustments needed after forking to align with the forked network's gas prices. All parameters are optional, allowing you to choose which ones you want to set. A boolean flag `generate_block` indicates whether a new block should be generated immediately after setting the gas prices. 10 | 11 | ### Explanation 12 | 13 | The modified gas prices take effect starting with the next block that is generated. 14 | 15 | ### generate_block 16 | 17 | - When set to `true`, a new block will be generated immediately after the gas prices are set. This ensures that the changes take effect right away and are reflected in the devnet state without waiting for the next block generation. 18 | - When set to `false` (or omitted), the gas prices will be set, but the changes will not be immediately committed to the devnet state until the next block is generated through the usual block generation process. 19 | 20 | ### JSON-RPC Request 21 | 22 | The following JSON-RPC request can be used to set gas prices (all properties optional): 23 | 24 | ```json 25 | JSON-RPC 26 | { 27 | "jsonrpc": "2.0", 28 | "id": "1", 29 | "method": "devnet_setGasPrice", 30 | "params": { 31 | "gas_price_wei": 1000000, 32 | "data_gas_price_wei": 10000, 33 | "gas_price_fri": 10000, 34 | "data_gas_price_fri": 10000, 35 | "l2_gas_price_wei": 1000000, 36 | "l2_gas_price_fri": 10000, 37 | "generate_block": false, 38 | } 39 | } 40 | ``` 41 | 42 | ## Response 43 | 44 | The expected response from the server will mirror the request gas parameters, confirming the modification of gas prices: 45 | 46 | ```json 47 | { 48 | "gas_price_wei": 1000000, 49 | "data_gas_price_wei": 10000, 50 | "gas_price_fri": 10000, 51 | "data_gas_price_fri": 10000, 52 | "l2_gas_price_wei": 10000, 53 | "l2_gas_price_fri": 10000 54 | } 55 | ``` 56 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.5.1/historic-state.md: -------------------------------------------------------------------------------- 1 | # Historic state support 2 | 3 | With state archive capacity set to `full`, Devnet will store full state history, enabling its querying by block hash or number. The default mode is `none`, where no old states are stored and only the latest is available for querying. 4 | 5 | ``` 6 | $ starknet-devnet --state-archive-capacity 7 | ``` 8 | 9 | All RPC endpoints that support querying the state at an old (non-latest) block only work with state archive capacity set to `full`. 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.5.1/lite.md: -------------------------------------------------------------------------------- 1 | # Lite mode 2 | 3 | To run Devnet in a minimal lite mode, provide the flag: 4 | 5 | ``` 6 | $ starknet-devnet --lite-mode 7 | ``` 8 | 9 | Steps skipped in lite mode: 10 | 11 | - calculating block hash 12 | 13 | This is useful if your use-case doesn't need the functionalities above. 14 | 15 | The extent of what is affected by lite mode may be expanded in the future. 16 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.5.1/restrictive.md: -------------------------------------------------------------------------------- 1 | # Restrictive mode 2 | 3 | The `--restrictive-mode` argument enables a restrictive mode for Devnet, allowing you to specify methods that are forbidden during execution. This option ensures that certain operations are restricted, enhancing control over Devnet's behavior. When a user sends a request to one of the restricted methods, Devnet will return either a JSON-RPC error with code -32604 or, if the method was targeted directly via the HTTP endpoint, a response with status 403. 4 | 5 | ## Default restricted methods 6 | 7 | When no methods are specified, the following default methods will be restricted, together with their HTTP endpoint counterparts (if any): 8 | 9 | - devnet_mint 10 | - devnet_load 11 | - devnet_restart 12 | - devnet_createBlock 13 | - devnet_abortBlocks 14 | - devnet_impersonateAccount 15 | - devnet_autoImpersonate 16 | - devnet_getPredeployedAccounts 17 | 18 | ## Usage 19 | 20 | ### With default methods 21 | 22 | ``` 23 | $ starknet-devnet --restrictive-mode 24 | ``` 25 | 26 | ### With a list of methods 27 | 28 | :::note 29 | 30 | Devnet will fail to start if any of the methods/routes are misspelled. 31 | 32 | ::: 33 | 34 | ``` 35 | $ starknet-devnet --restrictive-mode devnet_dump devnet_config 36 | ``` 37 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.5.1/running/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Running", 3 | "position": 2, 4 | "link": { 5 | "type": "generated-index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.6.0/examples.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | Usage examples relying on the [`starknet-devnet-js`](https://github.com/0xspaceShard/starknet-devnet-js) library can be found [here](https://github.com/0xSpaceShard/starknet-devnet-js/tree/master/test). 4 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.6.0/forking.md: -------------------------------------------------------------------------------- 1 | # Forking 2 | 3 | To interact with contracts deployed on mainnet or testnet, you can use forking. Simulate the origin and experiment with it locally, making no changes to the origin itself. 4 | 5 | ``` 6 | $ starknet-devnet --fork-network [--fork-block ] 7 | ``` 8 | 9 | The value passed to `--fork-network` should be the URL to a Starknet JSON-RPC API provider. Specifying a `--fork-block` is optional; it defaults to the `"latest"` block at the time of Devnet's start-up. All calls will first try Devnet's state and then fall back to the forking block. 10 | 11 | :::note How it works 12 | 13 | When you send a request to a forked Devnet instance, it first queries Devnet's local state, then tries the forking origin. Forking is not a step simply performed on Devnet startup, but happens continuously while the Devnet instance is alive. 14 | 15 | ::: 16 | 17 | ## Forking and ACCEPTED_ON_L1 18 | 19 | Assume you have run Devnet as a fork from an origin at a block that is not yet `ACCEPTED_ON_L1`, but only `ACCEPTED_ON_L2`. If in your state queries you specify `block_id: "l1_accepted"`, and there are no local blocks marked as `ACCEPTED_ON_L1`, Devnet will assume the forking block has become `ACCEPTED_ON_L1`. 20 | 21 | Read more about marking blocks as `ACCEPTED_ON_L1` on Devnet: [link](./blocks#accepting-blocks-on-l1). 22 | 23 | ## Account impersonation 24 | 25 | [Here](./account-impersonation) you can read more about acting as an account deployed on the origin. 26 | 27 | ## Deploying an undeclared account 28 | 29 | [Here](./predeployed#deploying-an-undeclared-account) you can read about deploying an account not declared on Devnet. 30 | 31 | ## Checking forking status 32 | 33 | To see if your Devnet instance is using forking or not, [fetch the current configuration](./api#config-api), and check the `url` property of its `fork_config` property. If Devnet is forked, this property contains the string of the origin URL specified on startup. 34 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.6.0/gas.md: -------------------------------------------------------------------------------- 1 | # Gas price modification 2 | 3 | ## On Devnet startup - via CLI 4 | 5 | All gas prices (L1 gas, L1 data gas, L2 gas) can be specified on startup, via their respective CLI params. Check `starknet-devnet --help | grep price` for more info. 6 | 7 | ## On a running Devnet - via JSON-RPC 8 | 9 | The `devnet_setGasPrice` RPC method allows users to modify the current gas prices on a running Devnet. This feature is particularly useful for testing purposes and for adjustments needed after forking to align with the forked network's gas prices. All parameters are optional, allowing you to choose which ones you want to set. A boolean flag `generate_block` indicates whether a new block should be generated immediately after setting the gas prices. 10 | 11 | ### Explanation 12 | 13 | The modified gas prices take effect starting with the next block that is generated. 14 | 15 | ### generate_block 16 | 17 | - When set to `true`, a new block will be generated immediately after the gas prices are set. This ensures that the changes take effect right away and are reflected in the devnet state without waiting for the next block generation. 18 | - When set to `false` (or omitted), the gas prices will be set, but the changes will not be immediately committed to the devnet state until the next block is generated through the usual block generation process. 19 | 20 | ### JSON-RPC Request 21 | 22 | The following JSON-RPC request can be used to set gas prices (all properties optional): 23 | 24 | ```json 25 | JSON-RPC 26 | { 27 | "jsonrpc": "2.0", 28 | "id": "1", 29 | "method": "devnet_setGasPrice", 30 | "params": { 31 | "gas_price_wei": 1000000, 32 | "data_gas_price_wei": 10000, 33 | "gas_price_fri": 10000, 34 | "data_gas_price_fri": 10000, 35 | "l2_gas_price_wei": 1000000, 36 | "l2_gas_price_fri": 10000, 37 | "generate_block": false, 38 | } 39 | } 40 | ``` 41 | 42 | ## Response 43 | 44 | The expected response from the server will mirror the request gas parameters, confirming the modification of gas prices: 45 | 46 | ```json 47 | { 48 | "gas_price_wei": 1000000, 49 | "data_gas_price_wei": 10000, 50 | "gas_price_fri": 10000, 51 | "data_gas_price_fri": 10000, 52 | "l2_gas_price_wei": 10000, 53 | "l2_gas_price_fri": 10000 54 | } 55 | ``` 56 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.6.0/historic-state.md: -------------------------------------------------------------------------------- 1 | # Historic state support 2 | 3 | With state archive capacity set to `full`, Devnet will store full state history, enabling its querying by block hash or number. The default mode is `none`, where no old states are stored and only the latest is available for querying. 4 | 5 | ``` 6 | $ starknet-devnet --state-archive-capacity 7 | ``` 8 | 9 | All RPC endpoints that support querying the state at an old (non-latest) block only work with state archive capacity set to `full`. 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.6.0/lite.md: -------------------------------------------------------------------------------- 1 | # Lite mode 2 | 3 | To run Devnet in a minimal lite mode, provide the flag: 4 | 5 | ``` 6 | $ starknet-devnet --lite-mode 7 | ``` 8 | 9 | Steps skipped in lite mode: 10 | 11 | - calculating block hash 12 | 13 | This is useful if your use-case doesn't need the functionalities above. 14 | 15 | The extent of what is affected by lite mode may be expanded in the future. 16 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.6.0/restrictive.md: -------------------------------------------------------------------------------- 1 | # Restrictive mode 2 | 3 | The `--restrictive-mode` argument enables a restrictive mode for Devnet, allowing you to specify methods that are forbidden during execution. This option ensures that certain operations are restricted, enhancing control over Devnet's behavior. When a user sends a request to one of the restricted methods, Devnet will return either a JSON-RPC error with code -32604 or, if the method was targeted directly via the HTTP endpoint, a response with status 403. 4 | 5 | ## Default restricted methods 6 | 7 | When no methods are specified, the following default methods will be restricted, together with their HTTP endpoint counterparts (if any): 8 | 9 | - devnet_mint 10 | - devnet_load 11 | - devnet_restart 12 | - devnet_createBlock 13 | - devnet_abortBlocks 14 | - devnet_impersonateAccount 15 | - devnet_autoImpersonate 16 | - devnet_getPredeployedAccounts 17 | 18 | ## Usage 19 | 20 | ### With default methods 21 | 22 | ``` 23 | $ starknet-devnet --restrictive-mode 24 | ``` 25 | 26 | ### With a list of methods 27 | 28 | :::note 29 | 30 | Devnet will fail to start if any of the methods/routes are misspelled. 31 | 32 | ::: 33 | 34 | ``` 35 | $ starknet-devnet --restrictive-mode devnet_dump devnet_config 36 | ``` 37 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.6.0/running/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Running", 3 | "position": 2, 4 | "link": { 5 | "type": "generated-index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.6.1/examples.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | Usage examples relying on the [`starknet-devnet-js`](https://github.com/0xspaceShard/starknet-devnet-js) library can be found [here](https://github.com/0xSpaceShard/starknet-devnet-js/tree/master/test). 4 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.6.1/forking.md: -------------------------------------------------------------------------------- 1 | # Forking 2 | 3 | To interact with contracts deployed on mainnet or testnet, you can use forking. Simulate the origin and experiment with it locally, making no changes to the origin itself. 4 | 5 | ``` 6 | $ starknet-devnet --fork-network [--fork-block ] 7 | ``` 8 | 9 | The value passed to `--fork-network` should be the URL to a Starknet JSON-RPC API provider. Specifying a `--fork-block` is optional; it defaults to the `"latest"` block at the time of Devnet's start-up. All calls will first try Devnet's state and then fall back to the forking block. 10 | 11 | :::note How it works 12 | 13 | When you send a request to a forked Devnet instance, it first queries Devnet's local state, then tries the forking origin. Forking is not a step simply performed on Devnet startup, but happens continuously while the Devnet instance is alive. 14 | 15 | ::: 16 | 17 | ## Forking and ACCEPTED_ON_L1 18 | 19 | Assume you have run Devnet as a fork from an origin at a block that is not yet `ACCEPTED_ON_L1`, but only `ACCEPTED_ON_L2`. If in your state queries you specify `block_id: "l1_accepted"`, and there are no local blocks marked as `ACCEPTED_ON_L1`, Devnet will assume the forking block has become `ACCEPTED_ON_L1`. 20 | 21 | Read more about marking blocks as `ACCEPTED_ON_L1` on Devnet: [link](./blocks#accepting-blocks-on-l1). 22 | 23 | ## Account impersonation 24 | 25 | [Here](./account-impersonation) you can read more about acting as an account deployed on the origin. 26 | 27 | ## Deploying an undeclared account 28 | 29 | [Here](./predeployed#deploying-an-undeclared-account) you can read about deploying an account not declared on Devnet. 30 | 31 | ## Checking forking status 32 | 33 | To see if your Devnet instance is using forking or not, [fetch the current configuration](./api#config-api), and check the `url` property of its `fork_config` property. If Devnet is forked, this property contains the string of the origin URL specified on startup. 34 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.6.1/gas.md: -------------------------------------------------------------------------------- 1 | # Gas price modification 2 | 3 | ## On Devnet startup - via CLI 4 | 5 | All gas prices (L1 gas, L1 data gas, L2 gas) can be specified on startup, via their respective CLI params. Check `starknet-devnet --help | grep price` for more info. 6 | 7 | ## On a running Devnet - via JSON-RPC 8 | 9 | The `devnet_setGasPrice` RPC method allows users to modify the current gas prices on a running Devnet. This feature is particularly useful for testing purposes and for adjustments needed after forking to align with the forked network's gas prices. All parameters are optional, allowing you to choose which ones you want to set. A boolean flag `generate_block` indicates whether a new block should be generated immediately after setting the gas prices. 10 | 11 | ### Explanation 12 | 13 | The modified gas prices take effect starting with the next block that is generated. 14 | 15 | ### generate_block 16 | 17 | - When set to `true`, a new block will be generated immediately after the gas prices are set. This ensures that the changes take effect right away and are reflected in the devnet state without waiting for the next block generation. 18 | - When set to `false` (or omitted), the gas prices will be set, but the changes will not be immediately committed to the devnet state until the next block is generated through the usual block generation process. 19 | 20 | ### JSON-RPC Request 21 | 22 | The following JSON-RPC request can be used to set gas prices (all properties optional): 23 | 24 | ```json 25 | JSON-RPC 26 | { 27 | "jsonrpc": "2.0", 28 | "id": "1", 29 | "method": "devnet_setGasPrice", 30 | "params": { 31 | "gas_price_wei": 1000000, 32 | "data_gas_price_wei": 10000, 33 | "gas_price_fri": 10000, 34 | "data_gas_price_fri": 10000, 35 | "l2_gas_price_wei": 1000000, 36 | "l2_gas_price_fri": 10000, 37 | "generate_block": false, 38 | } 39 | } 40 | ``` 41 | 42 | ## Response 43 | 44 | The expected response from the server will mirror the request gas parameters, confirming the modification of gas prices: 45 | 46 | ```json 47 | { 48 | "gas_price_wei": 1000000, 49 | "data_gas_price_wei": 10000, 50 | "gas_price_fri": 10000, 51 | "data_gas_price_fri": 10000, 52 | "l2_gas_price_wei": 10000, 53 | "l2_gas_price_fri": 10000 54 | } 55 | ``` 56 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.6.1/historic-state.md: -------------------------------------------------------------------------------- 1 | # Historic state support 2 | 3 | With state archive capacity set to `full`, Devnet will store full state history, enabling its querying by block hash or number. The default mode is `none`, where no old states are stored and only the latest is available for querying. 4 | 5 | ``` 6 | $ starknet-devnet --state-archive-capacity 7 | ``` 8 | 9 | All RPC endpoints that support querying the state at an old (non-latest) block only work with state archive capacity set to `full`. 10 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.6.1/lite.md: -------------------------------------------------------------------------------- 1 | # Lite mode 2 | 3 | To run Devnet in a minimal lite mode, provide the flag: 4 | 5 | ``` 6 | $ starknet-devnet --lite-mode 7 | ``` 8 | 9 | Steps skipped in lite mode: 10 | 11 | - calculating block hash 12 | 13 | This is useful if your use-case doesn't need the functionalities above. 14 | 15 | The extent of what is affected by lite mode may be expanded in the future. 16 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.6.1/restrictive.md: -------------------------------------------------------------------------------- 1 | # Restrictive mode 2 | 3 | The `--restrictive-mode` argument enables a restrictive mode for Devnet, allowing you to specify methods that are forbidden during execution. This option ensures that certain operations are restricted, enhancing control over Devnet's behavior. When a user sends a request to one of the restricted methods, Devnet will return either a JSON-RPC error with code -32604 or, if the method was targeted directly via the HTTP endpoint, a response with status 403. 4 | 5 | ## Default restricted methods 6 | 7 | When no methods are specified, the following default methods will be restricted, together with their HTTP endpoint counterparts (if any): 8 | 9 | - devnet_mint 10 | - devnet_load 11 | - devnet_restart 12 | - devnet_createBlock 13 | - devnet_abortBlocks 14 | - devnet_impersonateAccount 15 | - devnet_autoImpersonate 16 | - devnet_getPredeployedAccounts 17 | 18 | ## Usage 19 | 20 | ### With default methods 21 | 22 | ``` 23 | $ starknet-devnet --restrictive-mode 24 | ``` 25 | 26 | ### With a list of methods 27 | 28 | :::note 29 | 30 | Devnet will fail to start if any of the methods/routes are misspelled. 31 | 32 | ::: 33 | 34 | ``` 35 | $ starknet-devnet --restrictive-mode devnet_dump devnet_config 36 | ``` 37 | -------------------------------------------------------------------------------- /website/versioned_docs/version-0.6.1/running/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Running", 3 | "position": 2, 4 | "link": { 5 | "type": "generated-index" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /website/versioned_sidebars/version-0.0.6-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /website/versioned_sidebars/version-0.0.7-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /website/versioned_sidebars/version-0.1.1-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /website/versioned_sidebars/version-0.1.2-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /website/versioned_sidebars/version-0.2.0-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /website/versioned_sidebars/version-0.2.1-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /website/versioned_sidebars/version-0.2.2-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /website/versioned_sidebars/version-0.2.3-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /website/versioned_sidebars/version-0.2.4-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /website/versioned_sidebars/version-0.3.0-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /website/versioned_sidebars/version-0.4.0-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /website/versioned_sidebars/version-0.4.1-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /website/versioned_sidebars/version-0.4.2-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /website/versioned_sidebars/version-0.4.3-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /website/versioned_sidebars/version-0.5.0-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /website/versioned_sidebars/version-0.5.1-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /website/versioned_sidebars/version-0.6.0-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /website/versioned_sidebars/version-0.6.1-sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docSidebar": [ 3 | { 4 | "type": "autogenerated", 5 | "dirName": "." 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /website/versions.json: -------------------------------------------------------------------------------- 1 | [ 2 | "0.6.0", 3 | "0.5.1", 4 | "0.5.0", 5 | "0.4.3", 6 | "0.4.2", 7 | "0.4.1", 8 | "0.4.0", 9 | "0.3.0" 10 | ] 11 | --------------------------------------------------------------------------------