Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
dev: replace precompiles with cairo1_helpers (#923)
Browse files Browse the repository at this point in the history
* fix: replace precompiles with cairo1_helpers

* fix: replace whitespace with tab

* fix the error from cicd

* fix var not found syntax error

* fix:replace the code change with issue

* fix: use ok_or_eyre replace eyre macro

* fix: rename the parameter to cairo1_helpers_class_hash

* upgrade the kakarot to v0.6.2
  • Loading branch information
imotai authored Apr 9, 2024
1 parent 971b854 commit 7de2630
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ setup: .gitmodules
chmod +x ./scripts/extract_abi.sh
git submodule update --init --recursive
cd lib/kakarot && make setup && make build && make build-sol && \
mv build/ssj/contracts_Cairo1Helpers.contract_class.json build/precompiles.json && rm -fr build/ssj && cd ..
mv build/ssj/contracts_Cairo1Helpers.contract_class.json build/cairo1_helpers.json && rm -fr build/ssj && cd ..
./scripts/extract_abi.sh

deploy-kakarot:
Expand Down
12 changes: 5 additions & 7 deletions src/test_utils/katana/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ impl<T> KatanaGenesisBuilder<T> {
self.class_hashes.get("uninitialized_account").cloned().ok_or_eyre("Missing uninitialized account class hash")
}

pub fn precompiles_class_hash(&self) -> Result<FieldElement> {
self.class_hashes.get("precompiles").cloned().ok_or_eyre("Missing precompiles class hash")
pub fn cairo1_helpers_class_hash(&self) -> Result<FieldElement> {
self.class_hashes.get("cairo1_helpers").cloned().ok_or_eyre("Missing cairo1 helpers class hash")
}
}

Expand Down Expand Up @@ -201,10 +201,8 @@ impl KatanaGenesisBuilder<Loaded> {

let account_contract_class_hash = self.account_contract_class_hash()?;
let uninitialized_account_class_hash = self.uninitialized_account_class_hash()?;
let precompiles_class_hash = self.precompiles_class_hash()?;

let cairo1_helpers_class_hash = self.cairo1_helpers_class_hash()?;
let block_gas_limit = FieldElement::from(20_000_000u64);

// Construct the kakarot contract address. Based on the constructor args from
// https://github.com/kkrt-labs/kakarot/blob/main/src/kakarot/kakarot.cairo#L23
let kakarot_address = ContractAddress::new(get_udc_deployed_address(
Expand All @@ -216,7 +214,7 @@ impl KatanaGenesisBuilder<Loaded> {
DEFAULT_FEE_TOKEN_ADDRESS.0,
account_contract_class_hash,
uninitialized_account_class_hash,
precompiles_class_hash,
cairo1_helpers_class_hash,
coinbase_address,
block_gas_limit,
],
Expand All @@ -229,7 +227,7 @@ impl KatanaGenesisBuilder<Loaded> {
(storage_addr(KAKAROT_NATIVE_TOKEN_ADDRESS)?, *DEFAULT_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)?, precompiles_class_hash),
(storage_addr(KAKAROT_CAIRO1_HELPERS_CLASS_HASH)?, cairo1_helpers_class_hash),
(storage_addr(KAKAROT_COINBASE)?, coinbase_address),
(storage_addr(KAKAROT_BASE_FEE)?, FieldElement::ZERO),
(storage_addr(KAKAROT_PREV_RANDAO)?, FieldElement::ZERO),
Expand Down

0 comments on commit 7de2630

Please sign in to comment.