Sitelet https://github.com/Fantom-foundation/go-opera/commit/1bdeaef5aaf32e033e0a573f214ce4fb99449157
Skip to content

Commit 1bdeaef

Browse files
committed
replace general median gas price algorithm with Lachesis-specific estimation
1 parent aefa97d commit 1bdeaef

14 files changed

Lines changed: 363 additions & 210 deletions

File tree

‎cmd/opera/launcher/config.go‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"bytes"
66
"errors"
77
"fmt"
8+
"math/big"
89
"os"
910
"path"
1011
"path/filepath"
@@ -234,11 +235,8 @@ func setDataDir(ctx *cli.Context, cfg *node.Config) {
234235
}
235236

236237
func setGPO(ctx *cli.Context, cfg *gasprice.Config) {
237-
if ctx.GlobalIsSet(utils.GpoBlocksFlag.Name) {
238-
cfg.Blocks = ctx.GlobalInt(utils.GpoBlocksFlag.Name)
239-
}
240-
if ctx.GlobalIsSet(utils.GpoPercentileFlag.Name) {
241-
cfg.Percentile = ctx.GlobalInt(utils.GpoPercentileFlag.Name)
238+
if ctx.GlobalIsSet(utils.GpoMaxGasPriceFlag.Name) {
239+
cfg.MaxPrice = big.NewInt(ctx.GlobalInt64(utils.GpoMaxGasPriceFlag.Name))
242240
}
243241
}
244242

‎cmd/opera/launcher/launcher.go‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ func initFlags() {
6363

6464
// Flags that configure the node.
6565
gpoFlags = []cli.Flag{
66-
utils.GpoBlocksFlag,
67-
utils.GpoPercentileFlag,
6866
utils.GpoMaxGasPriceFlag,
6967
}
7068
accountFlags = []cli.Flag{

‎gossip/config.go‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,11 @@ func DefaultConfig(scale cachescale.Func) Config {
163163
},
164164

165165
GPO: gasprice.Config{
166-
Blocks: 20,
167-
Percentile: 60,
168-
MaxPrice: gasprice.DefaultMaxPrice,
169-
MinPrice: new(big.Int),
166+
MaxPrice: gasprice.DefaultMaxPrice,
167+
MinPrice: new(big.Int),
168+
MaxPriceMultiplierRatio: big.NewInt(20 * gasprice.DecimalUnit),
169+
MiddlePriceMultiplierRatio: big.NewInt(4 * gasprice.DecimalUnit),
170+
GasPowerWallRatio: big.NewInt(0.05 * gasprice.DecimalUnit),
170171
},
171172

172173
VersionWatcher: verwatcher.Config{

‎gossip/emitter/control.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"github.com/Fantom-foundation/lachesis-base/inter/idx"
88
"github.com/Fantom-foundation/lachesis-base/inter/pos"
99

10-
"github.com/Fantom-foundation/go-opera/gossip/emitter/piecefunc"
1110
"github.com/Fantom-foundation/go-opera/inter"
11+
"github.com/Fantom-foundation/go-opera/utils/piecefunc"
1212
)
1313

1414
func scalarUpdMetric(diff idx.Event, weight pos.Weight, totalWeight pos.Weight) ancestor.Metric {

‎gossip/emitter/emitter.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ import (
1919

2020
"github.com/Fantom-foundation/go-opera/evmcore"
2121
"github.com/Fantom-foundation/go-opera/gossip/emitter/originatedtxs"
22-
"github.com/Fantom-foundation/go-opera/gossip/emitter/piecefunc"
2322
"github.com/Fantom-foundation/go-opera/inter"
2423
"github.com/Fantom-foundation/go-opera/logger"
2524
"github.com/Fantom-foundation/go-opera/tracing"
25+
"github.com/Fantom-foundation/go-opera/utils/piecefunc"
2626
"github.com/Fantom-foundation/go-opera/utils/rate"
2727
)
2828

‎gossip/emitter/piecefuncs.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/Fantom-foundation/lachesis-base/emitter/ancestor"
77
"github.com/Fantom-foundation/lachesis-base/inter/idx"
88

9-
"github.com/Fantom-foundation/go-opera/gossip/emitter/piecefunc"
9+
"github.com/Fantom-foundation/go-opera/utils/piecefunc"
1010
)
1111

1212
var (

‎gossip/emitter/validators.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/Fantom-foundation/lachesis-base/inter/idx"
77
"github.com/Fantom-foundation/lachesis-base/inter/pos"
88

9-
"github.com/Fantom-foundation/go-opera/gossip/emitter/piecefunc"
9+
"github.com/Fantom-foundation/go-opera/utils/piecefunc"
1010
)
1111

1212
const (

‎gossip/ethapi_backend.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ func (b *EthAPIBackend) Progress() ethapi.PeerProgress {
413413
}
414414

415415
func (b *EthAPIBackend) SuggestPrice(ctx context.Context) (*big.Int, error) {
416-
return b.gpo.SuggestPrice(ctx)
416+
return b.gpo.SuggestPrice(), nil
417417
}
418418

419419
func (b *EthAPIBackend) ChainDb() ethdb.Database {

0 commit comments

Comments
 (0)