Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update amp worker set query to not use keyID #42

Merged
merged 6 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion evm/deploy-gateway-v5.0.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@ async function programHandler() {
program.addOption(new Option('-g, --governance <governance>', 'governance address').env('GOVERNANCE'));
program.addOption(new Option('-m, --mintLimiter <mintLimiter>', 'mint limiter address').env('MINT_LIMITER'));
program.addOption(new Option('-y, --yes', 'skip deployment prompt confirmation').env('YES'));
program.addOption(new Option('-k, --keyID <keyID>', 'key ID').env('KEY_ID'));
program.addOption(new Option('-a, --amplifier', 'deploy amplifier gateway').env('AMPLIFIER'));
program.addOption(new Option('--prevKeyIDs <prevKeyIDs>', 'previous key IDs to be used for auth contract'));
program.addOption(new Option('-u, --upgrade', 'upgrade gateway').env('UPGRADE'));
Expand Down
17 changes: 7 additions & 10 deletions evm/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ const getEVMAddresses = async (config, chain, options = {}) => {
const keyID = options.keyID || '';
milapsheth marked this conversation as resolved.
Show resolved Hide resolved

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()));
Expand All @@ -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) {
Expand Down