diff --git a/go/host/l1/publisher.go b/go/host/l1/publisher.go index 534d06abdf..75c40ed0dd 100644 --- a/go/host/l1/publisher.go +++ b/go/host/l1/publisher.go @@ -259,8 +259,14 @@ func (p *Publisher) PublishCrossChainBundle(bundle *common.ExtCrossChainBundle) return } + nonce, err := p.ethClient.EthClient().PendingNonceAt(context.Background(), p.hostWallet.Address()) + if err != nil { + p.logger.Error("Unable to get nonce for management contract", log.ErrKey, err) + return + } + // transactor.GasLimit = 200_000 - transactor.Nonce = big.NewInt(0).SetUint64(p.hostWallet.GetNonceAndIncrement()) + transactor.Nonce = big.NewInt(0).SetUint64(nonce) tx, err := managementCtr.AddCrossChainMessagesRoot(transactor, [32]byte(bundle.StateRootHash.Bytes()), bundle.L1BlockHash, bundle.L1BlockNum, bundle.CrossChainHashes, bundle.Signature) if err != nil { diff --git a/integration/simulation/transaction_injector.go b/integration/simulation/transaction_injector.go index 26dba752ea..826745d182 100644 --- a/integration/simulation/transaction_injector.go +++ b/integration/simulation/transaction_injector.go @@ -402,6 +402,13 @@ func (ti *TransactionInjector) awaitAndFinalizeWithdrawal(tx *types.Transaction, } time.Sleep(20 * time.Second) + + oldBalance, err := ti.rpcHandles.RndEthClient().BalanceAt(vTransfers[0].Receiver, nil) + if err != nil { + ti.logger.Error("Failed to retrieve balance of receiver", log.ErrKey, err) + return + } + withdrawalTx, err := mCtr.ExtractNativeValue(opts, ManagementContract.StructsValueTransferMessage(vTransfers[0]), proof32, header.TransfersTree) if err != nil { ti.logger.Error("Failed to extract value transfer from L2", log.ErrKey, err) @@ -419,6 +426,17 @@ func (ti *TransactionInjector) awaitAndFinalizeWithdrawal(tx *types.Transaction, return } + newBalance, err := ti.rpcHandles.RndEthClient().BalanceAt(vTransfers[0].Receiver, nil) + if err != nil { + ti.logger.Error("Failed to retrieve balance of receiver", log.ErrKey, err) + return + } + + if newBalance.Sub(newBalance, oldBalance).Cmp(vTransfers[0].Amount) != 0 { + ti.logger.Error("Balance of receiver did not increase by the expected amount", "expected", vTransfers[0].Amount, "actual", newBalance.Sub(newBalance, oldBalance)) + return + } + ti.logger.Info("Successful bridge withdrawal", log.TxKey, withdrawalTx.Hash()) }