sdk/js: Redeem on Algorand dynamic cost budget fix

Addresses #2345
This commit is contained in:
Kevin Peters 2023-09-26 08:54:01 -05:00 committed by Evan Gray
parent 11a82aee56
commit 20aea2ebcf
1 changed files with 3 additions and 4 deletions

View File

@ -25,7 +25,6 @@ import { BigNumber } from "ethers";
import { keccak256 } from "ethers/lib/utils";
import { getEmitterAddressAlgorand } from "../bridge";
import {
ChainId,
CHAIN_ID_ALGORAND,
hexToUint8Array,
textToHexString,
@ -45,7 +44,7 @@ const BITS_PER_BYTE: number = 8;
export const BITS_PER_KEY: number = MAX_BYTES_PER_KEY * BITS_PER_BYTE;
const MAX_BYTES: number = MAX_BYTES_PER_KEY * MAX_KEYS;
export const MAX_BITS: number = BITS_PER_BYTE * MAX_BYTES;
const MAX_SIGS_PER_TXN: number = 9;
const MAX_SIGS_PER_TXN: number = 6;
const ALGO_VERIFY_HASH =
"EZATROXX2HISIRZDRGXW4LRQ46Z6IUJYYIHU3PJGP7P5IQDPKVX42N767A";
@ -614,12 +613,12 @@ export async function submitVAAHeader(
.do();
// We don't pass the entire payload in but instead just pass it pre digested. This gets around size
// limitations with lsigs AND reduces the cost of the entire operation on a conjested network by reducing the
// limitations with lsigs AND reduces the cost of the entire operation on a congested network by reducing the
// bytes passed into the transaction
// This is a 2 pass digest
const digest = keccak256(keccak256(parsedVAA.digest)).slice(2);
// How many signatures can we process in a single txn... we can do 9!
// How many signatures can we process in a single txn... we can do 6!
// There are likely upwards of 19 signatures. So, we ned to split things up
const numSigs: number = parsedVAA.siglen;
let numTxns: number = Math.floor(numSigs / MAX_SIGS_PER_TXN) + 1;