Skip to content

Commit

Permalink
chore bump kakarot (#996)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
Eikix and greged93 authored Apr 22, 2024
1 parent 6479457 commit 18c25e2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/kakarot
Submodule kakarot updated 55 files
+4 −10 .devcontainer/devcontainer.json
+0 −3 .env.example
+2 −2 Makefile
+3 −0 blockchain-tests-skip.yml
+6 −7 deployments/kakarot-sepolia/declarations.json
+3 −13 deployments/kakarot-sepolia/deployments.json
+3 −3 deployments/starknet-sepolia/declarations.json
+2 −2 deployments/starknet-sepolia/deployments.json
+8 −14 docs/general/accounts.md
+12 −4 kakarot_scripts/constants.py
+43 −9 kakarot_scripts/utils/kakarot.py
+101 −7 poetry.lock
+3 −1 pyproject.toml
+1 −1 rust-toolchain
+0 −93 solidity_contracts/src/UniswapV2/conftest.py
+47 −24 src/kakarot/accounts/account_contract.cairo
+95 −36 src/kakarot/accounts/library.cairo
+14 −0 src/kakarot/accounts/model.cairo
+11 −8 src/kakarot/constants.cairo
+2 −0 src/kakarot/evm.cairo
+2 −0 src/kakarot/gas.cairo
+2 −1 src/kakarot/instructions/memory_operations.cairo
+11 −6 src/kakarot/instructions/stop_and_math_operations.cairo
+320 −16 src/kakarot/instructions/system_operations.cairo
+22 −0 src/kakarot/interfaces/interfaces.cairo
+8 −24 src/kakarot/interpreter.cairo
+28 −0 src/kakarot/kakarot.cairo
+27 −0 src/kakarot/library.cairo
+2 −0 src/kakarot/model.cairo
+46 −8 src/kakarot/precompiles/ec_recover.cairo
+11 −0 src/utils/array.cairo
+0 −61 src/utils/eth_transaction.cairo
+2 −9 src/utils/modexp/modexp_utils.cairo
+189 −1 src/utils/uint256.cairo
+4 −2 src/utils/utils.cairo
+2 −8 tests/end_to_end/UniswapV2/conftest.py
+137 −0 tests/end_to_end/test_account.py
+24 −0 tests/fixtures/account_contract_fixture.cairo
+8 −1 tests/fixtures/starknet.py
+33 −16 tests/src/kakarot/accounts/test_contract_account.cairo
+116 −33 tests/src/kakarot/accounts/test_contract_account.py
+1 −38 tests/src/kakarot/instructions/test_environmental_information.py
+93 −0 tests/src/kakarot/instructions/test_system_operations.cairo
+197 −0 tests/src/kakarot/instructions/test_system_operations.py
+10 −224 tests/src/kakarot/precompiles/test_ec_recover.cairo
+79 −3 tests/src/kakarot/precompiles/test_ec_recover.py
+16 −1 tests/src/utils/test_array.cairo
+16 −0 tests/src/utils/test_array.py
+0 −29 tests/src/utils/test_eth_transaction.cairo
+1 −101 tests/src/utils/test_eth_transaction.py
+19 −0 tests/utils/constants.py
+14 −1 tests/utils/helpers.cairo
+1 −0 tests/utils/serde.py
+41 −2 tests/utils/syscall_handler.py
+14 −0 vyper_contracts/src/EIP3074/AuthorizedTransfer.vy
1 change: 1 addition & 0 deletions src/test_utils/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
9 changes: 8 additions & 1 deletion src/test_utils/hive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
};

Expand Down Expand Up @@ -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])?;
Expand Down
10 changes: 7 additions & 3 deletions src/test_utils/katana/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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! {
Expand Down Expand Up @@ -221,6 +222,7 @@ impl KatanaGenesisBuilder<Loaded> {
));
// 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 = [
Expand Down Expand Up @@ -257,12 +259,14 @@ impl KatanaGenesisBuilder<Initialized> {

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::<HashMap<_, _>>();
Expand Down

0 comments on commit 18c25e2

Please sign in to comment.