From 18c25e2bc7434c3c9100b9ead5cd042986f5c540 Mon Sep 17 00:00:00 2001 From: Elias Tazartes <66871571+Eikix@users.noreply.github.com> Date: Mon, 22 Apr 2024 13:07:43 +0200 Subject: [PATCH] chore bump kakarot (#996) * chore bump kakarot * Update src/test_utils/constants.rs Co-authored-by: greged93 <82421016+greged93@users.noreply.github.com> * Update src/test_utils/katana/genesis.rs Co-authored-by: greged93 <82421016+greged93@users.noreply.github.com> * feat add cairo1 helpers in hive * fix import * fix genesis cache --------- Co-authored-by: greged93 <82421016+greged93@users.noreply.github.com> --- lib/kakarot | 2 +- src/test_utils/constants.rs | 1 + src/test_utils/hive/mod.rs | 9 ++++++++- src/test_utils/katana/genesis.rs | 10 +++++++--- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/lib/kakarot b/lib/kakarot index a9625be77..fdad69f62 160000 --- a/lib/kakarot +++ b/lib/kakarot @@ -1 +1 @@ -Subproject commit a9625be77535767d9453bf33129e5b13c78b2e11 +Subproject commit fdad69f62f084cd8e42b1ed3ccc4c91b53991095 diff --git a/src/test_utils/constants.rs b/src/test_utils/constants.rs index b9c538dff..911af97d6 100644 --- a/src/test_utils/constants.rs +++ b/src/test_utils/constants.rs @@ -3,6 +3,7 @@ pub const ACCOUNT_IMPLEMENTATION: &str = "Account_implementation"; pub const ACCOUNT_NONCE: &str = "Account_nonce"; pub const ACCOUNT_STORAGE: &str = "Account_storage"; pub const OWNABLE_OWNER: &str = "Ownable_owner"; +pub const ACCOUNT_CAIRO1_HELPERS_CLASS_HASH: &str = "Account_cairo1_helpers_class_hash"; pub const KAKAROT_EVM_TO_STARKNET_ADDRESS: &str = "Kakarot_evm_to_starknet_address"; pub const KAKAROT_NATIVE_TOKEN_ADDRESS: &str = "Kakarot_native_token_address"; diff --git a/src/test_utils/hive/mod.rs b/src/test_utils/hive/mod.rs index d8a881528..a84baaa0d 100644 --- a/src/test_utils/hive/mod.rs +++ b/src/test_utils/hive/mod.rs @@ -13,7 +13,10 @@ use starknet_api::core::ClassHash; use starknet_crypto::FieldElement; use super::{ - constants::{ACCOUNT_IMPLEMENTATION, ACCOUNT_NONCE, KAKAROT_EVM_TO_STARKNET_ADDRESS, OWNABLE_OWNER}, + constants::{ + ACCOUNT_CAIRO1_HELPERS_CLASS_HASH, ACCOUNT_IMPLEMENTATION, ACCOUNT_NONCE, KAKAROT_EVM_TO_STARKNET_ADDRESS, + OWNABLE_OWNER, + }, katana::genesis::{KatanaGenesisBuilder, Loaded}, }; @@ -92,6 +95,10 @@ impl HiveGenesisConfig { (implementation_key, account_contract_class_hash.0.into()), (get_storage_var_address(ACCOUNT_NONCE, &[])?, FieldElement::ONE), (get_storage_var_address(OWNABLE_OWNER, &[])?, kakarot_address), + ( + get_storage_var_address(ACCOUNT_CAIRO1_HELPERS_CLASS_HASH, &[])?, + builder.cache_load("cairo1_helpers")?, + ), ]); let key = get_storage_var_address("ERC20_allowances", &[starknet_address, kakarot_address])?; diff --git a/src/test_utils/katana/genesis.rs b/src/test_utils/katana/genesis.rs index 84e39391d..79041d482 100644 --- a/src/test_utils/katana/genesis.rs +++ b/src/test_utils/katana/genesis.rs @@ -32,9 +32,10 @@ use starknet::core::utils::{get_contract_address, get_storage_var_address, get_u use walkdir::WalkDir; use crate::test_utils::constants::{ - ACCOUNT_EVM_ADDRESS, ACCOUNT_IMPLEMENTATION, KAKAROT_ACCOUNT_CONTRACT_CLASS_HASH, KAKAROT_BASE_FEE, - KAKAROT_BLOCK_GAS_LIMIT, KAKAROT_CAIRO1_HELPERS_CLASS_HASH, KAKAROT_COINBASE, KAKAROT_EVM_TO_STARKNET_ADDRESS, - KAKAROT_NATIVE_TOKEN_ADDRESS, KAKAROT_PREV_RANDAO, KAKAROT_UNINITIALIZED_ACCOUNT_CLASS_HASH, OWNABLE_OWNER, + ACCOUNT_CAIRO1_HELPERS_CLASS_HASH, ACCOUNT_EVM_ADDRESS, ACCOUNT_IMPLEMENTATION, + KAKAROT_ACCOUNT_CONTRACT_CLASS_HASH, KAKAROT_BASE_FEE, KAKAROT_BLOCK_GAS_LIMIT, KAKAROT_CAIRO1_HELPERS_CLASS_HASH, + KAKAROT_COINBASE, KAKAROT_EVM_TO_STARKNET_ADDRESS, KAKAROT_NATIVE_TOKEN_ADDRESS, KAKAROT_PREV_RANDAO, + KAKAROT_UNINITIALIZED_ACCOUNT_CLASS_HASH, OWNABLE_OWNER, }; lazy_static! { @@ -221,6 +222,7 @@ impl KatanaGenesisBuilder { )); // Cache the address for later use. self.cache.insert("kakarot_address".to_string(), kakarot_address.0); + self.cache.insert("cairo1_helpers".to_string(), cairo1_helpers_class_hash); // Construct the kakarot contract storage. let kakarot_storage = [ @@ -257,12 +259,14 @@ impl KatanaGenesisBuilder { let kakarot_address = self.cache_load("kakarot_address")?; let account_contract_class_hash = self.account_contract_class_hash()?; + let cairo1_helpers_class_hash = self.cairo1_helpers_class_hash()?; // Set the eoa storage let eoa_storage = [ (storage_addr(ACCOUNT_EVM_ADDRESS)?, evm_address), (storage_addr(OWNABLE_OWNER)?, kakarot_address), (storage_addr(ACCOUNT_IMPLEMENTATION)?, account_contract_class_hash), + (storage_addr(ACCOUNT_CAIRO1_HELPERS_CLASS_HASH)?, cairo1_helpers_class_hash), ] .into_iter() .collect::>();