Skip to content

bug: Provided Gas for Axelar is insufficient #861 #395

@mustermeiszer

Description

@mustermeiszer

This is an estimation bug from the SDK side. The provide value is insufficient to satisfy the onchain gas calculations.

  • Failing sim here - fails at Axelar at the end
  • Happens in prod and on manage-demo branch

sdk/src/Centrifuge.ts

Lines 670 to 704 in 21b4e11

repayBatch(fromCentrifugeId: number, toCentrifugeId: number, batch: HexString, extraPayment = 0n) {
const self = this
return this._transact(async function* (ctx) {
const [addresses, client] = await Promise.all([
self._protocolAddresses(fromCentrifugeId),
self.getClient(fromCentrifugeId),
])
const batchHash = keccak256(batch)
const [counter, gasLimit] = await client.readContract({
address: addresses.gateway,
abi: ABI.Gateway,
functionName: 'underpaid',
args: [toCentrifugeId, batchHash],
})
if (counter === 0n) {
throw new Error(`Batch is not underpaid and can't be repaid. Batch hash: "${batchHash}"`)
}
const estimate = await client.readContract({
address: addresses.multiAdapter,
abi: ABI.MultiAdapter,
functionName: 'estimate',
args: [toCentrifugeId, batch, gasLimit],
})
yield* doTransaction('Repay', ctx, () =>
ctx.walletClient.writeContract({
address: addresses.gateway,
abi: ABI.Gateway,
functionName: 'repay',
args: [toCentrifugeId, batch, ctx.signingAddress],
value: estimate + extraPayment,
})
)
}, fromCentrifugeId)
}

This method does not caculate the gas correctly. Use in the scanner to repay but creates a tx with insufficient gas - see here

Screen.Recording.2026-03-05.at.09.26.04.mov

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions