randomize sequence in governance VAAs
Solana does replay protection via the sequence so multiple sequential chain registrations were failing Change-Id: I95045c5d8ccd6ce8d2129ccf9141e3bc6a500bac
This commit is contained in:
parent
af67e71bfb
commit
3c3182040f
|
@ -102,7 +102,7 @@ yargs(hideBin(process.argv))
|
||||||
1,
|
1,
|
||||||
1,
|
1,
|
||||||
"0x0000000000000000000000000000000000000000000000000000000000000004",
|
"0x0000000000000000000000000000000000000000000000000000000000000004",
|
||||||
0,
|
Math.floor(Math.random() * 100000000),
|
||||||
data,
|
data,
|
||||||
[
|
[
|
||||||
"cfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0"
|
"cfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0"
|
||||||
|
@ -136,11 +136,11 @@ yargs(hideBin(process.argv))
|
||||||
alias: 'c',
|
alias: 'c',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
description: 'Chain ID',
|
description: 'Chain ID',
|
||||||
// Should be localterra in theory, however Terra Station will
|
// Should be localterra in theory, however Terra Station will
|
||||||
// assume columbus-4 when localterra is set, while our current
|
// assume columbus-4 when localterra is set, while our current
|
||||||
// dev environment is based on columbus-4. Should change when
|
// dev environment is based on columbus-4. Should change when
|
||||||
// change ID within terra/devnet/config/genesis.json is also
|
// change ID within terra/devnet/config/genesis.json is also
|
||||||
// changed.
|
// changed.
|
||||||
default: 'columbus-4'
|
default: 'columbus-4'
|
||||||
})
|
})
|
||||||
.option('mnemonic', {
|
.option('mnemonic', {
|
||||||
|
@ -150,38 +150,38 @@ yargs(hideBin(process.argv))
|
||||||
default: 'notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius',
|
default: 'notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius',
|
||||||
})
|
})
|
||||||
}, async (argv: any) => {
|
}, async (argv: any) => {
|
||||||
const terra = new LCDClient({
|
const terra = new LCDClient({
|
||||||
URL: argv.rpc,
|
URL: argv.rpc,
|
||||||
chainID: argv.chain_id,
|
chainID: argv.chain_id,
|
||||||
});
|
|
||||||
|
|
||||||
const wallet = terra.wallet(new MnemonicKey({
|
|
||||||
mnemonic: argv.mnemonic
|
|
||||||
}));
|
|
||||||
|
|
||||||
// create a simple message that moves coin balances
|
|
||||||
const vaa = Buffer.from(argv.vaa, "hex");
|
|
||||||
const transaction = new MsgExecuteContract(
|
|
||||||
wallet.key.accAddress,
|
|
||||||
argv.token_bridge,
|
|
||||||
{
|
|
||||||
submit_vaa: {
|
|
||||||
data: fromUint8Array(vaa)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ uluna: 1000 }
|
|
||||||
);
|
|
||||||
|
|
||||||
wallet
|
|
||||||
.createAndSignTx({
|
|
||||||
msgs: [transaction],
|
|
||||||
memo: '',
|
|
||||||
})
|
|
||||||
.then(tx => terra.tx.broadcast(tx))
|
|
||||||
.then(result => {
|
|
||||||
console.log(result);
|
|
||||||
console.log(`TX hash: ${result.txhash}`);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const wallet = terra.wallet(new MnemonicKey({
|
||||||
|
mnemonic: argv.mnemonic
|
||||||
|
}));
|
||||||
|
|
||||||
|
// create a simple message that moves coin balances
|
||||||
|
const vaa = Buffer.from(argv.vaa, "hex");
|
||||||
|
const transaction = new MsgExecuteContract(
|
||||||
|
wallet.key.accAddress,
|
||||||
|
argv.token_bridge,
|
||||||
|
{
|
||||||
|
submit_vaa: {
|
||||||
|
data: fromUint8Array(vaa)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{uluna: 1000}
|
||||||
|
);
|
||||||
|
|
||||||
|
wallet
|
||||||
|
.createAndSignTx({
|
||||||
|
msgs: [transaction],
|
||||||
|
memo: '',
|
||||||
|
})
|
||||||
|
.then(tx => terra.tx.broadcast(tx))
|
||||||
|
.then(result => {
|
||||||
|
console.log(result);
|
||||||
|
console.log(`TX hash: ${result.txhash}`);
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.command('solana execute_governance_vaa [vaa]', 'execute a governance VAA on Solana', (yargs) => {
|
.command('solana execute_governance_vaa [vaa]', 'execute a governance VAA on Solana', (yargs) => {
|
||||||
return yargs
|
return yargs
|
||||||
|
|
Loading…
Reference in New Issue