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
10 changes: 5 additions & 5 deletions apps/evm/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/rs/zerolog"
"github.com/spf13/cobra"

"github.com/evstack/ev-node/apps/evm/server"
"github.com/evstack/ev-node/block"
"github.com/evstack/ev-node/core/execution"
coresequencer "github.com/evstack/ev-node/core/sequencer"
Expand All @@ -29,8 +30,6 @@ import (
"github.com/evstack/ev-node/pkg/sequencers/based"
"github.com/evstack/ev-node/pkg/sequencers/single"
"github.com/evstack/ev-node/pkg/store"

"github.com/evstack/ev-node/apps/evm/server"
)

const (
Expand All @@ -56,7 +55,8 @@ var RunCmd = &cobra.Command{
return err
}

executor, err := createExecutionClient(cmd, datastore)
tracingEnabled := nodeConfig.Instrumentation.IsTracingEnabled()
executor, err := createExecutionClient(cmd, datastore, tracingEnabled)
if err != nil {
return err
}
Expand Down Expand Up @@ -201,7 +201,7 @@ func createSequencer(
return sequencer, nil
}

func createExecutionClient(cmd *cobra.Command, db datastore.Batching) (execution.Executor, error) {
func createExecutionClient(cmd *cobra.Command, db datastore.Batching, tracingEnabled bool) (execution.Executor, error) {
// Read execution client parameters from flags
ethURL, err := cmd.Flags().GetString(evm.FlagEvmEthURL)
if err != nil {
Expand Down Expand Up @@ -246,7 +246,7 @@ func createExecutionClient(cmd *cobra.Command, db datastore.Batching) (execution
genesisHash := common.HexToHash(genesisHashStr)
feeRecipient := common.HexToAddress(feeRecipientStr)

return evm.NewEngineExecutionClient(ethURL, engineURL, jwtSecret, genesisHash, feeRecipient, db)
return evm.NewEngineExecutionClient(ethURL, engineURL, jwtSecret, genesisHash, feeRecipient, db, tracingEnabled)
}

// addFlags adds flags related to the EVM execution client
Expand Down
42 changes: 29 additions & 13 deletions execution/evm/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/rs/zerolog"

"github.com/evstack/ev-node/core/execution"
"github.com/evstack/ev-node/pkg/telemetry"
)

const (
Expand Down Expand Up @@ -157,40 +158,55 @@ type EngineClient struct {
// The db parameter is required for ExecMeta tracking which enables idempotent
// execution and crash recovery. The db is wrapped with a prefix to isolate
// EVM execution data from other ev-node data.
// When tracingEnabled is true, the client will inject W3C trace context headers
// and wrap Engine API calls with OpenTelemetry spans.
func NewEngineExecutionClient(
ethURL,
engineURL string,
jwtSecret string,
genesisHash common.Hash,
feeRecipient common.Address,
db ds.Batching,
tracingEnabled bool,
) (*EngineClient, error) {
if db == nil {
return nil, errors.New("db is required for EVM execution client")
}

ethClient, err := ethclient.Dial(ethURL)
var rpcOpts []rpc.ClientOption
// If tracing enabled, add W3C header propagation to rpcOpts
if tracingEnabled {
rpcOpts = append(rpcOpts, rpc.WithHTTPClient(
telemetry.NewPropagatingHTTPClient(http.DefaultTransport)))
}

// Create ETH RPC client with HTTP options
ethRPC, err := rpc.DialOptions(context.Background(), ethURL, rpcOpts...)
if err != nil {
return nil, err
}
ethClient := ethclient.NewClient(ethRPC)

secret, err := decodeSecret(jwtSecret)
if err != nil {
return nil, err
}

engineClient, err := rpc.DialOptions(context.Background(), engineURL,
rpc.WithHTTPAuth(func(h http.Header) error {
authToken, err := getAuthToken(secret)
if err != nil {
return err
}

if authToken != "" {
h.Set("Authorization", "Bearer "+authToken)
}
return nil
}))
// Create Engine RPC with optional HTTP client and JWT auth
// Compose engine options: pass-through rpcOpts plus JWT auth
engineOptions := make([]rpc.ClientOption, len(rpcOpts))
copy(engineOptions, rpcOpts) // copy to avoid using same backing array from rpcOpts.
engineOptions = append(engineOptions, rpc.WithHTTPAuth(func(h http.Header) error {
authToken, err := getAuthToken(secret)
if err != nil {
return err
}
if authToken != "" {
h.Set("Authorization", "Bearer "+authToken)
}
return nil
}))
engineClient, err := rpc.DialOptions(context.Background(), engineURL, engineOptions...)
if err != nil {
return nil, err
}
Expand Down
52 changes: 49 additions & 3 deletions execution/evm/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.24.6

require (
github.com/ethereum/go-ethereum v1.16.7
github.com/evstack/ev-node v1.0.0-beta.10
github.com/evstack/ev-node/core v1.0.0-beta.5
github.com/golang-jwt/jwt/v5 v5.3.0
github.com/ipfs/go-datastore v0.9.0
Expand All @@ -18,8 +19,10 @@ require (
github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20251001021608-1fe7b43fc4d6 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/bits-and-blooms/bitset v1.20.0 // indirect
github.com/celestiaorg/go-square/v3 v3.0.2 // indirect
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/consensys/gnark-crypto v0.18.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect
github.com/crate-crypto/go-eth-kzg v1.4.0 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
Expand All @@ -29,33 +32,76 @@ require (
github.com/ethereum/c-kzg-4844/v2 v2.1.5 // indirect
github.com/ethereum/go-verkle v0.2.2 // indirect
github.com/ferranbt/fastssz v0.1.4 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/goccy/go-yaml v1.19.0 // indirect
github.com/gofrs/flock v0.12.1 // indirect
github.com/golang/snappy v1.0.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect
github.com/holiman/uint256 v1.3.2 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/ipfs/go-cid v0.6.0 // indirect
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/multiformats/go-base32 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.2.0 // indirect
github.com/multiformats/go-multiaddr v0.16.1 // indirect
github.com/multiformats/go-multibase v0.2.0 // indirect
github.com/multiformats/go-multihash v0.2.3 // indirect
github.com/multiformats/go-varint v0.1.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
github.com/rs/cors v1.11.1 // indirect
github.com/sagikazarmark/locafero v0.11.0 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.15.0 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/spf13/cobra v1.10.2 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/spf13/viper v1.21.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/supranational/blst v0.3.16-0.20250831170142-f48500c1fdbe // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/otel v1.39.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 // indirect
go.opentelemetry.io/otel/metric v1.39.0 // indirect
go.opentelemetry.io/otel/sdk v1.38.0 // indirect
go.opentelemetry.io/otel/trace v1.39.0 // indirect
go.opentelemetry.io/proto/otlp v1.7.1 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.46.0 // indirect
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 // indirect
golang.org/x/net v0.48.0 // indirect
golang.org/x/sync v0.19.0 // indirect
golang.org/x/sys v0.39.0 // indirect
golang.org/x/text v0.32.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 // indirect
google.golang.org/grpc v1.75.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
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 => ../../
github.com/evstack/ev-node/core => ../../core
)
Loading
Loading