From 972521f5e9f4a88b1e9fb8d54957001e5650bbcb Mon Sep 17 00:00:00 2001 From: Flouse Date: Fri, 6 May 2022 16:10:15 +0800 Subject: [PATCH] Merge pull request from GHSA-qmc9-4hg8-q3p8 * fix: CALLCODE and DELEGATECALL should skip transfer There is only one place calling `handle_transfer`, so we could put this `special_call` check in the caller side to save cycles * test: fix delegatecall test case --- c/polyjuice.h | 21 ++- c/polyjuice_globals.h | 2 +- polyjuice-tests/Cargo.lock | 26 +-- .../src/test_cases/beacon_proxy.rs | 157 ++++++++++++++++++ .../src/test_cases/delegatecall.rs | 23 ++- .../test_cases/evm-contracts/AddressType.sol | 2 +- .../test_cases/evm-contracts/BeaconProxy.bin | 1 + .../test_cases/evm-contracts/BeaconProxy.sol | 95 +++++++++++ .../test_cases/evm-contracts/CallContract.sol | 1 + .../evm-contracts/CallMultipleTimes.sol | 1 + .../evm-contracts/CallNonExistsContract.sol | 1 + .../src/test_cases/evm-contracts/Create2.sol | 1 - polyjuice-tests/src/test_cases/mod.rs | 1 + 13 files changed, 302 insertions(+), 30 deletions(-) create mode 100644 polyjuice-tests/src/test_cases/beacon_proxy.rs create mode 100644 polyjuice-tests/src/test_cases/evm-contracts/BeaconProxy.bin create mode 100644 polyjuice-tests/src/test_cases/evm-contracts/BeaconProxy.sol diff --git a/c/polyjuice.h b/c/polyjuice.h index 400dc10b..9c84c86e 100644 --- a/c/polyjuice.h +++ b/c/polyjuice.h @@ -1131,12 +1131,21 @@ int handle_message(gw_context_t* ctx, } } - /* Handle transfer logic. - NOTE: MUST do this before vm.execute and after to_id finalized */ - bool to_address_is_eoa = !to_address_exists || (to_address_exists && code_size == 0); - ret = handle_transfer(ctx, &msg, to_address_is_eoa); - if (ret != 0) { - return ret; + /** + * Handle transfer logic + * + * NOTE: + * 1. MUST do this before vm.execute and after to_id finalized + * 2. CALLCODE/DELEGATECALL should skip `handle_transfer`, otherwise + * `value transfer` of CALLCODE/DELEGATECALL will be executed twice + */ + if (!is_special_call(msg.kind)) { + bool to_address_is_eoa = !to_address_exists + || (to_address_exists && code_size == 0); + ret = handle_transfer(ctx, &msg, to_address_is_eoa); + if (ret != 0) { + return ret; + } } debug_print_int("[handle_message] msg.kind", msg.kind); diff --git a/c/polyjuice_globals.h b/c/polyjuice_globals.h index 8ce47bf7..78e46310 100644 --- a/c/polyjuice_globals.h +++ b/c/polyjuice_globals.h @@ -1,7 +1,7 @@ #ifndef POLYJUICE_GLOBALS_H #define POLYJUICE_GLOBALS_H -#define POLYJUICE_VERSION "v1.1.3-beta" +#define POLYJUICE_VERSION "v1.1.4-beta" #define ETH_ADDRESS_LEN 20 diff --git a/polyjuice-tests/Cargo.lock b/polyjuice-tests/Cargo.lock index 0296063f..75a6dc6a 100644 --- a/polyjuice-tests/Cargo.lock +++ b/polyjuice-tests/Cargo.lock @@ -144,9 +144,9 @@ checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" [[package]] name = "byte-slice-cast" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d30c751592b77c499e7bce34d99d67c2c11bdc0574e9a488ddade14150a4698" +checksum = "87c5fdd0166095e1d463fc6cc01aa8ce547ad77a4e84d42eb6762b084e28067e" [[package]] name = "byteorder" @@ -559,7 +559,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" dependencies = [ "byteorder", - "rand 0.8.4", + "rand 0.8.5", "rustc-hex", "static_assertions", ] @@ -672,9 +672,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.4" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418d37c8b1d42553c93648be529cb70f920d3baf8ef469b74b9638df426e0b4c" +checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" dependencies = [ "cfg-if 1.0.0", "libc", @@ -733,7 +733,6 @@ dependencies = [ "gw-hash", "gw-types", "merkle-cbt", - "primitive-types", "sparse-merkle-tree", "thiserror", ] @@ -870,6 +869,7 @@ dependencies = [ "ckb-types", "gw-hash", "molecule", + "primitive-types", "sparse-merkle-tree", ] @@ -1123,9 +1123,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.117" +version = "0.2.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e74d72e0f9b65b5b4ca49a346af3976df0f9c61d550727f349ecd559f251a26c" +checksum = "21a41fed9d98f27ab1c6d161da622a4fa35e8a54a8adc24bbf3ddd0ef70b0e50" [[package]] name = "libloading" @@ -1463,9 +1463,9 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "1.1.0" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ebace6889caf889b4d3f76becee12e90353f2b8c7d875534a71e5742f8f6f83" +checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" dependencies = [ "thiserror", "toml", @@ -1510,9 +1510,9 @@ dependencies = [ [[package]] name = "rand" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha 0.3.1", @@ -1554,7 +1554,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ - "getrandom 0.2.4", + "getrandom 0.2.6", ] [[package]] diff --git a/polyjuice-tests/src/test_cases/beacon_proxy.rs b/polyjuice-tests/src/test_cases/beacon_proxy.rs new file mode 100644 index 00000000..12acf3f3 --- /dev/null +++ b/polyjuice-tests/src/test_cases/beacon_proxy.rs @@ -0,0 +1,157 @@ +use crate::helper::{self, MockContractInfo, L2TX_MAX_CYCLES}; +use gw_common::{ + builtins::{CKB_SUDT_ACCOUNT_ID, ETH_REGISTRY_ACCOUNT_ID}, + registry_address::RegistryAddress, + state::State, +}; +use gw_generator::traits::StateExt; +use gw_store::{chain_view::ChainView, traits::chain_store::ChainStore}; +use gw_types::{ + bytes::Bytes, + packed::RawL2Transaction, + prelude::{Builder, Entity, Pack}, U256, +}; + +const CONTRACT_CODE: &str = include_str!("./evm-contracts/BeaconProxy.bin"); +const EVMC_SUCCESS: i8 = 0; + +#[test] +fn test_beacon_proxy() { + let (store, mut state, generator) = helper::setup(); + let block_producer = helper::create_block_producer(&mut state); + let mut block_number = 0; + + // init accounts + let from_eth_address = [1u8; 20]; + let (from_id, _from_script_hash) = + helper::create_eth_eoa_account(&mut state, &from_eth_address, U256::from(2000000u64)); + + // deploy payableInitializationBugContractTest contract + let run_result = helper::deploy( + &generator, + &store, + &mut state, + helper::CREATOR_ACCOUNT_ID, + from_id, + CONTRACT_CODE, + 80000, + 0, + block_producer.to_owned(), + block_number, + ); + assert_eq!(run_result.exit_code, EVMC_SUCCESS); + let contract = MockContractInfo::create(&from_eth_address, 0); + let contract_account_id = state + .get_account_id_by_script_hash(&contract.script_hash) + .unwrap() + .expect("get_account_id_by_script_hash"); + + // invoke payableInitializationBugContractTest.init() -> 0xe1c7392a + block_number += 1; + let block_info = helper::new_block_info(block_producer.to_owned(), block_number, block_number); + let input = hex::decode("e1c7392a").expect("init() method ID"); + let args = helper::PolyjuiceArgsBuilder::default() + .gas_limit(1829630) + .gas_price(1) + .value(0) + .input(&input) + .build(); + let raw_tx = RawL2Transaction::new_builder() + .from_id(from_id.pack()) + .to_id(contract_account_id.pack()) + .args(Bytes::from(args).pack()) + .build(); + let db = store.begin_transaction(); + let tip_block_hash = store.get_tip_block_hash().unwrap(); + let run_result = generator + .execute_transaction( + &ChainView::new(&db, tip_block_hash), + &state, + &block_info, + &raw_tx, + L2TX_MAX_CYCLES, + None, + ) + .expect("invode initializaion"); + assert_eq!(run_result.exit_code, EVMC_SUCCESS); + state.apply_run_result(&run_result).expect("update state"); + + state + .mint_sudt(CKB_SUDT_ACCOUNT_ID, &contract.reg_addr, U256::from(200u64)) + .unwrap(); + + // deployBeaconProxy( + // upgradeable_beacon_addr, + // ethers.utils.arrayify("0xe79f5bee0000000000000000000000000000000000000000000000000000000000000037"), + // { value: 110 }) + block_number += 1; + let block_info = helper::new_block_info(block_producer.to_owned(), block_number, block_number); + let input = hex::decode("dc3bdc5500000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000024e79f5bee000000000000000000000000000000000000000000000000000000000000003700000000000000000000000000000000000000000000000000000000").expect("deployBeaconProxy(bytes)"); + const DEPOLOY_MES_VALUE: u128 = 17; + let args = helper::PolyjuiceArgsBuilder::default() + .gas_limit(447270) + .gas_price(1) + .value(DEPOLOY_MES_VALUE) + .input(&input) + .build(); + let raw_tx = RawL2Transaction::new_builder() + .from_id(from_id.pack()) + .to_id(contract_account_id.pack()) + .args(Bytes::from(args).pack()) + .build(); + let db = store.begin_transaction(); + let tip_block_hash = store.get_tip_block_hash().unwrap(); + let run_result = generator + .execute_transaction( + &ChainView::new(&db, tip_block_hash), + &state, + &block_info, + &raw_tx, + L2TX_MAX_CYCLES, + None, + ) + .expect("Call deployBeaconProxy"); + assert_eq!(run_result.exit_code, EVMC_SUCCESS); + state.apply_run_result(&run_result).expect("update state"); + + // get BeaconProxy public bpx and check it's balance + block_number += 1; + let block_info = helper::new_block_info(block_producer, block_number, block_number); + let input = hex::decode("c6662850").expect("bpx.get() method id"); + let args = helper::PolyjuiceArgsBuilder::default() + .gas_limit(23778) + .gas_price(1) + .value(0) + .input(&input) + .build(); + let raw_tx = RawL2Transaction::new_builder() + .from_id(from_id.pack()) + .to_id(contract_account_id.pack()) + .args(Bytes::from(args).pack()) + .build(); + let db = store.begin_transaction(); + let tip_block_hash = store.get_tip_block_hash().unwrap(); + let run_result = generator + .execute_transaction( + &ChainView::new(&db, tip_block_hash), + &state, + &block_info, + &raw_tx, + L2TX_MAX_CYCLES, + None, + ) + .expect("get BeaconProxy contract address"); + assert_eq!(run_result.exit_code, EVMC_SUCCESS); + state.apply_run_result(&run_result).expect("update state"); + assert_eq!(run_result.return_data.len(), 32); + let beacon_proxy_ethabi_addr = &run_result.return_data[12..]; + let beacon_reg_addr = + RegistryAddress::new(ETH_REGISTRY_ACCOUNT_ID, beacon_proxy_ethabi_addr.to_vec()); + assert_eq!( + state + .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &beacon_reg_addr) + .unwrap(), + U256::from(DEPOLOY_MES_VALUE), + "check the balance of BeaconProxy contract" + ); +} diff --git a/polyjuice-tests/src/test_cases/delegatecall.rs b/polyjuice-tests/src/test_cases/delegatecall.rs index db1b0939..d917f123 100644 --- a/polyjuice-tests/src/test_cases/delegatecall.rs +++ b/polyjuice-tests/src/test_cases/delegatecall.rs @@ -6,7 +6,7 @@ use crate::helper::{ new_contract_account_script_with_nonce, setup, simple_storage_get, MockContractInfo, PolyjuiceArgsBuilder, CREATOR_ACCOUNT_ID, L2TX_MAX_CYCLES, }; -use gw_common::state::State; +use gw_common::{state::State, builtins::CKB_SUDT_ACCOUNT_ID}; use gw_generator::traits::StateExt; use gw_store::chain_view::ChainView; use gw_store::traits::chain_store::ChainStore; @@ -18,7 +18,7 @@ const INIT_CODE: &str = include_str!("./evm-contracts/DelegateCall.bin"); #[test] fn test_delegatecall() { let (store, mut state, generator) = setup(); - let block_producer_id = helper::create_block_producer(&mut state); + let block_producer = helper::create_block_producer(&mut state); let from_eth_address = [1u8; 20]; let (from_id, _from_script_hash) = @@ -35,7 +35,7 @@ fn test_delegatecall() { SS_INIT_CODE, 122000, 0, - block_producer_id.clone(), + block_producer.clone(), block_number, ); let ss_account_script = new_contract_account_script_with_nonce(&from_eth_address, 0); @@ -55,7 +55,7 @@ fn test_delegatecall() { INIT_CODE, 122000, 0, - block_producer_id.clone(), + block_producer.clone(), block_number, ); // [Deploy DelegateCall] used cycles: 753698 < 760K @@ -74,6 +74,7 @@ fn test_delegatecall() { assert_eq!(state.get_nonce(from_id).unwrap(), 2); assert_eq!(state.get_nonce(ss_account_id).unwrap(), 0); assert_eq!(state.get_nonce(delegate_contract_id).unwrap(), 0); + /* * In a delegatecall, only the code of the given address is used, all other aspects (storage, * balance, …) are taken from the current contract. @@ -81,6 +82,7 @@ fn test_delegatecall() { * The user has to ensure that the layout of storage in both contracts is suitable for * delegatecall to be used. */ + const MSG_VALUE: u128 = 17; for (fn_sighash, expected_return_value) in [ // DelegateCall.set(address, uint) => used cycles: 1002251 ( @@ -101,7 +103,7 @@ fn test_delegatecall() { .iter() { block_number += 1; - let block_info = new_block_info(block_producer_id.clone(), block_number, block_number); + let block_info = new_block_info(block_producer.clone(), block_number, block_number); let input = hex::decode(format!( "{}{}{}", fn_sighash, @@ -112,7 +114,7 @@ fn test_delegatecall() { let args = PolyjuiceArgsBuilder::default() .gas_limit(200000) .gas_price(1) - .value(0) + .value(MSG_VALUE) .input(&input) .build(); let raw_tx = RawL2Transaction::new_builder() @@ -153,7 +155,11 @@ fn test_delegatecall() { hex::decode(expected_return_value).unwrap() ); } - + // check the balance of DelegateCall contract + let delegate_contract_balance = state + .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &delegate_contract.reg_addr) + .unwrap(); + assert_eq!(delegate_contract_balance, gw_types::U256::from(MSG_VALUE * 3)); assert_eq!(state.get_nonce(from_id).unwrap(), 5); assert_eq!(state.get_nonce(ss_account_id).unwrap(), 0); assert_eq!(state.get_nonce(delegate_contract_id).unwrap(), 0); @@ -168,6 +174,7 @@ fn test_delegatecall() { ); assert_eq!( run_result.return_data, - hex::decode("000000000000000000000000000000000000000000000000000000000000007b").unwrap() + hex::decode("000000000000000000000000000000000000000000000000000000000000007b").unwrap(), + "The storedData in SimepleStorage contract won't be changed." ); } diff --git a/polyjuice-tests/src/test_cases/evm-contracts/AddressType.sol b/polyjuice-tests/src/test_cases/evm-contracts/AddressType.sol index 7130fd11..b447c4b9 100644 --- a/polyjuice-tests/src/test_cases/evm-contracts/AddressType.sol +++ b/polyjuice-tests/src/test_cases/evm-contracts/AddressType.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: SEE LICENSE IN LICENSE +// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; contract AddressType { diff --git a/polyjuice-tests/src/test_cases/evm-contracts/BeaconProxy.bin b/polyjuice-tests/src/test_cases/evm-contracts/BeaconProxy.bin new file mode 100644 index 00000000..bc0232f8 --- /dev/null +++ b/polyjuice-tests/src/test_cases/evm-contracts/BeaconProxy.bin @@ -0,0 +1 @@ +608060405234801561001057600080fd5b50612f8c806100206000396000f3fe6080604052600436106200007a5760003560e01c8063c16751831162000055578063c167518314620000ff578063c6662850146200012f578063dc3bdc55146200015f578063e1c7392a146200017f576200007a565b80632e10bee4146200007f578063955c1b5a14620000af578063a09f114314620000cf575b600080fd5b3480156200008c57600080fd5b506200009762000199565b604051620000a6919062000612565b60405180910390f35b620000cd6004803603810190620000c79190620007a5565b620001bd565b005b348015620000dc57600080fd5b50620000e7620002d1565b604051620000f691906200081b565b60405180910390f35b3480156200010c57600080fd5b5062000117620002f7565b6040516200012691906200085d565b60405180910390f35b3480156200013c57600080fd5b50620001476200031d565b604051620001569190620008b3565b60405180910390f35b6200017d6004803603810190620001779190620007a5565b62000343565b005b3480156200018c57600080fd5b506200019762000457565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b34600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682604051620001f0906200055d565b620001fd92919062000988565b6040518091039082f09050801580156200021b573d6000803e3d6000fd5b50600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fc3c09a1e56969c59209cb6368be0ce64266343fd870df00b9a6a4e3852c10aba600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1631604051620002c69190620009d7565b60405180910390a150565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b34600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168260405162000376906200055d565b6200038392919062000988565b6040518091039082f0905080158015620003a1573d6000803e3d6000fd5b50600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fc3c09a1e56969c59209cb6368be0ce64266343fd870df00b9a6a4e3852c10aba600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16316040516200044c9190620009d7565b60405180910390a150565b60405162000465906200056b565b604051809103906000f08015801562000482573d6000803e3d6000fd5b506000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051620004f19062000579565b620004fd9190620009f4565b604051809103906000f0801580156200051a573d6000803e3d6000fd5b50600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6110748062000a1283390190565b6109ff8062001a8683390190565b610ad2806200248583390190565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000620005d2620005cc620005c68462000587565b620005a7565b62000587565b9050919050565b6000620005e682620005b1565b9050919050565b6000620005fa82620005d9565b9050919050565b6200060c81620005ed565b82525050565b600060208201905062000629600083018462000601565b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b62000698826200064d565b810181811067ffffffffffffffff82111715620006ba57620006b96200065e565b5b80604052505050565b6000620006cf6200062f565b9050620006dd82826200068d565b919050565b600067ffffffffffffffff8211156200070057620006ff6200065e565b5b6200070b826200064d565b9050602081019050919050565b82818337600083830152505050565b60006200073e6200073884620006e2565b620006c3565b9050828152602081018484840111156200075d576200075c62000648565b5b6200076a84828562000718565b509392505050565b600082601f8301126200078a576200078962000643565b5b81356200079c84826020860162000727565b91505092915050565b600060208284031215620007be57620007bd62000639565b5b600082013567ffffffffffffffff811115620007df57620007de6200063e565b5b620007ed8482850162000772565b91505092915050565b60006200080382620005d9565b9050919050565b6200081581620007f6565b82525050565b60006020820190506200083260008301846200080a565b92915050565b60006200084582620005d9565b9050919050565b620008578162000838565b82525050565b60006020820190506200087460008301846200084c565b92915050565b60006200088782620005b1565b9050919050565b60006200089b826200087a565b9050919050565b620008ad816200088e565b82525050565b6000602082019050620008ca6000830184620008a2565b92915050565b6000620008dd8262000587565b9050919050565b620008ef81620008d0565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b838110156200093157808201518184015260208101905062000914565b8381111562000941576000848401525b50505050565b60006200095482620008f5565b62000960818562000900565b93506200097281856020860162000911565b6200097d816200064d565b840191505092915050565b60006040820190506200099f6000830185620008e4565b8181036020830152620009b3818462000947565b90509392505050565b6000819050919050565b620009d181620009bc565b82525050565b6000602082019050620009ee6000830184620009c6565b92915050565b600060208201905062000a0b6000830184620008e4565b9291505056fe608060405260405162001074380380620010748339818101604052810190620000299190620006fa565b60017fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5160001c6200005b919062000799565b60001b7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5060001b14620000935762000092620007d4565b5b620000a782826000620000af60201b60201c565b505062000ae4565b620000c083620001a660201b60201c565b8273ffffffffffffffffffffffffffffffffffffffff167f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e60405160405180910390a2600082511180620001115750805b15620001a1576200019f8373ffffffffffffffffffffffffffffffffffffffff16635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000167573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200018d919062000803565b836200034560201b620000371760201c565b505b505050565b620001bc816200037b60201b620000641760201c565b620001fe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620001f590620008bc565b60405180910390fd5b620002858173ffffffffffffffffffffffffffffffffffffffff16635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200024e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000274919062000803565b6200037b60201b620000641760201c565b620002c7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620002be9062000954565b60405180910390fd5b80620003017fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5060001b6200039e60201b620000871760201c565b60000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60606200037383836040518060600160405280602781526020016200104d60279139620003a860201b60201c565b905092915050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6000819050919050565b6060620003bb846200037b60201b60201c565b620003fd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620003f490620009ec565b60405180910390fd5b6000808573ffffffffffffffffffffffffffffffffffffffff168560405162000427919062000a5b565b600060405180830381855af49150503d806000811462000464576040519150601f19603f3d011682016040523d82523d6000602084013e62000469565b606091505b5091509150620004818282866200048c60201b60201c565b925050509392505050565b606083156200049e57829050620004f1565b600083511115620004b25782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620004e8919062000ac0565b60405180910390fd5b9392505050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600062000539826200050c565b9050919050565b6200054b816200052c565b81146200055757600080fd5b50565b6000815190506200056b8162000540565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620005c6826200057b565b810181811067ffffffffffffffff82111715620005e857620005e76200058c565b5b80604052505050565b6000620005fd620004f8565b90506200060b8282620005bb565b919050565b600067ffffffffffffffff8211156200062e576200062d6200058c565b5b62000639826200057b565b9050602081019050919050565b60005b838110156200066657808201518184015260208101905062000649565b8381111562000676576000848401525b50505050565b6000620006936200068d8462000610565b620005f1565b905082815260208101848484011115620006b257620006b162000576565b5b620006bf84828562000646565b509392505050565b600082601f830112620006df57620006de62000571565b5b8151620006f18482602086016200067c565b91505092915050565b6000806040838503121562000714576200071362000502565b5b600062000724858286016200055a565b925050602083015167ffffffffffffffff81111562000748576200074762000507565b5b6200075685828601620006c7565b9150509250929050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000620007a68262000760565b9150620007b38362000760565b925082821015620007c957620007c86200076a565b5b828203905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b6000602082840312156200081c576200081b62000502565b5b60006200082c848285016200055a565b91505092915050565b600082825260208201905092915050565b7f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e60008201527f7472616374000000000000000000000000000000000000000000000000000000602082015250565b6000620008a460258362000835565b9150620008b18262000846565b604082019050919050565b60006020820190508181036000830152620008d78162000895565b9050919050565b7f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960008201527f73206e6f74206120636f6e747261637400000000000000000000000000000000602082015250565b60006200093c60308362000835565b91506200094982620008de565b604082019050919050565b600060208201905081810360008301526200096f816200092d565b9050919050565b7f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60008201527f6e74726163740000000000000000000000000000000000000000000000000000602082015250565b6000620009d460268362000835565b9150620009e18262000976565b604082019050919050565b6000602082019050818103600083015262000a0781620009c5565b9050919050565b600081519050919050565b600081905092915050565b600062000a318262000a0e565b62000a3d818562000a19565b935062000a4f81856020860162000646565b80840191505092915050565b600062000a69828462000a24565b915081905092915050565b600081519050919050565b600062000a8c8262000a74565b62000a98818562000835565b935062000aaa81856020860162000646565b62000ab5816200057b565b840191505092915050565b6000602082019050818103600083015262000adc818462000a7f565b905092915050565b6105598062000af46000396000f3fe6080604052366100135761001161001d565b005b61001b61001d565b005b610025610091565b610035610030610093565b610110565b565b606061005c83836040518060600160405280602781526020016104fd60279139610136565b905092915050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6000819050919050565b565b600061009d610203565b73ffffffffffffffffffffffffffffffffffffffff16635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010b9190610324565b905090565b3660008037600080366000845af43d6000803e8060008114610131573d6000f35b3d6000fd5b606061014184610064565b610180576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610177906103d4565b60405180910390fd5b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516101a8919061046e565b600060405180830381855af49150503d80600081146101e3576040519150601f19603f3d011682016040523d82523d6000602084013e6101e8565b606091505b50915091506101f882828661025a565b925050509392505050565b60006102317fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5060001b610087565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060831561026a578290506102ba565b60008351111561027d5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102b191906104da565b60405180910390fd5b9392505050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006102f1826102c6565b9050919050565b610301816102e6565b811461030c57600080fd5b50565b60008151905061031e816102f8565b92915050565b60006020828403121561033a576103396102c1565b5b60006103488482850161030f565b91505092915050565b600082825260208201905092915050565b7f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60008201527f6e74726163740000000000000000000000000000000000000000000000000000602082015250565b60006103be602683610351565b91506103c982610362565b604082019050919050565b600060208201905081810360008301526103ed816103b1565b9050919050565b600081519050919050565b600081905092915050565b60005b8381101561042857808201518184015260208101905061040d565b83811115610437576000848401525b50505050565b6000610448826103f4565b61045281856103ff565b935061046281856020860161040a565b80840191505092915050565b600061047a828461043d565b915081905092915050565b600081519050919050565b6000601f19601f8301169050919050565b60006104ac82610485565b6104b68185610351565b93506104c681856020860161040a565b6104cf81610490565b840191505092915050565b600060208201905081810360008301526104f481846104a1565b90509291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220973e2d8ce1ee024176004aa582e08ccf2ea71f1a81f0970591781f3f97638f0b64736f6c634300080d0033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564608060405234801561001057600080fd5b506109df806100206000396000f3fe60806040526004361061009c5760003560e01c80635e383d21116100645780635e383d21146101505780636d4ce63c1461018d578063763e2831146101b85780639fba1f9a146101e1578063d31f8b6b146101eb578063e79f5bee146102145761009c565b80631f1bd692146100a1578063227367d5146100cc5780633bccbbc9146100e35780633fa4f245146100fa57806354fd4d5014610125575b600080fd5b3480156100ad57600080fd5b506100b6610230565b6040516100c3919061055c565b60405180910390f35b3480156100d857600080fd5b506100e16102be565b005b3480156100ef57600080fd5b506100f86102c8565b005b34801561010657600080fd5b5061010f61030b565b60405161011c9190610597565b60405180910390f35b34801561013157600080fd5b5061013a610311565b604051610147919061055c565b60405180910390f35b34801561015c57600080fd5b50610177600480360381019061017291906105f2565b61034e565b6040516101849190610597565b60405180910390f35b34801561019957600080fd5b506101a2610372565b6040516101af919061063a565b60405180910390f35b3480156101c457600080fd5b506101df60048036038101906101da91906105f2565b61037b565b005b6101e9610385565b005b3480156101f757600080fd5b50610212600480360381019061020d9190610852565b61038f565b005b61022e600480360381019061022991906105f2565b6103c9565b005b6001805461023d9061090c565b80601f01602080910402602001604051908101604052809291908181526020018280546102699061090c565b80156102b65780601f1061028b576101008083540402835291602001916102b6565b820191906000526020600020905b81548152906001019060200180831161029957829003601f168201915b505050505081565b600a600081905550565b6000610309576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161030090610989565b60405180910390fd5b565b60005481565b60606040518060400160405280600281526020017f5631000000000000000000000000000000000000000000000000000000000000815250905090565b6002818154811061035e57600080fd5b906000526020600020016000915090505481565b60006001905090565b8060008190555050565b6064600081905550565b8260008190555081600190805190602001906103ac9291906103d3565b5080600290805190602001906103c3929190610459565b50505050565b8060008190555050565b8280546103df9061090c565b90600052602060002090601f0160209004810192826104015760008555610448565b82601f1061041a57805160ff1916838001178555610448565b82800160010185558215610448579182015b8281111561044757825182559160200191906001019061042c565b5b50905061045591906104a6565b5090565b828054828255906000526020600020908101928215610495579160200282015b82811115610494578251825591602001919060010190610479565b5b5090506104a291906104a6565b5090565b5b808211156104bf5760008160009055506001016104a7565b5090565b600081519050919050565b600082825260208201905092915050565b60005b838110156104fd5780820151818401526020810190506104e2565b8381111561050c576000848401525b50505050565b6000601f19601f8301169050919050565b600061052e826104c3565b61053881856104ce565b93506105488185602086016104df565b61055181610512565b840191505092915050565b600060208201905081810360008301526105768184610523565b905092915050565b6000819050919050565b6105918161057e565b82525050565b60006020820190506105ac6000830184610588565b92915050565b6000604051905090565b600080fd5b600080fd5b6105cf8161057e565b81146105da57600080fd5b50565b6000813590506105ec816105c6565b92915050565b600060208284031215610608576106076105bc565b5b6000610616848285016105dd565b91505092915050565b60008115159050919050565b6106348161061f565b82525050565b600060208201905061064f600083018461062b565b92915050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61069782610512565b810181811067ffffffffffffffff821117156106b6576106b561065f565b5b80604052505050565b60006106c96105b2565b90506106d5828261068e565b919050565b600067ffffffffffffffff8211156106f5576106f461065f565b5b6106fe82610512565b9050602081019050919050565b82818337600083830152505050565b600061072d610728846106da565b6106bf565b9050828152602081018484840111156107495761074861065a565b5b61075484828561070b565b509392505050565b600082601f83011261077157610770610655565b5b813561078184826020860161071a565b91505092915050565b600067ffffffffffffffff8211156107a5576107a461065f565b5b602082029050602081019050919050565b600080fd5b60006107ce6107c98461078a565b6106bf565b905080838252602082019050602084028301858111156107f1576107f06107b6565b5b835b8181101561081a578061080688826105dd565b8452602084019350506020810190506107f3565b5050509392505050565b600082601f83011261083957610838610655565b5b81356108498482602086016107bb565b91505092915050565b60008060006060848603121561086b5761086a6105bc565b5b6000610879868287016105dd565b935050602084013567ffffffffffffffff81111561089a576108996105c1565b5b6108a68682870161075c565b925050604084013567ffffffffffffffff8111156108c7576108c66105c1565b5b6108d386828701610824565b9150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061092457607f821691505b602082108103610937576109366108dd565b5b50919050565b7f44756d6d79496d706c656d656e746174696f6e20726576657274656400000000600082015250565b6000610973601c836104ce565b915061097e8261093d565b602082019050919050565b600060208201905081810360008301526109a281610966565b905091905056fea2646970667358221220dcc096851dfb5cbfaa46d062cfac666e329e0daf474705fff82652788b1e707764736f6c634300080d003360806040523480156200001157600080fd5b5060405162000ad238038062000ad2833981810160405281019062000037919062000264565b620000576200004b6200006f60201b60201c565b6200007760201b60201c565b62000068816200013b60201b60201c565b506200033f565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6200015181620001d760201b620003771760201c565b62000193576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200018a906200031d565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200022c82620001ff565b9050919050565b6200023e816200021f565b81146200024a57600080fd5b50565b6000815190506200025e8162000233565b92915050565b6000602082840312156200027d576200027c620001fa565b5b60006200028d848285016200024d565b91505092915050565b600082825260208201905092915050565b7f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f60008201527f6e206973206e6f74206120636f6e747261637400000000000000000000000000602082015250565b60006200030560338362000296565b91506200031282620002a7565b604082019050919050565b600060208201905081810360008301526200033881620002f6565b9050919050565b610783806200034f6000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80633659cfe61461005c5780635c60da1b14610078578063715018a6146100965780638da5cb5b146100a0578063f2fde38b146100be575b600080fd5b61007660048036038101906100719190610555565b6100da565b005b6100806101a5565b60405161008d9190610591565b60405180910390f35b61009e6101cf565b005b6100a8610257565b6040516100b59190610591565b60405180910390f35b6100d860048036038101906100d39190610555565b610280565b005b6100e261039a565b73ffffffffffffffffffffffffffffffffffffffff16610100610257565b73ffffffffffffffffffffffffffffffffffffffff1614610156576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161014d90610609565b60405180910390fd5b61015f816103a2565b8073ffffffffffffffffffffffffffffffffffffffff167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b60405160405180910390a250565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6101d761039a565b73ffffffffffffffffffffffffffffffffffffffff166101f5610257565b73ffffffffffffffffffffffffffffffffffffffff161461024b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161024290610609565b60405180910390fd5b610255600061042e565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b61028861039a565b73ffffffffffffffffffffffffffffffffffffffff166102a6610257565b73ffffffffffffffffffffffffffffffffffffffff16146102fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102f390610609565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361036b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103629061069b565b60405180910390fd5b6103748161042e565b50565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600033905090565b6103ab81610377565b6103ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103e19061072d565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610522826104f7565b9050919050565b61053281610517565b811461053d57600080fd5b50565b60008135905061054f81610529565b92915050565b60006020828403121561056b5761056a6104f2565b5b600061057984828501610540565b91505092915050565b61058b81610517565b82525050565b60006020820190506105a66000830184610582565b92915050565b600082825260208201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006105f36020836105ac565b91506105fe826105bd565b602082019050919050565b60006020820190508181036000830152610622816105e6565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006106856026836105ac565b915061069082610629565b604082019050919050565b600060208201905081810360008301526106b481610678565b9050919050565b7f5570677261646561626c65426561636f6e3a20696d706c656d656e746174696f60008201527f6e206973206e6f74206120636f6e747261637400000000000000000000000000602082015250565b60006107176033836105ac565b9150610722826106bb565b604082019050919050565b600060208201905081810360008301526107468161070a565b905091905056fea26469706673582212204fe795820cd143d8efbaef9c09894067552f98df2ac7e958638583e8a4af566464736f6c634300080d0033a2646970667358221220624ed4a7312e4a623236ce6e314d70dbab24ce4cbe6a0f496245e19c00dd5dda64736f6c634300080d0033 \ No newline at end of file diff --git a/polyjuice-tests/src/test_cases/evm-contracts/BeaconProxy.sol b/polyjuice-tests/src/test_cases/evm-contracts/BeaconProxy.sol new file mode 100644 index 00000000..db60d804 --- /dev/null +++ b/polyjuice-tests/src/test_cases/evm-contracts/BeaconProxy.sol @@ -0,0 +1,95 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +contract DummyImplementation { + uint256 public value; + string public text; + uint256[] public values; + + function initializeNonPayable() public { + value = 10; + } + + function initializePayable() public payable { + value = 100; + } + + function initializeNonPayableWithValue(uint256 _value) public { + value = _value; + } + + function initializePayableWithValue(uint256 _value) public payable { + value = _value; + } + + function initialize( + uint256 _value, + string memory _text, + uint256[] memory _values + ) public { + value = _value; + text = _text; + values = _values; + } + + function get() public pure returns (bool) { + return true; + } + + function version() public pure virtual returns (string memory) { + return "V1"; + } + + function reverts() public pure { + require(false, "DummyImplementation reverted"); + } +} + +contract DummyImplementationV2 is DummyImplementation { + function migrate(uint256 newVal) public payable { + value = newVal; + } + + function version() public pure override returns (string memory) { + return "V2"; + } +} + +import "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol"; +import "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol"; + +contract payableInitializationTest { + DummyImplementation public impl1; + DummyImplementationV2 public impl2; + UpgradeableBeacon public ub; + BeaconProxy public bpx; + event GetBalance(uint256); + + function init() public { + impl1 = new DummyImplementation(); + // impl2 = new DummyImplementationV2(); + ub = new UpgradeableBeacon(address(impl1)); + } + + function Test(bytes memory invokeSigns) public payable { + // 0xe79f5bee0000000000000000000000000000000000000000000000000000000000000037 + bpx = new BeaconProxy{value:msg.value}(address(ub), invokeSigns); + emit GetBalance(address(bpx).balance); + } + + function deployBeaconProxy(bytes memory invokeSigns) public payable { + // invokeSigns: 0xe79f5bee0000000000000000000000000000000000000000000000000000000000000037 + + /* BeaconProxy constructor(address beacon, bytes data) + + Initializes the proxy with beacon. + If data is nonempty, it’s used as data in a delegate call to the + implementation returned by the beacon. This will typically be an + encoded function call, and allows initializating the storage of the + proxy like a Solidity constructor. + */ + bpx = new BeaconProxy{value: msg.value}(address(ub), invokeSigns); + + emit GetBalance(address(bpx).balance); + } +} diff --git a/polyjuice-tests/src/test_cases/evm-contracts/CallContract.sol b/polyjuice-tests/src/test_cases/evm-contracts/CallContract.sol index 7e50d8c6..cab7a2b4 100644 --- a/polyjuice-tests/src/test_cases/evm-contracts/CallContract.sol +++ b/polyjuice-tests/src/test_cases/evm-contracts/CallContract.sol @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: MIT pragma solidity >=0.4.0 <0.7.0; interface SimpleStorage { diff --git a/polyjuice-tests/src/test_cases/evm-contracts/CallMultipleTimes.sol b/polyjuice-tests/src/test_cases/evm-contracts/CallMultipleTimes.sol index f15be746..f5fc61b8 100644 --- a/polyjuice-tests/src/test_cases/evm-contracts/CallMultipleTimes.sol +++ b/polyjuice-tests/src/test_cases/evm-contracts/CallMultipleTimes.sol @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: MIT pragma solidity >=0.4.0 <0.7.0; interface SimpleStorage { diff --git a/polyjuice-tests/src/test_cases/evm-contracts/CallNonExistsContract.sol b/polyjuice-tests/src/test_cases/evm-contracts/CallNonExistsContract.sol index dc207c50..3cdd32b5 100644 --- a/polyjuice-tests/src/test_cases/evm-contracts/CallNonExistsContract.sol +++ b/polyjuice-tests/src/test_cases/evm-contracts/CallNonExistsContract.sol @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.9.0; contract CallNonExistsContract { diff --git a/polyjuice-tests/src/test_cases/evm-contracts/Create2.sol b/polyjuice-tests/src/test_cases/evm-contracts/Create2.sol index 7cbe0578..feb1bbdd 100644 --- a/polyjuice-tests/src/test_cases/evm-contracts/Create2.sol +++ b/polyjuice-tests/src/test_cases/evm-contracts/Create2.sol @@ -1,5 +1,4 @@ // SPDX-License-Identifier: MIT - pragma solidity ^0.8.0; contract Create2Impl { diff --git a/polyjuice-tests/src/test_cases/mod.rs b/polyjuice-tests/src/test_cases/mod.rs index 067a9736..a439669b 100644 --- a/polyjuice-tests/src/test_cases/mod.rs +++ b/polyjuice-tests/src/test_cases/mod.rs @@ -27,5 +27,6 @@ pub(crate) mod rlp; pub(crate) mod invalid_sudt_erc20_proxy; pub(crate) mod sudt_erc20_proxy; +mod beacon_proxy; mod error; mod eth_addr_reg;