diff --git a/CHANGELOG.md b/CHANGELOG.md index ed0090fca9..30b04aea76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- 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)) - 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)) ### Removed diff --git a/apps/evm/single/cmd/run.go b/apps/evm/single/cmd/run.go index 80ea927822..500107af66 100644 --- a/apps/evm/single/cmd/run.go +++ b/apps/evm/single/cmd/run.go @@ -53,7 +53,7 @@ var RunCmd = &cobra.Command{ logger.Info().Str("headerNamespace", headerNamespace.HexString()).Str("dataNamespace", dataNamespace.HexString()).Msg("namespaces") - daJrpc, err := jsonrpc.NewClient(context.Background(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, nodeConfig.DA.GasPrice, nodeConfig.DA.GasMultiplier, rollcmd.DefaultMaxBlobSize) + daJrpc, err := jsonrpc.NewClient(context.Background(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, rollcmd.DefaultMaxBlobSize) if err != nil { return err } diff --git a/apps/evm/single/go.mod b/apps/evm/single/go.mod index f1351da31c..3c925f8ce6 100644 --- a/apps/evm/single/go.mod +++ b/apps/evm/single/go.mod @@ -192,3 +192,7 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.4.1 // indirect ) + +replace github.com/evstack/ev-node/core => ../../../core + +replace github.com/evstack/ev-node/da => ../../../da diff --git a/apps/evm/single/go.sum b/apps/evm/single/go.sum index c26f06a35f..343cc98756 100644 --- a/apps/evm/single/go.sum +++ b/apps/evm/single/go.sum @@ -103,10 +103,6 @@ github.com/ethereum/go-ethereum v1.16.5 h1:GZI995PZkzP7ySCxEFaOPzS8+bd8NldE//1qv github.com/ethereum/go-ethereum v1.16.5/go.mod h1:kId9vOtlYg3PZk9VwKbGlQmSACB5ESPTBGT+M9zjmok= github.com/ethereum/go-verkle v0.2.2 h1:I2W0WjnrFUIzzVPwm8ykY+7pL2d4VhlsePn4j7cnFk8= github.com/ethereum/go-verkle v0.2.2/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk= -github.com/evstack/ev-node/core v1.0.0-beta.4 h1:F/rqHCrZ+ViUY4I6RuoBVvkhYfosD68yo/6gCdGRdmo= -github.com/evstack/ev-node/core v1.0.0-beta.4/go.mod h1:n2w/LhYQTPsi48m6lMj16YiIqsaQw6gxwjyJvR+B3sY= -github.com/evstack/ev-node/da v1.0.0-beta.5 h1:rWs/H0Nkj9uwTqD7Tzu+PpaNHGFE71B1ZVKCFLx0yVI= -github.com/evstack/ev-node/da v1.0.0-beta.5/go.mod h1:lJ7vGlczBwiqTaTE9C4zV9tEsQO+oi0sqyUyYzj3zpo= github.com/evstack/ev-node/execution/evm v1.0.0-beta.3 h1:xo0mZz3CJtntP1RPLFDBubBKpNkqStImt9H9N0xysj8= github.com/evstack/ev-node/execution/evm v1.0.0-beta.3/go.mod h1:yazCKZaVczYwizfHYSQ4KIYqW0d42M7q7e9AxuSXV3s= github.com/evstack/ev-node/sequencers/single v1.0.0-beta.3 h1:BT/UeH7Tf8z0btzomCzTbbDDZGAT8/yHcd6xY6P/aaw= diff --git a/apps/grpc/single/cmd/run.go b/apps/grpc/single/cmd/run.go index b99e3b2fcd..cef7e092e0 100644 --- a/apps/grpc/single/cmd/run.go +++ b/apps/grpc/single/cmd/run.go @@ -52,7 +52,7 @@ The execution client must implement the Evolve execution gRPC interface.`, logger.Info().Str("headerNamespace", headerNamespace.HexString()).Str("dataNamespace", dataNamespace.HexString()).Msg("namespaces") // Create DA client - daJrpc, err := jsonrpc.NewClient(cmd.Context(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, nodeConfig.DA.GasPrice, nodeConfig.DA.GasMultiplier, rollcmd.DefaultMaxBlobSize) + daJrpc, err := jsonrpc.NewClient(cmd.Context(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, rollcmd.DefaultMaxBlobSize) if err != nil { return err } diff --git a/apps/grpc/single/go.mod b/apps/grpc/single/go.mod index a18e523349..2125e41226 100644 --- a/apps/grpc/single/go.mod +++ b/apps/grpc/single/go.mod @@ -170,3 +170,7 @@ replace ( github.com/evstack/ev-node => ../../../ github.com/evstack/ev-node/execution/grpc => ../../../execution/grpc ) + +replace github.com/evstack/ev-node/core => ../../../core + +replace github.com/evstack/ev-node/da => ../../../da diff --git a/apps/grpc/single/go.sum b/apps/grpc/single/go.sum index 128a4f8242..b65311f06b 100644 --- a/apps/grpc/single/go.sum +++ b/apps/grpc/single/go.sum @@ -60,10 +60,6 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/evstack/ev-node/core v1.0.0-beta.4 h1:F/rqHCrZ+ViUY4I6RuoBVvkhYfosD68yo/6gCdGRdmo= -github.com/evstack/ev-node/core v1.0.0-beta.4/go.mod h1:n2w/LhYQTPsi48m6lMj16YiIqsaQw6gxwjyJvR+B3sY= -github.com/evstack/ev-node/da v1.0.0-beta.5 h1:rWs/H0Nkj9uwTqD7Tzu+PpaNHGFE71B1ZVKCFLx0yVI= -github.com/evstack/ev-node/da v1.0.0-beta.5/go.mod h1:lJ7vGlczBwiqTaTE9C4zV9tEsQO+oi0sqyUyYzj3zpo= github.com/evstack/ev-node/sequencers/single v1.0.0-beta.3 h1:BT/UeH7Tf8z0btzomCzTbbDDZGAT8/yHcd6xY6P/aaw= github.com/evstack/ev-node/sequencers/single v1.0.0-beta.3/go.mod h1:eCkDecdJ3s7TB3R5nFdPDyz7jjRmwYen6lGe9D2sSH4= github.com/filecoin-project/go-clock v0.1.0 h1:SFbYIM75M8NnFm1yMHhN9Ahy3W5bEZV9gd6MPfXbKVU= diff --git a/apps/testapp/cmd/run.go b/apps/testapp/cmd/run.go index 061b8075ca..c72d220cdd 100644 --- a/apps/testapp/cmd/run.go +++ b/apps/testapp/cmd/run.go @@ -51,7 +51,7 @@ var RunCmd = &cobra.Command{ logger.Info().Str("headerNamespace", headerNamespace.HexString()).Str("dataNamespace", dataNamespace.HexString()).Msg("namespaces") - daJrpc, err := jsonrpc.NewClient(ctx, logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, nodeConfig.DA.GasPrice, nodeConfig.DA.GasMultiplier, rollcmd.DefaultMaxBlobSize) + daJrpc, err := jsonrpc.NewClient(ctx, logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, rollcmd.DefaultMaxBlobSize) if err != nil { return err } diff --git a/block/components_test.go b/block/components_test.go index 60a1df6a22..eadf45328c 100644 --- a/block/components_test.go +++ b/block/components_test.go @@ -92,7 +92,7 @@ func TestNewSyncComponents_Creation(t *testing.T) { } mockExec := testmocks.NewMockExecutor(t) - dummyDA := coreda.NewDummyDA(10_000_000, 0, 0, 10*time.Millisecond) + dummyDA := coreda.NewDummyDA(10_000_000, 10*time.Millisecond) // Just test that the constructor doesn't panic - don't start the components // to avoid P2P store dependencies @@ -143,7 +143,7 @@ func TestNewAggregatorComponents_Creation(t *testing.T) { mockExec := testmocks.NewMockExecutor(t) mockSeq := testmocks.NewMockSequencer(t) - dummyDA := coreda.NewDummyDA(10_000_000, 0, 0, 10*time.Millisecond) + dummyDA := coreda.NewDummyDA(10_000_000, 10*time.Millisecond) components, err := NewAggregatorComponents( cfg, @@ -197,7 +197,7 @@ func TestExecutor_RealExecutionClientFailure_StopsNode(t *testing.T) { // Create mock executor that will fail on ExecuteTxs mockExec := testmocks.NewMockExecutor(t) mockSeq := testmocks.NewMockSequencer(t) - dummyDA := coreda.NewDummyDA(10_000_000, 0, 0, 10*time.Millisecond) + dummyDA := coreda.NewDummyDA(10_000_000, 10*time.Millisecond) // Mock InitChain to succeed initially mockExec.On("InitChain", mock.Anything, mock.Anything, mock.Anything, mock.Anything). diff --git a/block/internal/submitting/da_retry_test.go b/block/internal/submitting/da_retry_test.go index 0f521552dd..88aa477647 100644 --- a/block/internal/submitting/da_retry_test.go +++ b/block/internal/submitting/da_retry_test.go @@ -9,104 +9,53 @@ import ( func TestRetryStateNext_Table(t *testing.T) { pol := retryPolicy{ - MaxAttempts: 10, - MinBackoff: 100 * time.Millisecond, - MaxBackoff: 1 * time.Second, - MinGasPrice: 0.0, - MaxGasPrice: 10.0, - MaxBlobBytes: 2 * 1024 * 1024, - MaxGasMultiplier: 3.0, + MaxAttempts: 10, + MinBackoff: 100 * time.Millisecond, + MaxBackoff: 1 * time.Second, + MaxBlobBytes: 2 * 1024 * 1024, } tests := map[string]struct { - startGas float64 - startBackoff time.Duration - reason retryReason - gasMult float64 - sentinelNoGas bool - wantGas float64 - wantBackoff time.Duration + startBackoff time.Duration + reason retryReason + wantBackoff time.Duration }{ - "success reduces gas and resets backoff": { - startGas: 9.0, + "success resets backoff": { startBackoff: 500 * time.Millisecond, reason: reasonSuccess, - gasMult: 3.0, - wantGas: 3.0, // 9 / 3 wantBackoff: pol.MinBackoff, }, - "success clamps very small gasMult to 1/Max, possibly increasing gas": { - startGas: 3.0, - startBackoff: 250 * time.Millisecond, - reason: reasonSuccess, - gasMult: 0.01, // clamped to 1/MaxGasMultiplier = 1/3 - wantGas: 9.0, // 3 / (1/3) - wantBackoff: pol.MinBackoff, - }, - "mempool increases gas and sets max backoff": { - startGas: 2.0, - startBackoff: 0, - reason: reasonMempool, - gasMult: 2.0, - wantGas: 4.0, // 2 * 2 - wantBackoff: pol.MaxBackoff, - }, - "mempool clamps gas to max": { - startGas: 9.5, + "mempool sets max backoff": { startBackoff: 0, reason: reasonMempool, - gasMult: 3.0, - wantGas: 10.0, // 9.5 * 3 = 28.5 -> clamp 10 wantBackoff: pol.MaxBackoff, }, "failure sets initial backoff": { - startGas: 1.0, startBackoff: 0, reason: reasonFailure, - gasMult: 2.0, - wantGas: 1.0, // unchanged wantBackoff: pol.MinBackoff, }, "failure doubles backoff capped at max": { - startGas: 1.0, startBackoff: 700 * time.Millisecond, reason: reasonFailure, - gasMult: 2.0, - wantGas: 1.0, // unchanged wantBackoff: 1 * time.Second, // 700ms*2=1400ms -> clamp 1s }, "tooBig doubles backoff like failure": { - startGas: 1.0, startBackoff: 100 * time.Millisecond, reason: reasonTooBig, - gasMult: 2.0, - wantGas: 1.0, wantBackoff: 200 * time.Millisecond, }, - "sentinel no gas keeps gas unchanged on success": { - startGas: 5.0, - startBackoff: 0, - reason: reasonSuccess, - gasMult: 2.0, - sentinelNoGas: true, - wantGas: 5.0, - wantBackoff: pol.MinBackoff, - }, - "undefined reason keeps gas unchanged and uses min backoff": { - startGas: 3.0, + "undefined reason uses zero backoff": { startBackoff: 500 * time.Millisecond, reason: reasonUndefined, - gasMult: 2.0, - wantGas: 3.0, wantBackoff: 0, }, } for name, tc := range tests { t.Run(name, func(t *testing.T) { - rs := retryState{Attempt: 0, Backoff: tc.startBackoff, GasPrice: tc.startGas} - rs.Next(tc.reason, pol, tc.gasMult, tc.sentinelNoGas) + rs := retryState{Attempt: 0, Backoff: tc.startBackoff} + rs.Next(tc.reason, pol) - assert.Equal(t, tc.wantGas, rs.GasPrice, "gas price") assert.Equal(t, tc.wantBackoff, rs.Backoff, "backoff") assert.Equal(t, 1, rs.Attempt, "attempt") }) diff --git a/block/internal/submitting/da_submitter.go b/block/internal/submitting/da_submitter.go index 2186e7fc34..5a8fabc167 100644 --- a/block/internal/submitting/da_submitter.go +++ b/block/internal/submitting/da_submitter.go @@ -22,43 +22,31 @@ import ( ) const ( - submissionTimeout = 60 * time.Second - noGasPrice = -1 - initialBackoff = 100 * time.Millisecond - defaultGasPrice = 0.0 - defaultGasMultiplier = 1.0 - defaultMaxGasPriceClamp = 1000.0 - defaultMaxGasMultiplierClamp = 3.0 // must always > 0 to avoid division by zero + submissionTimeout = 60 * time.Second + initialBackoff = 100 * time.Millisecond ) -// retryPolicy defines clamped bounds for retries, backoff, and gas pricing. +// retryPolicy defines clamped bounds for retries and backoff. type retryPolicy struct { - MaxAttempts int - MinBackoff time.Duration - MaxBackoff time.Duration - MinGasPrice float64 - MaxGasPrice float64 - MaxBlobBytes int - MaxGasMultiplier float64 + MaxAttempts int + MinBackoff time.Duration + MaxBackoff time.Duration + MaxBlobBytes int } func defaultRetryPolicy(maxAttempts int, maxDuration time.Duration) retryPolicy { return retryPolicy{ - MaxAttempts: maxAttempts, - MinBackoff: initialBackoff, - MaxBackoff: maxDuration, - MinGasPrice: defaultGasPrice, - MaxGasPrice: defaultMaxGasPriceClamp, - MaxBlobBytes: common.DefaultMaxBlobSize, - MaxGasMultiplier: defaultMaxGasMultiplierClamp, + MaxAttempts: maxAttempts, + MinBackoff: initialBackoff, + MaxBackoff: maxDuration, + MaxBlobBytes: common.DefaultMaxBlobSize, } } -// retryState holds the current retry attempt, backoff, and gas price. +// retryState holds the current retry attempt and backoff. type retryState struct { - Attempt int - Backoff time.Duration - GasPrice float64 + Attempt int + Backoff time.Duration } type retryReason int @@ -71,21 +59,11 @@ const ( reasonTooBig ) -func (rs *retryState) Next(reason retryReason, pol retryPolicy, gasMultiplier float64, sentinelNoGas bool) { +func (rs *retryState) Next(reason retryReason, pol retryPolicy) { switch reason { case reasonSuccess: - // Reduce gas price towards initial on success, if multiplier is available - if !sentinelNoGas && gasMultiplier > 0 { - m := clamp(gasMultiplier, 1/pol.MaxGasMultiplier, pol.MaxGasMultiplier) - rs.GasPrice = clamp(rs.GasPrice/m, pol.MinGasPrice, pol.MaxGasPrice) - } rs.Backoff = pol.MinBackoff case reasonMempool: - if !sentinelNoGas && gasMultiplier > 0 { - m := clamp(gasMultiplier, 1/pol.MaxGasMultiplier, pol.MaxGasMultiplier) - rs.GasPrice = clamp(rs.GasPrice*m, pol.MinGasPrice, pol.MaxGasPrice) - } - // Honor mempool stalling by using max backoff window rs.Backoff = pol.MaxBackoff case reasonFailure, reasonTooBig: if rs.Backoff == 0 { @@ -100,8 +78,8 @@ func (rs *retryState) Next(reason retryReason, pol retryPolicy, gasMultiplier fl rs.Attempt++ } -// clamp constrains a value between min and max bounds for any comparable type -func clamp[T ~float64 | time.Duration](v, min, max T) T { +// clamp constrains a duration between min and max bounds +func clamp(v, min, max time.Duration) time.Duration { if min > max { min, max = max, min } @@ -190,34 +168,6 @@ func (s *DASubmitter) recordFailure(reason common.DASubmitterFailureReason) { } } -// getGasMultiplier fetches the gas multiplier from DA layer with fallback and clamping -func (s *DASubmitter) getGasMultiplier(ctx context.Context, pol retryPolicy) float64 { - gasMultiplier, err := s.da.GasMultiplier(ctx) - if err != nil || gasMultiplier <= 0 { - if s.config.DA.GasMultiplier > 0 { - return clamp(s.config.DA.GasMultiplier, 0.1, pol.MaxGasMultiplier) - } - s.logger.Warn().Err(err).Msg("failed to get gas multiplier from DA layer, using default 1.0") - return defaultGasMultiplier - } - return clamp(gasMultiplier, 0.1, pol.MaxGasMultiplier) -} - -// initialGasPrice determines the starting gas price with clamping and sentinel handling -func (s *DASubmitter) initialGasPrice(ctx context.Context, pol retryPolicy) (price float64, sentinelNoGas bool) { - if s.config.DA.GasPrice == noGasPrice { - return noGasPrice, true - } - if s.config.DA.GasPrice > 0 { - return clamp(s.config.DA.GasPrice, pol.MinGasPrice, pol.MaxGasPrice), false - } - if gp, err := s.da.GasPrice(ctx); err == nil { - return clamp(gp, pol.MinGasPrice, pol.MaxGasPrice), false - } - s.logger.Warn().Msg("DA gas price unavailable; using default 0.0") - return pol.MinGasPrice, false -} - // SubmitHeaders submits pending headers to DA layer func (s *DASubmitter) SubmitHeaders(ctx context.Context, cache cache.Manager) error { headers, err := cache.GetPendingHeaders(ctx) @@ -239,11 +189,10 @@ func (s *DASubmitter) SubmitHeaders(ctx context.Context, cache cache.Manager) er } return proto.Marshal(headerPb) }, - func(submitted []*types.SignedHeader, res *coreda.ResultSubmit, gasPrice float64) { + func(submitted []*types.SignedHeader, res *coreda.ResultSubmit) { for _, header := range submitted { cache.SetHeaderDAIncluded(header.Hash().String(), res.Height, header.Height()) } - // Update last submitted height if l := len(submitted); l > 0 { lastHeight := submitted[l-1].Height() cache.SetLastSubmittedHeaderHeight(ctx, lastHeight) @@ -283,7 +232,7 @@ func (s *DASubmitter) SubmitData(ctx context.Context, cache cache.Manager, signe func(signedData *types.SignedData) ([]byte, error) { return signedData.MarshalBinary() }, - func(submitted []*types.SignedData, res *coreda.ResultSubmit, gasPrice float64) { + func(submitted []*types.SignedData, res *coreda.ResultSubmit) { for _, sd := range submitted { cache.SetDataDAIncluded(sd.Data.DACommitment().String(), res.Height, sd.Height()) } @@ -399,7 +348,7 @@ func submitToDA[T any]( ctx context.Context, items []T, marshalFn func(T) ([]byte, error), - postSubmit func([]T, *coreda.ResultSubmit, float64), + postSubmit func([]T, *coreda.ResultSubmit), itemType string, namespace []byte, options []byte, @@ -410,13 +359,9 @@ func submitToDA[T any]( return err } - // Build retry policy from config with sane defaults pol := defaultRetryPolicy(s.config.DA.MaxSubmitAttempts, s.config.DA.BlockTime.Duration) - // Choose initial gas price with clamp - gasPrice, sentinelNoGas := s.initialGasPrice(ctx, pol) - rs := retryState{Attempt: 0, Backoff: 0, GasPrice: gasPrice} - gm := s.getGasMultiplier(ctx, pol) + rs := retryState{Attempt: 0, Backoff: 0} // Limit this submission to a single size-capped batch if len(marshaled) > 0 { @@ -466,21 +411,21 @@ func submitToDA[T any]( // Perform submission start := time.Now() - res := types.SubmitWithHelpers(submitCtx, s.da, s.logger, marshaled, rs.GasPrice, namespace, mergedOptions) + res := types.SubmitWithHelpers(submitCtx, s.da, s.logger, marshaled, -1, namespace, mergedOptions) s.logger.Debug().Int("attempts", rs.Attempt).Dur("elapsed", time.Since(start)).Uint64("code", uint64(res.Code)).Msg("got SubmitWithHelpers response from celestia") // Record submission result for observability if daVisualizationServer := server.GetDAVisualizationServer(); daVisualizationServer != nil { - daVisualizationServer.RecordSubmission(&res, rs.GasPrice, uint64(len(items))) + daVisualizationServer.RecordSubmission(&res, 0, uint64(len(items))) } switch res.Code { case coreda.StatusSuccess: submitted := items[:res.SubmittedCount] - postSubmit(submitted, &res, rs.GasPrice) - s.logger.Info().Str("itemType", itemType).Float64("gasPrice", rs.GasPrice).Uint64("count", res.SubmittedCount).Msg("successfully submitted items to DA layer") + postSubmit(submitted, &res) + s.logger.Info().Str("itemType", itemType).Uint64("count", res.SubmittedCount).Msg("successfully submitted items to DA layer") if int(res.SubmittedCount) == len(items) { - rs.Next(reasonSuccess, pol, gm, sentinelNoGas) + rs.Next(reasonSuccess, pol) // Update pending blobs metric to reflect total backlog if getTotalPendingFn != nil { s.metrics.DASubmitterPendingBlobs.Set(float64(getTotalPendingFn())) @@ -490,7 +435,7 @@ func submitToDA[T any]( // partial success: advance window items = items[res.SubmittedCount:] marshaled = marshaled[res.SubmittedCount:] - rs.Next(reasonSuccess, pol, gm, sentinelNoGas) + rs.Next(reasonSuccess, pol) // Update pending blobs count to reflect total backlog if getTotalPendingFn != nil { s.metrics.DASubmitterPendingBlobs.Set(float64(getTotalPendingFn())) @@ -514,7 +459,7 @@ func submitToDA[T any]( items = items[:half] marshaled = marshaled[:half] s.logger.Debug().Int("newBatchSize", half).Msg("batch too big; halving and retrying") - rs.Next(reasonTooBig, pol, gm, sentinelNoGas) + rs.Next(reasonTooBig, pol) // Update pending blobs count to reflect total backlog if getTotalPendingFn != nil { s.metrics.DASubmitterPendingBlobs.Set(float64(getTotalPendingFn())) @@ -523,14 +468,14 @@ func submitToDA[T any]( case coreda.StatusNotIncludedInBlock: // Record failure metric s.recordFailure(common.DASubmitterFailureReasonNotIncludedInBlock) - s.logger.Info().Dur("backoff", pol.MaxBackoff).Float64("gasPrice", rs.GasPrice).Msg("retrying due to mempool state") - rs.Next(reasonMempool, pol, gm, sentinelNoGas) + s.logger.Info().Dur("backoff", pol.MaxBackoff).Msg("retrying due to mempool state") + rs.Next(reasonMempool, pol) case coreda.StatusAlreadyInMempool: // Record failure metric s.recordFailure(common.DASubmitterFailureReasonAlreadyInMempool) - s.logger.Info().Dur("backoff", pol.MaxBackoff).Float64("gasPrice", rs.GasPrice).Msg("retrying due to mempool state") - rs.Next(reasonMempool, pol, gm, sentinelNoGas) + s.logger.Info().Dur("backoff", pol.MaxBackoff).Msg("retrying due to mempool state") + rs.Next(reasonMempool, pol) case coreda.StatusContextCanceled: // Record failure metric @@ -542,7 +487,7 @@ func submitToDA[T any]( // Record failure metric s.recordFailure(common.DASubmitterFailureReasonUnknown) s.logger.Error().Str("error", res.Message).Int("attempt", rs.Attempt+1).Msg("DA layer submission failed") - rs.Next(reasonFailure, pol, gm, sentinelNoGas) + rs.Next(reasonFailure, pol) } } diff --git a/block/internal/submitting/da_submitter_integration_test.go b/block/internal/submitting/da_submitter_integration_test.go index 11713d707b..421340e11d 100644 --- a/block/internal/submitting/da_submitter_integration_test.go +++ b/block/internal/submitting/da_submitter_integration_test.go @@ -83,7 +83,7 @@ func TestDASubmitter_SubmitHeadersAndData_MarksInclusionAndUpdatesLastSubmitted( require.NoError(t, batch2.Commit()) // Dummy DA - dummyDA := coreda.NewDummyDA(10_000_000, 0, 0, 10*time.Millisecond) + dummyDA := coreda.NewDummyDA(10_000_000, 10*time.Millisecond) // Create DA submitter daSubmitter := NewDASubmitter(dummyDA, cfg, gen, common.DefaultBlockOptions(), common.NopMetrics(), zerolog.Nop()) diff --git a/block/internal/submitting/da_submitter_mocks_test.go b/block/internal/submitting/da_submitter_mocks_test.go index 9ef14fba36..d914e6db61 100644 --- a/block/internal/submitting/da_submitter_mocks_test.go +++ b/block/internal/submitting/da_submitter_mocks_test.go @@ -38,18 +38,9 @@ func TestSubmitToDA_MempoolRetry_IncreasesGasAndSucceeds(t *testing.T) { t.Parallel() mockDA := mocks.NewMockDA(t) - // Initial gas price fetched from DA since cfg.DA.GasPrice==0 - mockDA.On("GasPrice", mock.Anything).Return(1.0, nil).Once() - // Gas multiplier available and used on mempool retry - mockDA.On("GasMultiplier", mock.Anything).Return(2.0, nil).Once() - - // First attempt returns a mempool-related error (mapped to StatusNotIncludedInBlock) - // Expect gasPrice=1.0 nsBz := coreda.NamespaceFromString("ns").Bytes() - opts := []byte("opts") - // capture gas prices used var usedGas []float64 mockDA. On("SubmitWithOptions", mock.Anything, mock.Anything, mock.AnythingOfType("float64"), nsBz, opts). @@ -59,7 +50,6 @@ func TestSubmitToDA_MempoolRetry_IncreasesGasAndSucceeds(t *testing.T) { Return(nil, coreda.ErrTxTimedOut). Once() - // Second attempt should use doubled gas price = 2.0 and succeed for all items ids := [][]byte{[]byte("id1"), []byte("id2"), []byte("id3")} mockDA. On("SubmitWithOptions", mock.Anything, mock.Anything, mock.AnythingOfType("float64"), nsBz, opts). @@ -69,10 +59,7 @@ func TestSubmitToDA_MempoolRetry_IncreasesGasAndSucceeds(t *testing.T) { Return(ids, nil). Once() - s := newTestSubmitter(mockDA, func(c *config.Config) { - // trigger initial gas price path from DA - c.DA.GasPrice = 0 - }) + s := newTestSubmitter(mockDA, nil) items := []string{"a", "b", "c"} ctx := context.Background() @@ -81,7 +68,7 @@ func TestSubmitToDA_MempoolRetry_IncreasesGasAndSucceeds(t *testing.T) { ctx, items, marshalString, - func(_ []string, _ *coreda.ResultSubmit, _ float64) {}, + func(_ []string, _ *coreda.ResultSubmit) {}, "item", nsBz, opts, @@ -89,8 +76,8 @@ func TestSubmitToDA_MempoolRetry_IncreasesGasAndSucceeds(t *testing.T) { ) assert.NoError(t, err) - // Expect two attempts with gas 1.0 then 2.0 - assert.Equal(t, []float64{1.0, 2.0}, usedGas) + // Sentinel value is preserved on retry + assert.Equal(t, []float64{-1, -1}, usedGas) mockDA.AssertExpectations(t) } @@ -98,8 +85,6 @@ func TestSubmitToDA_UnknownError_RetriesSameGasThenSucceeds(t *testing.T) { t.Parallel() mockDA := mocks.NewMockDA(t) - // Initial gas price comes from config (set below), so DA.GasPrice is not called - mockDA.On("GasMultiplier", mock.Anything).Return(3.0, nil).Once() nsBz := coreda.NamespaceFromString("ns").Bytes() @@ -121,9 +106,7 @@ func TestSubmitToDA_UnknownError_RetriesSameGasThenSucceeds(t *testing.T) { Return(ids, nil). Once() - s := newTestSubmitter(mockDA, func(c *config.Config) { - c.DA.GasPrice = 5.5 // fixed gas from config - }) + s := newTestSubmitter(mockDA, nil) items := []string{"x"} ctx := context.Background() @@ -132,14 +115,14 @@ func TestSubmitToDA_UnknownError_RetriesSameGasThenSucceeds(t *testing.T) { ctx, items, marshalString, - func(_ []string, _ *coreda.ResultSubmit, _ float64) {}, + func(_ []string, _ *coreda.ResultSubmit) {}, "item", nsBz, opts, nil, ) assert.NoError(t, err) - assert.Equal(t, []float64{5.5, 5.5}, usedGas) + assert.Equal(t, []float64{-1, -1}, usedGas) mockDA.AssertExpectations(t) } @@ -147,8 +130,6 @@ func TestSubmitToDA_TooBig_HalvesBatch(t *testing.T) { t.Parallel() mockDA := mocks.NewMockDA(t) - // Use fixed gas from config to simplify - mockDA.On("GasMultiplier", mock.Anything).Return(2.0, nil).Once() nsBz := coreda.NamespaceFromString("ns").Bytes() @@ -177,9 +158,7 @@ func TestSubmitToDA_TooBig_HalvesBatch(t *testing.T) { Return(ids, nil). Once() - s := newTestSubmitter(mockDA, func(c *config.Config) { - c.DA.GasPrice = 1.0 - }) + s := newTestSubmitter(mockDA, nil) items := []string{"a", "b", "c", "d"} ctx := context.Background() @@ -188,7 +167,7 @@ func TestSubmitToDA_TooBig_HalvesBatch(t *testing.T) { ctx, items, marshalString, - func(_ []string, _ *coreda.ResultSubmit, _ float64) {}, + func(_ []string, _ *coreda.ResultSubmit) {}, "item", nsBz, opts, @@ -203,8 +182,6 @@ func TestSubmitToDA_SentinelNoGas_PreservesGasAcrossRetries(t *testing.T) { t.Parallel() mockDA := mocks.NewMockDA(t) - // GasMultiplier is still called once, but should not affect gas when sentinel is used - mockDA.On("GasMultiplier", mock.Anything).Return(10.0, nil).Once() nsBz := coreda.NamespaceFromString("ns").Bytes() @@ -226,9 +203,7 @@ func TestSubmitToDA_SentinelNoGas_PreservesGasAcrossRetries(t *testing.T) { Return(ids, nil). Once() - s := newTestSubmitter(mockDA, func(c *config.Config) { - c.DA.GasPrice = -1 // sentinel no-gas behavior - }) + s := newTestSubmitter(mockDA, nil) items := []string{"only"} ctx := context.Background() @@ -237,7 +212,7 @@ func TestSubmitToDA_SentinelNoGas_PreservesGasAcrossRetries(t *testing.T) { ctx, items, marshalString, - func(_ []string, _ *coreda.ResultSubmit, _ float64) {}, + func(_ []string, _ *coreda.ResultSubmit) {}, "item", nsBz, opts, @@ -252,7 +227,6 @@ func TestSubmitToDA_PartialSuccess_AdvancesWindow(t *testing.T) { t.Parallel() mockDA := mocks.NewMockDA(t) - mockDA.On("GasMultiplier", mock.Anything).Return(2.0, nil).Once() nsBz := coreda.NamespaceFromString("ns").Bytes() @@ -268,7 +242,7 @@ func TestSubmitToDA_PartialSuccess_AdvancesWindow(t *testing.T) { secondIDs := [][]byte{[]byte("id3")} mockDA.On("SubmitWithOptions", mock.Anything, mock.Anything, mock.Anything, nsBz, opts).Return(secondIDs, nil).Once() - s := newTestSubmitter(mockDA, func(c *config.Config) { c.DA.GasPrice = 1.0 }) + s := newTestSubmitter(mockDA, nil) items := []string{"a", "b", "c"} ctx := context.Background() @@ -277,7 +251,7 @@ func TestSubmitToDA_PartialSuccess_AdvancesWindow(t *testing.T) { ctx, items, marshalString, - func(submitted []string, _ *coreda.ResultSubmit, _ float64) { totalSubmitted += len(submitted) }, + func(submitted []string, _ *coreda.ResultSubmit) { totalSubmitted += len(submitted) }, "item", nsBz, opts, diff --git a/block/internal/submitting/da_submitter_test.go b/block/internal/submitting/da_submitter_test.go index 69af9ab1fa..c657d8185b 100644 --- a/block/internal/submitting/da_submitter_test.go +++ b/block/internal/submitting/da_submitter_test.go @@ -35,7 +35,7 @@ func setupDASubmitterTest(t *testing.T) (*DASubmitter, store.Store, cache.Manage require.NoError(t, err) // Create dummy DA - dummyDA := coreda.NewDummyDA(10_000_000, 0, 0, 10*time.Millisecond) + dummyDA := coreda.NewDummyDA(10_000_000, 10*time.Millisecond) // Create config cfg := config.DefaultConfig() @@ -93,7 +93,7 @@ func TestNewDASubmitterSetsVisualizerWhenEnabled(t *testing.T) { cfg.RPC.EnableDAVisualization = true cfg.Node.Aggregator = true - dummyDA := coreda.NewDummyDA(10_000_000, 0, 0, 10*time.Millisecond) + dummyDA := coreda.NewDummyDA(10_000_000, 10*time.Millisecond) NewDASubmitter( dummyDA, diff --git a/core/da/da.go b/core/da/da.go index b297fb23ef..4229f99879 100644 --- a/core/da/da.go +++ b/core/da/da.go @@ -35,12 +35,6 @@ type DA interface { // Validate validates Commitments against the corresponding Proofs. This should be possible without retrieving the Blobs. Validate(ctx context.Context, ids []ID, proofs []Proof, namespace []byte) ([]bool, error) - - // GasPrice returns the gas price for the DA layer. - GasPrice(ctx context.Context) (float64, error) - - // GasMultiplier returns the gas multiplier for the DA layer. - GasMultiplier(ctx context.Context) (float64, error) } // Blob is the data submitted/received from DA interface. diff --git a/core/da/dummy.go b/core/da/dummy.go index 0f9fd38244..a66622bd77 100644 --- a/core/da/dummy.go +++ b/core/da/dummy.go @@ -22,8 +22,6 @@ type DummyDA struct { timestampsByHeight map[uint64]time.Time namespaceByID map[string][]byte // Track namespace for each blob ID maxBlobSize uint64 - gasPrice float64 - gasMultiplier float64 // DA height simulation currentHeight uint64 @@ -37,7 +35,7 @@ type DummyDA struct { var ErrHeightFromFutureStr = fmt.Errorf("given height is from the future") // NewDummyDA creates a new instance of DummyDA with the specified maximum blob size and block time. -func NewDummyDA(maxBlobSize uint64, gasPrice float64, gasMultiplier float64, blockTime time.Duration) *DummyDA { +func NewDummyDA(maxBlobSize uint64, blockTime time.Duration) *DummyDA { return &DummyDA{ blobs: make(map[string]Blob), commitments: make(map[string]Commitment), @@ -46,8 +44,6 @@ func NewDummyDA(maxBlobSize uint64, gasPrice float64, gasMultiplier float64, blo timestampsByHeight: make(map[uint64]time.Time), namespaceByID: make(map[string][]byte), maxBlobSize: maxBlobSize, - gasPrice: gasPrice, - gasMultiplier: gasMultiplier, blockTime: blockTime, stopCh: make(chan struct{}), currentHeight: 0, @@ -77,16 +73,6 @@ func (d *DummyDA) StopHeightTicker() { close(d.stopCh) } -// GasPrice returns the gas price for the DA layer. -func (d *DummyDA) GasPrice(ctx context.Context) (float64, error) { - return d.gasPrice, nil -} - -// GasMultiplier returns the gas multiplier for the DA layer. -func (d *DummyDA) GasMultiplier(ctx context.Context) (float64, error) { - return d.gasMultiplier, nil -} - // Get returns blobs for the given IDs. func (d *DummyDA) Get(ctx context.Context, ids []ID, namespace []byte) ([]Blob, error) { d.mu.RLock() diff --git a/core/da/dummy_test.go b/core/da/dummy_test.go index fffcbd4929..9538aacc83 100644 --- a/core/da/dummy_test.go +++ b/core/da/dummy_test.go @@ -10,7 +10,7 @@ import ( func TestDummyDA(t *testing.T) { testDABlockTime := 100 * time.Millisecond // Create a new DummyDA instance with a max blob size of 1024 bytes - dummyDA := NewDummyDA(1024, 0, 0, testDABlockTime) + dummyDA := NewDummyDA(1024, testDABlockTime) dummyDA.StartHeightTicker() defer dummyDA.StopHeightTicker() // Height is always 0 diff --git a/da/cmd/local-da/local.go b/da/cmd/local-da/local.go index a06388e67e..4117419aa7 100644 --- a/da/cmd/local-da/local.go +++ b/da/cmd/local-da/local.go @@ -73,18 +73,6 @@ func (d *LocalDA) MaxBlobSize(ctx context.Context) (uint64, error) { return d.maxBlobSize, nil } -// GasMultiplier returns the gas multiplier. -func (d *LocalDA) GasMultiplier(ctx context.Context) (float64, error) { - d.logger.Debug().Msg("GasMultiplier called") - return 1.0, nil -} - -// GasPrice returns the gas price. -func (d *LocalDA) GasPrice(ctx context.Context) (float64, error) { - d.logger.Debug().Msg("GasPrice called") - return 0.0, nil -} - // Get returns Blobs for given IDs. func (d *LocalDA) Get(ctx context.Context, ids []coreda.ID, ns []byte) ([]coreda.Blob, error) { if err := validateNamespace(ns); err != nil { diff --git a/da/go.mod b/da/go.mod index 53dc3ae7c0..8303ea3820 100644 --- a/da/go.mod +++ b/da/go.mod @@ -30,3 +30,5 @@ require ( gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +replace github.com/evstack/ev-node/core => ../core diff --git a/da/go.sum b/da/go.sum index a01c95c892..2194a6b7c3 100644 --- a/da/go.sum +++ b/da/go.sum @@ -13,8 +13,6 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/evstack/ev-node/core v1.0.0-beta.4 h1:F/rqHCrZ+ViUY4I6RuoBVvkhYfosD68yo/6gCdGRdmo= -github.com/evstack/ev-node/core v1.0.0-beta.4/go.mod h1:n2w/LhYQTPsi48m6lMj16YiIqsaQw6gxwjyJvR+B3sY= github.com/filecoin-project/go-jsonrpc v0.9.0 h1:G47qEF52w7GholpI21vPSTVBFvsrip6geIoqNiqyZtQ= github.com/filecoin-project/go-jsonrpc v0.9.0/go.mod h1:OG7kVBVh/AbDFHIwx7Kw0l9ARmKOS6gGOr0LbdBpbLc= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= diff --git a/da/jsonrpc/client.go b/da/jsonrpc/client.go index a1286bc942..9803ebcd49 100644 --- a/da/jsonrpc/client.go +++ b/da/jsonrpc/client.go @@ -20,11 +20,9 @@ type Module interface { // API defines the jsonrpc service module API type API struct { - Logger zerolog.Logger - MaxBlobSize uint64 - gasPrice float64 - gasMultiplier float64 - Internal struct { + Logger zerolog.Logger + MaxBlobSize uint64 + Internal struct { Get func(ctx context.Context, ids []da.ID, ns []byte) ([]da.Blob, error) `perm:"read"` GetIDs func(ctx context.Context, height uint64, ns []byte) (*da.GetIDsResult, error) `perm:"read"` GetProofs func(ctx context.Context, ids []da.ID, ns []byte) ([]da.Proof, error) `perm:"read"` @@ -32,8 +30,6 @@ type API struct { Validate func(context.Context, []da.ID, []da.Proof, []byte) ([]bool, error) `perm:"read"` Submit func(context.Context, []da.Blob, float64, []byte) ([]da.ID, error) `perm:"write"` SubmitWithOptions func(context.Context, []da.Blob, float64, []byte, []byte) ([]da.ID, error) `perm:"write"` - GasMultiplier func(context.Context) (float64, error) `perm:"read"` - GasPrice func(context.Context) (float64, error) `perm:"read"` } } @@ -180,18 +176,6 @@ func (api *API) SubmitWithOptions(ctx context.Context, inputBlobs []da.Blob, gas return res, err } -func (api *API) GasMultiplier(ctx context.Context) (float64, error) { - api.Logger.Debug().Str("method", "GasMultiplier").Msg("Making RPC call") - - return api.gasMultiplier, nil -} - -func (api *API) GasPrice(ctx context.Context) (float64, error) { - api.Logger.Debug().Str("method", "GasPrice").Msg("Making RPC call") - - return api.gasPrice, nil -} - // Client is the jsonrpc client type Client struct { DA API @@ -222,18 +206,16 @@ func (c *Client) Close() { // NewClient creates a new Client with one connection per namespace with the // given token as the authorization token. -func NewClient(ctx context.Context, logger zerolog.Logger, addr, token string, gasPrice, gasMultiplier float64, maxBlobSize uint64) (*Client, error) { +func NewClient(ctx context.Context, logger zerolog.Logger, addr, token string, maxBlobSize uint64) (*Client, error) { authHeader := http.Header{"Authorization": []string{fmt.Sprintf("Bearer %s", token)}} - return newClient(ctx, logger, addr, authHeader, gasPrice, gasMultiplier, maxBlobSize) + return newClient(ctx, logger, addr, authHeader, maxBlobSize) } -func newClient(ctx context.Context, logger zerolog.Logger, addr string, authHeader http.Header, gasPrice, gasMultiplier float64, maxBlobSize uint64) (*Client, error) { +func newClient(ctx context.Context, logger zerolog.Logger, addr string, authHeader http.Header, maxBlobSize uint64) (*Client, error) { var multiCloser multiClientCloser var client Client client.DA.Logger = logger client.DA.MaxBlobSize = maxBlobSize - client.DA.gasPrice = gasPrice - client.DA.gasMultiplier = gasMultiplier errs := getKnownErrorsMapping() for name, module := range moduleMap(&client) { diff --git a/da/jsonrpc/proxy_test.go b/da/jsonrpc/proxy_test.go index e0086d3899..5bbce0d2b6 100644 --- a/da/jsonrpc/proxy_test.go +++ b/da/jsonrpc/proxy_test.go @@ -45,7 +45,7 @@ func getTestDABlockTime() time.Duration { } func TestProxy(t *testing.T) { - dummy := coreda.NewDummyDA(100_000, 0, 0, getTestDABlockTime()) + dummy := coreda.NewDummyDA(100_000, getTestDABlockTime()) dummy.StartHeightTicker() logger := zerolog.Nop() server := proxy.NewServer(logger, ServerHost, ServerPort, dummy) @@ -57,7 +57,7 @@ func TestProxy(t *testing.T) { } }() - client, err := proxy.NewClient(context.Background(), logger, ClientURL, "74657374", 0, 1, DefaultMaxBlobSize) + client, err := proxy.NewClient(context.Background(), logger, ClientURL, "74657374", DefaultMaxBlobSize) require.NoError(t, err) t.Run("Basic DA test", func(t *testing.T) { diff --git a/da/jsonrpc/server.go b/da/jsonrpc/server.go index 1e42c0176e..456eefe908 100644 --- a/da/jsonrpc/server.go +++ b/da/jsonrpc/server.go @@ -72,18 +72,6 @@ func (s *serverInternalAPI) SubmitWithOptions(ctx context.Context, blobs []da.Bl return s.daImpl.SubmitWithOptions(ctx, blobs, gasPrice, ns, options) } -// GasPrice implements the RPC method. -func (s *serverInternalAPI) GasPrice(ctx context.Context) (float64, error) { - s.logger.Debug().Msg("RPC server: GasPrice called") - return s.daImpl.GasPrice(ctx) -} - -// GasMultiplier implements the RPC method. -func (s *serverInternalAPI) GasMultiplier(ctx context.Context) (float64, error) { - s.logger.Debug().Msg("RPC server: GasMultiplier called") - return s.daImpl.GasMultiplier(ctx) -} - // NewServer accepts the host address port and the DA implementation to serve as a jsonrpc service func NewServer(logger zerolog.Logger, address, port string, daImplementation da.DA) *Server { rpc := jsonrpc.NewServer(jsonrpc.WithServerErrors(getKnownErrorsMapping())) diff --git a/go.mod b/go.mod index 440911fd28..5529903687 100644 --- a/go.mod +++ b/go.mod @@ -161,3 +161,5 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.4.1 // indirect ) + +replace github.com/evstack/ev-node/core => ./core diff --git a/go.sum b/go.sum index 9f6f5f2b25..5b1debef77 100644 --- a/go.sum +++ b/go.sum @@ -62,8 +62,6 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/evstack/ev-node/core v1.0.0-beta.4 h1:F/rqHCrZ+ViUY4I6RuoBVvkhYfosD68yo/6gCdGRdmo= -github.com/evstack/ev-node/core v1.0.0-beta.4/go.mod h1:n2w/LhYQTPsi48m6lMj16YiIqsaQw6gxwjyJvR+B3sY= github.com/filecoin-project/go-clock v0.1.0 h1:SFbYIM75M8NnFm1yMHhN9Ahy3W5bEZV9gd6MPfXbKVU= github.com/filecoin-project/go-clock v0.1.0/go.mod h1:4uB/O4PvOjlx1VCMdZ9MyDZXRm//gkj1ELEbxfI1AZs= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= diff --git a/node/helpers_test.go b/node/helpers_test.go index 06d789060f..e77744a4ec 100644 --- a/node/helpers_test.go +++ b/node/helpers_test.go @@ -46,7 +46,7 @@ const ( func createTestComponents(t *testing.T, config evconfig.Config) (coreexecutor.Executor, coresequencer.Sequencer, coreda.DA, *p2p.Client, datastore.Batching, *key.NodeKey, func()) { executor := coreexecutor.NewDummyExecutor() sequencer := coresequencer.NewDummySequencer() - dummyDA := coreda.NewDummyDA(100_000, 0, 0, config.DA.BlockTime.Duration) + dummyDA := coreda.NewDummyDA(100_000, config.DA.BlockTime.Duration) dummyDA.StartHeightTicker() stopDAHeightTicker := func() { diff --git a/pkg/cmd/run_node_test.go b/pkg/cmd/run_node_test.go index 0a8a89900e..2980f94741 100644 --- a/pkg/cmd/run_node_test.go +++ b/pkg/cmd/run_node_test.go @@ -29,7 +29,7 @@ const MockDANamespace = "test" func createTestComponents(_ context.Context, t *testing.T) (coreexecutor.Executor, coresequencer.Sequencer, coreda.DA, signer.Signer, *p2p.Client, datastore.Batching, func()) { executor := coreexecutor.NewDummyExecutor() sequencer := coresequencer.NewDummySequencer() - dummyDA := coreda.NewDummyDA(100_000, 0, 0, 10*time.Second) + dummyDA := coreda.NewDummyDA(100_000, 10*time.Second) dummyDA.StartHeightTicker() stopDAHeightTicker := func() { dummyDA.StopHeightTicker() @@ -63,8 +63,6 @@ func TestParseFlags(t *testing.T) { "--rollkit.da.address", "http://127.0.0.1:27005", "--rollkit.da.auth_token", "token", "--rollkit.da.block_time", "20s", - "--rollkit.da.gas_multiplier", "1.5", - "--rollkit.da.gas_price", "1.5", "--rollkit.da.mempool_ttl", "10", "--rollkit.da.namespace", "namespace", "--rollkit.node.lazy_mode", @@ -121,8 +119,6 @@ func TestParseFlags(t *testing.T) { {"DAAddress", nodeConfig.DA.Address, "http://127.0.0.1:27005"}, {"DAAuthToken", nodeConfig.DA.AuthToken, "token"}, {"DABlockTime", nodeConfig.DA.BlockTime.Duration, 20 * time.Second}, - {"DAGasMultiplier", nodeConfig.DA.GasMultiplier, 1.5}, - {"DAGasPrice", nodeConfig.DA.GasPrice, 1.5}, {"DAMempoolTTL", nodeConfig.DA.MempoolTTL, uint64(10)}, {"DANamespace", nodeConfig.DA.Namespace, "namespace"}, {"LazyAggregator", nodeConfig.Node.LazyMode, true}, diff --git a/pkg/config/config.go b/pkg/config/config.go index 8e7f8cce26..aad4ce6b93 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -60,10 +60,6 @@ const ( FlagDAAuthToken = FlagPrefixEvnode + "da.auth_token" // #nosec G101 // FlagDABlockTime is a flag for specifying the data availability layer block time FlagDABlockTime = FlagPrefixEvnode + "da.block_time" - // FlagDAGasPrice is a flag for specifying the data availability layer gas price - FlagDAGasPrice = FlagPrefixEvnode + "da.gas_price" - // FlagDAGasMultiplier is a flag for specifying the data availability layer gas price retry multiplier - FlagDAGasMultiplier = FlagPrefixEvnode + "da.gas_multiplier" // FlagDANamespace is a flag for specifying the DA namespace ID FlagDANamespace = FlagPrefixEvnode + "da.namespace" // FlagDADataNamespace is a flag for specifying the DA data namespace ID @@ -161,8 +157,6 @@ type Config struct { type DAConfig struct { Address string `mapstructure:"address" yaml:"address" comment:"Address of the data availability layer service (host:port). This is the endpoint where Rollkit will connect to submit and retrieve data."` AuthToken string `mapstructure:"auth_token" yaml:"auth_token" comment:"Authentication token for the data availability layer service. Required if the DA service needs authentication."` - GasPrice float64 `mapstructure:"gas_price" yaml:"gas_price" comment:"Gas price for data availability transactions. Use -1 for automatic gas price determination. Higher values may result in faster inclusion."` - GasMultiplier float64 `mapstructure:"gas_multiplier" yaml:"gas_multiplier" comment:"Multiplier applied to gas price when retrying failed DA submissions. Values > 1 increase gas price on retries to improve chances of inclusion."` SubmitOptions string `mapstructure:"submit_options" yaml:"submit_options" comment:"Additional options passed to the DA layer when submitting data. Format depends on the specific DA implementation being used."` SigningAddresses []string `mapstructure:"signing_addresses" yaml:"signing_addresses" comment:"List of addresses to use for DA submissions. When multiple addresses are provided, they will be used in round-robin fashion to prevent sequence mismatches. Useful for high-throughput chains."` Namespace string `mapstructure:"namespace" yaml:"namespace" comment:"Namespace ID used when submitting blobs to the DA layer. When a DataNamespace is provided, only the header is sent to this namespace."` @@ -326,8 +320,6 @@ func AddFlags(cmd *cobra.Command) { cmd.Flags().String(FlagDAAddress, def.DA.Address, "DA address (host:port)") cmd.Flags().String(FlagDAAuthToken, def.DA.AuthToken, "DA auth token") cmd.Flags().Duration(FlagDABlockTime, def.DA.BlockTime.Duration, "DA chain block time (for syncing)") - cmd.Flags().Float64(FlagDAGasPrice, def.DA.GasPrice, "DA gas price for blob transactions") - cmd.Flags().Float64(FlagDAGasMultiplier, def.DA.GasMultiplier, "DA gas price multiplier for retrying blob transactions") cmd.Flags().String(FlagDANamespace, def.DA.Namespace, "DA namespace for header (or blob) submissions") cmd.Flags().String(FlagDADataNamespace, def.DA.DataNamespace, "DA namespace for data submissions") cmd.Flags().String(FlagDASubmitOptions, def.DA.SubmitOptions, "DA submit options") diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index c9284076b7..206d6040bd 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -24,8 +24,6 @@ func TestDefaultConfig(t *testing.T) { assert.Equal(t, false, def.Node.Light) assert.Equal(t, DefaultConfig().DA.Address, def.DA.Address) assert.Equal(t, "", def.DA.AuthToken) - assert.Equal(t, float64(-1), def.DA.GasPrice) - assert.Equal(t, float64(0), def.DA.GasMultiplier) assert.Equal(t, "", def.DA.SubmitOptions) assert.NotEmpty(t, def.DA.Namespace) assert.Equal(t, 1*time.Second, def.Node.BlockTime.Duration) @@ -69,8 +67,6 @@ func TestAddFlags(t *testing.T) { assertFlagValue(t, flags, FlagDAAddress, DefaultConfig().DA.Address) assertFlagValue(t, flags, FlagDAAuthToken, DefaultConfig().DA.AuthToken) assertFlagValue(t, flags, FlagDABlockTime, DefaultConfig().DA.BlockTime.Duration) - assertFlagValue(t, flags, FlagDAGasPrice, DefaultConfig().DA.GasPrice) - assertFlagValue(t, flags, FlagDAGasMultiplier, DefaultConfig().DA.GasMultiplier) assertFlagValue(t, flags, FlagDANamespace, DefaultConfig().DA.Namespace) assertFlagValue(t, flags, FlagDASubmitOptions, DefaultConfig().DA.SubmitOptions) assertFlagValue(t, flags, FlagDASigningAddresses, DefaultConfig().DA.SigningAddresses) @@ -105,7 +101,7 @@ func TestAddFlags(t *testing.T) { assertFlagValue(t, flags, FlagRPCAddress, DefaultConfig().RPC.Address) // Count the number of flags we're explicitly checking - expectedFlagCount := 40 // Update this number if you add more flag checks above + expectedFlagCount := 38 // Update this number if you add more flag checks above // Get the actual number of flags (both regular and persistent) actualFlagCount := 0 @@ -237,7 +233,6 @@ signer: // Set some flags through the command line cmd.SetArgs([]string{ "--home=" + tempDir, - "--rollkit.da.gas_price=0.5", "--rollkit.node.lazy_mode=true", }) err = cmd.Execute() @@ -250,7 +245,6 @@ signer: // Now create a Viper instance with the same flags v := viper.New() v.Set(FlagRootDir, tempDir) - v.Set("rollkit.da.gas_price", "0.5") v.Set("rollkit.node.lazy_mode", true) // Load configuration using the new LoadFromViper method @@ -259,7 +253,6 @@ signer: // Compare the results - they should be identical require.Equal(t, cfgFromLoad.RootDir, cfgFromViper.RootDir, "RootDir should match") - require.Equal(t, cfgFromLoad.DA.GasPrice, cfgFromViper.DA.GasPrice, "DA.GasPrice should match") require.Equal(t, cfgFromLoad.Node.LazyMode, cfgFromViper.Node.LazyMode, "Node.LazyMode should match") require.Equal(t, cfgFromLoad.Node.Aggregator, cfgFromViper.Node.Aggregator, "Node.Aggregator should match") require.Equal(t, cfgFromLoad.Node.BlockTime, cfgFromViper.Node.BlockTime, "Node.BlockTime should match") diff --git a/pkg/config/defaults.go b/pkg/config/defaults.go index 0e20e2a874..3410547531 100644 --- a/pkg/config/defaults.go +++ b/pkg/config/defaults.go @@ -73,8 +73,6 @@ func DefaultConfig() Config { DA: DAConfig{ Address: "http://localhost:7980", BlockTime: DurationWrapper{6 * time.Second}, - GasPrice: -1, - GasMultiplier: 0, MaxSubmitAttempts: 30, Namespace: randString(10), DataNamespace: "", diff --git a/pkg/rpc/server/da_visualization_test.go b/pkg/rpc/server/da_visualization_test.go index 2b7d3d7f86..80b9a1408c 100644 --- a/pkg/rpc/server/da_visualization_test.go +++ b/pkg/rpc/server/da_visualization_test.go @@ -46,13 +46,13 @@ func TestRecordSubmission(t *testing.T) { }, } - server.RecordSubmission(result, 0.5, 2) + server.RecordSubmission(result, -1, 2) assert.Equal(t, 1, len(server.submissions)) submission := server.submissions[0] assert.Equal(t, uint64(100), submission.Height) assert.Equal(t, uint64(1024), submission.BlobSize) - assert.Equal(t, 0.5, submission.GasPrice) + assert.Equal(t, float64(-1), submission.GasPrice) assert.Equal(t, "Success", submission.StatusCode) assert.Equal(t, uint64(2), submission.NumBlobs) assert.Equal(t, 2, len(submission.BlobIDs)) diff --git a/sequencers/single/go.mod b/sequencers/single/go.mod index 8735545298..036a55f033 100644 --- a/sequencers/single/go.mod +++ b/sequencers/single/go.mod @@ -155,3 +155,7 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.4.1 // indirect ) + +replace github.com/evstack/ev-node/core => ../../core + +replace github.com/evstack/ev-node/da => ../../da diff --git a/sequencers/single/go.sum b/sequencers/single/go.sum index 5262ff27e1..1616ccdc63 100644 --- a/sequencers/single/go.sum +++ b/sequencers/single/go.sum @@ -56,8 +56,6 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evstack/ev-node v1.0.0-beta.9 h1:9hRfT+EECIxrimhshjfAhER7x8wItFuytznC5jqRHrI= github.com/evstack/ev-node v1.0.0-beta.9/go.mod h1:+gJ1h9OF6r1rM557emHq7OrMxSI+73gNtKbzMFPK9zU= -github.com/evstack/ev-node/core v1.0.0-beta.4 h1:F/rqHCrZ+ViUY4I6RuoBVvkhYfosD68yo/6gCdGRdmo= -github.com/evstack/ev-node/core v1.0.0-beta.4/go.mod h1:n2w/LhYQTPsi48m6lMj16YiIqsaQw6gxwjyJvR+B3sY= github.com/filecoin-project/go-clock v0.1.0 h1:SFbYIM75M8NnFm1yMHhN9Ahy3W5bEZV9gd6MPfXbKVU= github.com/filecoin-project/go-clock v0.1.0/go.mod h1:4uB/O4PvOjlx1VCMdZ9MyDZXRm//gkj1ELEbxfI1AZs= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= diff --git a/sequencers/single/sequencer_test.go b/sequencers/single/sequencer_test.go index 585339bcd2..3904a62f73 100644 --- a/sequencers/single/sequencer_test.go +++ b/sequencers/single/sequencer_test.go @@ -20,7 +20,7 @@ import ( func TestNewSequencer(t *testing.T) { // Create a new sequencer with mock DA client - dummyDA := coreda.NewDummyDA(100_000_000, 0, 0, 10*time.Second) + dummyDA := coreda.NewDummyDA(100_000_000, 10*time.Second) metrics, _ := NopMetrics() db := ds.NewMapDatastore() ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) @@ -53,7 +53,7 @@ func TestNewSequencer(t *testing.T) { func TestSequencer_SubmitBatchTxs(t *testing.T) { // Initialize a new sequencer metrics, _ := NopMetrics() - dummyDA := coreda.NewDummyDA(100_000_000, 0, 0, 10*time.Second) + dummyDA := coreda.NewDummyDA(100_000_000, 10*time.Second) db := ds.NewMapDatastore() ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) defer cancel() @@ -106,7 +106,7 @@ func TestSequencer_SubmitBatchTxs(t *testing.T) { func TestSequencer_SubmitBatchTxs_EmptyBatch(t *testing.T) { // Initialize a new sequencer metrics, _ := NopMetrics() - dummyDA := coreda.NewDummyDA(100_000_000, 0, 0, 10*time.Second) + dummyDA := coreda.NewDummyDA(100_000_000, 10*time.Second) db := ds.NewMapDatastore() ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) defer cancel() @@ -397,8 +397,6 @@ func TestSequencer_GetNextBatch_BeforeDASubmission(t *testing.T) { }() // Set up mock expectations - mockDA.On("GasPrice", mock.Anything).Return(float64(0), nil) - mockDA.On("GasMultiplier", mock.Anything).Return(float64(0), nil) mockDA.On("Submit", mock.Anything, mock.Anything, mock.Anything, mock.Anything). Return(nil, errors.New("mock DA always rejects submissions")) @@ -636,7 +634,7 @@ func TestSequencer_DAFailureAndQueueThrottling_Integration(t *testing.T) { defer db.Close() // Create a dummy DA that we can make fail - dummyDA := coreda.NewDummyDA(100_000, 0, 0, 100*time.Millisecond) + dummyDA := coreda.NewDummyDA(100_000, 100*time.Millisecond) dummyDA.StartHeightTicker() defer dummyDA.StopHeightTicker() diff --git a/test/docker-e2e/docker_test.go b/test/docker-e2e/docker_test.go index 9d64f51484..7fc6145584 100644 --- a/test/docker-e2e/docker_test.go +++ b/test/docker-e2e/docker_test.go @@ -218,7 +218,6 @@ func (s *DockerTestSuite) StartEVNodeWithNamespace(ctx context.Context, bridgeNo daAddress := fmt.Sprintf("http://%s", bridgeRPCAddress) err = evNode.Start(ctx, "--evnode.da.address", daAddress, - "--evnode.da.gas_price", "0.025", "--evnode.da.auth_token", authToken, "--evnode.rpc.address", "0.0.0.0:7331", // bind to 0.0.0.0 so rpc is reachable from test host. "--evnode.da.namespace", headerNamespace, diff --git a/test/docker-e2e/upgrade_test.go b/test/docker-e2e/upgrade_test.go index 8abd44686e..b11a0fe9f7 100644 --- a/test/docker-e2e/upgrade_test.go +++ b/test/docker-e2e/upgrade_test.go @@ -177,7 +177,6 @@ func (s *EVMSingleUpgradeTestSuite) setupEVMSingle(ctx context.Context, image co WithDANamespace("evm-single-header"). WithAdditionalStartArgs( "--evnode.rpc.address", "0.0.0.0:7331", - "--evnode.da.gas_price", "0.025", "--evnode.da.data_namespace", "evm-single-data", ). Build() diff --git a/tools/da-debug/go.mod b/tools/da-debug/go.mod index e6821f15c9..e33b6fea35 100644 --- a/tools/da-debug/go.mod +++ b/tools/da-debug/go.mod @@ -14,7 +14,7 @@ require ( require ( github.com/celestiaorg/go-header v0.7.3 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect - github.com/filecoin-project/go-jsonrpc v0.8.0 // indirect + github.com/filecoin-project/go-jsonrpc v0.9.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect github.com/google/uuid v1.6.0 // indirect @@ -52,3 +52,7 @@ require ( golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect lukechampine.com/blake3 v1.4.1 // indirect ) + +replace github.com/evstack/ev-node/core => ../../core + +replace github.com/evstack/ev-node/da => ../../da diff --git a/tools/da-debug/go.sum b/tools/da-debug/go.sum index 0774497fea..257ecf743d 100644 --- a/tools/da-debug/go.sum +++ b/tools/da-debug/go.sum @@ -31,14 +31,10 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evstack/ev-node v1.0.0-beta.6 h1:jjGWAUsjHDpuBjvM7KXnY6Y8uYHM8LOrn0hDrk5zE6E= github.com/evstack/ev-node v1.0.0-beta.6/go.mod h1:ZABT4xTIg4bINUS08r8e8LFIUk5anWe799fZ320q+Mk= -github.com/evstack/ev-node/core v1.0.0-beta.4 h1:F/rqHCrZ+ViUY4I6RuoBVvkhYfosD68yo/6gCdGRdmo= -github.com/evstack/ev-node/core v1.0.0-beta.4/go.mod h1:n2w/LhYQTPsi48m6lMj16YiIqsaQw6gxwjyJvR+B3sY= -github.com/evstack/ev-node/da v1.0.0-beta.4 h1:6W+UsQrsEdBbAnyy8j+lYNo2VQvJUaoSNkToMFThtVU= -github.com/evstack/ev-node/da v1.0.0-beta.4/go.mod h1:O3Lbx4/WFN0DIUOHdTihmyRnGmQwVXdswH19RW/KyG4= github.com/filecoin-project/go-clock v0.1.0 h1:SFbYIM75M8NnFm1yMHhN9Ahy3W5bEZV9gd6MPfXbKVU= github.com/filecoin-project/go-clock v0.1.0/go.mod h1:4uB/O4PvOjlx1VCMdZ9MyDZXRm//gkj1ELEbxfI1AZs= -github.com/filecoin-project/go-jsonrpc v0.8.0 h1:2yqlN3Vd8Gx5UtA3fib7tQu2aW1cSOJt253LEBWExo4= -github.com/filecoin-project/go-jsonrpc v0.8.0/go.mod h1:p8WGOwQGYbFugSdK7qKIGhhb1VVcQ2rtBLdEiik1QWI= +github.com/filecoin-project/go-jsonrpc v0.9.0 h1:G47qEF52w7GholpI21vPSTVBFvsrip6geIoqNiqyZtQ= +github.com/filecoin-project/go-jsonrpc v0.9.0/go.mod h1:OG7kVBVh/AbDFHIwx7Kw0l9ARmKOS6gGOr0LbdBpbLc= github.com/flynn/noise v1.1.0 h1:KjPQoQCEFdZDiP03phOvGi11+SVVhBG2wOWAorLsstg= github.com/flynn/noise v1.1.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= diff --git a/tools/da-debug/main.go b/tools/da-debug/main.go index 47b7e05e3f..70c81edf64 100644 --- a/tools/da-debug/main.go +++ b/tools/da-debug/main.go @@ -20,14 +20,12 @@ import ( ) var ( - daURL string - authToken string - timeout time.Duration - verbose bool - maxBlobSize uint64 - gasPrice float64 - gasMultiplier float64 - filterHeight uint64 + daURL string + authToken string + timeout time.Duration + verbose bool + maxBlobSize uint64 + filterHeight uint64 ) func main() { @@ -44,8 +42,6 @@ A powerful DA debugging tool for inspecting blockchain data availability layers. rootCmd.PersistentFlags().DurationVar(&timeout, "timeout", 30*time.Second, "Request timeout") rootCmd.PersistentFlags().BoolVar(&verbose, "verbose", false, "Enable verbose logging") rootCmd.PersistentFlags().Uint64Var(&maxBlobSize, "max-blob-size", 1970176, "Maximum blob size in bytes") - rootCmd.PersistentFlags().Float64Var(&gasPrice, "gas-price", 0.0, "Gas price for DA operations") - rootCmd.PersistentFlags().Float64Var(&gasMultiplier, "gas-multiplier", 1.0, "Gas multiplier for DA operations") // Add subcommands rootCmd.AddCommand(queryCmd()) @@ -517,7 +513,7 @@ func createDAClient() (*jsonrpc.Client, error) { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - client, err := jsonrpc.NewClient(ctx, logger, daURL, authToken, gasPrice, gasMultiplier, maxBlobSize) + client, err := jsonrpc.NewClient(ctx, logger, daURL, authToken, maxBlobSize) if err != nil { return nil, fmt.Errorf("failed to create DA client: %w", err) }