Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 25 additions & 24 deletions .github/workflows/check_consts_drift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Fetch Celestia App Consts
id: fetch_celestia_consts
run: |
curl -sSL https://raw.githubusercontent.com/celestiaorg/celestia-app/main/pkg/appconsts/initial_consts.go -o /tmp/celestia_initial_consts.go
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
Expand Down Expand Up @@ -60,29 +60,30 @@ jobs:

# Perform the diff and handle its exit code robustly
diff_command_output=""
if ! diff_command_output=$(diff -u "$LOCAL_FILE_TMP" "$CELESTIA_FILE_TMP"); then
# diff exited with non-zero status
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<<EOF" >> $GITHUB_OUTPUT
echo "$diff_command_output" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "files_differ=true" >> $GITHUB_OUTPUT
exit 1 # Fail the step
else
# 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<<EOF" >> $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
exit $diff_exit_code
fi
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<<EOF" >> $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<<EOF" >> $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)."
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

<!-- Bug fixes -->
-
- Pass correct namespaces for header and data to the da layer for posting ([#2560](https://github.com/evstack/ev-node/pull/2560))

### Security

Expand Down
9 changes: 8 additions & 1 deletion apps/evm/single/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package cmd

import (
"context"
"encoding/hex"
"fmt"
"path/filepath"

"github.com/evstack/ev-node/core/da"
"github.com/evstack/ev-node/da/jsonrpc"
"github.com/evstack/ev-node/node"
"github.com/evstack/ev-node/sequencers/single"
Expand Down Expand Up @@ -40,7 +42,12 @@ var RunCmd = &cobra.Command{

logger := rollcmd.SetupLogger(nodeConfig.Log)

daJrpc, err := jsonrpc.NewClient(context.Background(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, nodeConfig.DA.Namespace)
headerNamespace := da.PrepareNamespace([]byte(nodeConfig.DA.HeaderNamespace))
dataNamespace := da.PrepareNamespace([]byte(nodeConfig.DA.DataNamespace))

logger.Info().Str("headerNamespace", hex.EncodeToString(headerNamespace)).Str("dataNamespace", hex.EncodeToString(dataNamespace)).Msg("namespaces")

daJrpc, err := jsonrpc.NewClient(context.Background(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, nodeConfig.DA.GasPrice, nodeConfig.DA.GasMultiplier)
if err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion apps/evm/single/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ require (
github.com/buger/goterm v1.0.4 // indirect
github.com/celestiaorg/go-header v0.6.6 // indirect
github.com/celestiaorg/go-libp2p-messenger v0.2.2 // indirect
github.com/celestiaorg/go-square/v2 v2.2.0 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/compose-spec/compose-go/v2 v2.6.0 // indirect
Expand Down
2 changes: 0 additions & 2 deletions apps/evm/single/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ github.com/celestiaorg/go-header v0.6.6 h1:17GvSXU/w8L1YWHZP4pYm9/4YHA8iy5Ku2wTE
github.com/celestiaorg/go-header v0.6.6/go.mod h1:RdnlTmsyuNerztNiJiQE5G/EGEH+cErhQ83xNjuGcaQ=
github.com/celestiaorg/go-libp2p-messenger v0.2.2 h1:osoUfqjss7vWTIZrrDSy953RjQz+ps/vBFE7bychLEc=
github.com/celestiaorg/go-libp2p-messenger v0.2.2/go.mod h1:oTCRV5TfdO7V/k6nkx7QjQzGrWuJbupv+0o1cgnY2i4=
github.com/celestiaorg/go-square/v2 v2.2.0 h1:zJnUxCYc65S8FgUfVpyG/osDcsnjzo/JSXw/Uwn8zp4=
github.com/celestiaorg/go-square/v2 v2.2.0/go.mod h1:j8kQUqJLYtcvCQMQV6QjEhUdaF7rBTXF74g8LbkR0Co=
github.com/celestiaorg/utils v0.1.0 h1:WsP3O8jF7jKRgLNFmlDCwdThwOFMFxg0MnqhkLFVxPo=
github.com/celestiaorg/utils v0.1.0/go.mod h1:vQTh7MHnvpIeCQZ2/Ph+w7K1R2UerDheZbgJEJD2hSU=
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
Expand Down
9 changes: 8 additions & 1 deletion apps/grpc/single/cmd/run.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package cmd

import (
"encoding/hex"
"fmt"
"path/filepath"

"github.com/spf13/cobra"

coreda "github.com/evstack/ev-node/core/da"
"github.com/evstack/ev-node/core/execution"
"github.com/evstack/ev-node/da/jsonrpc"
executiongrpc "github.com/evstack/ev-node/execution/grpc"
Expand Down Expand Up @@ -45,8 +47,13 @@ The execution client must implement the Evolve execution gRPC interface.`,

logger := rollcmd.SetupLogger(nodeConfig.Log)

headerNamespace := coreda.PrepareNamespace([]byte(nodeConfig.DA.HeaderNamespace))
dataNamespace := coreda.PrepareNamespace([]byte(nodeConfig.DA.DataNamespace))

logger.Info().Str("headerNamespace", hex.EncodeToString(headerNamespace)).Str("dataNamespace", hex.EncodeToString(dataNamespace)).Msg("namespaces")

// Create DA client
daJrpc, err := jsonrpc.NewClient(cmd.Context(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, nodeConfig.DA.Namespace)
daJrpc, err := jsonrpc.NewClient(cmd.Context(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, nodeConfig.DA.GasPrice, nodeConfig.DA.GasMultiplier)
if err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion apps/grpc/single/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/celestiaorg/go-header v0.6.6 // indirect
github.com/celestiaorg/go-libp2p-messenger v0.2.2 // indirect
github.com/celestiaorg/go-square/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/containerd/cgroups v1.1.0 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
Expand Down
2 changes: 0 additions & 2 deletions apps/grpc/single/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ github.com/celestiaorg/go-header v0.6.6 h1:17GvSXU/w8L1YWHZP4pYm9/4YHA8iy5Ku2wTE
github.com/celestiaorg/go-header v0.6.6/go.mod h1:RdnlTmsyuNerztNiJiQE5G/EGEH+cErhQ83xNjuGcaQ=
github.com/celestiaorg/go-libp2p-messenger v0.2.2 h1:osoUfqjss7vWTIZrrDSy953RjQz+ps/vBFE7bychLEc=
github.com/celestiaorg/go-libp2p-messenger v0.2.2/go.mod h1:oTCRV5TfdO7V/k6nkx7QjQzGrWuJbupv+0o1cgnY2i4=
github.com/celestiaorg/go-square/v2 v2.2.0 h1:zJnUxCYc65S8FgUfVpyG/osDcsnjzo/JSXw/Uwn8zp4=
github.com/celestiaorg/go-square/v2 v2.2.0/go.mod h1:j8kQUqJLYtcvCQMQV6QjEhUdaF7rBTXF74g8LbkR0Co=
github.com/celestiaorg/utils v0.1.0 h1:WsP3O8jF7jKRgLNFmlDCwdThwOFMFxg0MnqhkLFVxPo=
github.com/celestiaorg/utils v0.1.0/go.mod h1:vQTh7MHnvpIeCQZ2/Ph+w7K1R2UerDheZbgJEJD2hSU=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
Expand Down
9 changes: 8 additions & 1 deletion apps/testapp/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package cmd

import (
"context"
"encoding/hex"
"fmt"
"path/filepath"

"github.com/spf13/cobra"

kvexecutor "github.com/evstack/ev-node/apps/testapp/kv"
"github.com/evstack/ev-node/core/da"
"github.com/evstack/ev-node/da/jsonrpc"
"github.com/evstack/ev-node/node"
rollcmd "github.com/evstack/ev-node/pkg/cmd"
Expand Down Expand Up @@ -45,7 +47,12 @@ var RunCmd = &cobra.Command{
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

daJrpc, err := jsonrpc.NewClient(ctx, logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, nodeConfig.DA.Namespace)
headerNamespace := da.PrepareNamespace([]byte(nodeConfig.DA.HeaderNamespace))
dataNamespace := da.PrepareNamespace([]byte(nodeConfig.DA.DataNamespace))

logger.Info().Str("headerNamespace", hex.EncodeToString(headerNamespace)).Str("dataNamespace", hex.EncodeToString(dataNamespace)).Msg("namespaces")

daJrpc, err := jsonrpc.NewClient(ctx, logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, nodeConfig.DA.GasPrice, nodeConfig.DA.GasMultiplier)
if err != nil {
return err
}
Expand Down
3 changes: 1 addition & 2 deletions apps/testapp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ replace (

require (
github.com/evstack/ev-node v0.0.0-00010101000000-000000000000
github.com/evstack/ev-node/core v0.0.0-20250312114929-104787ba1a4c
github.com/evstack/ev-node/da v0.0.0-00010101000000-000000000000
github.com/evstack/ev-node/sequencers/single v0.0.0-00010101000000-000000000000
github.com/ipfs/go-datastore v0.8.2
Expand All @@ -25,7 +26,6 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/celestiaorg/go-header v0.6.6 // indirect
github.com/celestiaorg/go-libp2p-messenger v0.2.2 // indirect
github.com/celestiaorg/go-square/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/containerd/cgroups v1.1.0 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
Expand All @@ -37,7 +37,6 @@ require (
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/elastic/gosigar v0.14.3 // indirect
github.com/evstack/ev-node/core v0.0.0-20250312114929-104787ba1a4c // indirect
github.com/filecoin-project/go-jsonrpc v0.7.1 // indirect
github.com/flynn/noise v1.1.0 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
Expand Down
2 changes: 0 additions & 2 deletions apps/testapp/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ github.com/celestiaorg/go-header v0.6.6 h1:17GvSXU/w8L1YWHZP4pYm9/4YHA8iy5Ku2wTE
github.com/celestiaorg/go-header v0.6.6/go.mod h1:RdnlTmsyuNerztNiJiQE5G/EGEH+cErhQ83xNjuGcaQ=
github.com/celestiaorg/go-libp2p-messenger v0.2.2 h1:osoUfqjss7vWTIZrrDSy953RjQz+ps/vBFE7bychLEc=
github.com/celestiaorg/go-libp2p-messenger v0.2.2/go.mod h1:oTCRV5TfdO7V/k6nkx7QjQzGrWuJbupv+0o1cgnY2i4=
github.com/celestiaorg/go-square/v2 v2.2.0 h1:zJnUxCYc65S8FgUfVpyG/osDcsnjzo/JSXw/Uwn8zp4=
github.com/celestiaorg/go-square/v2 v2.2.0/go.mod h1:j8kQUqJLYtcvCQMQV6QjEhUdaF7rBTXF74g8LbkR0Co=
github.com/celestiaorg/utils v0.1.0 h1:WsP3O8jF7jKRgLNFmlDCwdThwOFMFxg0MnqhkLFVxPo=
github.com/celestiaorg/utils v0.1.0/go.mod h1:vQTh7MHnvpIeCQZ2/Ph+w7K1R2UerDheZbgJEJD2hSU=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
Expand Down
35 changes: 35 additions & 0 deletions client/crates/client/src/config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
use crate::{client::Client, error::Result};
use ev_types::v1::{config_service_client::ConfigServiceClient, GetNamespaceResponse};
use tonic::Request;

pub struct ConfigClient {
inner: ConfigServiceClient<tonic::transport::Channel>,
}

impl ConfigClient {
/// Create a new ConfigClient from a Client
pub fn new(client: &Client) -> Self {
let inner = ConfigServiceClient::new(client.channel().clone());
Self { inner }
}

/// Get the namespace for this network
pub async fn get_namespace(&self) -> Result<GetNamespaceResponse> {
let request = Request::new(());
let response = self.inner.clone().get_namespace(request).await?;

Ok(response.into_inner())
}

/// Get the header namespace
pub async fn get_header_namespace(&self) -> Result<String> {
let response = self.get_namespace().await?;
Ok(response.header_namespace)
}

/// Get the data namespace
pub async fn get_data_namespace(&self) -> Result<String> {
let response = self.get_namespace().await?;
Ok(response.data_namespace)
}
}
10 changes: 9 additions & 1 deletion client/crates/client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! # Example
//!
//! ```no_run
//! use ev_client::{Client, HealthClient};
//! use ev_client::{Client, HealthClient, ConfigClient};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
Expand All @@ -17,6 +17,12 @@
//! let is_healthy = health.is_healthy().await?;
//! println!("Node healthy: {}", is_healthy);
//!
//! // Get namespace configuration
//! let config = ConfigClient::new(&client);
//! let namespace = config.get_namespace().await?;
//! println!("Header namespace: {}", namespace.header_namespace);
//! println!("Data namespace: {}", namespace.data_namespace);
//!
//! Ok(())
//! }
//! ```
Expand Down Expand Up @@ -71,6 +77,7 @@
//! ```

pub mod client;
pub mod config;
pub mod error;
pub mod health;
pub mod p2p;
Expand All @@ -79,6 +86,7 @@ pub mod store;

// Re-export main types for convenience
pub use client::{Client, ClientBuilder};
pub use config::ConfigClient;
pub use error::{ClientError, Result};
pub use health::HealthClient;
pub use p2p::P2PClient;
Expand Down
9 changes: 9 additions & 0 deletions client/crates/types/src/proto/evnode.v1.messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,3 +418,12 @@ pub struct GetMetadataResponse {
#[prost(bytes = "vec", tag = "1")]
pub value: ::prost::alloc::vec::Vec<u8>,
}
/// GetNamespaceResponse returns the namespace for this network
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetNamespaceResponse {
#[prost(string, tag = "1")]
pub header_namespace: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub data_namespace: ::prost::alloc::string::String,
}
Loading
Loading