diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index 167e1faa..4264f281 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -53,19 +53,36 @@ signer: ' or ' deploy: ism: - - 11155111 + type: routing + owner: + isms: + - type: multisig + owner: + validators: + 11155111: + addrs: + - + threshold: 1 hooks: default: - type: mock - - required: type: aggregate - # if you keep it as "", the script will identify this as deployer address owner: hooks: - type: merkle + - type: igp + owner: + configs: + 11155111: + exchange_rate: 3000 + gas_price: 5000 + default_gas_usage: 30000 + + required: + type: aggregate + owner: + hooks: - type: pausable owner: paused: false @@ -76,14 +93,6 @@ deploy: # if you didn't set the denom, it will be set as gas denom of network config denom: uosmo amount: 1 - - - type: igp - owner: - configs: - 11155111: - exchange_rate: 3000 - gas_price: 5000 - default_gas_usage: 30000 ``` ## 2. Upload Contract Codes @@ -146,8 +155,10 @@ Replace every `{sepolia_private_key}` and `{osmosis_private_key}` from files bel And run with below command. ```bash +cd ./example + # Merge osmo-test-5.config.json and agent-config.docker.json -OSMOSIS_TESTNET_AGENT_CONFIG=$(cat ../context/osmo-test-5.config.json) && \ +OSMOSIS_TESTNET_AGENT_CONFIG=$(cat ../context/osmo-test-5.config.json | jq -r '.chains.osmotest5') && \ OSMOSIS_TESTNET_AGENT_CONFIG_NAME=$(echo $OSMOSIS_TESTNET_AGENT_CONFIG | jq -r '.name') && \ cat ./hyperlane/agent-config.docker.json \ | jq ".chains.$OSMOSIS_TESTNET_AGENT_CONFIG_NAME=$(echo $OSMOSIS_TESTNET_AGENT_CONFIG)" > merge.tmp && \ @@ -206,7 +217,7 @@ yarn cw-hpl-exp warp deploy --pk 'YOUR_PRIVATE_KEY' { "hypErc20Osmo": "0x..." } # deploy warp route on osmo-test-5 -yarn cw-hpl warp deploy create ./warp/uosmo.json -n osmo-test-5 +yarn cw-hpl warp create ./example/warp/uosmo.json -n osmo-test-5 # register osmo-test-5 warp route to sepolia warp route yarn cw-hpl-exp warp link $hypErc20Osmo 1037 $OSMOSIS_WARP_ROUTE_ADDRESS --pk 'YOUR_PRIVATE_KEY' diff --git a/config.example.yaml b/config.example.yaml index 95457a28..2ab98616 100644 --- a/config.example.yaml +++ b/config.example.yaml @@ -1,46 +1,41 @@ networks: - - id: "localwasmd" - hrp: "uwasm" + - id: 'localwasmd' + hrp: 'uwasm' endpoint: - rpc: "http://localhost:26657" - rest: "http://localhost:1317" - grpc: "http://localhost:9090" + rpc: 'http://localhost:26657' + rest: 'http://localhost:1317' + grpc: 'http://localhost:9090' gas: - price: "0.025" - denom: "uwasm" + price: '0.025' + denom: 'uwasm' domain: 1063 # localwasmd -> ascii / decimal -> sum - - id: "localosmosis" - hrp: "osmo" + - id: 'localosmosis' + hrp: 'osmo' endpoint: - rpc: "http://localhost:26657" - rest: "http://localhost:1317" - grpc: "http://localhost:9090" + rpc: 'http://localhost:26657' + rest: 'http://localhost:1317' + grpc: 'http://localhost:9090' gas: - price: "0.025" - denom: "uosmo" + price: '0.025' + denom: 'uosmo' domain: 1304 # localosmosis -> ascii / decimal -> sum - - id: "localneutron" - hrp: "neutron" + - id: 'localneutron' + hrp: 'neutron' endpoint: - rpc: "http://localhost:26657" - rest: "http://localhost:1317" - grpc: "http://localhost:9090" + rpc: 'http://localhost:26657' + rest: 'http://localhost:1317' + grpc: 'http://localhost:9090' gas: - price: "0.025" - denom: "untrn" + price: '0.025' + denom: 'untrn' domain: 1302 signer: deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef deploy: ism: - # # hpl_ism_multisig with default validator setup (signer = validator, threshold = 1) - # - 5 - # - 420 - # - 421613 - # # hpl_ism_multisig # type: multisig # owner: diff --git a/context/.gitkeep b/context/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/context/osmo-test-5.json b/context/osmo-test-5.json deleted file mode 100644 index 59101d06..00000000 --- a/context/osmo-test-5.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "artifacts": { - "hpl_mailbox": 7162, - "hpl_validator_announce": 7163, - "hpl_ism_aggregate": 7164, - "hpl_ism_multisig": 7165, - "hpl_ism_pausable": 7166, - "hpl_ism_routing": 7167, - "hpl_igp": 7168, - "hpl_hook_aggregate": 7169, - "hpl_hook_fee": 7170, - "hpl_hook_merkle": 7171, - "hpl_hook_pausable": 7172, - "hpl_hook_routing": 7173, - "hpl_hook_routing_custom": 7174, - "hpl_hook_routing_fallback": 7175, - "hpl_test_mock_hook": 7176, - "hpl_test_mock_ism": 7177, - "hpl_test_mock_msg_receiver": 7178, - "hpl_igp_oracle": 7179, - "hpl_warp_cw20": 7180, - "hpl_warp_native": 7181 - }, - "deployments": { - "core": { - "mailbox": { - "type": "hpl_mailbox", - "address": "osmo133mald0u39vge6mcv8gzc0j2838hn3klja3nshsyxaug95pndf8sufctsq" - }, - "validator_announce": { - "type": "hpl_validator_announce", - "address": "osmo19amvm0gqzhc8wfktt55ppjadghdhemgzsjc6y3wp7v3ddd2p4ckshajfhp" - } - }, - "isms": { - "type": "hpl_ism_multisig", - "address": "osmo1ydgvay2j86k73s9k67davma09u7vkvawyjg30lzcghqa994c4afqqv2dum" - }, - "hooks": { - "default": { - "type": "hpl_hook_aggregate", - "address": "osmo1xx8qvhum836lpn7eftepegdrrnwlktytnylkfqzgsrvkvn5eqqzq02wlah", - "hooks": [ - { - "type": "hpl_hook_merkle", - "address": "osmo1vxjlhn4dkq6htf5daaxvw0rs26vewhek2gwgmpmw7jvq0tvjrhxqljnact" - }, - { - "type": "hpl_igp", - "address": "osmo19yadu0cunfv7zm9m8ewhgwnwvy7cxjuxcfs7qdcmlxsfr8taj9asdlajps", - "oracle": { - "type": "hpl_igp_oracle", - "address": "osmo1ncns63wyprqq6guvrd2uu2w2dt04mm5zjy4tuqvx997je2kjnnzqknyzmx" - } - } - ] - }, - "required": { - "type": "hpl_hook_aggregate", - "address": "osmo1zf80lhjyw2kmqn39xqz4ypnef7020slfd05skxv9gslss8yrm2pqzwdjzn", - "hooks": [ - { - "type": "hpl_hook_pausable", - "address": "osmo1xwd2czumymaqe8gn292r2jjxsny8uklt90rjglxtwkj25s0v4sxqadwz35" - }, - { - "type": "hpl_hook_fee", - "address": "osmo12g03dm27u3zrx3lcqrl9yrkywknftsanlzr60ws4wveqdxl9tzssghukur" - } - ] - } - }, - "warp": { - "native": [ - { - "id": "uosmo", - "type": "hpl_warp_native", - "address": "osmo1v0vw7rsfhd8adyah20cphw45ercq5p2yj3ddsn8lx6rhhy278jcqj2l370" - } - ], - "cw20": [] - }, - "test": { - "msg_receiver": { - "type": "hpl_test_mock_msg_receiver", - "address": "osmo1henzdxappv2sqzg2nlfl4nv42lmp39pc42fvwkjs8al3nsppn75st54ecq" - } - } - } -} \ No newline at end of file diff --git a/example/docker-compose.yml b/example/docker-compose.yml index e622bd6b..1ab0b75d 100644 --- a/example/docker-compose.yml +++ b/example/docker-compose.yml @@ -2,6 +2,7 @@ version: '2' services: relayer: container_name: hpl-relayer + # image: gcr.io/abacus-labs-dev/hyperlane-agent:9736164-20240307-131918 image: gcr.io/abacus-labs-dev/hyperlane-agent:3bb4d87-20240129-164519 user: root # restart: always @@ -21,6 +22,7 @@ services: validator-sepolia: container_name: hpl-validator-sepolia + # image: gcr.io/abacus-labs-dev/hyperlane-agent:9736164-20240307-131918 image: gcr.io/abacus-labs-dev/hyperlane-agent:3bb4d87-20240129-164519 user: root # restart: always @@ -40,6 +42,7 @@ services: validator-osmotest5: container_name: hpl-validator-osmotest5 + # image: gcr.io/abacus-labs-dev/hyperlane-agent:9736164-20240307-131918 image: gcr.io/abacus-labs-dev/hyperlane-agent:3bb4d87-20240129-164519 user: root # restart: always diff --git a/package.json b/package.json index 3298a8da..2fb53276 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "build": "yarn clean && esbuild ./script --bundle --outfile=./dist/index.js --platform=node", "start": "yarn build && node ./dist/index.js", "cw-hpl": "yarn start", + "cw-hpl-exp": "tsx ./example", "dev": "tsx ./script" }, "keywords": [], diff --git a/script/commands/deploy.ts b/script/commands/deploy.ts index 8664e4d3..5f69de07 100644 --- a/script/commands/deploy.ts +++ b/script/commands/deploy.ts @@ -1,13 +1,9 @@ import { Command } from 'commander'; import { deployHook, deployIsm } from '../deploy'; +import { saveAgentConfig } from '../shared/agent'; import { Client, config, getNetwork } from '../shared/config'; -import { - Context, - ContextDeployments, - saveAgentConfig, - saveContext, -} from '../shared/context'; +import { Context, ContextDeployments, saveContext } from '../shared/context'; import { deployContract, executeMultiMsg } from '../shared/contract'; import { CONTAINER, Dependencies } from '../shared/ioc'; diff --git a/script/deploy/ism.ts b/script/deploy/ism.ts index 3aea24b2..ea12efa3 100644 --- a/script/deploy/ism.ts +++ b/script/deploy/ism.ts @@ -1,10 +1,6 @@ import { Client, IsmType } from '../shared/config'; import { Context, ContextIsm } from '../shared/context'; -import { - deployContract, - executeContract, - executeMultiMsg, -} from '../shared/contract'; +import { deployContract, executeMultiMsg } from '../shared/contract'; const deployRoutingIsm = async ( ctx: Context, @@ -21,17 +17,10 @@ const deployRoutingIsm = async ( const routing = await deployContract(ctx, client, 'hpl_ism_routing', { owner: ism.owner === '' ? client.signer : ism.owner, - }); - - await executeContract(client, routing, { - router: { - set_routes: { - set: routes.map(({ domain, route }) => ({ - domain, - route: route.address, - })), - }, - }, + isms: routes.map(({ domain, route }) => ({ + domain, + address: route.address, + })), }); return { @@ -61,7 +50,9 @@ export async function deployIsm( set_validators: { domain: Number(domain), threshold, - validators: addrs, + validators: addrs.map((v) => + v === '' ? client.signer_addr : v, + ), }, }, }), diff --git a/script/shared/agent.ts b/script/shared/agent.ts index d838f05f..2e03ec23 100644 --- a/script/shared/agent.ts +++ b/script/shared/agent.ts @@ -56,8 +56,11 @@ export async function fromContext( index: { from: // sub 1 block to make sure we don't miss any block - parseInt(mailboxContractInfo.contract_info.created.block_height) - - 1, + mailboxContractInfo + ? parseInt( + mailboxContractInfo.contract_info.created.block_height, + ) - 1 + : undefined, chunk: 10_000, }, blocks: { diff --git a/script/shared/context.ts b/script/shared/context.ts index 0c0386a2..caca6a2b 100644 --- a/script/shared/context.ts +++ b/script/shared/context.ts @@ -77,11 +77,7 @@ export function loadContext( const result = fs.readFileSync(fileName, 'utf-8'); return JSON.parse(result.toString()) as Context; } catch (err) { - console.error( - 'Failed to load context. Returning an empty context object.', - 'err:', - err, - ); + console.error('Failed to load context. Returning an empty context object.'); } return {