diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 722096aee..68d3256f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -168,6 +168,7 @@ jobs: uses: actions/checkout@v3 with: repository: kkrt-labs/ef-tests + ref: dev/rename-precompiles-class - name: Checkout local skip file uses: actions/checkout@v3 with: diff --git a/src/kakarot/instructions/block_information.cairo b/src/kakarot/instructions/block_information.cairo index 93fa19642..5adb26e38 100644 --- a/src/kakarot/instructions/block_information.cairo +++ b/src/kakarot/instructions/block_information.cairo @@ -11,7 +11,7 @@ from starkware.cairo.common.uint256 import Uint256 from kakarot.constants import Constants from kakarot.evm import EVM from kakarot.interfaces.interfaces import ICairo1Helpers -from kakarot.storages import Kakarot_precompiles_class_hash +from kakarot.storages import Kakarot_cairo1_helpers_class_hash from kakarot.model import model from kakarot.stack import Stack from kakarot.state import State @@ -172,7 +172,7 @@ namespace Internals { return (); } - let (implementation) = Kakarot_precompiles_class_hash.read(); + let (implementation) = Kakarot_cairo1_helpers_class_hash.read(); let (blockhash) = ICairo1Helpers.library_call_get_block_hash( implementation, block_number.low ); diff --git a/src/kakarot/instructions/environmental_information.cairo b/src/kakarot/instructions/environmental_information.cairo index c8fedaabd..1c3eacf90 100644 --- a/src/kakarot/instructions/environmental_information.cairo +++ b/src/kakarot/instructions/environmental_information.cairo @@ -19,7 +19,7 @@ from kakarot.memory import Memory from kakarot.model import model from kakarot.stack import Stack from kakarot.state import State -from kakarot.storages import Kakarot_precompiles_class_hash +from kakarot.storages import Kakarot_cairo1_helpers_class_hash from utils.array import slice from utils.bytes import bytes_to_bytes8_little_endian from utils.uint256 import uint256_to_uint160, uint256_add @@ -481,7 +481,7 @@ namespace EnvironmentalInformation { dst, account.code_len, account.code ); - let (implementation) = Kakarot_precompiles_class_hash.read(); + let (implementation) = Kakarot_cairo1_helpers_class_hash.read(); let (code_hash) = ICairo1Helpers.library_call_keccak( class_hash=implementation, words_len=dst_len, diff --git a/src/kakarot/instructions/sha3.cairo b/src/kakarot/instructions/sha3.cairo index 4966d3ef3..7daac5b0f 100644 --- a/src/kakarot/instructions/sha3.cairo +++ b/src/kakarot/instructions/sha3.cairo @@ -15,7 +15,7 @@ from kakarot.gas import Gas from kakarot.memory import Memory from kakarot.model import model from kakarot.stack import Stack -from kakarot.storages import Kakarot_precompiles_class_hash +from kakarot.storages import Kakarot_cairo1_helpers_class_hash from utils.bytes import bytes_to_bytes8_little_endian namespace Sha3 { @@ -61,7 +61,7 @@ namespace Sha3 { dst, size.low, bigendian_data ); - let (implementation) = Kakarot_precompiles_class_hash.read(); + let (implementation) = Kakarot_cairo1_helpers_class_hash.read(); let (result) = ICairo1Helpers.library_call_keccak( class_hash=implementation, words_len=dst_len, diff --git a/src/kakarot/instructions/system_operations.cairo b/src/kakarot/instructions/system_operations.cairo index cef2cec28..230cea11b 100644 --- a/src/kakarot/instructions/system_operations.cairo +++ b/src/kakarot/instructions/system_operations.cairo @@ -21,7 +21,7 @@ from kakarot.gas import Gas from kakarot.memory import Memory from kakarot.model import model from kakarot.stack import Stack -from kakarot.storages import Kakarot_precompiles_class_hash +from kakarot.storages import Kakarot_cairo1_helpers_class_hash from kakarot.state import State from utils.utils import Helpers from utils.array import slice @@ -1011,7 +1011,7 @@ namespace CreateHelper { message_bytes8, message_len, message ); - let (implementation) = Kakarot_precompiles_class_hash.read(); + let (implementation) = Kakarot_cairo1_helpers_class_hash.read(); let (message_hash) = ICairo1Helpers.library_call_keccak( class_hash=implementation, words_len=message_bytes8_len, @@ -1047,7 +1047,7 @@ namespace CreateHelper { bytecode_bytes8, bytecode_len, bytecode ); - let (implementation) = Kakarot_precompiles_class_hash.read(); + let (implementation) = Kakarot_cairo1_helpers_class_hash.read(); let (bytecode_hash) = ICairo1Helpers.library_call_keccak( class_hash=implementation, words_len=bytecode_bytes8_len, diff --git a/src/kakarot/kakarot.cairo b/src/kakarot/kakarot.cairo index 0012b03e8..49467306c 100644 --- a/src/kakarot/kakarot.cairo +++ b/src/kakarot/kakarot.cairo @@ -27,7 +27,7 @@ func constructor{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr native_token_address: felt, account_contract_class_hash: felt, uninitialized_account_class_hash: felt, - precompiles_class_hash: felt, + cairo1_helpers_class_hash: felt, coinbase: felt, block_gas_limit: felt, ) { @@ -36,7 +36,7 @@ func constructor{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr native_token_address, account_contract_class_hash, uninitialized_account_class_hash, - precompiles_class_hash, + cairo1_helpers_class_hash, coinbase, block_gas_limit, ); diff --git a/src/kakarot/library.cairo b/src/kakarot/library.cairo index 5ebb40d98..7a3967fff 100644 --- a/src/kakarot/library.cairo +++ b/src/kakarot/library.cairo @@ -16,7 +16,7 @@ from kakarot.storages import ( Kakarot_account_contract_class_hash, Kakarot_base_fee, Kakarot_native_token_address, - Kakarot_precompiles_class_hash, + Kakarot_cairo1_helpers_class_hash, Kakarot_coinbase, Kakarot_prev_randao, Kakarot_block_gas_limit, @@ -37,14 +37,14 @@ namespace Kakarot { // @param native_token_address The ERC20 contract used to emulate ETH. // @param account_contract_class_hash The clash hash of the contract account. // @param uninitialized_account_class_hash The class hash of the uninitialized account used for deterministic address calculation. - // @param precompiles_class_hash The precompiles class hash for precompiles not implemented in Kakarot. + // @param cairo1_helpers_class_hash The precompiles class hash for precompiles not implemented in Kakarot. // @param coinbase The EOA whose key is owned by the deployer (or known to be owned by Coinbase) func constructor{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}( owner: felt, native_token_address, account_contract_class_hash, uninitialized_account_class_hash, - precompiles_class_hash, + cairo1_helpers_class_hash, coinbase, block_gas_limit, ) { @@ -52,7 +52,7 @@ namespace Kakarot { Kakarot_native_token_address.write(native_token_address); Kakarot_account_contract_class_hash.write(account_contract_class_hash); Kakarot_uninitialized_account_class_hash.write(uninitialized_account_class_hash); - Kakarot_precompiles_class_hash.write(precompiles_class_hash); + Kakarot_cairo1_helpers_class_hash.write(cairo1_helpers_class_hash); Kakarot_coinbase.write(coinbase); Kakarot_block_gas_limit.write(block_gas_limit); return (); diff --git a/src/kakarot/precompiles/precompiles.cairo b/src/kakarot/precompiles/precompiles.cairo index 96c4a3302..7d41a36e6 100644 --- a/src/kakarot/precompiles/precompiles.cairo +++ b/src/kakarot/precompiles/precompiles.cairo @@ -7,7 +7,7 @@ from starkware.cairo.common.alloc import alloc from starkware.cairo.common.memcpy import memcpy from kakarot.interfaces.interfaces import ICairo1Helpers -from kakarot.storages import Kakarot_precompiles_class_hash +from kakarot.storages import Kakarot_cairo1_helpers_class_hash from kakarot.errors import Errors from kakarot.precompiles.blake2f import PrecompileBlake2f from kakarot.precompiles.datacopy import PrecompileDataCopy @@ -123,7 +123,7 @@ namespace Precompiles { output_len: felt, output: felt*, gas_used: felt, reverted: felt ) { alloc_locals; - let (implementation) = Kakarot_precompiles_class_hash.read(); + let (implementation) = Kakarot_cairo1_helpers_class_hash.read(); let (calldata: felt*) = alloc(); assert [calldata] = evm_address; assert [calldata + 1] = input_len; diff --git a/src/kakarot/storages.cairo b/src/kakarot/storages.cairo index 236e5a5dd..2d5f1d644 100644 --- a/src/kakarot/storages.cairo +++ b/src/kakarot/storages.cairo @@ -5,7 +5,7 @@ from starkware.cairo.common.uint256 import Uint256 @storage_var -func Kakarot_precompiles_class_hash() -> (res: felt) { +func Kakarot_cairo1_helpers_class_hash() -> (res: felt) { } @storage_var diff --git a/tests/fixtures/EVM.cairo b/tests/fixtures/EVM.cairo index e2a850989..7d989f046 100644 --- a/tests/fixtures/EVM.cairo +++ b/tests/fixtures/EVM.cairo @@ -21,7 +21,7 @@ from kakarot.storages import ( Kakarot_native_token_address, Kakarot_account_contract_class_hash, Kakarot_uninitialized_account_class_hash, - Kakarot_precompiles_class_hash, + Kakarot_cairo1_helpers_class_hash, Kakarot_coinbase, Kakarot_block_gas_limit, ) @@ -34,14 +34,14 @@ func constructor{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr native_token_address: felt, account_contract_class_hash: felt, uninitialized_account_class_hash: felt, - precompiles_class_hash: felt, + cairo1_helpers_class_hash: felt, coinbase: felt, block_gas_limit: felt, ) { Kakarot_native_token_address.write(native_token_address); Kakarot_account_contract_class_hash.write(account_contract_class_hash); Kakarot_uninitialized_account_class_hash.write(uninitialized_account_class_hash); - Kakarot_precompiles_class_hash.write(precompiles_class_hash); + Kakarot_cairo1_helpers_class_hash.write(cairo1_helpers_class_hash); Kakarot_coinbase.write(coinbase); Kakarot_block_gas_limit.write(block_gas_limit); return (); diff --git a/tests/src/kakarot/instructions/test_environmental_information.py b/tests/src/kakarot/instructions/test_environmental_information.py index bb7ff2252..72041aa9a 100644 --- a/tests/src/kakarot/instructions/test_environmental_information.py +++ b/tests/src/kakarot/instructions/test_environmental_information.py @@ -148,7 +148,7 @@ def _pack_into_u64_words(self, bytecode): EXISTING_ACCOUNT_SN_ADDR, ) @SyscallHandler.patch( - "Kakarot_precompiles_class_hash", + "Kakarot_cairo1_helpers_class_hash", CAIRO1_HELPERS_CLASS_HASH, ) def test_extcodehash__should_push_hash(