From e1eaa205acbea31e547cc4104a5059441866fd7b Mon Sep 17 00:00:00 2001 From: Christian Lohr Date: Thu, 29 Aug 2024 14:36:46 +0200 Subject: [PATCH] fix: apply estimate before attempting to send handover --- chain/evm/compass.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chain/evm/compass.go b/chain/evm/compass.go index 44cf273..469c69a 100644 --- a/chain/evm/compass.go +++ b/chain/evm/compass.go @@ -338,6 +338,11 @@ func (t compass) compass_handover( return CompassLogicCallArgs{arg.GetPayload(), common.HexToAddress(arg.GetHexContractAddress())} }) + if opts.estimateOnly { + // Simulate maximum gas estimate to ensure the transaction is not rejected + estimate = big.NewInt(0).SetUint64(cConservativeDummyGasEstimate) + } + // TODO: Use generated contract code directly // compass 2.0.0 // def compass_update_batch(consensus: Consensus, update_compass_args: DynArray[LogicCallArgs, MAX_BATCH], deadline: uint256, gas_estimate: uint256, relayer: address):