relayer: fix several ci issues (#2745)

* Installs forge dependencies in `eth-node` image.

* changes sdk.sh to use bash

* removing relayer tests from SDK image

* relayer: deployment script can self-sign with multiple signers

* relayer: update dockerignore

---------

Co-authored-by: chase-45 <chasemoran45@gmail.com>
Co-authored-by: Evan Gray <battledingo@gmail.com>
Co-authored-by: Joe Howarth <jhowarth@jumptrading.com>
This commit is contained in:
scnale 2023-04-21 18:49:39 -03:00 committed by derpy-duck
parent 270086c8ef
commit 9dd4b7c67e
8 changed files with 45 additions and 22 deletions

View File

@ -6,3 +6,6 @@ bin
wormchain/build/config/gentx/
ethereum/ts-scripts/relayer/output
ethereum/build
ethereum/cache
ethereum/out

View File

@ -13,7 +13,7 @@ spec:
command:
- /bin/sh
- -c
- "sh /app/testing/sdk.sh && touch /app/testing/success"
- "bash /app/testing/sdk.sh && touch /app/testing/success"
readinessProbe:
exec:
command:

View File

@ -1,3 +1,6 @@
node_modules
flattened
ts-scripts/relayer/output
ts-scripts/relayer/output
build
cache
out

View File

@ -58,3 +58,4 @@ RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \
RUN rm -rf node_modules && mv node_modules_cache node_modules
COPY --chown=node:node . .
RUN make forge_dependencies

View File

@ -0,0 +1,3 @@
GUARDIAN_KEY=cfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0
GUARDIAN_KEY2=c3b2e45c422a1602333a64078aeb42637370b0f48fe385f9cfa6ad54a8e0c47e
WALLET_KEY=0x6370fd033278c143179d81c5526140625662b8daa446c22ee2d73db3707e620c

View File

@ -216,12 +216,20 @@ export function loadMockIntegrations(): Deployment[] {
}
}
export function loadGuardianKey(): string {
//TODO load these keys more intelligently,
//potentially from devnet-consts
export function loadGuardianKeys(): string[] {
const output = [];
const guardianKey = get_env_var("GUARDIAN_KEY");
const guardianKey2 = get_env_var("GUARDIAN_KEY2");
if (!guardianKey) {
throw Error("Failed to find guardian key for this process!");
}
return guardianKey;
if(guardianKey2) {
output.push(guardianKey2);
}
output.push(guardianKey);
return output;
}
export function writeOutputFiles(output: any, processName: string) {

View File

@ -4,7 +4,7 @@ import {
ChainInfo,
getCoreRelayerAddress,
getRelayProviderAddress,
loadGuardianKey,
loadGuardianKeys,
loadGuardianSetIndex,
} from "./env";
const elliptic = require("elliptic");
@ -105,28 +105,33 @@ export function encodeAndSignGovernancePayload(payload: string): string {
const hash = doubleKeccak256(encodedVAABody);
// sign the hash
const ec = new elliptic.ec("secp256k1");
const key = ec.keyFromPrivate(loadGuardianKey());
const signature = key.sign(hash.substring(2), { canonical: true });
const pks = loadGuardianKeys();
let signatures = "";
// pack the signatures
const packSig = [
ethers.utils.solidityPack(["uint8"], [0]).substring(2),
zeroPadBytes(signature.r.toString(16), 32),
zeroPadBytes(signature.s.toString(16), 32),
ethers.utils
.solidityPack(["uint8"], [signature.recoveryParam])
.substring(2),
];
const signatures = packSig.join("");
for (let pk of pks) {
// sign the hash
const ec = new elliptic.ec("secp256k1");
const key = ec.keyFromPrivate(pk);
const signature = key.sign(hash.substring(2), { canonical: true });
// pack the signatures
const packSig = [
ethers.utils.solidityPack(["uint8"], [0]).substring(2),
zeroPadBytes(signature.r.toString(16), 32),
zeroPadBytes(signature.s.toString(16), 32),
ethers.utils
.solidityPack(["uint8"], [signature.recoveryParam])
.substring(2),
];
signatures += packSig.join("");
}
const vm = [
ethers.utils.solidityPack(["uint8"], [1]).substring(2),
ethers.utils
.solidityPack(["uint32"], [loadGuardianSetIndex()])
.substring(2), // guardianSetIndex
ethers.utils.solidityPack(["uint8"], [1]).substring(2), // number of signers
ethers.utils.solidityPack(["uint8"], [pks.length]).substring(2), // number of signers
signatures,
encodedVAABody.substring(2),
].join("");

View File

@ -1,7 +1,7 @@
#!/bin/sh
#!/bin/bash
set -e
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' guardian:6060/readyz)" != "200" ]]; do sleep 5; done
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' spy:6060/metrics)" != "200" ]]; do sleep 5; done
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' ibc-relayer:7597/debug/pprof/)" != "200" ]]; do sleep 5; done
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' relayer-engine:3000/metrics)" != "200" ]]; do sleep 5; done
CI=true npm --prefix ../sdk/js run test-ci
CI=true npm --prefix ../ethereum run relayer-ci-test