From 2afa6c3d83556a936247b2759ecd2660e27117ba Mon Sep 17 00:00:00 2001 From: eguajardo Date: Wed, 20 Sep 2023 11:11:47 -0600 Subject: [PATCH] feat: update amp worker set query to not use keyID (#42) * feat: update amp worker set query to not use keyID * update ecdsa field key * update worker set query to adjust to prover API changes * remove unused option * Revert "remove unused option" This reverts commit 3cce2bcb89d077b8eefd7cddf6bfaf293700ecc4. --- evm/utils.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/evm/utils.js b/evm/utils.js index ce32f01e..55229c59 100644 --- a/evm/utils.js +++ b/evm/utils.js @@ -407,7 +407,7 @@ const getEVMAddresses = async (config, chain, options = {}) => { const keyID = options.keyID || ''; const evmAddresses = options.amplifier - ? await getAmplifierKeyAddresses(config, chain, keyID) + ? await getAmplifierKeyAddresses(config, chain) : await httpGet(`${config.axelar.lcd}/axelar/evm/v1beta1/key_address/${chain}?key_id=${keyID}`); const sortedAddresses = evmAddresses.addresses.sort((a, b) => a.address.toLowerCase().localeCompare(b.address.toLowerCase())); @@ -419,19 +419,16 @@ const getEVMAddresses = async (config, chain, options = {}) => { return { addresses, weights, threshold }; }; -const getAmplifierKeyAddresses = async (config, chain, keyID = '') => { +const getAmplifierKeyAddresses = async (config, chain) => { const client = await CosmWasmClient.connect(config.axelar.rpc); - const key = await client.queryContractSmart(config.axelar.contracts.Multisig.address, { - get_key: { key_id: { owner: config.axelar.contracts.MultisigProver[chain].address, subkey: keyID } }, - }); - const pubkeys = new Map(Object.entries(key.pub_keys)); + const workerSet = await client.queryContractSmart(config.axelar.contracts.MultisigProver[chain].address, 'get_worker_set'); - const weightedAddresses = Object.values(key.snapshot.participants).map((participant) => ({ - address: computeAddress(`0x${pubkeys.get(participant.address)}`), - weight: participant.weight, + const weightedAddresses = workerSet.signers.map((signer) => ({ + address: computeAddress(`0x${signer.pub_key.ecdsa}`), + weight: signer.weight, })); - return { addresses: weightedAddresses, threshold: key.snapshot.quorum }; + return { addresses: weightedAddresses, threshold: workerSet.threshold }; }; function sleep(ms) {