From 9481dcd2be80945c3b8f669f0c5b83da7323b084 Mon Sep 17 00:00:00 2001 From: Thomas Coratger Date: Tue, 29 Oct 2024 12:37:36 +0100 Subject: [PATCH 1/4] bump katana to v1.0.0-alpha.19 --- Cargo.lock | 98 +++++++++++++++++--------------- Cargo.toml | 6 +- Makefile | 2 +- docker-compose.yaml | 2 +- docker/hive/Dockerfile | 2 +- src/test_utils/hive/mod.rs | 7 --- src/test_utils/katana/genesis.rs | 16 ++---- src/test_utils/katana/mod.rs | 22 +++++-- 8 files changed, 78 insertions(+), 77 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index eed52eb06..01f761d53 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1497,7 +1497,7 @@ dependencies = [ [[package]] name = "blockifier" version = "0.8.0-rc.3" -source = "git+https://github.com/dojoengine/sequencer?tag=v0.8.0-rc3.1#dd69217cdec340f9b5267b781be38eef972ac401" +source = "git+https://github.com/dojoengine/sequencer?tag=v0.8.0-rc3.2#d6951f24fc2082c7aa89cdbc063648915b131d74" dependencies = [ "anyhow", "ark-ec", @@ -1529,7 +1529,7 @@ dependencies = [ "sha2", "sha3", "starknet-types-core", - "starknet_api 0.13.0-rc.1 (git+https://github.com/dojoengine/sequencer?tag=v0.8.0-rc3.1)", + "starknet_api 0.13.0-rc.1 (git+https://github.com/dojoengine/sequencer?tag=v0.8.0-rc3.2)", "strum 0.25.0", "strum_macros 0.25.3", "thiserror", @@ -2410,6 +2410,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58363ad8065ed891e3b14a8191b707677c7c7cb5b9d10030822506786d8d8108" dependencies = [ "anyhow", + "arbitrary", "bincode 2.0.0-rc.3", "bitvec", "generic-array", @@ -3241,8 +3242,8 @@ dependencies = [ [[package]] name = "dojo-lang" -version = "1.0.0-alpha.15" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.15#f56c4f90eca84b92f348303dc85ff6e126609f16" +version = "1.0.0-alpha.19" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.19#ef696ea9bbaa22d3f6db392d9692b4821578c23c" dependencies = [ "anyhow", "cairo-lang-compiler", @@ -3280,8 +3281,8 @@ dependencies = [ [[package]] name = "dojo-metrics" -version = "1.0.0-alpha.15" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.15#f56c4f90eca84b92f348303dc85ff6e126609f16" +version = "1.0.0-alpha.19" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.19#ef696ea9bbaa22d3f6db392d9692b4821578c23c" dependencies = [ "anyhow", "hyper 0.14.30", @@ -3294,13 +3295,14 @@ dependencies = [ "metrics-util", "thiserror", "tokio", + "tokio-util", "tracing", ] [[package]] name = "dojo-test-utils" -version = "1.0.0-alpha.15" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.15#f56c4f90eca84b92f348303dc85ff6e126609f16" +version = "1.0.0-alpha.19" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.19#ef696ea9bbaa22d3f6db392d9692b4821578c23c" dependencies = [ "anyhow", "assert_fs", @@ -3325,8 +3327,8 @@ dependencies = [ [[package]] name = "dojo-types" -version = "1.0.0-alpha.15" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.15#f56c4f90eca84b92f348303dc85ff6e126609f16" +version = "1.0.0-alpha.19" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.19#ef696ea9bbaa22d3f6db392d9692b4821578c23c" dependencies = [ "cainome", "crypto-bigint", @@ -3343,8 +3345,8 @@ dependencies = [ [[package]] name = "dojo-utils" -version = "1.0.0-alpha.15" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.15#f56c4f90eca84b92f348303dc85ff6e126609f16" +version = "1.0.0-alpha.19" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.19#ef696ea9bbaa22d3f6db392d9692b4821578c23c" dependencies = [ "anyhow", "futures", @@ -3357,8 +3359,8 @@ dependencies = [ [[package]] name = "dojo-world" -version = "1.0.0-alpha.15" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.15#f56c4f90eca84b92f348303dc85ff6e126609f16" +version = "1.0.0-alpha.19" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.19#ef696ea9bbaa22d3f6db392d9692b4821578c23c" dependencies = [ "anyhow", "async-trait", @@ -6231,8 +6233,8 @@ dependencies = [ [[package]] name = "katana-cairo" -version = "1.0.0-alpha.15" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.15#f56c4f90eca84b92f348303dc85ff6e126609f16" +version = "1.0.0-alpha.19" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.19#ef696ea9bbaa22d3f6db392d9692b4821578c23c" dependencies = [ "cairo-lang-casm", "cairo-lang-runner", @@ -6242,13 +6244,13 @@ dependencies = [ "cairo-lang-starknet-classes", "cairo-lang-utils", "cairo-vm", - "starknet_api 0.13.0-rc.1 (git+https://github.com/dojoengine/sequencer?tag=v0.8.0-rc3.1)", + "starknet_api 0.13.0-rc.1 (git+https://github.com/dojoengine/sequencer?tag=v0.8.0-rc3.2)", ] [[package]] name = "katana-core" -version = "1.0.0-alpha.15" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.15#f56c4f90eca84b92f348303dc85ff6e126609f16" +version = "1.0.0-alpha.19" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.19#ef696ea9bbaa22d3f6db392d9692b4821578c23c" dependencies = [ "alloy-contract", "alloy-network 0.3.6", @@ -6270,6 +6272,7 @@ dependencies = [ "katana-tasks", "lazy_static", "metrics", + "num-traits 0.2.19", "parking_lot 0.12.3", "reqwest 0.12.8", "serde", @@ -6283,8 +6286,8 @@ dependencies = [ [[package]] name = "katana-db" -version = "1.0.0-alpha.15" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.15#f56c4f90eca84b92f348303dc85ff6e126609f16" +version = "1.0.0-alpha.19" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.19#ef696ea9bbaa22d3f6db392d9692b4821578c23c" dependencies = [ "anyhow", "dojo-metrics", @@ -6304,8 +6307,8 @@ dependencies = [ [[package]] name = "katana-executor" -version = "1.0.0-alpha.15" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.15#f56c4f90eca84b92f348303dc85ff6e126609f16" +version = "1.0.0-alpha.19" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.19#ef696ea9bbaa22d3f6db392d9692b4821578c23c" dependencies = [ "blockifier", "katana-cairo", @@ -6319,8 +6322,8 @@ dependencies = [ [[package]] name = "katana-node" -version = "1.0.0-alpha.15" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.15#f56c4f90eca84b92f348303dc85ff6e126609f16" +version = "1.0.0-alpha.19" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.19#ef696ea9bbaa22d3f6db392d9692b4821578c23c" dependencies = [ "anyhow", "dojo-metrics", @@ -6333,11 +6336,9 @@ dependencies = [ "katana-pipeline", "katana-pool", "katana-primitives", - "katana-provider", "katana-rpc", "katana-rpc-api", "katana-tasks", - "num-traits 0.2.19", "serde_json", "starknet", "strum 0.25.0", @@ -6349,8 +6350,8 @@ dependencies = [ [[package]] name = "katana-pipeline" -version = "1.0.0-alpha.15" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.15#f56c4f90eca84b92f348303dc85ff6e126609f16" +version = "1.0.0-alpha.19" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.19#ef696ea9bbaa22d3f6db392d9692b4821578c23c" dependencies = [ "anyhow", "async-trait", @@ -6360,13 +6361,14 @@ dependencies = [ "katana-pool", "katana-tasks", "thiserror", + "tokio", "tracing", ] [[package]] name = "katana-pool" -version = "1.0.0-alpha.15" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.15#f56c4f90eca84b92f348303dc85ff6e126609f16" +version = "1.0.0-alpha.19" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.19#ef696ea9bbaa22d3f6db392d9692b4821578c23c" dependencies = [ "futures", "katana-executor", @@ -6379,11 +6381,12 @@ dependencies = [ [[package]] name = "katana-primitives" -version = "1.0.0-alpha.15" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.15#f56c4f90eca84b92f348303dc85ff6e126609f16" +version = "1.0.0-alpha.19" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.19#ef696ea9bbaa22d3f6db392d9692b4821578c23c" dependencies = [ "alloy-primitives", "anyhow", + "arbitrary", "base64 0.21.7", "derive_more 0.99.18", "flate2", @@ -6397,14 +6400,14 @@ dependencies = [ "serde_with", "starknet", "starknet-crypto 0.7.2", - "strum_macros 0.25.3", + "starknet-types-core", "thiserror", ] [[package]] name = "katana-provider" -version = "1.0.0-alpha.15" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.15#f56c4f90eca84b92f348303dc85ff6e126609f16" +version = "1.0.0-alpha.19" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.19#ef696ea9bbaa22d3f6db392d9692b4821578c23c" dependencies = [ "anyhow", "auto_impl", @@ -6420,8 +6423,8 @@ dependencies = [ [[package]] name = "katana-rpc" -version = "1.0.0-alpha.15" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.15#f56c4f90eca84b92f348303dc85ff6e126609f16" +version = "1.0.0-alpha.19" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.19#ef696ea9bbaa22d3f6db392d9692b4821578c23c" dependencies = [ "anyhow", "dojo-metrics", @@ -6444,8 +6447,8 @@ dependencies = [ [[package]] name = "katana-rpc-api" -version = "1.0.0-alpha.15" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.15#f56c4f90eca84b92f348303dc85ff6e126609f16" +version = "1.0.0-alpha.19" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.19#ef696ea9bbaa22d3f6db392d9692b4821578c23c" dependencies = [ "jsonrpsee 0.16.3", "katana-core", @@ -6456,8 +6459,8 @@ dependencies = [ [[package]] name = "katana-rpc-types" -version = "1.0.0-alpha.15" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.15#f56c4f90eca84b92f348303dc85ff6e126609f16" +version = "1.0.0-alpha.19" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.19#ef696ea9bbaa22d3f6db392d9692b4821578c23c" dependencies = [ "alloy-primitives", "anyhow", @@ -6480,8 +6483,8 @@ dependencies = [ [[package]] name = "katana-rpc-types-builder" -version = "1.0.0-alpha.15" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.15#f56c4f90eca84b92f348303dc85ff6e126609f16" +version = "1.0.0-alpha.19" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.19#ef696ea9bbaa22d3f6db392d9692b4821578c23c" dependencies = [ "anyhow", "katana-executor", @@ -6493,8 +6496,8 @@ dependencies = [ [[package]] name = "katana-tasks" -version = "1.0.0-alpha.15" -source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.15#f56c4f90eca84b92f348303dc85ff6e126609f16" +version = "1.0.0-alpha.19" +source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.19#ef696ea9bbaa22d3f6db392d9692b4821578c23c" dependencies = [ "futures", "rayon", @@ -11499,6 +11502,7 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa1b9e01ccb217ab6d475c5cda05dbb22c30029f7bb52b192a010a00d77a3d74" dependencies = [ + "arbitrary", "lambdaworks-crypto", "lambdaworks-math", "lazy_static", @@ -11535,7 +11539,7 @@ dependencies = [ [[package]] name = "starknet_api" version = "0.13.0-rc.1" -source = "git+https://github.com/dojoengine/sequencer?tag=v0.8.0-rc3.1#dd69217cdec340f9b5267b781be38eef972ac401" +source = "git+https://github.com/dojoengine/sequencer?tag=v0.8.0-rc3.2#d6951f24fc2082c7aa89cdbc063648915b131d74" dependencies = [ "bitvec", "cairo-lang-starknet-classes", diff --git a/Cargo.toml b/Cargo.toml index a591a62a3..37393b2b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -172,9 +172,9 @@ tokio-util = { version = "0.7", features = [ tokio-stream = { version = "0.1", default-features = false, optional = true } walkdir = { version = "2.5", default-features = false, optional = true } -dojo-test-utils = { git = 'https://github.com/dojoengine/dojo', tag = "v1.0.0-alpha.15", default-features = false, optional = true } -katana-node = { git = 'https://github.com/dojoengine/dojo', tag = "v1.0.0-alpha.15", default-features = false, optional = true } -katana-primitives = { git = 'https://github.com/dojoengine/dojo', tag = "v1.0.0-alpha.15", default-features = false, features = [ +dojo-test-utils = { git = 'https://github.com/dojoengine/dojo', tag = "v1.0.0-alpha.19", default-features = false, optional = true } +katana-node = { git = 'https://github.com/dojoengine/dojo', tag = "v1.0.0-alpha.19", default-features = false, optional = true } +katana-primitives = { git = 'https://github.com/dojoengine/dojo', tag = "v1.0.0-alpha.19", default-features = false, features = [ "serde", ], optional = true } mockall = { version = "0.13.0", default-features = false, optional = true } diff --git a/Makefile b/Makefile index 9eb429b52..95d8bbe40 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ run-dev: load-env RUST_LOG=trace cargo run --bin kakarot-rpc install-katana: - cargo install --git https://github.com/dojoengine/dojo --locked --tag v1.0.0-alpha.15 katana + cargo install --git https://github.com/dojoengine/dojo --locked --tag v1.0.0-alpha.19 katana katana-genesis: install-katana cargo run --bin katana_genesis --features testing diff --git a/docker-compose.yaml b/docker-compose.yaml index 12a42f94f..455f30bf7 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -14,7 +14,7 @@ services: restart: on-failure starknet: - image: ghcr.io/dojoengine/dojo:v1.0.0-alpha.16 + image: ghcr.io/dojoengine/dojo:v1.0.0-alpha.19 command: - katana - --disable-fee diff --git a/docker/hive/Dockerfile b/docker/hive/Dockerfile index 0f0956e5f..b85127c20 100644 --- a/docker/hive/Dockerfile +++ b/docker/hive/Dockerfile @@ -1,7 +1,7 @@ # trunk-ignore-all(terrascan/AC_DOCKER_0047) # CairoVM Chain -FROM ghcr.io/dojoengine/dojo:v1.0.0-alpha.15 as katana +FROM ghcr.io/dojoengine/dojo:v1.0.0-alpha.19 as katana # Indexer service ### Apibara DNA indexer and indexer diff --git a/src/test_utils/hive/mod.rs b/src/test_utils/hive/mod.rs index cbc4bfb73..7d5ffac97 100644 --- a/src/test_utils/hive/mod.rs +++ b/src/test_utils/hive/mod.rs @@ -61,7 +61,6 @@ impl HiveGenesisConfig { // Fetch the contracts from the alloc field. let mut additional_kakarot_storage = HashMap::with_capacity(self.alloc.len()); // 1 mapping per contract - let mut fee_token_storage = HashMap::with_capacity(2 * self.alloc.len()); // 2 allowances per contract let contracts = self .alloc .into_iter() @@ -98,10 +97,6 @@ impl HiveGenesisConfig { ), ]); - let key = get_storage_var_address("ERC20_allowances", &[starknet_address, kakarot_address])?; - fee_token_storage.insert(key, u128::MAX.into()); - fee_token_storage.insert(key + Felt::ONE, u128::MAX.into()); - Ok(( ContractAddress::new(starknet_address), GenesisContractJson { @@ -123,8 +118,6 @@ impl HiveGenesisConfig { contract.storage.get_or_insert_with(BTreeMap::new).extend(additional_kakarot_storage); }); - genesis.fee_token.storage.get_or_insert_with(BTreeMap::new).extend(fee_token_storage); - // Add the contracts to the genesis. genesis.contracts.extend(contracts); diff --git a/src/test_utils/katana/genesis.rs b/src/test_utils/katana/genesis.rs index 6dcce4eb9..8b7381eca 100644 --- a/src/test_utils/katana/genesis.rs +++ b/src/test_utils/katana/genesis.rs @@ -15,10 +15,9 @@ use katana_primitives::{ contract::{ContractAddress, StorageKey, StorageValue}, genesis::{ allocation::DevAllocationsGenerator, - constant::{DEFAULT_FEE_TOKEN_ADDRESS, DEFAULT_PREFUNDED_ACCOUNT_BALANCE}, + constant::{DEFAULT_ETH_FEE_TOKEN_ADDRESS, DEFAULT_PREFUNDED_ACCOUNT_BALANCE}, json::{ - ClassNameOrHash, FeeTokenConfigJson, GenesisAccountJson, GenesisClassJson, GenesisContractJson, - GenesisJson, PathOrFullArtifact, + ClassNameOrHash, GenesisAccountJson, GenesisClassJson, GenesisContractJson, GenesisJson, PathOrFullArtifact, }, }, }; @@ -201,7 +200,7 @@ impl KatanaGenesisBuilder { &UdcUniqueness::NotUnique, &[ Felt::ZERO, - DEFAULT_FEE_TOKEN_ADDRESS.0, + DEFAULT_ETH_FEE_TOKEN_ADDRESS.0, account_contract_class_hash, uninitialized_account_class_hash, cairo1_helpers_class_hash, @@ -215,7 +214,7 @@ impl KatanaGenesisBuilder { // Construct the kakarot contract storage. let kakarot_storage = [ - (storage_addr(KAKAROT_NATIVE_TOKEN_ADDRESS)?, *DEFAULT_FEE_TOKEN_ADDRESS), + (storage_addr(KAKAROT_NATIVE_TOKEN_ADDRESS)?, *DEFAULT_ETH_FEE_TOKEN_ADDRESS), (storage_addr(KAKAROT_ACCOUNT_CONTRACT_CLASS_HASH)?, account_contract_class_hash), (storage_addr(KAKAROT_UNINITIALIZED_ACCOUNT_CLASS_HASH)?, uninitialized_account_class_hash), (storage_addr(KAKAROT_CAIRO1_HELPERS_CLASS_HASH)?, cairo1_helpers_class_hash), @@ -315,13 +314,6 @@ impl KatanaGenesisBuilder { Ok(GenesisJson { sequencer_address: self.compute_starknet_address(self.coinbase)?, classes: self.classes, - fee_token: FeeTokenConfigJson { - name: "Ether".to_string(), - symbol: "ETH".to_string(), - decimals: 18, - storage: Some(self.fee_token_storage), - ..Default::default() - }, accounts: self.accounts, contracts: self.contracts, ..Default::default() diff --git a/src/test_utils/katana/mod.rs b/src/test_utils/katana/mod.rs index e91e38cf0..4fffdac07 100644 --- a/src/test_utils/katana/mod.rs +++ b/src/test_utils/katana/mod.rs @@ -22,10 +22,16 @@ use crate::{ }; use alloy_primitives::{Address, Bytes, U256}; use alloy_rpc_types::Log; -use dojo_test_utils::sequencer::{Environment, StarknetConfig, TestSequencer}; +use dojo_test_utils::sequencer::TestSequencer; +use katana_node::config::execution::ExecutionConfig; use katana_primitives::{ chain::ChainId, - genesis::{json::GenesisJson, Genesis}, + chain_spec::FeeContracts, + genesis::{ + constant::{DEFAULT_ETH_FEE_TOKEN_ADDRESS, DEFAULT_STRK_FEE_TOKEN_ADDRESS}, + json::GenesisJson, + Genesis, + }, }; use mongodb::{ bson, @@ -62,9 +68,10 @@ fn load_genesis() -> Genesis { #[cfg(any(test, feature = "arbitrary", feature = "testing"))] pub async fn katana_sequencer() -> TestSequencer { TestSequencer::start(Config { - chain: ChainSpec { id: ChainId::parse("kaka_test").unwrap(), genesis: load_genesis() }, - starknet: StarknetConfig { - env: Environment { invoke_max_steps: u32::MAX, validate_max_steps: u32::MAX }, + chain: ChainSpec { + id: ChainId::parse("kaka_test").unwrap(), + genesis: load_genesis(), + fee_contracts: FeeContracts { eth: DEFAULT_ETH_FEE_TOKEN_ADDRESS, strk: DEFAULT_STRK_FEE_TOKEN_ADDRESS }, ..Default::default() }, sequencing: SequencingConfig { block_time: None, no_mining: false }, @@ -75,6 +82,11 @@ pub async fn katana_sequencer() -> TestSequencer { allowed_origins: None, apis: HashSet::from([ApiKind::Starknet, ApiKind::Dev, ApiKind::Saya, ApiKind::Torii]), }, + execution: ExecutionConfig { + invocation_max_steps: u32::MAX, + validation_max_steps: u32::MAX, + ..Default::default() + }, ..Default::default() }) .await From 66e9b41dde908b9c4a7965a07d91302391387ecc Mon Sep 17 00:00:00 2001 From: Thomas Coratger Date: Tue, 29 Oct 2024 12:58:24 +0100 Subject: [PATCH 2/4] fix --- src/test_utils/hive/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/test_utils/hive/mod.rs b/src/test_utils/hive/mod.rs index 7d5ffac97..e2c4fee08 100644 --- a/src/test_utils/hive/mod.rs +++ b/src/test_utils/hive/mod.rs @@ -61,6 +61,7 @@ impl HiveGenesisConfig { // Fetch the contracts from the alloc field. let mut additional_kakarot_storage = HashMap::with_capacity(self.alloc.len()); // 1 mapping per contract + let mut fee_token_storage = HashMap::with_capacity(2 * self.alloc.len()); // 2 allowances per contract let contracts = self .alloc .into_iter() @@ -97,6 +98,10 @@ impl HiveGenesisConfig { ), ]); + let key = get_storage_var_address("ERC20_allowances", &[starknet_address, kakarot_address])?; + fee_token_storage.insert(key, u128::MAX.into()); + fee_token_storage.insert(key + Felt::ONE, u128::MAX.into()); + Ok(( ContractAddress::new(starknet_address), GenesisContractJson { From d9510db14be692ac08b0cfca5df861865f339c53 Mon Sep 17 00:00:00 2001 From: Thomas Coratger Date: Tue, 29 Oct 2024 14:02:05 +0100 Subject: [PATCH 3/4] fix --- src/test_utils/hive/mod.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/test_utils/hive/mod.rs b/src/test_utils/hive/mod.rs index e2c4fee08..fab8466e3 100644 --- a/src/test_utils/hive/mod.rs +++ b/src/test_utils/hive/mod.rs @@ -8,7 +8,10 @@ use account::{Account, KakarotAccount}; use alloy_primitives::{Address, Bytes, B256, U256, U64}; use katana_primitives::{ contract::ContractAddress, - genesis::json::{ClassNameOrHash, GenesisContractJson, GenesisJson}, + genesis::{ + constant::DEFAULT_ETH_FEE_TOKEN_ADDRESS, + json::{ClassNameOrHash, GenesisContractJson, GenesisJson}, + }, }; use serde::{Deserialize, Serialize}; use starknet::core::{types::Felt, utils::get_storage_var_address}; @@ -123,6 +126,22 @@ impl HiveGenesisConfig { contract.storage.get_or_insert_with(BTreeMap::new).extend(additional_kakarot_storage); }); + // Add the fee token storage to the genesis. + genesis + .accounts + .entry(DEFAULT_ETH_FEE_TOKEN_ADDRESS) + .or_insert_with(|| katana_primitives::genesis::json::GenesisAccountJson { + public_key: Felt::ZERO, + balance: None, + nonce: None, + class: None, + storage: Some(BTreeMap::new()), + private_key: None, + }) + .storage + .get_or_insert_with(BTreeMap::new) + .extend(fee_token_storage); + // Add the contracts to the genesis. genesis.contracts.extend(contracts); From 702cee72731e8e456a09bcae2feee2b386453ad2 Mon Sep 17 00:00:00 2001 From: Thomas Coratger Date: Wed, 30 Oct 2024 19:32:29 +0100 Subject: [PATCH 4/4] fix storage slot --- lib/kakarot | 2 +- src/test_utils/hive/mod.rs | 6 ++---- src/test_utils/katana/genesis.rs | 13 ++++++++++++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/kakarot b/lib/kakarot index b8f5f2a20..8f5c25899 160000 --- a/lib/kakarot +++ b/lib/kakarot @@ -1 +1 @@ -Subproject commit b8f5f2a20bd733cc8885c010291885e1df7dc50e +Subproject commit 8f5c25899f785682bf018411459988ad82cf9228 diff --git a/src/test_utils/hive/mod.rs b/src/test_utils/hive/mod.rs index fab8466e3..d4b729763 100644 --- a/src/test_utils/hive/mod.rs +++ b/src/test_utils/hive/mod.rs @@ -128,15 +128,13 @@ impl HiveGenesisConfig { // Add the fee token storage to the genesis. genesis - .accounts + .contracts .entry(DEFAULT_ETH_FEE_TOKEN_ADDRESS) - .or_insert_with(|| katana_primitives::genesis::json::GenesisAccountJson { - public_key: Felt::ZERO, + .or_insert_with(|| katana_primitives::genesis::json::GenesisContractJson { balance: None, nonce: None, class: None, storage: Some(BTreeMap::new()), - private_key: None, }) .storage .get_or_insert_with(BTreeMap::new) diff --git a/src/test_utils/katana/genesis.rs b/src/test_utils/katana/genesis.rs index 8b7381eca..5ac97dac4 100644 --- a/src/test_utils/katana/genesis.rs +++ b/src/test_utils/katana/genesis.rs @@ -311,11 +311,22 @@ impl KatanaGenesisBuilder { /// Consume the [`KatanaGenesisBuilder`] and returns the corresponding [`GenesisJson`]. pub fn build(self) -> Result { + let mut contracts = self.contracts.clone(); + contracts.insert( + DEFAULT_ETH_FEE_TOKEN_ADDRESS, + GenesisContractJson { + balance: None, + nonce: None, + class: None, + storage: Some(self.fee_token_storage.clone()), + }, + ); + Ok(GenesisJson { sequencer_address: self.compute_starknet_address(self.coinbase)?, classes: self.classes, accounts: self.accounts, - contracts: self.contracts, + contracts, ..Default::default() }) }