-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: configurable chain config (#255)
- Loading branch information
1 parent
bccdccf
commit 8be242a
Showing
30 changed files
with
883 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Name of the blockchain network | ||
chain_name: "Starknet Mainnet" | ||
|
||
# Unique identifier for the blockchain network | ||
chain_id: "SN_MAIN" | ||
|
||
# Contract address of the token used to pay transaction fees on this network (STRK) | ||
native_fee_token_address: "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d" | ||
|
||
# Contract address of the token used for fees on the parent chain (ETH) | ||
parent_fee_token_address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7" | ||
|
||
# Paths to JSON files containing blockifier's constants for different versions | ||
versioned_constants: | ||
"0.13.0": "crates/primitives/chain_config/resources/versioned_constants_13_0.json" | ||
"0.13.1": "crates/primitives/chain_config/resources/versioned_constants_13_1.json" | ||
"0.13.1.1": "crates/primitives/chain_config/resources/versioned_constants_13_1_1.json" | ||
"0.13.2": "crates/primitives/chain_config/resources/versioned_constants_13_2.json" | ||
|
||
# Address of the core contract on the L1 network that interacts with this L2 network | ||
eth_core_contract_address: "0xc662c410C0ECf747543f5bA90660f6ABeBD9C8c4" | ||
|
||
# Most recent version supported | ||
latest_protocol_version: "0.13.2" | ||
|
||
# Target time interval between blocks, in seconds | ||
block_time: 360 | ||
|
||
# How often the pending block is updated, in seconds | ||
pending_block_update_time: 2 | ||
|
||
# Settings for the transaction bouncer | ||
bouncer_config: | ||
block_max_capacity: | ||
# Limits for various built-in operations (set to max uint64 value) | ||
builtin_count: | ||
add_mod: 18446744073709551615 | ||
bitwise: 18446744073709551615 | ||
ecdsa: 18446744073709551615 | ||
ec_op: 18446744073709551615 | ||
keccak: 18446744073709551615 | ||
mul_mod: 18446744073709551615 | ||
pedersen: 18446744073709551615 | ||
poseidon: 18446744073709551615 | ||
range_check: 18446744073709551615 | ||
range_check96: 18446744073709551615 | ||
# Maximum gas limit per block | ||
gas: 5000000 | ||
# Maximum number of steps per block | ||
n_steps: 40000000 | ||
# Maximum length of message segments | ||
message_segment_length: 18446744073709551615 | ||
# Maximum number of events per block | ||
n_events: 18446744073709551615 | ||
# Maximum size of state differences per block | ||
state_diff_size: 131072 | ||
|
||
# Address of the sequencer (0x0 for a full node). | ||
sequencer_address: "0x0" | ||
|
||
# Maximum nonce difference allowed for skipping validation of intermediate transactions | ||
max_nonce_for_validation_skip: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,27 @@ | ||
mod common; | ||
|
||
use common::temp_db; | ||
use common::*; | ||
use mc_db::DatabaseService; | ||
use mp_chain_config::ChainConfig; | ||
use mp_utils::tests_common::*; | ||
use rstest::*; | ||
|
||
#[rstest] | ||
#[tokio::test] | ||
async fn test_open_db() { | ||
async fn test_open_db(_set_workdir: ()) { | ||
temp_db().await; | ||
} | ||
|
||
#[rstest] | ||
#[tokio::test] | ||
async fn test_open_different_chain_id() { | ||
async fn test_open_different_chain_id(_set_workdir: ()) { | ||
let temp_dir = tempfile::TempDir::new().unwrap(); | ||
{ | ||
let chain_config = std::sync::Arc::new(ChainConfig::starknet_integration()); | ||
let chain_config = std::sync::Arc::new( | ||
ChainConfig::starknet_integration().expect("failed to retrieve integration chain config"), | ||
); | ||
let _db = DatabaseService::new(temp_dir.path(), None, false, chain_config).await.unwrap(); | ||
} | ||
let chain_config = std::sync::Arc::new(ChainConfig::test_config()); | ||
let chain_config = std::sync::Arc::new(ChainConfig::test_config().expect("failed to retrieve test chain config")); | ||
assert!(DatabaseService::new(temp_dir.path(), None, false, chain_config).await.is_err()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.