Skip to content

Commit bc6a0b1

Browse files
authored
refactor(block): reduce max size in da submitter (#2720)
<!-- Please read and fill out this form before submitting your PR. Please make sure you have reviewed our contributors guide before submitting your first PR. NOTE: PR titles should follow semantic commits: https://www.conventionalcommits.org/en/v1.0.0/ --> ## Overview <!-- Please provide an explanation of the PR, including the appropriate context, background, goal, and rationale. If there is an issue with this information, please provide a tl;dr and link the issue. Ex: Closes #<issue number> --> short term fix to clear cache it turns out that 2MB is the max tx size and not the max blob size. This means DA is down and pending headers/data increases, when it was reaching 2MB it would constantly fail
1 parent a3b4b0d commit bc6a0b1

File tree

9 files changed

+13
-142
lines changed

9 files changed

+13
-142
lines changed

.github/workflows/check_consts_drift.yml

Lines changed: 0 additions & 91 deletions
This file was deleted.

apps/evm/single/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(context.Background(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, nodeConfig.DA.GasPrice, nodeConfig.DA.GasMultiplier)
54+
daJrpc, err := jsonrpc.NewClient(context.Background(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, nodeConfig.DA.GasPrice, nodeConfig.DA.GasMultiplier, rollcmd.DefaultMaxBlobSize)
5555
if err != nil {
5656
return err
5757
}

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)
55+
daJrpc, err := jsonrpc.NewClient(cmd.Context(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, nodeConfig.DA.GasPrice, nodeConfig.DA.GasMultiplier, rollcmd.DefaultMaxBlobSize)
5656
if err != nil {
5757
return err
5858
}

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

block/internal/submitting/da_submitter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const (
2525
initialBackoff = 100 * time.Millisecond
2626
defaultGasPrice = 0.0
2727
defaultGasMultiplier = 1.0
28-
defaultMaxBlobSize = 2 * 1024 * 1024 // 2MB fallback blob size limit
28+
defaultMaxBlobSize = 1.5 * 1024 * 1024 // 1.5MB fallback blob size limit
2929
defaultMaxGasPriceClamp = 1000.0
3030
defaultMaxGasMultiplierClamp = 3.0 // must always > 0 to avoid division by zero
3131
)

da/jsonrpc/client.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"github.com/rs/zerolog"
1212

1313
"github.com/evstack/ev-node/core/da"
14-
internal "github.com/evstack/ev-node/da/jsonrpc/internal"
1514
)
1615

1716
//go:generate mockgen -destination=mocks/api.go -package=mocks . Module
@@ -223,16 +222,16 @@ func (c *Client) Close() {
223222

224223
// NewClient creates a new Client with one connection per namespace with the
225224
// given token as the authorization token.
226-
func NewClient(ctx context.Context, logger zerolog.Logger, addr, token string, gasPrice, gasMultiplier float64) (*Client, error) {
225+
func NewClient(ctx context.Context, logger zerolog.Logger, addr, token string, gasPrice, gasMultiplier float64, maxBlobSize uint64) (*Client, error) {
227226
authHeader := http.Header{"Authorization": []string{fmt.Sprintf("Bearer %s", token)}}
228-
return newClient(ctx, logger, addr, authHeader, gasPrice, gasMultiplier)
227+
return newClient(ctx, logger, addr, authHeader, gasPrice, gasMultiplier, maxBlobSize)
229228
}
230229

231-
func newClient(ctx context.Context, logger zerolog.Logger, addr string, authHeader http.Header, gasPrice, gasMultiplier float64) (*Client, error) {
230+
func newClient(ctx context.Context, logger zerolog.Logger, addr string, authHeader http.Header, gasPrice, gasMultiplier float64, maxBlobSize uint64) (*Client, error) {
232231
var multiCloser multiClientCloser
233232
var client Client
234233
client.DA.Logger = logger
235-
client.DA.MaxBlobSize = uint64(internal.MaxTxSize)
234+
client.DA.MaxBlobSize = maxBlobSize
236235
client.DA.gasPrice = gasPrice
237236
client.DA.gasMultiplier = gasMultiplier
238237

da/jsonrpc/internal/consts.go

Lines changed: 0 additions & 41 deletions
This file was deleted.

da/jsonrpc/proxy_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ const (
2929
ClientURL = "http://localhost:3450"
3030

3131
testMaxBlobSize = 100
32+
33+
DefaultMaxBlobSize = 1.5 * 1024 * 1024 // 1.5MB
3234
)
3335

3436
// testNamespace is a 15-byte namespace that will be hex encoded to 30 chars and truncated to 29
@@ -55,7 +57,7 @@ func TestProxy(t *testing.T) {
5557
}
5658
}()
5759

58-
client, err := proxy.NewClient(context.Background(), logger, ClientURL, "74657374", 0, 1)
60+
client, err := proxy.NewClient(context.Background(), logger, ClientURL, "74657374", 0, 1, DefaultMaxBlobSize)
5961
require.NoError(t, err)
6062

6163
t.Run("Basic DA test", func(t *testing.T) {

pkg/cmd/run_node.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import (
2626
"github.com/evstack/ev-node/pkg/signer/file"
2727
)
2828

29+
const DefaultMaxBlobSize = 1.5 * 1024 * 1024 // 1.5MB
30+
2931
// ParseConfig is an helpers that loads the node configuration and validates it.
3032
func ParseConfig(cmd *cobra.Command) (rollconf.Config, error) {
3133
nodeConfig, err := rollconf.Load(cmd)

0 commit comments

Comments
 (0)