Skip to content

Commit

Permalink
fix(reporter): adds nonce within simulateContract to avoid to generat…
Browse files Browse the repository at this point in the history
…e txs with the same nonce
  • Loading branch information
allemanfredi committed Sep 20, 2024
1 parent 77ff55c commit c57a4ee
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class StandardReporterController extends BaseController {
const client = this.multiClient.getClientByChain(this.sourceChain)
const blockNumber = _blockNumbers[_blockNumbers.length - 1]

let nonce = await client.getTransactionCount({ address: client.account.address })
for (const chain of this.destinationChains as Chain[]) {
if (!this.adapterAddresses[chain.name]) {
this.logger.info(`Adapter address is missing for ${chain.name}. Skipping...`)
Expand All @@ -37,10 +38,12 @@ class StandardReporterController extends BaseController {
functionName: "dispatchBlocks",
args: [chain.id, this.adapterAddresses[chain.name], [blockNumber]],
value: this._reportHeadersValue,
nonce,
})

const txHash = await client.writeContract(request)
this.logger.info(`headers reporter from ${this.sourceChain.name} to ${chain.name}: ${txHash}`)
nonce += 1
}
} catch (_error) {
this.logger.error(_error)
Expand Down

0 comments on commit c57a4ee

Please sign in to comment.