Skip to content

Commit

Permalink
fix(relayer): Relayer paid gas (#14748)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey authored and KorbinianK committed Sep 28, 2023
1 parent 57e877c commit 22bcf53
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/relayer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}

- name: Login to GCR
uses: docker/login-action@v2
Expand Down
9 changes: 8 additions & 1 deletion packages/relayer/processor/estimate_gas.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@ package processor

import (
"context"
"log/slog"
"math/big"

"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/pkg/errors"
"github.com/taikoxyz/taiko-mono/packages/relayer/bindings/bridge"
)

var (
gasPaddingAmt uint64 = 80000
)

func (p *Processor) estimateGas(
ctx context.Context, message bridge.IBridgeMessage, proof []byte) (uint64, *big.Int, error) {
auth, err := bind.NewKeyedTransactorWithChainID(p.ecdsaKey, message.DestChainId)
Expand All @@ -26,5 +31,7 @@ func (p *Processor) estimateGas(
return 0, nil, errors.Wrap(err, "p.destBridge.ProcessMessage")
}

return tx.Gas(), tx.Cost(), nil
slog.Info("estimated gas", "gas", tx.Gas(), "paddingAmt", gasPaddingAmt)

return tx.Gas() + gasPaddingAmt, tx.Cost(), nil
}
2 changes: 2 additions & 0 deletions packages/relayer/processor/process_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ func (p *Processor) sendProcessMessageCall(
if err != nil {
return nil, errors.Wrap(err, "p.hardcodeGasLimit")
}
} else {
auth.GasLimit = gas
}
}

Expand Down

0 comments on commit 22bcf53

Please sign in to comment.