From ceb0517549aa25b906b5a5b9a98bae4e885ae871 Mon Sep 17 00:00:00 2001 From: Julian Arce <52429267+JuArce@users.noreply.github.com> Date: Tue, 18 Mar 2025 18:15:31 -0300 Subject: [PATCH 1/3] fix(examples): use correct `verifyBatchInclusion` function and update python scripts on `examples/verify` (#1796) Co-authored-by: Mauro Toscano <12560266+MauroToscano@users.noreply.github.com> --- examples/verify/README.md | 32 ++++++++++++----- examples/verify/encode_verification_data.py | 34 ++++++++----------- .../verify/src/VerifyBatchInclusionCaller.sol | 8 +++-- examples/verify/verify.py | 3 +- 4 files changed, 44 insertions(+), 33 deletions(-) diff --git a/examples/verify/README.md b/examples/verify/README.md index 886c80d07b..f4c9c76a1a 100644 --- a/examples/verify/README.md +++ b/examples/verify/README.md @@ -38,21 +38,31 @@ This will output the address of the deployed contract. You will need this addres First encode the ethereum call to the contract using the following command: ```bash -python3 encode_verification_data.py --aligned-verification-data [PATH_TO_ALIGNED_VERIFICATION_DATA] +python3 encode_verification_data.py --aligned-verification-data [PATH_TO_ALIGNED_VERIFICATION_DATA] --sender-address [SENDER_ADDRESS] ``` Replace `[PATH_TO_ALIGNED_VERIFICATION_DATA]` with the path to the json file containing the verification data. This is the output when submitting a proof from the aligned cli. +Replace `[SENDER_ADDRESS]` with the address of the `BatcherPaymentService` contract. + This will output the encoded call. You can then use this encoded call to check your submitted proof with the associated data is verified in Ethereum by running the following command: ```bash -curl -H "Content-Type: application/json" \ - --data '{"jsonrpc":"2.0","method":"eth_call","params":[{"to": "", "data": ""}]}' \ - -X POST +curl -X POST http://localhost:8545 \ +-H "Content-Type: application/json" \ +-d '{ + "jsonrpc": "2.0", + "method": "eth_call", + "params": [{ + "to": "", + "data": "" + }], + "id": 1 +}' ``` -Replace `` with the address of the contract you deployed earlier (or `0x58F280BeBE9B34c9939C3C39e0890C81f163B623` for Aligned ServiceManager in Holesky), `` with the encoded call, +Replace `` with the address of the contract you deployed earlier (or `0x58F280BeBE9B34c9939C3C39e0890C81f163B623` for Aligned ServiceManager in Holesky), `` with the encoded call, and `` with the RPC URL of the blockchain you are using. The output data should be something like this: @@ -61,7 +71,7 @@ The output data should be something like this: { "jsonrpc":"2.0", "result":"0x0000000000000000000000000000000000000000000000000000000000000001", - "id":null + "id":q } ``` @@ -78,13 +88,17 @@ Note that if result ends in 1 it means that your submitted proof with the associ Then, you can run the script by running the following command: ```bash -python3 verify.py --contract-address [CONTRACT_ADDRESS] --aligned-verification-data [PATH_TO_ALIGNED_VERIFICATION_DATA] +python3 verify.py --contract-address [CONTRACT_ADDRESS] --aligned-verification-data [PATH_TO_ALIGNED_VERIFICATION_DATA] --sender-address [SENDER_ADDRESS] ``` -Replace `[CONTRACT_ADDRESS]`, and `[PATH_TO_ALIGNED_VERIFICATION_DATA]` with your actual values. +Replace `[CONTRACT_ADDRESS]`, `[PATH_TO_ALIGNED_VERIFICATION_DATA]` and `[SENDER_ADDRESS]` with your actual values. #### Example Command ```bash -python3 verify.py --contract-address 0x623926229DD27c45AE40B4e16ba4CD6522fC4d22 --aligned-verification-data ../../aligned_verification_data/7553cb14bff387c06e016cb3e7946e91d9fe44a54ad5d888ce8343ddb16116a7_118.json +python3 verify.py --contract-address 0x58F280BeBE9B34c9939C3C39e0890C81f163B623 --aligned-verification-data ../../aligned_verification_data/b8c17406_4.json --sender-address 0x815aeCA64a974297942D2Bbf034ABEe22a38A003 ``` + +In this case, `--contract-address` is the address of the `AlignedLayerServiceManager` and `--sender-address` is the address of the `BatcherPaymentService` in Holesky Testnet. + +You need to replace the `--aligned-verification-data` with the path to the JSON file containing the verification data. This is the output when submitting a proof. diff --git a/examples/verify/encode_verification_data.py b/examples/verify/encode_verification_data.py index 6d8ebf3191..b752ce690d 100644 --- a/examples/verify/encode_verification_data.py +++ b/examples/verify/encode_verification_data.py @@ -4,40 +4,34 @@ from Crypto.Hash import keccak -def encode_call(file): +def encode_call(file, sender_address): with open(file) as f: data = load(f) - verification_data_commitment = data['verification_data_commitment'] - proof_commitment = bytearray(verification_data_commitment['proof_commitment']) - pub_input_commitment = bytearray(verification_data_commitment['pub_input_commitment']) - proving_system_aux_data_commitment = bytearray( - verification_data_commitment['proving_system_aux_data_commitment']) - proof_generator_addr = bytearray(verification_data_commitment['proof_generator_addr']) - batch_merkle_root = bytearray(data['batch_merkle_root']) + proof_commitment = bytearray.fromhex(data['proof_commitment']) + pub_input_commitment = bytearray.fromhex(data['pub_input_commitment']) + proving_system_aux_data_commitment = bytearray.fromhex(data['program_id_commitment']) + proof_generator_addr = bytearray.fromhex(data['proof_generator_addr']) + batch_merkle_root = bytearray.fromhex(data['batch_merkle_root']) + merkle_proof = bytearray.fromhex(data['merkle_proof']) + verification_data_batch_index = data['verification_data_batch_index'] - merkle_path_arr = data['batch_inclusion_proof']['merkle_path'] - merkle_proof = bytearray() - for i in range(0, len(merkle_path_arr)): - merkle_proof += bytearray(merkle_path_arr[i]) - - index = data['index_in_batch'] - - output = encode(['bytes32', 'bytes32', 'bytes32', 'bytes20', 'bytes32', 'bytes', 'uint256'], + output = encode(['bytes32', 'bytes32', 'bytes32', 'bytes20', 'bytes32', 'bytes', 'uint256', 'address'], [proof_commitment, pub_input_commitment, proving_system_aux_data_commitment, - proof_generator_addr, batch_merkle_root, merkle_proof, index]) + proof_generator_addr, batch_merkle_root, merkle_proof, verification_data_batch_index, + sender_address]) k = keccak.new(digest_bits=256) - k.update(b'verifyBatchInclusion(bytes32,bytes32,bytes32,bytes20,bytes32,bytes,uint256)') + k.update(b'verifyBatchInclusion(bytes32,bytes32,bytes32,bytes20,bytes32,bytes,uint256,address)') signature = k.hexdigest()[:8] - return '0x' + signature + output.hex() if __name__ == "__main__": parser = ArgumentParser() parser.add_argument('--aligned-verification-data', help='Path to JSON file with the verification data') + parser.add_argument('--sender-address', help='Address that sent the batch to Aligned') args = parser.parse_args() - data = encode_call(args.aligned_verification_data) + data = encode_call(args.aligned_verification_data, args.sender_address) print(data) diff --git a/examples/verify/src/VerifyBatchInclusionCaller.sol b/examples/verify/src/VerifyBatchInclusionCaller.sol index 7c47a45a72..6fd6c38a37 100644 --- a/examples/verify/src/VerifyBatchInclusionCaller.sol +++ b/examples/verify/src/VerifyBatchInclusionCaller.sol @@ -15,18 +15,20 @@ contract VerifyBatchInclusionCaller { bytes20 proofGeneratorAddr, bytes32 batchMerkleRoot, bytes memory merkleProof, - uint256 verificationDataBatchIndex + uint256 verificationDataBatchIndex, + address senderAddress ) external view returns (bool) { (bool callWasSuccessfull, bytes memory proofIsIncluded) = targetContract.staticcall( abi.encodeWithSignature( - "verifyBatchInclusion(bytes32,bytes32,bytes32,bytes20,bytes32,bytes,uint256)", + "verifyBatchInclusion(bytes32,bytes32,bytes32,bytes20,bytes32,bytes,uint256,address)", proofCommitment, pubInputCommitment, provingSystemAuxDataCommitment, proofGeneratorAddr, batchMerkleRoot, merkleProof, - verificationDataBatchIndex + verificationDataBatchIndex, + senderAddress ) ); diff --git a/examples/verify/verify.py b/examples/verify/verify.py index b46c32f61b..cc68838a44 100644 --- a/examples/verify/verify.py +++ b/examples/verify/verify.py @@ -10,12 +10,13 @@ def main(): parser.add_argument('--aligned-verification-data', help='Path to JSON file with the verification data', required=True) parser.add_argument('--contract-address', help='Verifier Contract address', required=True) + parser.add_argument('--sender-address', help='Address that sent the batch to Aligned') args = parser.parse_args() provider = Web3(Web3.HTTPProvider(args.rpc_url)) - data = encode_call(args.aligned_verification_data) + data = encode_call(args.aligned_verification_data, args.sender_address) result = provider.eth.call({ 'to': args.contract_address, From 824201cd3458d2e243d30adb3eceebcbc296cb1d Mon Sep 17 00:00:00 2001 From: Julian Arce <52429267+JuArce@users.noreply.github.com> Date: Tue, 25 Mar 2025 14:50:17 -0300 Subject: [PATCH 2/3] Mainnet staging deployment (#1822) Co-authored-by: MauroFab --- .../aligned.mainnet.config.json | 82 +++++++++++++++++++ ...atcher-payment-service.mainnet.config.json | 16 ++++ .../script/output/mainnet_staging/.gitkeep | 0 .../alignedlayer_deployment_output.json | 32 ++++++++ contracts/scripts/.env.mainnet | 2 +- contracts/scripts/.env.mainnet.staging | 8 ++ 6 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 contracts/script/deploy/config/mainnet_staging/aligned.mainnet.config.json create mode 100644 contracts/script/deploy/config/mainnet_staging/batcher-payment-service.mainnet.config.json create mode 100644 contracts/script/output/mainnet_staging/.gitkeep create mode 100644 contracts/script/output/mainnet_staging/alignedlayer_deployment_output.json create mode 100644 contracts/scripts/.env.mainnet.staging diff --git a/contracts/script/deploy/config/mainnet_staging/aligned.mainnet.config.json b/contracts/script/deploy/config/mainnet_staging/aligned.mainnet.config.json new file mode 100644 index 0000000000..98e92924bc --- /dev/null +++ b/contracts/script/deploy/config/mainnet_staging/aligned.mainnet.config.json @@ -0,0 +1,82 @@ +{ + "chainInfo": { + "chainId": 1 + }, + "permissions" : { + "aggregator": "0xb72D98AB27EBCF86C96a53564135d3141bAAE398", + "deployer": "0xb72D98AB27EBCF86C96a53564135d3141bAAE398", + "owner": "0x2106AC6FE9599f8A0710643C75661aaf8d8B1599", + "upgrader": "0x2106AC6FE9599f8A0710643C75661aaf8d8B1599", + "churner": "0x2106AC6FE9599f8A0710643C75661aaf8d8B1599", + "ejector": "0x2106AC6FE9599f8A0710643C75661aaf8d8B1599", + "pauser": "0x2106AC6FE9599f8A0710643C75661aaf8d8B1599", + "initalPausedStatus": 0 + }, + "minimumStakes": [ + 1 + ], + "strategyWeights": [ + [ + { + "0_strategy": "0xbeaC0eeEeeeeEEeEeEEEEeeEEeEeeeEeeEEBEaC0", + "1_multiplier": 1000000000000000000 + }, + { + "0_strategy": "0x93c4b944D05dfe6df7645A86cd2206016c51564D", + "1_multiplier": 1030077629425962827 + }, + { + "0_strategy": "0x1BeE69b7dFFfA4E2d53C2a2Df135C388AD25dCD2", + "1_multiplier": 1102456657360376283 + }, + { + "0_strategy": "0x54945180dB7943c0ed0FEE7EdaB2Bd24620256bc", + "1_multiplier": 1067949170243902475 + }, + { + "0_strategy": "0x9d7eD45EE2E8FC5482fa2428f15C971e6369011d", + "1_multiplier": 1026158078493781538 + }, + { + "0_strategy": "0x13760F50a9d7377e4F20CB8CF9e4c26586c658ff", + "1_multiplier": 1152393415227598758 + }, + { + "0_strategy": "0xa4C637e0F704745D182e4D38cAb7E7485321d059", + "1_multiplier": 1011855761455017859 + }, + { + "0_strategy": "0x57ba429517c3473B6d34CA9aCd56c0e735b94c02", + "1_multiplier": 1012495275290785447 + }, + { + "0_strategy": "0x0Fe4F44beE93503346A3Ac9EE5A26b130a5796d6", + "1_multiplier": 1055446649335815388 + }, + { + "0_strategy": "0x7CA911E83dabf90C90dD3De5411a10F1A6112184", + "1_multiplier": 1035345726488000000 + }, + { + "0_strategy": "0x8CA7A5d6f3acd3A7A8bC468a8CD0FB14B6BD28b6", + "1_multiplier": 1081259809521793439 + }, + { + "0_strategy": "0xAe60d8180437b5C34bB956822ac2710972584473", + "1_multiplier": 1044315639811926396 + }, + { + "0_strategy": "0x298aFB19A105D59E74658C4C334Ff360BadE6dd2", + "1_multiplier": 1028802524926876401 + } + ] + ], + "operatorSetParams": [ + { + "0_maxOperatorCount": 200, + "1_kickBIPsOfOperatorStake": 11000, + "2_kickBIPsOfTotalStake": 50 + } + ], + "uri": "" + } diff --git a/contracts/script/deploy/config/mainnet_staging/batcher-payment-service.mainnet.config.json b/contracts/script/deploy/config/mainnet_staging/batcher-payment-service.mainnet.config.json new file mode 100644 index 0000000000..1047b6d0d1 --- /dev/null +++ b/contracts/script/deploy/config/mainnet_staging/batcher-payment-service.mainnet.config.json @@ -0,0 +1,16 @@ +{ + "address": { + "batcherWallet": "0xCA81D63e24C5C4E6C4fdB2859420e77c8aB565C2", + "alignedLayerServiceManager": "0x96b6a29D7B98519Ae66E6398BD27A76B30a5dC3f" + }, + "amounts": { + "gasForAggregator": "300000", + "gasPerProof": "21000" + }, + "permissions": { + "owner": "0x2106AC6FE9599f8A0710643C75661aaf8d8B1599" + }, + "eip712": { + "noncedVerificationDataTypeHash": "0x41817b5c5b0c3dcda70ccb43ba175fdcd7e586f9e0484422a2c6bba678fdf4a3" + } +} diff --git a/contracts/script/output/mainnet_staging/.gitkeep b/contracts/script/output/mainnet_staging/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/contracts/script/output/mainnet_staging/alignedlayer_deployment_output.json b/contracts/script/output/mainnet_staging/alignedlayer_deployment_output.json new file mode 100644 index 0000000000..ba6046512c --- /dev/null +++ b/contracts/script/output/mainnet_staging/alignedlayer_deployment_output.json @@ -0,0 +1,32 @@ +{ + "addresses": { + "alignedLayerProxyAdmin": "0x0D16a82be664c337c615499f8775Ef0431703daC", + "alignedLayerServiceManager": "0x96b6a29D7B98519Ae66E6398BD27A76B30a5dC3f", + "alignedLayerServiceManagerImplementation": "0x97D1f6e8AC6ed284a8b4c846A71Ad6e16E84061E", + "blsApkRegistry": "0x1c81a981bC1605f050C4D400415c7B68f3007053", + "blsApkRegistryImplementation": "0xd49879DD898dB153a9580627ED423832827730c2", + "indexRegistry": "0x4f71C1ab239C967Cb8F8F7f3A3ce6547c753b70B", + "indexRegistryImplementation": "0xd899b7280Cf05b3a802Fc5Cf3ABA55824a0be962", + "operatorStateRetriever": "0xf12De3271f2681Db6d5201F6CFe64d38A668ff34", + "pauserRegistry": "0x9A97Fa7c8b4F076b714F691E87816787aAaDa41D", + "registryCoordinator": "0x7bAF5135241D7D1F870AC6Dd6956BDB1FF55fc3D", + "registryCoordinatorImplementation": "0xB4eECf481fbe258eF0BE6c64C334Fd73896BEc7B", + "serviceManagerRouter": "0xDd7b2239aCb6FB660FE20136a4D2e8A04E15FE6A", + "stakeRegistry": "0x4d52a2289f9f1b126E96937193558fFD2F294DcC", + "stakeRegistryImplementation": "0x398Fe850c9c0B10CCAEe273Af68a526AB99278D2", + "batcherPaymentService": "0x88ad27EfBeF16b6fC5b2E40c5155d61876f847c5", + "batcherPaymentServiceImplementation": "0xC7834f3ca05cf00bbE39B8751eAE4C8C8c2374CD" + }, + "chainInfo": { + "chainId": 1, + "deploymentBlock": 22124788 + }, + "permissions": { + "alignedLayerAggregator": "0xb72D98AB27EBCF86C96a53564135d3141bAAE398", + "alignedLayerChurner": "0x2106AC6FE9599f8A0710643C75661aaf8d8B1599", + "alignedLayerEjector": "0x2106AC6FE9599f8A0710643C75661aaf8d8B1599", + "alignedLayerOwner": "0x2106AC6FE9599f8A0710643C75661aaf8d8B1599", + "alignedLayerPauser": "0x2106AC6FE9599f8A0710643C75661aaf8d8B1599", + "alignedLayerUpgrader": "0x2106AC6FE9599f8A0710643C75661aaf8d8B1599" + } +} \ No newline at end of file diff --git a/contracts/scripts/.env.mainnet b/contracts/scripts/.env.mainnet index 52ae4b6fd9..005ce1769a 100644 --- a/contracts/scripts/.env.mainnet +++ b/contracts/scripts/.env.mainnet @@ -5,4 +5,4 @@ DEPLOY_CONFIG_PATH=./script/deploy/config/mainnet/aligned.mainnet.config.json BATCHER_PAYMENT_SERVICE_CONFIG_PATH=./script/deploy/config/mainnet/batcher-payment-service.mainnet.config.json OUTPUT_PATH=./script/output/mainnet/alignedlayer_deployment_output.json ETHERSCAN_API_KEY= -MULTISIG=false \ No newline at end of file +MULTISIG=false diff --git a/contracts/scripts/.env.mainnet.staging b/contracts/scripts/.env.mainnet.staging new file mode 100644 index 0000000000..4caf4f82a2 --- /dev/null +++ b/contracts/scripts/.env.mainnet.staging @@ -0,0 +1,8 @@ +RPC_URL=https://ethereum-rpc.publicnode.com +PRIVATE_KEY= +EXISTING_DEPLOYMENT_INFO_PATH=./script/output/mainnet/eigenlayer_deployment_output.json +DEPLOY_CONFIG_PATH=./script/deploy/config/mainnet_staging/aligned.mainnet.config.json +BATCHER_PAYMENT_SERVICE_CONFIG_PATH=./script/deploy/config/mainnet_staging/batcher-payment-service.mainnet.config.json +OUTPUT_PATH=./script/output/mainnet_staging/alignedlayer_deployment_output.json +ETHERSCAN_API_KEY= +MULTISIG=false From d9fd29dba06f745523129cb9b751ab62b8abcfc4 Mon Sep 17 00:00:00 2001 From: Mauro Toscano <12560266+MauroToscano@users.noreply.github.com> Date: Wed, 26 Mar 2025 14:44:35 -0300 Subject: [PATCH 3/3] Delete contracts/script/output/mainnet_staging/.gitkeep --- contracts/script/output/mainnet_staging/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 contracts/script/output/mainnet_staging/.gitkeep diff --git a/contracts/script/output/mainnet_staging/.gitkeep b/contracts/script/output/mainnet_staging/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000