diff --git a/Makefile b/Makefile index e1f876474..9cf1a8588 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,9 @@ katana: ; build: $(SSJ_DIR) uv run compile +declare: build build-sol + uv run declare + deploy: build build-sol uv run deploy diff --git a/deployments/starknet-mainnet/declarations.json b/deployments/starknet-mainnet/declarations.json index e91122242..52c1e9dff 100644 --- a/deployments/starknet-mainnet/declarations.json +++ b/deployments/starknet-mainnet/declarations.json @@ -1,13 +1,13 @@ { - "account_contract": "0x25d4b4889979f3df8171991f6a0163b42b756daebf313bcd0dec74cacf903f9", - "BalanceSender": "0x74bbbe278acf68f240004d5e38c9d12a7dea6c8d6c7e956d691509d5844be6c", + "account_contract": "0x24d700216e7f5a33f7e1426b550bcbba17acd52c5c645ba1e01e783b5cbafab", + "BalanceSender": "0xe85f18e5d88f398b84beba1faf6818fa461c93bc22e13af873d203d0ce1489", "BenchmarkCairoCalls": "0x58dc8a979af32668e05579313d1d6c672d3b668f72778780e8b2e97964159c3", "Cairo1Helpers": "0x6c84a7ed6ee3fa25d198f058b8c8a06d9d4e4dc040efd6fa4d741f00fdc1b63", "Cairo1HelpersFixture": "0x3810527e57a1df22d701b2c48f3d739e8fe3550876cb16435706d1448f89cbe", "Counter": "0x27ccfaf84757dabd7885d410018bf0e264c881e4799a47f555b96bf21e5af5b", "ERC20": "0xb36ee7670ae475d6c195e066201a526f7d850bb01961850405dcbd7aedd9bc", - "EVM": "0x586235fb226e2703fae36312476786cb6a70a5632ebcc4a5e4f9c642566f964", - "kakarot": "0x6583c98e878bb450518cccb0c667d6279cb780dc0eac1bcae883ce1e34e8771", + "EVM": "0x58e505d461c0cff95e868e634d37467170816e6bb9540fffd264b4bddb8c914", + "kakarot": "0x4a548d70f5f30756d77eda35f9d7b8ec34edc51ccd1f045bc2e0ba29f4cc5cd", "MockPragmaOracle": "0x675f00328ff84f127d71b179b3f3a3a06ce8432054770cddd5729c8d62866da", "OpenzeppelinAccount": "0x3a58e037be64a3608dfe423eeb8a77b400b0f56f1f5e0ed4937d3c873f988e2", "replace_class": "0x451a4decb11b581b288d8a0512ab6f6ea7f1fd89caefbb415e510ec7f17efe1", diff --git a/deployments/starknet-sepolia/declarations.json b/deployments/starknet-sepolia/declarations.json index e91122242..52c1e9dff 100644 --- a/deployments/starknet-sepolia/declarations.json +++ b/deployments/starknet-sepolia/declarations.json @@ -1,13 +1,13 @@ { - "account_contract": "0x25d4b4889979f3df8171991f6a0163b42b756daebf313bcd0dec74cacf903f9", - "BalanceSender": "0x74bbbe278acf68f240004d5e38c9d12a7dea6c8d6c7e956d691509d5844be6c", + "account_contract": "0x24d700216e7f5a33f7e1426b550bcbba17acd52c5c645ba1e01e783b5cbafab", + "BalanceSender": "0xe85f18e5d88f398b84beba1faf6818fa461c93bc22e13af873d203d0ce1489", "BenchmarkCairoCalls": "0x58dc8a979af32668e05579313d1d6c672d3b668f72778780e8b2e97964159c3", "Cairo1Helpers": "0x6c84a7ed6ee3fa25d198f058b8c8a06d9d4e4dc040efd6fa4d741f00fdc1b63", "Cairo1HelpersFixture": "0x3810527e57a1df22d701b2c48f3d739e8fe3550876cb16435706d1448f89cbe", "Counter": "0x27ccfaf84757dabd7885d410018bf0e264c881e4799a47f555b96bf21e5af5b", "ERC20": "0xb36ee7670ae475d6c195e066201a526f7d850bb01961850405dcbd7aedd9bc", - "EVM": "0x586235fb226e2703fae36312476786cb6a70a5632ebcc4a5e4f9c642566f964", - "kakarot": "0x6583c98e878bb450518cccb0c667d6279cb780dc0eac1bcae883ce1e34e8771", + "EVM": "0x58e505d461c0cff95e868e634d37467170816e6bb9540fffd264b4bddb8c914", + "kakarot": "0x4a548d70f5f30756d77eda35f9d7b8ec34edc51ccd1f045bc2e0ba29f4cc5cd", "MockPragmaOracle": "0x675f00328ff84f127d71b179b3f3a3a06ce8432054770cddd5729c8d62866da", "OpenzeppelinAccount": "0x3a58e037be64a3608dfe423eeb8a77b400b0f56f1f5e0ed4937d3c873f988e2", "replace_class": "0x451a4decb11b581b288d8a0512ab6f6ea7f1fd89caefbb415e510ec7f17efe1", diff --git a/deployments/starknet-sepolia/deployments.json b/deployments/starknet-sepolia/deployments.json index b6c9e38f7..f92c4d7e7 100644 --- a/deployments/starknet-sepolia/deployments.json +++ b/deployments/starknet-sepolia/deployments.json @@ -1,6 +1,6 @@ { "kakarot": "0x1d2e513630d8120666fc6e7d52ad0c01479fd99c183baac79fff9135f46e359", - "EVM": "0x77fbe27deb2caf8199b6b385b6cd9aa57203654bca4cbe8c3aece3f3991d545", + "EVM": "0x705d78cbe382d5432099682716f5ae7bdc4116b1d0d9252ab6332a1475b6201", "Counter": "0x49ef4ec31812310ea4d33b98d8e462515cf753b8f6245899d2ff3b22e07a403", "MockPragmaOracle": "0x17e64c92b06da9a331da9fd333a683a33019ae2a393254caf332d4158edc74d", "UniversalLibraryCaller": "0x4e23e34042e1f0198311e2dcfc9565c214a48261574f2b37a7f12d1f65100f1", diff --git a/deployments/starknet-sepolia/kakarot_deployments.json b/deployments/starknet-sepolia/kakarot_deployments.json index 90225d4c7..43a7df8c5 100644 --- a/deployments/starknet-sepolia/kakarot_deployments.json +++ b/deployments/starknet-sepolia/kakarot_deployments.json @@ -18,5 +18,17 @@ "Coinbase": { "address": "0xccaa1b04b831ea3e547d4fe4359e0c2f5b34b749", "starknet_address": "0x152c78b2d1229464d461bc323801739bf7a439d049685f59c506b356d0da1bb" + }, + "Multicall3": { + "address": "0xca11bde05977b3631167028862be2a173976ca11", + "starknet_address": "0x2dde6ca425942c0decd3908bc923ad2cd83edae11e27068fd77881cf51bd3bd" + }, + "ArachnidProxy": { + "address": "0x4e59b44847b379578588920ca78fbf26c0b4956c", + "starknet_address": "0x7cd414bed2e300ecfd409cf07c4f53906408e93e87d69812728f25ce5be7179" + }, + "CreateX": { + "address": "0xba5ed099633d3b313e4d5f7bdc1305d3c28ba5ed", + "starknet_address": "0x2361be1b7ded312bfc16c2547eaaf2308d3c9b6aa9037d8fc9ee57329f00951" } -} +} \ No newline at end of file diff --git a/docker/deployer/Dockerfile b/docker/deployer/Dockerfile index 6c9dea0fb..93e44c1a2 100644 --- a/docker/deployer/Dockerfile +++ b/docker/deployer/Dockerfile @@ -58,7 +58,7 @@ COPY . . COPY .env.example .env SHELL ["/bin/bash", "-c"] -RUN source "$HOME/.cargo/env" && uv venv && uv pip install -e . +RUN source "$HOME/.cargo/env" # Install asdf for multiple scarb versions RUN git clone --depth 1 https://github.com/asdf-vm/asdf.git "$HOME/.asdf" && \ @@ -67,6 +67,7 @@ RUN git clone --depth 1 https://github.com/asdf-vm/asdf.git "$HOME/.asdf" && \ RUN source "$HOME/.asdf/asdf.sh" && asdf plugin add scarb && asdf install scarb 0.7.0 && asdf install scarb 2.6.5 && asdf install scarb 2.8.3 +RUN uv sync --all-extras --dev RUN --mount=type=cache,target=/root/.cache \ source "$HOME/.asdf/asdf.sh" && source "$HOME/.cargo/env" && make build && make build-sol @@ -84,6 +85,7 @@ COPY --from=builder /app/kakarot/.venv ./.venv # Cairo Smart contracts are used in deploy_kakarot.py # To limit the probability of this Dockerfile to break, we copy the entire src and not individual files COPY --from=builder /app/kakarot/cairo_zero/ ./cairo_zero/ +COPY --from=builder /app/kakarot/cairo/ ./cairo/ # Default Solidity contracts are also used in deploy_kakarot.py COPY --from=builder /app/kakarot/solidity_contracts ./solidity_contracts/ @@ -93,6 +95,9 @@ COPY --from=builder /app/kakarot/uv.lock . COPY --from=builder /app/kakarot/pyproject.toml . COPY --from=builder /app/kakarot/foundry.toml . COPY --from=builder /app/kakarot/README.md . +COPY --from=builder /app/kakarot/.env.example .env +COPY --from=builder /app/kakarot/conftest.py . +ENV PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python # Deploy kakarot CMD ["uv", "run", "deploy"] diff --git a/kakarot_scripts/deployment/main.py b/kakarot_scripts/deployment/main.py index 8d277a3e6..eb061ce0e 100644 --- a/kakarot_scripts/deployment/main.py +++ b/kakarot_scripts/deployment/main.py @@ -72,7 +72,9 @@ async def main(): logger.error("❌ Coinbase is set to 0, all transaction fees will be lost") else: logger.info(f"✅ Coinbase set to: 0x{coinbase_address:040x}") - coinbase = await get_contract("Kakarot", "Coinbase", address=coinbase_address) + coinbase = await get_contract( + "Kakarot", "Coinbase", address=f"0x{coinbase_address:040x}" + ) coinbase_balance = await eth_balance_of(coinbase_address) if coinbase_balance / 1e18 > 0.001: logger.info( diff --git a/kakarot_scripts/deployment/starknet_deployments.py b/kakarot_scripts/deployment/starknet_deployments.py index ef40f955e..2a2dae5f8 100644 --- a/kakarot_scripts/deployment/starknet_deployments.py +++ b/kakarot_scripts/deployment/starknet_deployments.py @@ -11,6 +11,7 @@ RPC_CLIENT, NetworkType, ) +from kakarot_scripts.utils.starknet import call from kakarot_scripts.utils.starknet import deploy as deploy_starknet from kakarot_scripts.utils.starknet import ( dump_deployments, @@ -30,13 +31,14 @@ # %% async def deploy_starknet_contracts(account): - # %% Deployments + # %% Declarations class_hash = get_declarations() starknet_deployments = get_deployments() if NETWORK["type"] is NetworkType.PROD: return + # %% Deployments starknet_deployments["EVM"] = await deploy_starknet( "EVM", account.address, @@ -46,12 +48,20 @@ async def deploy_starknet_contracts(account): class_hash["Cairo1Helpers"], BLOCK_GAS_LIMIT, ) - await invoke( - "EVM", - "set_coinbase", - COINBASE, - address=starknet_deployments["EVM"], - ) + try: + coinbase = ( + await call("EVM", "get_coinbase", address=starknet_deployments["EVM"]) + )[0] + except Exception: + coinbase = None + if coinbase != COINBASE: + logger.info(f"ℹī¸ Setting EVM coinbase to {COINBASE}") + await invoke( + "EVM", + "set_coinbase", + COINBASE, + address=starknet_deployments["EVM"], + ) starknet_deployments["Counter"] = await deploy_starknet("Counter") starknet_deployments["MockPragmaOracle"] = await deploy_starknet("MockPragmaOracle") starknet_deployments["UniversalLibraryCaller"] = await deploy_starknet( diff --git a/pyproject.toml b/pyproject.toml index 4ca9f3b6e..7f483a2d9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,6 +16,7 @@ dependencies = [ [project.scripts] setup = "kakarot_scripts.setup.setup:main" compile = "kakarot_scripts.compile_kakarot:main" +declare = "kakarot_scripts.deployment.declarations:main_sync" deploy = "kakarot_scripts.deployment.main:main_sync" ef_tests = "kakarot_scripts.ef_tests.fetch:generate_tests" diff --git a/tests/fixtures/EVM.cairo b/tests/fixtures/EVM.cairo index 169db874e..38f31d104 100644 --- a/tests/fixtures/EVM.cairo +++ b/tests/fixtures/EVM.cairo @@ -34,6 +34,7 @@ from kakarot.kakarot import ( get_cairo1_helpers_class_hash, get_native_token, set_coinbase, + get_coinbase, ) from backend.starknet import Starknet, Internals as StarknetInternals from utils.dict import dict_keys, dict_values