Skip to content

Commit

Permalink
feat(relayer): fix cost calculation for isProfitable (#14767)
Browse files Browse the repository at this point in the history
Co-authored-by: Jeffery Walsh <[email protected]>
  • Loading branch information
2 people authored and KorbinianK committed Sep 28, 2023
1 parent e1f9736 commit ebc8ffa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
8 changes: 8 additions & 0 deletions packages/relayer/cmd/flags/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ var (
Value: 1,
EnvVars: []string{"QUEUE_PREFETCH_COUNT"},
}
EnableTaikoL2 = &cli.BoolFlag{
Name: "enableTaikoL2",
Usage: "Whether to instantiate a taikoL2 contract based off the config.DestTaikoAddress",
Value: false,
Category: processorCategory,
EnvVars: []string{"ENABLE_TAIKO_L2"},
}
)

var ProcessorFlags = MergeFlags(CommonFlags, []cli.Flag{
Expand All @@ -115,4 +122,5 @@ var ProcessorFlags = MergeFlags(CommonFlags, []cli.Flag{
BackOffRetryInterval,
BackOffMaxRetrys,
QueuePrefetchCount,
EnableTaikoL2,
})
5 changes: 3 additions & 2 deletions packages/relayer/processor/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ var (
headerSyncInterval = "30"
confirmations = "10"
confirmationTimeout = "30"
profitableOnly = "true"
backoffRetryInterval = "20"
backOffMaxRetrys = "10"
databaseMaxIdleConns = "10"
Expand Down Expand Up @@ -69,6 +68,7 @@ func TestNewConfigFromCliContext(t *testing.T) {
assert.Equal(t, uint64(10), c.ETHClientTimeout)
assert.Equal(t, true, c.ProfitableOnly)
assert.Equal(t, uint64(100), c.QueuePrefetch)
assert.Equal(t, true, c.EnableTaikoL2)

c.OpenDBFunc = func() (DB, error) {
return &mock.DB{}, nil
Expand Down Expand Up @@ -112,7 +112,8 @@ func TestNewConfigFromCliContext(t *testing.T) {
"-" + flags.DatabaseConnMaxLifetime.Name, databaseMaxConnLifetime,
"-" + flags.ETHClientTimeout.Name, ethClientTimeout,
"-" + flags.QueuePrefetchCount.Name, "100",
"-" + flags.ProfitableOnly.Name, profitableOnly,
"--" + flags.ProfitableOnly.Name,
"--" + flags.EnableTaikoL2.Name,
}))
}

Expand Down
2 changes: 1 addition & 1 deletion packages/relayer/processor/estimate_gas.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ func (p *Processor) estimateGas(

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

return tx.Gas() + gasPaddingAmt, tx.Cost(), nil
return tx.Gas() + gasPaddingAmt, nil
}

0 comments on commit ebc8ffa

Please sign in to comment.