Skip to content

Commit 8436bf4

Browse files
authored
refactor!: use Celestia node fees estimation system (#2822)
## Summary Remove GasPrice and GasMultiplier from DA interface to use celestia-node's fee estimation. Closes #2235 ## Changes - Remove `GasPrice()` and `GasMultiplier()` methods from DA interface - Remove gas configuration fields from DA config and CLI flags
1 parent 3a9c9ba commit 8436bf4

39 files changed

+117
-337
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515

1616
### Changed
1717

18+
- Remove GasPrice and GasMultiplier from DA interface and configuration to use celestia-node's native fee estimation. ([#2822](https://github.com/evstack/ev-node/pull/2822))
1819
- Use cache instead of in memory store for reaper. Persist cache on reload. Autoclean after 24 hours. ([#2811](https://github.com/evstack/ev-node/pull/2811))
1920

2021
### Removed

apps/evm/single/cmd/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ var RunCmd = &cobra.Command{
5353

5454
logger.Info().Str("headerNamespace", headerNamespace.HexString()).Str("dataNamespace", dataNamespace.HexString()).Msg("namespaces")
5555

56-
daJrpc, err := jsonrpc.NewClient(context.Background(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, nodeConfig.DA.GasPrice, nodeConfig.DA.GasMultiplier, rollcmd.DefaultMaxBlobSize)
56+
daJrpc, err := jsonrpc.NewClient(context.Background(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, rollcmd.DefaultMaxBlobSize)
5757
if err != nil {
5858
return err
5959
}

apps/evm/single/go.mod

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,7 @@ require (
192192
gopkg.in/yaml.v3 v3.0.1 // indirect
193193
lukechampine.com/blake3 v1.4.1 // indirect
194194
)
195+
196+
replace github.com/evstack/ev-node/core => ../../../core
197+
198+
replace github.com/evstack/ev-node/da => ../../../da

apps/evm/single/go.sum

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,6 @@ github.com/ethereum/go-ethereum v1.16.5 h1:GZI995PZkzP7ySCxEFaOPzS8+bd8NldE//1qv
103103
github.com/ethereum/go-ethereum v1.16.5/go.mod h1:kId9vOtlYg3PZk9VwKbGlQmSACB5ESPTBGT+M9zjmok=
104104
github.com/ethereum/go-verkle v0.2.2 h1:I2W0WjnrFUIzzVPwm8ykY+7pL2d4VhlsePn4j7cnFk8=
105105
github.com/ethereum/go-verkle v0.2.2/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk=
106-
github.com/evstack/ev-node/core v1.0.0-beta.4 h1:F/rqHCrZ+ViUY4I6RuoBVvkhYfosD68yo/6gCdGRdmo=
107-
github.com/evstack/ev-node/core v1.0.0-beta.4/go.mod h1:n2w/LhYQTPsi48m6lMj16YiIqsaQw6gxwjyJvR+B3sY=
108-
github.com/evstack/ev-node/da v1.0.0-beta.5 h1:rWs/H0Nkj9uwTqD7Tzu+PpaNHGFE71B1ZVKCFLx0yVI=
109-
github.com/evstack/ev-node/da v1.0.0-beta.5/go.mod h1:lJ7vGlczBwiqTaTE9C4zV9tEsQO+oi0sqyUyYzj3zpo=
110106
github.com/evstack/ev-node/execution/evm v1.0.0-beta.3 h1:xo0mZz3CJtntP1RPLFDBubBKpNkqStImt9H9N0xysj8=
111107
github.com/evstack/ev-node/execution/evm v1.0.0-beta.3/go.mod h1:yazCKZaVczYwizfHYSQ4KIYqW0d42M7q7e9AxuSXV3s=
112108
github.com/evstack/ev-node/sequencers/single v1.0.0-beta.3 h1:BT/UeH7Tf8z0btzomCzTbbDDZGAT8/yHcd6xY6P/aaw=

apps/grpc/single/cmd/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ The execution client must implement the Evolve execution gRPC interface.`,
5252
logger.Info().Str("headerNamespace", headerNamespace.HexString()).Str("dataNamespace", dataNamespace.HexString()).Msg("namespaces")
5353

5454
// Create DA client
55-
daJrpc, err := jsonrpc.NewClient(cmd.Context(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, nodeConfig.DA.GasPrice, nodeConfig.DA.GasMultiplier, rollcmd.DefaultMaxBlobSize)
55+
daJrpc, err := jsonrpc.NewClient(cmd.Context(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, rollcmd.DefaultMaxBlobSize)
5656
if err != nil {
5757
return err
5858
}

apps/grpc/single/go.mod

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,7 @@ replace (
170170
github.com/evstack/ev-node => ../../../
171171
github.com/evstack/ev-node/execution/grpc => ../../../execution/grpc
172172
)
173+
174+
replace github.com/evstack/ev-node/core => ../../../core
175+
176+
replace github.com/evstack/ev-node/da => ../../../da

apps/grpc/single/go.sum

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF
6060
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
6161
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
6262
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
63-
github.com/evstack/ev-node/core v1.0.0-beta.4 h1:F/rqHCrZ+ViUY4I6RuoBVvkhYfosD68yo/6gCdGRdmo=
64-
github.com/evstack/ev-node/core v1.0.0-beta.4/go.mod h1:n2w/LhYQTPsi48m6lMj16YiIqsaQw6gxwjyJvR+B3sY=
65-
github.com/evstack/ev-node/da v1.0.0-beta.5 h1:rWs/H0Nkj9uwTqD7Tzu+PpaNHGFE71B1ZVKCFLx0yVI=
66-
github.com/evstack/ev-node/da v1.0.0-beta.5/go.mod h1:lJ7vGlczBwiqTaTE9C4zV9tEsQO+oi0sqyUyYzj3zpo=
6763
github.com/evstack/ev-node/sequencers/single v1.0.0-beta.3 h1:BT/UeH7Tf8z0btzomCzTbbDDZGAT8/yHcd6xY6P/aaw=
6864
github.com/evstack/ev-node/sequencers/single v1.0.0-beta.3/go.mod h1:eCkDecdJ3s7TB3R5nFdPDyz7jjRmwYen6lGe9D2sSH4=
6965
github.com/filecoin-project/go-clock v0.1.0 h1:SFbYIM75M8NnFm1yMHhN9Ahy3W5bEZV9gd6MPfXbKVU=

apps/testapp/cmd/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ var RunCmd = &cobra.Command{
5151

5252
logger.Info().Str("headerNamespace", headerNamespace.HexString()).Str("dataNamespace", dataNamespace.HexString()).Msg("namespaces")
5353

54-
daJrpc, err := jsonrpc.NewClient(ctx, logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, nodeConfig.DA.GasPrice, nodeConfig.DA.GasMultiplier, rollcmd.DefaultMaxBlobSize)
54+
daJrpc, err := jsonrpc.NewClient(ctx, logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, rollcmd.DefaultMaxBlobSize)
5555
if err != nil {
5656
return err
5757
}

block/components_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func TestNewSyncComponents_Creation(t *testing.T) {
9292
}
9393

9494
mockExec := testmocks.NewMockExecutor(t)
95-
dummyDA := coreda.NewDummyDA(10_000_000, 0, 0, 10*time.Millisecond)
95+
dummyDA := coreda.NewDummyDA(10_000_000, 10*time.Millisecond)
9696

9797
// Just test that the constructor doesn't panic - don't start the components
9898
// to avoid P2P store dependencies
@@ -143,7 +143,7 @@ func TestNewAggregatorComponents_Creation(t *testing.T) {
143143

144144
mockExec := testmocks.NewMockExecutor(t)
145145
mockSeq := testmocks.NewMockSequencer(t)
146-
dummyDA := coreda.NewDummyDA(10_000_000, 0, 0, 10*time.Millisecond)
146+
dummyDA := coreda.NewDummyDA(10_000_000, 10*time.Millisecond)
147147

148148
components, err := NewAggregatorComponents(
149149
cfg,
@@ -197,7 +197,7 @@ func TestExecutor_RealExecutionClientFailure_StopsNode(t *testing.T) {
197197
// Create mock executor that will fail on ExecuteTxs
198198
mockExec := testmocks.NewMockExecutor(t)
199199
mockSeq := testmocks.NewMockSequencer(t)
200-
dummyDA := coreda.NewDummyDA(10_000_000, 0, 0, 10*time.Millisecond)
200+
dummyDA := coreda.NewDummyDA(10_000_000, 10*time.Millisecond)
201201

202202
// Mock InitChain to succeed initially
203203
mockExec.On("InitChain", mock.Anything, mock.Anything, mock.Anything, mock.Anything).

block/internal/submitting/da_retry_test.go

Lines changed: 12 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -9,104 +9,53 @@ import (
99

1010
func TestRetryStateNext_Table(t *testing.T) {
1111
pol := retryPolicy{
12-
MaxAttempts: 10,
13-
MinBackoff: 100 * time.Millisecond,
14-
MaxBackoff: 1 * time.Second,
15-
MinGasPrice: 0.0,
16-
MaxGasPrice: 10.0,
17-
MaxBlobBytes: 2 * 1024 * 1024,
18-
MaxGasMultiplier: 3.0,
12+
MaxAttempts: 10,
13+
MinBackoff: 100 * time.Millisecond,
14+
MaxBackoff: 1 * time.Second,
15+
MaxBlobBytes: 2 * 1024 * 1024,
1916
}
2017

2118
tests := map[string]struct {
22-
startGas float64
23-
startBackoff time.Duration
24-
reason retryReason
25-
gasMult float64
26-
sentinelNoGas bool
27-
wantGas float64
28-
wantBackoff time.Duration
19+
startBackoff time.Duration
20+
reason retryReason
21+
wantBackoff time.Duration
2922
}{
30-
"success reduces gas and resets backoff": {
31-
startGas: 9.0,
23+
"success resets backoff": {
3224
startBackoff: 500 * time.Millisecond,
3325
reason: reasonSuccess,
34-
gasMult: 3.0,
35-
wantGas: 3.0, // 9 / 3
3626
wantBackoff: pol.MinBackoff,
3727
},
38-
"success clamps very small gasMult to 1/Max, possibly increasing gas": {
39-
startGas: 3.0,
40-
startBackoff: 250 * time.Millisecond,
41-
reason: reasonSuccess,
42-
gasMult: 0.01, // clamped to 1/MaxGasMultiplier = 1/3
43-
wantGas: 9.0, // 3 / (1/3)
44-
wantBackoff: pol.MinBackoff,
45-
},
46-
"mempool increases gas and sets max backoff": {
47-
startGas: 2.0,
48-
startBackoff: 0,
49-
reason: reasonMempool,
50-
gasMult: 2.0,
51-
wantGas: 4.0, // 2 * 2
52-
wantBackoff: pol.MaxBackoff,
53-
},
54-
"mempool clamps gas to max": {
55-
startGas: 9.5,
28+
"mempool sets max backoff": {
5629
startBackoff: 0,
5730
reason: reasonMempool,
58-
gasMult: 3.0,
59-
wantGas: 10.0, // 9.5 * 3 = 28.5 -> clamp 10
6031
wantBackoff: pol.MaxBackoff,
6132
},
6233
"failure sets initial backoff": {
63-
startGas: 1.0,
6434
startBackoff: 0,
6535
reason: reasonFailure,
66-
gasMult: 2.0,
67-
wantGas: 1.0, // unchanged
6836
wantBackoff: pol.MinBackoff,
6937
},
7038
"failure doubles backoff capped at max": {
71-
startGas: 1.0,
7239
startBackoff: 700 * time.Millisecond,
7340
reason: reasonFailure,
74-
gasMult: 2.0,
75-
wantGas: 1.0, // unchanged
7641
wantBackoff: 1 * time.Second, // 700ms*2=1400ms -> clamp 1s
7742
},
7843
"tooBig doubles backoff like failure": {
79-
startGas: 1.0,
8044
startBackoff: 100 * time.Millisecond,
8145
reason: reasonTooBig,
82-
gasMult: 2.0,
83-
wantGas: 1.0,
8446
wantBackoff: 200 * time.Millisecond,
8547
},
86-
"sentinel no gas keeps gas unchanged on success": {
87-
startGas: 5.0,
88-
startBackoff: 0,
89-
reason: reasonSuccess,
90-
gasMult: 2.0,
91-
sentinelNoGas: true,
92-
wantGas: 5.0,
93-
wantBackoff: pol.MinBackoff,
94-
},
95-
"undefined reason keeps gas unchanged and uses min backoff": {
96-
startGas: 3.0,
48+
"undefined reason uses zero backoff": {
9749
startBackoff: 500 * time.Millisecond,
9850
reason: reasonUndefined,
99-
gasMult: 2.0,
100-
wantGas: 3.0,
10151
wantBackoff: 0,
10252
},
10353
}
10454
for name, tc := range tests {
10555
t.Run(name, func(t *testing.T) {
106-
rs := retryState{Attempt: 0, Backoff: tc.startBackoff, GasPrice: tc.startGas}
107-
rs.Next(tc.reason, pol, tc.gasMult, tc.sentinelNoGas)
56+
rs := retryState{Attempt: 0, Backoff: tc.startBackoff}
57+
rs.Next(tc.reason, pol)
10858

109-
assert.Equal(t, tc.wantGas, rs.GasPrice, "gas price")
11059
assert.Equal(t, tc.wantBackoff, rs.Backoff, "backoff")
11160
assert.Equal(t, 1, rs.Attempt, "attempt")
11261
})

0 commit comments

Comments
 (0)