Don't require padding on addrs in bridge clients (#1041)
Change-Id: Id32bfb90ee20d1bccc6b860de028c0bdecfd8786
This commit is contained in:
parent
745d3db68d
commit
014b3686fe
|
@ -91,7 +91,7 @@ yargs(hideBin(process.argv))
|
|||
"01",
|
||||
"0000",
|
||||
ethers.utils.defaultAbiCoder.encode(["uint16"], [argv.chain_id]).substring(2 + (64 - 4)),
|
||||
ethers.utils.defaultAbiCoder.encode(["bytes32"], [argv.contract_address]).substring(2),
|
||||
ethers.utils.defaultAbiCoder.encode(["bytes32"], [fmtAddress(argv.contract_address)]).substring(2),
|
||||
].join('')
|
||||
|
||||
const vm = signAndEncodeVM(
|
||||
|
@ -133,7 +133,7 @@ yargs(hideBin(process.argv))
|
|||
"00000000000000000000000000000000000000000000004e4654427269646765", // NFT Bridge header
|
||||
"02",
|
||||
ethers.utils.defaultAbiCoder.encode(["uint16"], [argv.chain_id]).substring(2 + (64 - 4)),
|
||||
ethers.utils.defaultAbiCoder.encode(["bytes32"], [argv.contract_address]).substring(2),
|
||||
ethers.utils.defaultAbiCoder.encode(["bytes32"], [fmtAddress(argv.contract_address)]).substring(2),
|
||||
].join('')
|
||||
|
||||
const vm = signAndEncodeVM(
|
||||
|
@ -151,7 +151,7 @@ yargs(hideBin(process.argv))
|
|||
);
|
||||
|
||||
console.log(vm)
|
||||
})
|
||||
})
|
||||
.command('solana execute_governance_vaa [vaa]', 'execute a governance VAA on Solana', (yargs) => {
|
||||
return yargs
|
||||
.positional('vaa', {
|
||||
|
@ -233,7 +233,7 @@ yargs(hideBin(process.argv))
|
|||
);
|
||||
console.log('SIGNATURE', signature);
|
||||
})
|
||||
.command('eth execute_governance_vaa [vaa]', 'execute a governance VAA on Solana', (yargs) => {
|
||||
.command('eth execute_governance_vaa [vaa]', 'execute a governance VAA on evm', (yargs) => {
|
||||
return yargs
|
||||
.positional('vaa', {
|
||||
describe: 'vaa to post',
|
||||
|
@ -348,6 +348,11 @@ function setupConnection(argv: yargs.Arguments): web3s.Connection {
|
|||
);
|
||||
}
|
||||
|
||||
function fmtAddress(addr: string) : string {
|
||||
let address = (addr.search("0x") == 0) ? addr.substring(2) : addr;
|
||||
return "0x" + zeroPadBytes(address, 32);
|
||||
}
|
||||
|
||||
interface BridgeState {
|
||||
// The current guardian set index, used to decide which signature sets to accept.
|
||||
guardian_set_index: number,
|
||||
|
|
|
@ -99,7 +99,7 @@ yargs(hideBin(process.argv))
|
|||
"01",
|
||||
"0000",
|
||||
ethers.utils.defaultAbiCoder.encode(["uint16"], [argv.chain_id]).substring(2 + (64 - 4)),
|
||||
ethers.utils.defaultAbiCoder.encode(["bytes32"], [argv.contract_address]).substring(2),
|
||||
ethers.utils.defaultAbiCoder.encode(["bytes32"], [fmtAddress(argv.contract_address)]).substring(2),
|
||||
].join('')
|
||||
|
||||
const vm = signAndEncodeVM(
|
||||
|
@ -141,7 +141,7 @@ yargs(hideBin(process.argv))
|
|||
"000000000000000000000000000000000000000000546f6b656e427269646765", // Token Bridge header
|
||||
"02",
|
||||
ethers.utils.defaultAbiCoder.encode(["uint16"], [argv.chain_id]).substring(2 + (64 - 4)),
|
||||
ethers.utils.defaultAbiCoder.encode(["bytes32"], [argv.contract_address]).substring(2),
|
||||
ethers.utils.defaultAbiCoder.encode(["bytes32"], [fmtAddress(argv.contract_address)]).substring(2),
|
||||
].join('')
|
||||
|
||||
const vm = signAndEncodeVM(
|
||||
|
@ -427,6 +427,11 @@ function setupConnection(argv: yargs.Arguments): web3s.Connection {
|
|||
);
|
||||
}
|
||||
|
||||
function fmtAddress(addr: string) : string {
|
||||
let address = (addr.search("0x") == 0) ? addr.substring(2) : addr;
|
||||
return "0x" + zeroPadBytes(address, 32);
|
||||
}
|
||||
|
||||
interface BridgeState {
|
||||
// The current guardian set index, used to decide which signature sets to accept.
|
||||
guardian_set_index: number,
|
||||
|
|
Loading…
Reference in New Issue