diff --git a/.github/workflows/cairo-zero-ci.yml b/.github/workflows/cairo-zero-ci.yml index 8e2d4cef8..26f7d1868 100644 --- a/.github/workflows/cairo-zero-ci.yml +++ b/.github/workflows/cairo-zero-ci.yml @@ -180,7 +180,6 @@ jobs: uses: actions/checkout@v4 with: repository: kkrt-labs/ef-tests - ref: feat/update-base-fee-state - name: Checkout local skip file uses: actions/checkout@v4 with: diff --git a/blockchain-tests-skip.yml b/blockchain-tests-skip.yml index 380795483..641830324 100644 --- a/blockchain-tests-skip.yml +++ b/blockchain-tests-skip.yml @@ -464,6 +464,9 @@ testname: - StaticcallToPrecompileFromCalledContract_d0g0v0_Cancun - StaticcallToPrecompileFromContractInitialization_d0g0v0_Cancun - StaticcallToPrecompileFromTransaction_d0g0v0_Cancun + - static_Call1024PreCalls_d1g0v0_Cancun #RunResources error + - static_Call1024PreCalls2_d1g0v0_Cancun #RunResources error + - static_Call1024PreCalls3_d1g0v0_Cancun #RunResources error - static_Call1MB1024Calldepth_d1g0v0_Cancun #RunResources error - static_Call1024PreCalls2_d0g0v0_Cancun #RunResources error - static_Call50000_d0g0v0_Cancun #RunResources error diff --git a/cairo_zero/kakarot/state.cairo b/cairo_zero/kakarot/state.cairo index 6ccc9d8a6..8552778d9 100644 --- a/cairo_zero/kakarot/state.cairo +++ b/cairo_zero/kakarot/state.cairo @@ -137,6 +137,7 @@ namespace State { alloc_locals; tempvar accounts_ptr = state.accounts; with accounts_ptr { + // EVM Precompiles Internals._cache_precompile(1); Internals._cache_precompile(2); Internals._cache_precompile(3); @@ -147,6 +148,14 @@ namespace State { Internals._cache_precompile(8); Internals._cache_precompile(9); Internals._cache_precompile(10); + + // RIP Precompiles + Internals._cache_precompile(Constants.P256VERIFY_PRECOMPILE); + + // Kakarot Precompiles + Internals._cache_precompile(Constants.CAIRO_WHITELISTED_CALL_PRECOMPILE); + Internals._cache_precompile(Constants.CAIRO_MULTICALL_PRECOMPILE); + Internals._cache_precompile(Constants.CAIRO_CALL_PRECOMPILE); } tempvar state = new model.State( accounts_start=state.accounts_start, diff --git a/cairo_zero/tests/src/kakarot/precompiles/test_precompiles.py b/cairo_zero/tests/src/kakarot/precompiles/test_precompiles.py index ac3cea87f..1e80a799e 100644 --- a/cairo_zero/tests/src/kakarot/precompiles/test_precompiles.py +++ b/cairo_zero/tests/src/kakarot/precompiles/test_precompiles.py @@ -219,7 +219,12 @@ def test__is_precompile_rollup_precompiles(self, cairo_run, address): assert result == (address in ROLLUP_PRECOMPILES) @pytest.mark.parametrize( - "address", range(KAKAROT_PRECOMPILES[0], KAKAROT_PRECOMPILES[-1] + 2) + "address", + [ + KAKAROT_PRECOMPILES[0] - 1, + *KAKAROT_PRECOMPILES, + KAKAROT_PRECOMPILES[-1] + 1, + ], ) def test__is_precompile_kakarot_precompiles(self, cairo_run, address): result = cairo_run("test__is_precompile", address=address) diff --git a/cairo_zero/tests/src/kakarot/test_state.py b/cairo_zero/tests/src/kakarot/test_state.py index d7dc44456..9b5cce632 100644 --- a/cairo_zero/tests/src/kakarot/test_state.py +++ b/cairo_zero/tests/src/kakarot/test_state.py @@ -5,7 +5,7 @@ TX_ACCESS_LIST_STORAGE_KEY_COST, ) -from tests.utils.constants import ETHEREUM_PRECOMPILES, TRANSACTIONS +from tests.utils.constants import ALL_PRECOMPILES, TRANSACTIONS from tests.utils.helpers import flatten_tx_access_list, merge_access_list from tests.utils.syscall_handler import SyscallHandler @@ -90,7 +90,7 @@ def test_should_cache_precompiles(self, cairo_run): state = cairo_run("test__cache_precompiles") assert [ int(address, 16) for address in state["accounts"].keys() - ] == ETHEREUM_PRECOMPILES + ] == ALL_PRECOMPILES @SyscallHandler.patch("IERC20.balanceOf", lambda *_: [0, 1]) @pytest.mark.parametrize("transaction", TRANSACTIONS) diff --git a/foundry.toml b/foundry.toml index aea918382..1559de579 100644 --- a/foundry.toml +++ b/foundry.toml @@ -4,6 +4,8 @@ test = 'solidity_contracts/tests' out = 'solidity_contracts/build' libs = ['solidity_contracts/lib'] +evm_version = "cancun" + optimizer = true optimizer_runs = 100_000 diff --git a/kakarot_scripts/compile_kakarot.py b/kakarot_scripts/compile_kakarot.py index d89ca2cee..871b97f83 100644 --- a/kakarot_scripts/compile_kakarot.py +++ b/kakarot_scripts/compile_kakarot.py @@ -50,8 +50,14 @@ def main(): cairo0_task = pool.map_async(compile_cairo_zero_contract, cairo0_contracts) cairo1_task = pool.map_async(compile_scarb_package, cairo1_packages) - cairo0_task.wait() - cairo1_task.wait() + try: + cairo0_task.wait() + cairo1_task.wait() + cairo0_task.get() + cairo1_task.get() + except Exception as e: + logger.error(e) + raise logger.info("ℹī¸ Computing deployed class hashes") with mp.Pool() as pool: class_hashes = pool.map(compute_deployed_class_hash, DECLARED_CONTRACTS) diff --git a/kakarot_scripts/ef_tests/fetch.py b/kakarot_scripts/ef_tests/fetch.py index 76ac5f135..b4091daec 100644 --- a/kakarot_scripts/ef_tests/fetch.py +++ b/kakarot_scripts/ef_tests/fetch.py @@ -8,7 +8,7 @@ import requests -EF_TESTS_TAG = "v14.1.1-kkrt" +EF_TESTS_TAG = "v14.1.3-kkrt" EF_TESTS_URL = ( f"https://github.com/kkrt-labs/tests/archive/refs/tags/{EF_TESTS_TAG}.tar.gz" ) diff --git a/kakarot_scripts/utils/starknet.py b/kakarot_scripts/utils/starknet.py index 73bb147fb..c656afc38 100644 --- a/kakarot_scripts/utils/starknet.py +++ b/kakarot_scripts/utils/starknet.py @@ -394,7 +394,7 @@ def compile_cairo_zero_contract(contract): if output.returncode != 0: raise RuntimeError( - f"❌ {contract['contract_name']} raised:\n{output.stderr}.\nOutput:\n{output.stdout}" + f"❌ {contract['contract_name']} raised: {output.stderr.decode().strip()}. Output: {output.stdout.decode().strip()}" ) elapsed = datetime.now() - start diff --git a/solidity_contracts/lib/kakarot-lib b/solidity_contracts/lib/kakarot-lib index 876daa08c..797819595 160000 --- a/solidity_contracts/lib/kakarot-lib +++ b/solidity_contracts/lib/kakarot-lib @@ -1 +1 @@ -Subproject commit 876daa08cfd23fd5d8c0d8caf1dceb384e9a8461 +Subproject commit 7978195955d328e4934092acc4fd56ab71fc94fb diff --git a/tests/utils/constants.py b/tests/utils/constants.py index a510e9346..03916ed0f 100644 --- a/tests/utils/constants.py +++ b/tests/utils/constants.py @@ -31,7 +31,7 @@ int.from_bytes(address, "big") for address in PRE_COMPILED_CONTRACTS.keys() ] ROLLUP_PRECOMPILES = [0x100] -KAKAROT_PRECOMPILES = [0x75001, 0x75002, 0x75003, 0x75004] +KAKAROT_PRECOMPILES = [0x75001, 0x75003, 0x75004] ALL_PRECOMPILES = [*ETHEREUM_PRECOMPILES, *ROLLUP_PRECOMPILES, *KAKAROT_PRECOMPILES] CAIRO_PRECOMPILE_GAS = 10000