Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
feat(proposer): remove --tierFee.max flag (#702)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha authored Apr 9, 2024
1 parent 985f030 commit 553c432
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 23 deletions.
7 changes: 0 additions & 7 deletions cmd/flags/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ var (
Category: proposerCategory,
Value: 3,
}
MaxTierFee = &cli.Uint64Flag{
Name: "tierFee.max",
Usage: "Fee max limit for all tier types. 0 means unlimited",
Value: 0,
Category: proposerCategory,
}
// Proposing epoch related.
ProposeInterval = &cli.DurationFlag{
Name: "epoch.interval",
Expand Down Expand Up @@ -160,5 +154,4 @@ var ProposerFlags = MergeFlags(CommonFlags, []cli.Flag{
ProposerAssignmentHookAddress,
BlobAllowed,
L1BlockBuilderTip,
MaxTierFee,
}, TxmgrFlags)
2 changes: 0 additions & 2 deletions proposer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ type Config struct {
BlobAllowed bool
TxmgrConfigs *txmgr.CLIConfig
L1BlockBuilderTip *big.Int
MaxTierFee *big.Int
}

// NewConfigFromCliContext initializes a Config instance from
Expand Down Expand Up @@ -121,6 +120,5 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) {
l1ProposerPrivKey,
c,
),
MaxTierFee: new(big.Int).SetUint64(c.Uint64(flags.MaxTierFee.Name)),
}, nil
}
1 change: 0 additions & 1 deletion proposer/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ func (p *Proposer) InitFromConfig(ctx context.Context, cfg *Config) (err error)
cfg.MaxTierFeePriceBumps,
proverAssignmentTimeout,
requestProverServerTimeout,
cfg.MaxTierFee,
); err != nil {
return err
}
Expand Down
15 changes: 4 additions & 11 deletions proposer/prover_selector/eth_fee_eoa_selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ type ETHFeeEOASelector struct {
maxTierFeePriceBumpIterations uint64
proposalExpiry time.Duration
requestTimeout time.Duration
MaxTierFee *big.Int
}

// NewETHFeeEOASelector creates a new ETHFeeEOASelector instance.
Expand All @@ -57,7 +56,6 @@ func NewETHFeeEOASelector(
maxTierFeePriceBumpIterations uint64,
proposalExpiry time.Duration,
requestTimeout time.Duration,
MaxTierFee *big.Int,
) (*ETHFeeEOASelector, error) {
if len(proverEndpoints) == 0 {
return nil, errEmptyProverEndpoints
Expand All @@ -81,7 +79,6 @@ func NewETHFeeEOASelector(
maxTierFeePriceBumpIterations,
proposalExpiry,
requestTimeout,
MaxTierFee,
}, nil
}

Expand All @@ -101,7 +98,7 @@ func (s *ETHFeeEOASelector) AssignProver(
maxProverFee = common.Big0
)

// Deep copy
// Deep copy the tierFees slice.
for i, fee := range tierFees {
fees[i] = encoding.TierFee{Tier: fee.Tier, Fee: fee.Fee}
}
Expand All @@ -110,23 +107,19 @@ func (s *ETHFeeEOASelector) AssignProver(
// If it is denied, we continue on to the next endpoint.
// If we do not find a prover, we can increase the fee up to a point, or give up.
for i := 0; i < int(s.maxTierFeePriceBumpIterations); i++ {
// Bump tier fee on each failed loop
// Bump tier fee on each failed loop.
cumulativeBumpPercent := new(big.Int).Mul(s.tierFeePriceBump, new(big.Int).SetUint64(uint64(i)))
for idx := range fees {
if i > 0 {
fee := new(big.Int).Mul(fees[idx].Fee, cumulativeBumpPercent)
tempFee := fees[idx].Fee.Add(fees[idx].Fee, fee.Div(fee, big100))
if s.MaxTierFee.Cmp(common.Big0) > 0 && tempFee.Cmp(s.MaxTierFee) > 0 {
fees[idx].Fee = s.MaxTierFee
} else {
fees[idx].Fee = tempFee
}
fees[idx].Fee = fees[idx].Fee.Add(fees[idx].Fee, fee.Div(fee, big100))
}
if fees[idx].Fee.Cmp(maxProverFee) > 0 {
maxProverFee = fees[idx].Fee
}
}

// Try to assign a prover from all given endpoints.
for _, endpoint := range s.shuffleProverEndpoints() {
encodedAssignment, proverAddress, err := assignProver(
ctx,
Expand Down
1 change: 0 additions & 1 deletion proposer/prover_selector/eth_fee_eoa_selector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func (s *ProverSelectorTestSuite) SetupTest() {
32,
1*time.Minute,
1*time.Minute,
common.Big32,
)
s.Nil(err)
}
Expand Down
1 change: 0 additions & 1 deletion proposer/transaction_builder/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ func (s *TransactionBuilderTestSuite) SetupTest() {
32,
1*time.Minute,
1*time.Minute,
common.Big0,
)
s.Nil(err)
s.calldataTxBuilder = NewCalldataTransactionBuilder(
Expand Down

0 comments on commit 553c432

Please sign in to comment.