From 40b210e106373a776948cc094d4e439fee9b9dd3 Mon Sep 17 00:00:00 2001 From: Alex Metelli Date: Mon, 15 Jul 2024 23:50:45 +0800 Subject: [PATCH] set new enviroment for use with ganache instead of anvil --- anvil.messaging.json | 8 ++++---- ethereum/anvil.env | 14 ++++++------- ethereum/foundry.toml | 2 +- ethereum/script/LocalTesting.s.sol | 4 ++-- ethereum/script/SendMessage.s.sol | 2 +- ethereum/soldeer.lock | 6 ++++++ ethereum/test/MockStorageTest.t.sol | 27 ------------------------- starknet/katana/deploy.sh | 31 +++++++++++++---------------- starknet/katana/katana.env | 2 +- 9 files changed, 36 insertions(+), 60 deletions(-) delete mode 100644 ethereum/test/MockStorageTest.t.sol diff --git a/anvil.messaging.json b/anvil.messaging.json index b23c94a..fc79083 100644 --- a/anvil.messaging.json +++ b/anvil.messaging.json @@ -1,9 +1,9 @@ { "chain": "ethereum", - "rpc_url": "http://127.0.0.1:8545", - "contract_address": "0x5FbDB2315678afecb367f032d93F642f64180aa3", - "sender_address": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", - "private_key": "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", + "rpc_url": "http://127.0.0.1:7545", + "contract_address": "0x27d3D261A62E82A47DdBcB2a7326398761BA95C5", + "sender_address": "0x6E7A2310e7E6A87f07B09e028EF281AAc6981c02", + "private_key": "0xce3ef648b7851e1884731ebafa4cbbc91a0bd3167ebef8b607f3aa2eed3ee8e2", "interval": 2, "from_block": 0 } diff --git a/ethereum/anvil.env b/ethereum/anvil.env index 7309c7b..abcbccb 100644 --- a/ethereum/anvil.env +++ b/ethereum/anvil.env @@ -1,15 +1,15 @@ # General config. -ETH_RPC_URL=http://127.0.0.1:8545 +ETH_RPC_URL=HTTP://127.0.0.1:7545 ETHERSCAN_API_KEY=0x1 # Account related variables (EOA account). -ACCOUNT_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 -ACCOUNT_ADDRESS=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 +ACCOUNT_PRIVATE_KEY=0xce3ef648b7851e1884731ebafa4cbbc91a0bd3167ebef8b607f3aa2eed3ee8e2 +ACCOUNT_ADDRESS=0x6E7A2310e7E6A87f07B09e028EF281AAc6981c02 # Contracts on L1. -CONTRACT_MSG_ADDRESS=0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512 -L1_MESSAGE_SENDER_ADDRESS=0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0 -SN_MESSAGING_ADDRESS=0x5FbDB2315678afecb367f032d93F642f64180aa3 +CONTRACT_MSG_ADDRESS=0x08a393Fe28Af83962C204709805469121f10910e +L1_MESSAGE_SENDER_ADDRESS=0xE7CF00da9CcAc9a3eE2B2f19F9CbF5851e31Ad0C +SN_MESSAGING_ADDRESS=0x27d3D261A62E82A47DdBcB2a7326398761BA95C5 # The "msg_handler_value" selector. @@ -19,4 +19,4 @@ L2_SELECTOR_STRUCT=0x00f1149cade9d692862ad41df96b108aa2c20af34f640457e781d166c98 # Account contract address that send messages on L2. L2_ACCOUNT=0x517ececd29116499f4a1b64b094da79ba08dfd54a3edaa316134c41f8160973 # Address of the L2 message proxy contract -L2_CONTRACT_ADDRESS=0x00ecee874a015525c1e2525fe405bf4e02da2f6cf3feb1ca39601a163f77ab00 +L2_CONTRACT_ADDRESS=0x06980633e6c57b62bae4bfa609c9a3025f63ee63bdb78fd79a55899b5442f47e diff --git a/ethereum/foundry.toml b/ethereum/foundry.toml index 17d8832..1d553a1 100644 --- a/ethereum/foundry.toml +++ b/ethereum/foundry.toml @@ -10,4 +10,4 @@ libs = ["dependencies"] fs_permissions = [{ access = "read-write", path = "./logs" }] [dependencies] -forge-std = { version = "1.8.2", url = "https://github.com/foundry-rs/foundry.git" } \ No newline at end of file +forge-std = "1.8.2" diff --git a/ethereum/script/LocalTesting.s.sol b/ethereum/script/LocalTesting.s.sol index 12eddf4..381d193 100644 --- a/ethereum/script/LocalTesting.s.sol +++ b/ethereum/script/LocalTesting.s.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; -import "@forge-std/src/Script.sol"; -import "@forge-std/src/console.sol"; +import "forge-std/src/Script.sol"; +import "forge-std/src/console.sol"; import "src/ContractMsg.sol"; import "src/L1MessageSender.sol"; diff --git a/ethereum/script/SendMessage.s.sol b/ethereum/script/SendMessage.s.sol index f3c0c7d..54abf84 100644 --- a/ethereum/script/SendMessage.s.sol +++ b/ethereum/script/SendMessage.s.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; -import "@forge-std/src/Script.sol"; +import "forge-std/src/Script.sol"; import "src/ContractMsg.sol"; diff --git a/ethereum/soldeer.lock b/ethereum/soldeer.lock index d106b24..10d080f 100644 --- a/ethereum/soldeer.lock +++ b/ethereum/soldeer.lock @@ -5,3 +5,9 @@ name = "forge-std" version = "1.8.2" source = "https://soldeer-revisions.s3.amazonaws.com/forge-std/1_8_2_19-05-2024_18:52:07_forge-std-1.8.2.zip" checksum = "88a37e1d79f60b8aad08c7bd50a7a5ef973fc172b1495028d0725a17f5a4976c" + +[[dependencies]] +name = "forge-std" +version = "1.8.2" +source = "https://soldeer-revisions.s3.amazonaws.com/forge-std/1_8_2_19-05-2024_18:52:07_forge-std-1.8.2.zip" +checksum = "88a37e1d79f60b8aad08c7bd50a7a5ef973fc172b1495028d0725a17f5a4976c" diff --git a/ethereum/test/MockStorageTest.t.sol b/ethereum/test/MockStorageTest.t.sol deleted file mode 100644 index 97849d1..0000000 --- a/ethereum/test/MockStorageTest.t.sol +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.0; - -import {Script} from "@forge-std/src/Script.sol"; -import {MockStorage} from "../src/Mock/MockStorage.sol"; -import {DeployMockStorage} from "../script/DeployMockStorage.s.sol"; -import {Test, console} from "@forge-std/src/Test.sol"; - -contract MockStorageTest is Test{ - MockStorage mockStorage; - - function setUp() external { - DeployMockStorage deployer = new DeployMockStorage(); - mockStorage = deployer.run(); - } - - - function testMockStorage() public view { - - assert( mockStorage.getValue() == 1000); - assert( mockStorage.getMapValues(1000) == 0x9D7f74d0C41E726EC95884E0e97Fa6129e3b5E99); - assert( mockStorage.getMapValues(2000) == 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4); - assert( mockStorage.getArrValues(0) == 0x9D7f74d0C41E726EC95884E0e97Fa6129e3b5E99); - assert( mockStorage.getArrValues(1) == 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4); - - } -} \ No newline at end of file diff --git a/starknet/katana/deploy.sh b/starknet/katana/deploy.sh index 2d15f31..e2174d6 100755 --- a/starknet/katana/deploy.sh +++ b/starknet/katana/deploy.sh @@ -1,21 +1,21 @@ #!/bin/bash -# Load the addresses from the deployed-contracts.txt file -declare -A class_hashes -declare -A addresses - +# Load the addresses from the declared-classes.txt file while IFS= read -r line; do contract_name=$(echo "$line" | cut -d ':' -f 1 | xargs) class_hash=$(echo "$line" | cut -d ' ' -f 2 | xargs) - - class_hashes["$contract_name"]=$class_hash + echo "Contract Name: $contract_name" + echo "Class Hash: $class_hash" + if [ "$contract_name" = "messages-proxy" ]; then + messages_proxy_class_hash=$class_hash + elif [ "$contract_name" = "headers-store" ]; then + headers_store_class_hash=$class_hash + elif [ "$contract_name" = "fact-registry" ]; then + fact_registry_class_hash=$class_hash + fi done < katana/declared-classes.txt -messages_proxy_class_hash=${class_hashes["messages-proxy"]} -headers_store_class_hash=${class_hashes["headers-store"]} -fact_registry_class_hash=${class_hashes["fact-registry"]} - -# Debug: Print the class_hashes +# Debug: Print the class hashes echo "Fact Registry Class hash: $fact_registry_class_hash" echo "Headers Store Class hash: $headers_store_class_hash" echo "Messages Proxy Class hash: $messages_proxy_class_hash" @@ -31,14 +31,13 @@ if [ -z "$l1_message_sender_address" ]; then exit 1 fi -# Remove existing declared-classes.txt file if it exists +# Remove existing deployed-contracts.txt file if it exists rm -f katana/deployed-contracts.txt # Perform Deployment # Message Proxy Deployment echo "Deploying messages-proxy with L1_MESSAGE_SENDER_ADDRESS and owner address..." output=$(starkli deploy "$messages_proxy_class_hash" "$l1_message_sender_address" "$owner_address" --salt 0x1 -w) -# output=$(starkli deploy "$messages_proxy_class_hash" "$l1_message_sender_address" katana-1 --salt 0x1 -w) echo "messages-proxy: $output" >> katana/deployed-contracts.txt messages_proxy=$output echo "Messages Proxy address: $messages_proxy" @@ -63,11 +62,9 @@ echo "Fact Registry address: $fact_registry" echo "Deployment address for fact-registry saved to deployed-contracts.txt" echo "Deployment complete." - echo " " -#Set l1_headers_store_address for messages-proxy +# Set l1_headers_store_address for messages-proxy echo "Setting headers-store for messages-proxy contract..." output=$(starkli invoke "$messages_proxy" set_l1_headers_store "$headers_store" --account katana-0 -w) - -echo "l1_headers_store_address set complete." \ No newline at end of file +echo "l1_headers_store_address set complete." diff --git a/starknet/katana/katana.env b/starknet/katana/katana.env index 73cc4a9..6c1e2d1 100644 --- a/starknet/katana/katana.env +++ b/starknet/katana/katana.env @@ -2,4 +2,4 @@ export STARKNET_ACCOUNT=katana-0 export STARKNET_RPC=http://0.0.0.0:5050 export OWNER_ADDRESS=0x6162896d1d7ab204c7ccac6dd5f8e9e7c25ecd5ae4fcb4ad32e57786bb46e03 export STARKNET_HANDLER_ADDRESS=0xe29882a1fcba1e7e10cad46212257fea5c752a4f9b1b1ec683c503a2cf5c8a -export L1_MESSAGE_SENDER_ADDRESS=0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0 \ No newline at end of file +export L1_MESSAGE_SENDER_ADDRESS=0xE7CF00da9CcAc9a3eE2B2f19F9CbF5851e31Ad0C \ No newline at end of file