Skip to content

Commit

Permalink
Fix batch_submitter for integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
boyuan-chen committed May 17, 2024
1 parent 581d950 commit db9e90e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 17 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
name: "Pull Request Labeler"
on:
- pull_request_target
# ---
# name: "Pull Request Labeler"
# on:
# - pull_request_target

jobs:
pr-labeler:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@main
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: .github/labeler.yml
# jobs:
# pr-labeler:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/labeler@main
# with:
# repo-token: "${{ secrets.GITHUB_TOKEN }}"
# configuration-path: .github/labeler.yml
4 changes: 2 additions & 2 deletions go/batch-submitter/drivers/proposer/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func (d *Driver) CraftBatchTx(
// so in the event their API is unreachable we can fallback to a degraded
// mode of operation. This also applies to our test environments, as hardhat
// doesn't support the query either.
case drivers.IsMaxPriorityFeePerGasNotFoundError(err):
case drivers.IsMaxPriorityFeePerGasNotFoundError(err) || drivers.IsMaxPriorityFeePerGasNotSupportedError(err):
log.Warn(d.cfg.Name + " eth_maxPriorityFeePerGas is unsupported " +
"by current backend, using fallback gasTipCap")
opts.GasTipCap = drivers.FallbackGasTipCap
Expand Down Expand Up @@ -265,7 +265,7 @@ func (d *Driver) SubmitBatchTx(
// so in the event their API is unreachable we can fallback to a degraded
// mode of operation. This also applies to our test environments, as hardhat
// doesn't support the query either.
case drivers.IsMaxPriorityFeePerGasNotFoundError(err):
case drivers.IsMaxPriorityFeePerGasNotFoundError(err) || drivers.IsMaxPriorityFeePerGasNotSupportedError(err):
log.Warn(d.cfg.Name + " eth_maxPriorityFeePerGas is unsupported " +
"by current backend, using fallback gasTipCap")
opts.GasTipCap = drivers.FallbackGasTipCap
Expand Down
4 changes: 2 additions & 2 deletions go/batch-submitter/drivers/sequencer/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ func (d *Driver) CraftBatchTx(
// method, so in the event their API is unreachable we can fallback to a
// degraded mode of operation. This also applies to our test
// environments, as hardhat doesn't support the query either.
case drivers.IsMaxPriorityFeePerGasNotFoundError(err):
case drivers.IsMaxPriorityFeePerGasNotFoundError(err) || drivers.IsMaxPriorityFeePerGasNotSupportedError(err):
log.Warn(d.cfg.Name + " eth_maxPriorityFeePerGas is unsupported " +
"by current backend, using fallback gasTipCap")
opts.GasTipCap = drivers.FallbackGasTipCap
Expand Down Expand Up @@ -295,7 +295,7 @@ func (d *Driver) SubmitBatchTx(
// so in the event their API is unreachable we can fallback to a degraded
// mode of operation. This also applies to our test environments, as hardhat
// doesn't support the query either.
case drivers.IsMaxPriorityFeePerGasNotFoundError(err):
case drivers.IsMaxPriorityFeePerGasNotFoundError(err) || drivers.IsMaxPriorityFeePerGasNotSupportedError(err):
log.Warn(d.cfg.Name + " eth_maxPriorityFeePerGas is unsupported " +
"by current backend, using fallback gasTipCap")
opts.GasTipCap = drivers.FallbackGasTipCap
Expand Down
2 changes: 1 addition & 1 deletion go/bss-core/drivers/clear_pending_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func SignClearingTx(

gasTipCap, err := l1Client.SuggestGasTipCap(ctx)
if err != nil {
if !IsMaxPriorityFeePerGasNotFoundError(err) {
if !IsMaxPriorityFeePerGasNotFoundError(err) && !IsMaxPriorityFeePerGasNotSupportedError(err) {
return nil, err
}

Expand Down
13 changes: 13 additions & 0 deletions go/bss-core/drivers/max_priority_fee_fallback.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ var (
"Method eth_maxPriorityFeePerGas not found",
)

errMaxPriorityFeePerGasNotSupported = errors.New(
"Method eth_maxPriorityFeePerGas is not supported",
)

// FallbackGasTipCap is the default fallback gasTipCap used when we are
// unable to query an L1 backend for a suggested gasTipCap.
FallbackGasTipCap = big.NewInt(1500000000)
Expand All @@ -24,3 +28,12 @@ func IsMaxPriorityFeePerGasNotFoundError(err error) bool {
err.Error(), errMaxPriorityFeePerGasNotFound.Error(),
)
}

// IsMaxPriorityFeePerGasNotSupportedError returns true if the provided error
// signals that the backend does not support the eth_maxPrirorityFeePerGas
// method. In this case, the caller should fallback to using the constant above.
func IsMaxPriorityFeePerGasNotSupportedError(err error) bool {
return strings.Contains(
err.Error(), errMaxPriorityFeePerGasNotSupported.Error(),
)
}

0 comments on commit db9e90e

Please sign in to comment.