Skip to content

Commit 85d36b1

Browse files
committed
pass maxbytes down to jsonrpc
1 parent 10621a0 commit 85d36b1

File tree

6 files changed

+12
-13
lines changed

6 files changed

+12
-13
lines changed

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
}

da/jsonrpc/client.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ import (
1313
"github.com/evstack/ev-node/core/da"
1414
)
1515

16-
const (
17-
// DefaultMaxBlobSize is the default maximum blob size in bytes.
18-
DefaultMaxBlobSize = 1.5 * 1024 * 1024 // 1.5MB
19-
)
20-
2116
//go:generate mockgen -destination=mocks/api.go -package=mocks . Module
2217
type Module interface {
2318
da.DA
@@ -227,16 +222,16 @@ func (c *Client) Close() {
227222

228223
// NewClient creates a new Client with one connection per namespace with the
229224
// given token as the authorization token.
230-
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) {
231226
authHeader := http.Header{"Authorization": []string{fmt.Sprintf("Bearer %s", token)}}
232-
return newClient(ctx, logger, addr, authHeader, gasPrice, gasMultiplier)
227+
return newClient(ctx, logger, addr, authHeader, gasPrice, gasMultiplier, maxBlobSize)
233228
}
234229

235-
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) {
236231
var multiCloser multiClientCloser
237232
var client Client
238233
client.DA.Logger = logger
239-
client.DA.MaxBlobSize = uint64(DefaultMaxBlobSize)
234+
client.DA.MaxBlobSize = maxBlobSize
240235
client.DA.gasPrice = gasPrice
241236
client.DA.gasMultiplier = gasMultiplier
242237

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)