diff --git a/solidity/hardhat.config.ts b/solidity/hardhat.config.ts index 23f47262a..a592bfc09 100644 --- a/solidity/hardhat.config.ts +++ b/solidity/hardhat.config.ts @@ -14,7 +14,10 @@ const config: HardhatUserConfig = { // forking: { // url: `${process.env.MAINNET_URL || "https://mainnet.infura.io/v3/infura-key"}`, // } - chainId: 1337 + chainId: 1337, + mining: { + interval: 3000 + }, }, mainnet: { url: `${process.env.MAINNET_URL || "https://mainnet.infura.io/v3/infura-key"}`, diff --git a/solidity/tasks/bridge_tasks.ts b/solidity/tasks/bridge_tasks.ts index 30d3a5fdc..e56e7d59c 100644 --- a/solidity/tasks/bridge_tasks.ts +++ b/solidity/tasks/bridge_tasks.ts @@ -99,14 +99,14 @@ const initBridge = task("init-bridge", "init bridge contract") .addParam("restUrl", "fx node rest rpc url", undefined, string, false) .addParam("chainName", "init cross chain name", undefined, string, false) .setAction(async (taskArgs, hre) => { - const {bridgeLogic, bridgeContract, fxRestUrl, chainName} = taskArgs; + const {bridgeLogic, bridgeContract, restUrl, chainName} = taskArgs; const {wallet} = await hre.run(SUB_CHECK_PRIVATE_KEY, taskArgs); const from = await wallet.getAddress(); const bridge_logic_factory = await hre.ethers.getContractFactory("FxBridgeLogic") - const oracle_set = await GetOracleSet(fxRestUrl, chainName) - const gravity_id_str = await GetGravityId(fxRestUrl, chainName) + const oracle_set = await GetOracleSet(restUrl, chainName) + const gravity_id_str = await GetGravityId(restUrl, chainName) const gravity_id = hre.ethers.encodeBytes32String(gravity_id_str); const external_addresses = []; @@ -130,7 +130,7 @@ const initBridge = task("init-bridge", "init bridge contract") ]) if (bridgeLogic) { - const proxy_factory = await hre.ethers.getContractFactory("TransparentUpgradeableProxy") + const proxy_factory = await hre.ethers.getContractAt("ITransparentUpgradeableProxy", bridgeContract, wallet) data = proxy_factory.interface.encodeFunctionData('upgradeToAndCall', [bridgeLogic, data]) } diff --git a/tests/scripts/bridge.sh b/tests/scripts/bridge.sh index 82f21f1bb..d1987e95a 100755 --- a/tests/scripts/bridge.sh +++ b/tests/scripts/bridge.sh @@ -114,7 +114,7 @@ EOF container_name: fx-$bridge_name image: $BRIDGE_IMAGE hostname: fx-$bridge_name - command: bridge --bridge-chain-name="$chain" --bridge-node-url="$external_json_rpc_url" --bridge-addr="$bridge_contract_address" --fx-gas-price=4000000000000FX --fx-grpc="http://fxcore:9090" --bridge-key=/root/eth-$bridge_name.key --bridge-pwd=12345678 --fx-key=/root/fx-$bridge_name.key --fx-pwd=/root/fx-$bridge_name.password + command: bridge --bridge-chain-name="$chain" --bridge-node-url="$external_json_rpc_url" --bridge-addr="$bridge_contract_address" --fx-gas-price=4000000000000FX --fx-grpc="http://fxcore:9090" --bridge-key=/root/eth-$bridge_name.key --bridge-pwd=12345678 --fx-key=/root/fx-$bridge_name.key --fx-pwd=12345678 networks: - $DOCKER_NETWORK volumes: @@ -129,6 +129,8 @@ networks: $DOCKER_NETWORK: external: true EOF + + docker-compose -f "$OUT_DIR/bridge-docker-compose.yml" up -d } function request_batch() { diff --git a/tests/scripts/run.sh b/tests/scripts/run.sh index 358aaa850..b355f5af0 100755 --- a/tests/scripts/run.sh +++ b/tests/scripts/run.sh @@ -12,7 +12,8 @@ function run() { ) ( - export LOCAL_PORT=8535 + LOCAL_PORT=8535 + export LOCAL_PORT "${script_dir}/ethereum.sh" start "${script_dir}/ethereum.sh" deploy_bridge_token "${script_dir}/ethereum.sh" deploy_bridge_contract @@ -46,6 +47,11 @@ function run() { "${script_dir}/bridge.sh" create_oracles eth "${script_dir}/bridge.sh" update_crosschain_oracles eth "${script_dir}/bridge.sh" create_oracle_bridger eth + + LOCAL_PORT=8535 + export LOCAL_PORT + "${script_dir}/ethereum.sh" init_bridge + "${script_dir}/bridge.sh" setup_bridge_server eth ) }