From bd520661f1d2dd05a30dbb32e2805368a6241a9b Mon Sep 17 00:00:00 2001 From: tac0turtle Date: Wed, 1 Oct 2025 13:11:12 +0200 Subject: [PATCH 1/3] reduce max size --- block/internal/submitting/da_submitter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/internal/submitting/da_submitter.go b/block/internal/submitting/da_submitter.go index 756d8d156..d47c4a229 100644 --- a/block/internal/submitting/da_submitter.go +++ b/block/internal/submitting/da_submitter.go @@ -25,7 +25,7 @@ const ( initialBackoff = 100 * time.Millisecond defaultGasPrice = 0.0 defaultGasMultiplier = 1.0 - defaultMaxBlobSize = 2 * 1024 * 1024 // 2MB fallback blob size limit + defaultMaxBlobSize = 1.5 * 1024 * 1024 // 1.5MB fallback blob size limit defaultMaxGasPriceClamp = 1000.0 defaultMaxGasMultiplierClamp = 3.0 // must always > 0 to avoid division by zero ) From 10621a0412f84458e9b7c967538bd9187083c157 Mon Sep 17 00:00:00 2001 From: tac0turtle Date: Wed, 1 Oct 2025 14:58:53 +0200 Subject: [PATCH 2/3] remove other consts --- .github/workflows/check_consts_drift.yml | 91 ------------------------ da/jsonrpc/client.go | 8 ++- da/jsonrpc/internal/consts.go | 41 ----------- 3 files changed, 6 insertions(+), 134 deletions(-) delete mode 100644 .github/workflows/check_consts_drift.yml delete mode 100644 da/jsonrpc/internal/consts.go diff --git a/.github/workflows/check_consts_drift.yml b/.github/workflows/check_consts_drift.yml deleted file mode 100644 index bf8a47d42..000000000 --- a/.github/workflows/check_consts_drift.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: Check Celestia App Consts Drift -permissions: - contents: read - issues: write - -on: - workflow_dispatch: - pull_request: - -jobs: - check_drift: - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v5 - - - name: Fetch Celestia App Consts - id: fetch_celestia_consts - run: | - curl -sSL https://raw.githubusercontent.com/celestiaorg/celestia-app/refs/tags/v5.0.1/pkg/appconsts/app_consts.go -o /tmp/celestia_initial_consts.go - if [ $? -ne 0 ]; then - echo "Failed to download Celestia app consts file." - exit 1 - fi - echo "celestia_file_path=/tmp/celestia_initial_consts.go" >> $GITHUB_OUTPUT - - - name: Compare Files - id: diff_files - run: | - LOCAL_FILE="da/jsonrpc/internal/consts.go" # Relative path from repo root - CELESTIA_FILE="${{ steps.fetch_celestia_consts.outputs.celestia_file_path }}" - - if [ ! -f "$LOCAL_FILE" ]; then - echo "Local consts.go file not found at $LOCAL_FILE" - exit 1 - fi - if [ ! -f "$CELESTIA_FILE" ]; then - echo "Fetched Celestia consts file not found at $CELESTIA_FILE" - # This should ideally be caught by the previous step's check - exit 1 - fi - - echo "Comparing $LOCAL_FILE (excluding last line) with $CELESTIA_FILE (excluding last line)" - - LOCAL_FILE_TMP=$(mktemp) - CELESTIA_FILE_TMP=$(mktemp) - # Ensure temporary files are removed on exit - trap 'rm -f "$LOCAL_FILE_TMP" "$CELESTIA_FILE_TMP"' EXIT - - head -n -1 "$LOCAL_FILE" > "$LOCAL_FILE_TMP" - if [ $? -ne 0 ]; then - echo "Error processing local file '$LOCAL_FILE' with head." - exit 1 - fi - head -n -1 "$CELESTIA_FILE" > "$CELESTIA_FILE_TMP" - if [ $? -ne 0 ]; then - echo "Error processing fetched Celestia file '$CELESTIA_FILE' with head." - exit 1 - fi - - # Perform the diff and handle its exit code robustly - diff_command_output="" - diff_exit_code=0 - diff_command_output=$(diff -u "$LOCAL_FILE_TMP" "$CELESTIA_FILE_TMP") || diff_exit_code=$? - - if [ $diff_exit_code -eq 1 ]; then - # Exit code 1 means files are different - echo "Files are different (excluding last line)." - echo "diff_output<> $GITHUB_OUTPUT - echo "$diff_command_output" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - echo "files_differ=true" >> $GITHUB_OUTPUT - echo "::error::Celestia app consts have drifted. Please update da/jsonrpc/internal/consts.go" - exit 1 # Fail the step - elif [ $diff_exit_code -gt 1 ]; then - # Exit code > 1 means diff encountered an error - echo "Error: diff command failed with exit code $diff_exit_code." - echo "Diff command output/error: $diff_command_output" - # Output error information for the issue - echo "diff_output<> $GITHUB_OUTPUT - echo "Diff command error (exit code $diff_exit_code):" >> $GITHUB_OUTPUT - echo "$diff_command_output" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - echo "files_differ=true" >> $GITHUB_OUTPUT # Treat as a difference to create an issue - echo "::error::Failed to compare files due to diff error" - exit $diff_exit_code - else - # diff exited with 0, files are identical - echo "Files are identical (excluding last line)." - echo "files_differ=false" >> $GITHUB_OUTPUT - fi diff --git a/da/jsonrpc/client.go b/da/jsonrpc/client.go index 5247ca511..8313d04e9 100644 --- a/da/jsonrpc/client.go +++ b/da/jsonrpc/client.go @@ -11,7 +11,11 @@ import ( "github.com/rs/zerolog" "github.com/evstack/ev-node/core/da" - internal "github.com/evstack/ev-node/da/jsonrpc/internal" +) + +const ( + // DefaultMaxBlobSize is the default maximum blob size in bytes. + DefaultMaxBlobSize = 1.5 * 1024 * 1024 // 1.5MB ) //go:generate mockgen -destination=mocks/api.go -package=mocks . Module @@ -232,7 +236,7 @@ func newClient(ctx context.Context, logger zerolog.Logger, addr string, authHead var multiCloser multiClientCloser var client Client client.DA.Logger = logger - client.DA.MaxBlobSize = uint64(internal.MaxTxSize) + client.DA.MaxBlobSize = uint64(DefaultMaxBlobSize) client.DA.gasPrice = gasPrice client.DA.gasMultiplier = gasMultiplier diff --git a/da/jsonrpc/internal/consts.go b/da/jsonrpc/internal/consts.go deleted file mode 100644 index 9e72b9d91..000000000 --- a/da/jsonrpc/internal/consts.go +++ /dev/null @@ -1,41 +0,0 @@ -package appconsts - -import "time" - -const ( - Version uint64 = 5 - // SquareSizeUpperBound imposes an upper bound on the max effective square size. - SquareSizeUpperBound int = 128 - // SubtreeRootThreshold works as a target upper bound for the number of subtree - // roots in the share commitment. If a blob contains more shares than this - // number, then the height of the subtree roots will increase by one so that the - // number of subtree roots in the share commitment decreases by a factor of two. - // This step is repeated until the number of subtree roots is less than the - // SubtreeRootThreshold. - // - // The rationale for this value is described in more detail in ADR-013. - SubtreeRootThreshold int = 64 - TxSizeCostPerByte uint64 = 10 - GasPerBlobByte uint32 = 8 - MaxTxSize int = 2097152 // 2 MiB in bytes - TimeoutPropose = time.Millisecond * 3500 - TimeoutCommit = time.Millisecond * 4200 - - // TestUpgradeHeightDelay is the number of blocks that chain-id "test" waits - // after a MsgTryUpgrade to activate the next version. - TestUpgradeHeightDelay = int64(3) - // ArabicaUpgradeHeightDelay is the number of blocks that Arabica waits - // after a MsgTryUpgrade to activate the next version. Assuming a block - // interval of 6 seconds, this is 1 day. - ArabicaUpgradeHeightDelay = int64(14_400) - // MochaUpgradeHeightDelay is the number of blocks that Mocha waits - // after a MsgTryUpgrade to activate the next version. Assuming a block - // interval of 6 seconds, this is 2 days. - MochaUpgradeHeightDelay = int64(28_800) - // MainnetUpgradeHeightDelay is the number of blocks that Mainnet waits - // after a MsgTryUpgrade to activate the next version. Assuming a block - // interval of 6 seconds, this is 7 day. - MainnetUpgradeHeightDelay = int64(100_800) - // Deprecated: Use MainnetUpgradeHeightDelay instead. - UpgradeHeightDelay = MainnetUpgradeHeightDelay -) From 85d36b15d96174357931661af25b2c7fecc68037 Mon Sep 17 00:00:00 2001 From: tac0turtle Date: Wed, 1 Oct 2025 15:15:19 +0200 Subject: [PATCH 3/3] pass maxbytes down to jsonrpc --- apps/evm/single/cmd/run.go | 2 +- apps/grpc/single/cmd/run.go | 2 +- apps/testapp/cmd/run.go | 2 +- da/jsonrpc/client.go | 13 ++++--------- da/jsonrpc/proxy_test.go | 4 +++- pkg/cmd/run_node.go | 2 ++ 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/apps/evm/single/cmd/run.go b/apps/evm/single/cmd/run.go index 03b95d81e..9082469d9 100644 --- a/apps/evm/single/cmd/run.go +++ b/apps/evm/single/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(context.Background(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, nodeConfig.DA.GasPrice, nodeConfig.DA.GasMultiplier) + daJrpc, err := jsonrpc.NewClient(context.Background(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, nodeConfig.DA.GasPrice, nodeConfig.DA.GasMultiplier, rollcmd.DefaultMaxBlobSize) if err != nil { return err } diff --git a/apps/grpc/single/cmd/run.go b/apps/grpc/single/cmd/run.go index 30cf44be4..b7e66b793 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) + daJrpc, err := jsonrpc.NewClient(cmd.Context(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, nodeConfig.DA.GasPrice, nodeConfig.DA.GasMultiplier, rollcmd.DefaultMaxBlobSize) if err != nil { return err } diff --git a/apps/testapp/cmd/run.go b/apps/testapp/cmd/run.go index acc49c028..834facff1 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) + daJrpc, err := jsonrpc.NewClient(ctx, logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, nodeConfig.DA.GasPrice, nodeConfig.DA.GasMultiplier, rollcmd.DefaultMaxBlobSize) if err != nil { return err } diff --git a/da/jsonrpc/client.go b/da/jsonrpc/client.go index 8313d04e9..a1286bc94 100644 --- a/da/jsonrpc/client.go +++ b/da/jsonrpc/client.go @@ -13,11 +13,6 @@ import ( "github.com/evstack/ev-node/core/da" ) -const ( - // DefaultMaxBlobSize is the default maximum blob size in bytes. - DefaultMaxBlobSize = 1.5 * 1024 * 1024 // 1.5MB -) - //go:generate mockgen -destination=mocks/api.go -package=mocks . Module type Module interface { da.DA @@ -227,16 +222,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) (*Client, error) { +func NewClient(ctx context.Context, logger zerolog.Logger, addr, token string, gasPrice, gasMultiplier float64, maxBlobSize uint64) (*Client, error) { authHeader := http.Header{"Authorization": []string{fmt.Sprintf("Bearer %s", token)}} - return newClient(ctx, logger, addr, authHeader, gasPrice, gasMultiplier) + return newClient(ctx, logger, addr, authHeader, gasPrice, gasMultiplier, maxBlobSize) } -func newClient(ctx context.Context, logger zerolog.Logger, addr string, authHeader http.Header, gasPrice, gasMultiplier float64) (*Client, error) { +func newClient(ctx context.Context, logger zerolog.Logger, addr string, authHeader http.Header, gasPrice, gasMultiplier float64, maxBlobSize uint64) (*Client, error) { var multiCloser multiClientCloser var client Client client.DA.Logger = logger - client.DA.MaxBlobSize = uint64(DefaultMaxBlobSize) + client.DA.MaxBlobSize = maxBlobSize client.DA.gasPrice = gasPrice client.DA.gasMultiplier = gasMultiplier diff --git a/da/jsonrpc/proxy_test.go b/da/jsonrpc/proxy_test.go index 39a97c25c..e0086d389 100644 --- a/da/jsonrpc/proxy_test.go +++ b/da/jsonrpc/proxy_test.go @@ -29,6 +29,8 @@ const ( ClientURL = "http://localhost:3450" testMaxBlobSize = 100 + + DefaultMaxBlobSize = 1.5 * 1024 * 1024 // 1.5MB ) // 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) { } }() - client, err := proxy.NewClient(context.Background(), logger, ClientURL, "74657374", 0, 1) + client, err := proxy.NewClient(context.Background(), logger, ClientURL, "74657374", 0, 1, DefaultMaxBlobSize) require.NoError(t, err) t.Run("Basic DA test", func(t *testing.T) { diff --git a/pkg/cmd/run_node.go b/pkg/cmd/run_node.go index 91a12f127..73b288965 100644 --- a/pkg/cmd/run_node.go +++ b/pkg/cmd/run_node.go @@ -26,6 +26,8 @@ import ( "github.com/evstack/ev-node/pkg/signer/file" ) +const DefaultMaxBlobSize = 1.5 * 1024 * 1024 // 1.5MB + // ParseConfig is an helpers that loads the node configuration and validates it. func ParseConfig(cmd *cobra.Command) (rollconf.Config, error) { nodeConfig, err := rollconf.Load(cmd)