Fix bug with HypCollateral warp route deployments (#3442)

### Description

- Fix incorrect adapter use in CLI's warp route deployment
- Add a warp collateral deployment to cli e2e test

### Related issues

Fixes https://github.com/hyperlane-xyz/issues/issues/1146

### Backward compatibility

Yes

### Testing

Tested manually and via new e2e test coverage
pull/3444/head
J M Rossy 8 months ago committed by GitHub
parent 3adc0e91ce
commit bfc2b792be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      .changeset/proud-cycles-wait.md
  2. 26
      typescript/cli/ci-test.sh
  3. 1
      typescript/cli/package.json
  4. 4
      typescript/cli/src/deploy/warp.ts
  5. 37
      typescript/cli/src/tests/deployTestErc20.ts
  6. 278
      yarn.lock

@ -0,0 +1,5 @@
---
'@hyperlane-xyz/cli': patch
---
Fix bug with HypCollateral warp route deployments

@ -21,9 +21,11 @@ if [ "$TEST_TYPE" == $TEST_TYPE_CONFIGURED_HOOK ]; then
HOOK_FLAG=true
fi
ANVIL_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
CHAIN1=anvil1
CHAIN2=anvil2
EXAMPLES_PATH=./examples
DEPLOY_ERC20_PATH=./src/tests/deployTestErc20.ts
# use different chain names and config for pi<>core test
if [ "$TEST_TYPE" == $TEST_TYPE_PI_CORE ]; then
@ -98,7 +100,7 @@ yarn workspace @hyperlane-xyz/cli run hyperlane deploy core \
$(if [ "$HOOK_FLAG" == "true" ]; then echo "--hook ${EXAMPLES_PATH}/hooks.yaml"; fi) \
--ism ${EXAMPLES_PATH}/ism.yaml \
--out /tmp \
--key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
--key $ANVIL_KEY \
--yes
AFTER_CORE=$(cast balance $DEPLOYER --rpc-url http://127.0.0.1:${CHAIN1_PORT})
@ -113,13 +115,27 @@ cat $CORE_ARTIFACTS_PATH
AGENT_CONFIG_FILENAME=`ls -t1 /tmp | grep agent-config | head -1`
echo "Deploying warp routes"
echo "Deploying hypNative warp route"
yarn workspace @hyperlane-xyz/cli run hyperlane deploy warp \
--chains ${EXAMPLES_PATH}/anvil-chains.yaml \
--core $CORE_ARTIFACTS_PATH \
--config ${EXAMPLES_PATH}/warp-route-deployment.yaml \
--out /tmp \
--key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
--key $ANVIL_KEY \
--yes
yarn workspace @hyperlane-xyz/cli run tsx $DEPLOY_ERC20_PATH \
http://127.0.0.1:$CHAIN1_PORT \
$CHAIN1 $CHAIN2 $ANVIL_KEY \
/tmp/warp-collateral-deployment.json \
echo "Deploying hypCollateral warp route"
yarn workspace @hyperlane-xyz/cli run hyperlane deploy warp \
--chains ${EXAMPLES_PATH}/anvil-chains.yaml \
--core $CORE_ARTIFACTS_PATH \
--config /tmp/warp-collateral-deployment.json \
--out /tmp \
--key $ANVIL_KEY \
--yes
AFTER_WARP=$(cast balance $DEPLOYER --rpc-url http://127.0.0.1:${CHAIN1_PORT})
@ -135,7 +151,7 @@ yarn workspace @hyperlane-xyz/cli run hyperlane send message \
--chains ${EXAMPLES_PATH}/anvil-chains.yaml \
--core $CORE_ARTIFACTS_PATH \
--quick \
--key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
--key $ANVIL_KEY \
| tee /tmp/message1
AFTER_MSG=$(cast balance $DEPLOYER --rpc-url http://127.0.0.1:${CHAIN1_PORT})
@ -158,7 +174,7 @@ yarn workspace @hyperlane-xyz/cli run hyperlane send transfer \
--core $CORE_ARTIFACTS_PATH \
--router ${!CHAIN1_ROUTER} \
--quick \
--key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
--key $ANVIL_KEY \
| tee /tmp/message2
MESSAGE2_ID=`cat /tmp/message2 | grep "Message ID" | grep -E -o '0x[0-9a-f]+'`

@ -11,6 +11,7 @@
"ethers": "^5.7.2",
"latest-version": "^8.0.0",
"terminal-link": "^3.0.0",
"tsx": "^4.7.1",
"yaml": "^2.3.1",
"yargs": "^17.7.2",
"zod": "^3.21.2"

@ -5,7 +5,7 @@ import {
ChainMap,
ChainName,
ConnectionClientConfig,
EvmHypCollateralAdapter,
EvmTokenAdapter,
HypERC20Deployer,
HypERC721Deployer,
HyperlaneContractsMap,
@ -292,7 +292,7 @@ async function fetchBaseTokenMetadata(
} else if (base.type === TokenType.collateral && address) {
// If it's a collateral type, use a TokenAdapter to query for its metadata
log(`Fetching token metadata for ${address} on ${chainName}}`);
const adapter = new EvmHypCollateralAdapter(
const adapter = new EvmTokenAdapter(
chainName,
MultiProtocolProvider.fromMultiProvider(multiProvider),
{ token: address },

@ -0,0 +1,37 @@
import { Wallet, providers } from 'ethers';
import fs from 'fs';
import { ERC20Test__factory } from '@hyperlane-xyz/core';
import { TokenType } from '@hyperlane-xyz/sdk';
import { WarpRouteDeployConfig } from '../config/warp.js';
async function deployERC20() {
const [rpcUrl, chain1, chain2, privateKey, outPath] = process.argv.slice(2);
console.log('Deploying Test ERC20 contract to local node');
const provider = new providers.JsonRpcProvider(rpcUrl);
const signer = new Wallet(privateKey, provider);
const factory = new ERC20Test__factory(signer);
const contract = await factory.deploy(
'fake',
'FAKE',
'100000000000000000000',
18,
);
await contract.deployed();
console.log('Test ERC20 contract deployed', contract.address);
const warpDeploymentConfig: WarpRouteDeployConfig = {
base: {
chainName: chain1,
type: TokenType.collateral,
address: contract.address,
},
synthetics: [{ chainName: chain2 }],
};
console.log('Writing deployment config to', outPath);
fs.writeFileSync(outPath, JSON.stringify(warpDeploymentConfig, null, 2));
}
deployERC20().catch(console.error);

@ -3583,6 +3583,167 @@ __metadata:
languageName: node
linkType: hard
"@esbuild/aix-ppc64@npm:0.19.12":
version: 0.19.12
resolution: "@esbuild/aix-ppc64@npm:0.19.12"
conditions: os=aix & cpu=ppc64
languageName: node
linkType: hard
"@esbuild/android-arm64@npm:0.19.12":
version: 0.19.12
resolution: "@esbuild/android-arm64@npm:0.19.12"
conditions: os=android & cpu=arm64
languageName: node
linkType: hard
"@esbuild/android-arm@npm:0.19.12":
version: 0.19.12
resolution: "@esbuild/android-arm@npm:0.19.12"
conditions: os=android & cpu=arm
languageName: node
linkType: hard
"@esbuild/android-x64@npm:0.19.12":
version: 0.19.12
resolution: "@esbuild/android-x64@npm:0.19.12"
conditions: os=android & cpu=x64
languageName: node
linkType: hard
"@esbuild/darwin-arm64@npm:0.19.12":
version: 0.19.12
resolution: "@esbuild/darwin-arm64@npm:0.19.12"
conditions: os=darwin & cpu=arm64
languageName: node
linkType: hard
"@esbuild/darwin-x64@npm:0.19.12":
version: 0.19.12
resolution: "@esbuild/darwin-x64@npm:0.19.12"
conditions: os=darwin & cpu=x64
languageName: node
linkType: hard
"@esbuild/freebsd-arm64@npm:0.19.12":
version: 0.19.12
resolution: "@esbuild/freebsd-arm64@npm:0.19.12"
conditions: os=freebsd & cpu=arm64
languageName: node
linkType: hard
"@esbuild/freebsd-x64@npm:0.19.12":
version: 0.19.12
resolution: "@esbuild/freebsd-x64@npm:0.19.12"
conditions: os=freebsd & cpu=x64
languageName: node
linkType: hard
"@esbuild/linux-arm64@npm:0.19.12":
version: 0.19.12
resolution: "@esbuild/linux-arm64@npm:0.19.12"
conditions: os=linux & cpu=arm64
languageName: node
linkType: hard
"@esbuild/linux-arm@npm:0.19.12":
version: 0.19.12
resolution: "@esbuild/linux-arm@npm:0.19.12"
conditions: os=linux & cpu=arm
languageName: node
linkType: hard
"@esbuild/linux-ia32@npm:0.19.12":
version: 0.19.12
resolution: "@esbuild/linux-ia32@npm:0.19.12"
conditions: os=linux & cpu=ia32
languageName: node
linkType: hard
"@esbuild/linux-loong64@npm:0.19.12":
version: 0.19.12
resolution: "@esbuild/linux-loong64@npm:0.19.12"
conditions: os=linux & cpu=loong64
languageName: node
linkType: hard
"@esbuild/linux-mips64el@npm:0.19.12":
version: 0.19.12
resolution: "@esbuild/linux-mips64el@npm:0.19.12"
conditions: os=linux & cpu=mips64el
languageName: node
linkType: hard
"@esbuild/linux-ppc64@npm:0.19.12":
version: 0.19.12
resolution: "@esbuild/linux-ppc64@npm:0.19.12"
conditions: os=linux & cpu=ppc64
languageName: node
linkType: hard
"@esbuild/linux-riscv64@npm:0.19.12":
version: 0.19.12
resolution: "@esbuild/linux-riscv64@npm:0.19.12"
conditions: os=linux & cpu=riscv64
languageName: node
linkType: hard
"@esbuild/linux-s390x@npm:0.19.12":
version: 0.19.12
resolution: "@esbuild/linux-s390x@npm:0.19.12"
conditions: os=linux & cpu=s390x
languageName: node
linkType: hard
"@esbuild/linux-x64@npm:0.19.12":
version: 0.19.12
resolution: "@esbuild/linux-x64@npm:0.19.12"
conditions: os=linux & cpu=x64
languageName: node
linkType: hard
"@esbuild/netbsd-x64@npm:0.19.12":
version: 0.19.12
resolution: "@esbuild/netbsd-x64@npm:0.19.12"
conditions: os=netbsd & cpu=x64
languageName: node
linkType: hard
"@esbuild/openbsd-x64@npm:0.19.12":
version: 0.19.12
resolution: "@esbuild/openbsd-x64@npm:0.19.12"
conditions: os=openbsd & cpu=x64
languageName: node
linkType: hard
"@esbuild/sunos-x64@npm:0.19.12":
version: 0.19.12
resolution: "@esbuild/sunos-x64@npm:0.19.12"
conditions: os=sunos & cpu=x64
languageName: node
linkType: hard
"@esbuild/win32-arm64@npm:0.19.12":
version: 0.19.12
resolution: "@esbuild/win32-arm64@npm:0.19.12"
conditions: os=win32 & cpu=arm64
languageName: node
linkType: hard
"@esbuild/win32-ia32@npm:0.19.12":
version: 0.19.12
resolution: "@esbuild/win32-ia32@npm:0.19.12"
conditions: os=win32 & cpu=ia32
languageName: node
linkType: hard
"@esbuild/win32-x64@npm:0.19.12":
version: 0.19.12
resolution: "@esbuild/win32-x64@npm:0.19.12"
conditions: os=win32 & cpu=x64
languageName: node
linkType: hard
"@eslint-community/eslint-utils@npm:^4.2.0":
version: 4.4.0
resolution: "@eslint-community/eslint-utils@npm:4.4.0"
@ -4761,6 +4922,7 @@ __metadata:
mocha: "npm:^10.2.0"
prettier: "npm:^2.8.8"
terminal-link: "npm:^3.0.0"
tsx: "npm:^4.7.1"
typescript: "npm:^5.1.6"
yaml: "npm:^2.3.1"
yargs: "npm:^17.7.2"
@ -12236,6 +12398,86 @@ __metadata:
languageName: node
linkType: hard
"esbuild@npm:~0.19.10":
version: 0.19.12
resolution: "esbuild@npm:0.19.12"
dependencies:
"@esbuild/aix-ppc64": "npm:0.19.12"
"@esbuild/android-arm": "npm:0.19.12"
"@esbuild/android-arm64": "npm:0.19.12"
"@esbuild/android-x64": "npm:0.19.12"
"@esbuild/darwin-arm64": "npm:0.19.12"
"@esbuild/darwin-x64": "npm:0.19.12"
"@esbuild/freebsd-arm64": "npm:0.19.12"
"@esbuild/freebsd-x64": "npm:0.19.12"
"@esbuild/linux-arm": "npm:0.19.12"
"@esbuild/linux-arm64": "npm:0.19.12"
"@esbuild/linux-ia32": "npm:0.19.12"
"@esbuild/linux-loong64": "npm:0.19.12"
"@esbuild/linux-mips64el": "npm:0.19.12"
"@esbuild/linux-ppc64": "npm:0.19.12"
"@esbuild/linux-riscv64": "npm:0.19.12"
"@esbuild/linux-s390x": "npm:0.19.12"
"@esbuild/linux-x64": "npm:0.19.12"
"@esbuild/netbsd-x64": "npm:0.19.12"
"@esbuild/openbsd-x64": "npm:0.19.12"
"@esbuild/sunos-x64": "npm:0.19.12"
"@esbuild/win32-arm64": "npm:0.19.12"
"@esbuild/win32-ia32": "npm:0.19.12"
"@esbuild/win32-x64": "npm:0.19.12"
dependenciesMeta:
"@esbuild/aix-ppc64":
optional: true
"@esbuild/android-arm":
optional: true
"@esbuild/android-arm64":
optional: true
"@esbuild/android-x64":
optional: true
"@esbuild/darwin-arm64":
optional: true
"@esbuild/darwin-x64":
optional: true
"@esbuild/freebsd-arm64":
optional: true
"@esbuild/freebsd-x64":
optional: true
"@esbuild/linux-arm":
optional: true
"@esbuild/linux-arm64":
optional: true
"@esbuild/linux-ia32":
optional: true
"@esbuild/linux-loong64":
optional: true
"@esbuild/linux-mips64el":
optional: true
"@esbuild/linux-ppc64":
optional: true
"@esbuild/linux-riscv64":
optional: true
"@esbuild/linux-s390x":
optional: true
"@esbuild/linux-x64":
optional: true
"@esbuild/netbsd-x64":
optional: true
"@esbuild/openbsd-x64":
optional: true
"@esbuild/sunos-x64":
optional: true
"@esbuild/win32-arm64":
optional: true
"@esbuild/win32-ia32":
optional: true
"@esbuild/win32-x64":
optional: true
bin:
esbuild: bin/esbuild
checksum: 861fa8eb2428e8d6521a4b7c7930139e3f45e8d51a86985cc29408172a41f6b18df7b3401e7e5e2d528cdf83742da601ddfdc77043ddc4f1c715a8ddb2d8a255
languageName: node
linkType: hard
"escalade@npm:^3.1.1":
version: 3.1.1
resolution: "escalade@npm:3.1.1"
@ -13497,7 +13739,7 @@ __metadata:
languageName: node
linkType: hard
"fsevents@npm:^2.3.2":
"fsevents@npm:^2.3.2, fsevents@npm:~2.3.3":
version: 2.3.3
resolution: "fsevents@npm:2.3.3"
dependencies:
@ -13527,7 +13769,7 @@ __metadata:
languageName: node
linkType: hard
"fsevents@patch:fsevents@npm%3A^2.3.2#optional!builtin<compat/fsevents>":
"fsevents@patch:fsevents@npm%3A^2.3.2#optional!builtin<compat/fsevents>, fsevents@patch:fsevents@npm%3A~2.3.3#optional!builtin<compat/fsevents>":
version: 2.3.3
resolution: "fsevents@patch:fsevents@npm%3A2.3.3#optional!builtin<compat/fsevents>::version=2.3.3&hash=df0bf1"
dependencies:
@ -13783,6 +14025,15 @@ __metadata:
languageName: node
linkType: hard
"get-tsconfig@npm:^4.7.2":
version: 4.7.3
resolution: "get-tsconfig@npm:4.7.3"
dependencies:
resolve-pkg-maps: "npm:^1.0.0"
checksum: 7397bb4f8aef936df4d9016555b662dcf5279f3c46428b7c7c1ff5e94ab2b87d018b3dda0f4bc1a28b154d5affd0eac5d014511172c085fd8a9cdff9ea7fe043
languageName: node
linkType: hard
"getpass@npm:^0.1.1":
version: 0.1.7
resolution: "getpass@npm:0.1.7"
@ -20011,6 +20262,13 @@ __metadata:
languageName: node
linkType: hard
"resolve-pkg-maps@npm:^1.0.0":
version: 1.0.0
resolution: "resolve-pkg-maps@npm:1.0.0"
checksum: 0763150adf303040c304009231314d1e84c6e5ebfa2d82b7d94e96a6e82bacd1dcc0b58ae257315f3c8adb89a91d8d0f12928241cba2df1680fbe6f60bf99b0e
languageName: node
linkType: hard
"resolve.exports@npm:^2.0.0":
version: 2.0.2
resolution: "resolve.exports@npm:2.0.2"
@ -22026,6 +22284,22 @@ __metadata:
languageName: node
linkType: hard
"tsx@npm:^4.7.1":
version: 4.7.1
resolution: "tsx@npm:4.7.1"
dependencies:
esbuild: "npm:~0.19.10"
fsevents: "npm:~2.3.3"
get-tsconfig: "npm:^4.7.2"
dependenciesMeta:
fsevents:
optional: true
bin:
tsx: dist/cli.mjs
checksum: 3a462b595f31ae58b31f9c6e8c450577dc87660b1225012bd972b6b58d7d2f6c4034728763ebc53bb731acff68de8b0fa50586e4c1ec4c086226f1788ccf9b7d
languageName: node
linkType: hard
"tty-table@npm:^4.1.5":
version: 4.2.3
resolution: "tty-table@npm:4.2.3"

Loading…
Cancel
Save