Skip to content
Open
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Implement forced inclusion and based sequencing ([#2797](https://github.com/evstack/ev-node/pull/2797))
This changes requires to add a `da_epoch_forced_inclusion` field in `genesis.json` file.
To enable this feature, set the force inclusion namespace in the `evnode.yaml`.

### Changed

- Rename `evm-single` to `evm` and `grpc-single` to `evgrpc` for clarity. [#2839](https://github.com/evstack/ev-node/pull/2839)
Expand Down
33 changes: 32 additions & 1 deletion apps/evm/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/rs/zerolog"
"github.com/spf13/cobra"

"github.com/evstack/ev-node/block"
"github.com/evstack/ev-node/core/da"
"github.com/evstack/ev-node/core/execution"
coresequencer "github.com/evstack/ev-node/core/sequencer"
Expand All @@ -25,6 +26,8 @@ import (
"github.com/evstack/ev-node/pkg/p2p"
"github.com/evstack/ev-node/pkg/p2p/key"
"github.com/evstack/ev-node/pkg/store"
"github.com/evstack/ev-node/sequencers/based"
seqcommon "github.com/evstack/ev-node/sequencers/common"
"github.com/evstack/ev-node/sequencers/single"
)

Expand Down Expand Up @@ -55,7 +58,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, rollcmd.DefaultMaxBlobSize)
daJrpc, err := jsonrpc.NewClient(context.Background(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, seqcommon.AbsoluteMaxBlobSize)
if err != nil {
return err
}
Expand Down Expand Up @@ -101,6 +104,8 @@ func init() {
}

// createSequencer creates a sequencer based on the configuration.
// If BasedSequencer is enabled, it creates a based sequencer that fetches transactions from DA.
// Otherwise, it creates a single (traditional) sequencer.
func createSequencer(
ctx context.Context,
logger zerolog.Logger,
Expand All @@ -109,6 +114,25 @@ func createSequencer(
nodeConfig config.Config,
genesis genesis.Genesis,
) (coresequencer.Sequencer, error) {
daClient := block.NewDAClient(da, nodeConfig, logger)
fiRetriever := block.NewForcedInclusionRetriever(daClient, genesis, logger)

if nodeConfig.Node.BasedSequencer {
// Based sequencer mode - fetch transactions only from DA
if !nodeConfig.Node.Aggregator {
return nil, fmt.Errorf("based sequencer mode requires aggregator mode to be enabled")
}

basedSeq := based.NewBasedSequencer(fiRetriever, da, nodeConfig, genesis, logger)

logger.Info().
Str("forced_inclusion_namespace", nodeConfig.DA.GetForcedInclusionNamespace()).
Uint64("da_epoch", genesis.DAEpochForcedInclusion).
Msg("based sequencer initialized")

return basedSeq, nil
}

singleMetrics, err := single.NopMetrics()
if err != nil {
return nil, fmt.Errorf("failed to create single sequencer metrics: %w", err)
Expand All @@ -123,11 +147,18 @@ func createSequencer(
nodeConfig.Node.BlockTime.Duration,
singleMetrics,
nodeConfig.Node.Aggregator,
1000,
fiRetriever,
genesis,
)
if err != nil {
return nil, fmt.Errorf("failed to create single sequencer: %w", err)
}

logger.Info().
Str("forced_inclusion_namespace", nodeConfig.DA.GetForcedInclusionNamespace()).
Msg("single sequencer initialized")

return sequencer, nil
}

Expand Down
9 changes: 5 additions & 4 deletions apps/evm/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ replace (

require (
github.com/celestiaorg/go-header v0.7.3
github.com/ethereum/go-ethereum v1.16.5
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/evstack/ev-node/da v1.0.0-beta.6
github.com/evstack/ev-node/da v0.0.0-00010101000000-000000000000
github.com/evstack/ev-node/execution/evm v1.0.0-beta.3
github.com/ipfs/go-datastore v0.9.0
github.com/rs/zerolog v1.34.0
Expand All @@ -26,14 +26,15 @@ require (
connectrpc.com/connect v1.19.1 // indirect
connectrpc.com/grpcreflect v1.3.0 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
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/benbjohnson/clock v1.3.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.20.0 // indirect
github.com/celestiaorg/go-libp2p-messenger v0.2.2 // indirect
github.com/celestiaorg/go-square/v3 v3.0.2 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/consensys/gnark-crypto v0.18.1 // indirect
github.com/consensys/gnark-crypto v0.18.0 // 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 @@ -44,7 +45,7 @@ require (
github.com/dgraph-io/ristretto/v2 v2.1.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emicklei/dot v1.6.2 // indirect
github.com/ethereum/c-kzg-4844/v2 v2.1.3 // indirect
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/filecoin-project/go-clock v0.1.0 // indirect
Expand Down
14 changes: 8 additions & 6 deletions apps/evm/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ=
github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw=
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20251001021608-1fe7b43fc4d6 h1:1zYrtlhrZ6/b6SAjLSfKzWtdgqK0U+HtH/VcBWh1BaU=
github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20251001021608-1fe7b43fc4d6/go.mod h1:ioLG6R+5bUSO1oeGSDxOV3FADARuMoytZCSX6MEMQkI=
github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA=
github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8=
github.com/VictoriaMetrics/fastcache v1.13.0 h1:AW4mheMR5Vd9FkAPUv+NH6Nhw+fmbTMGMsNAoA/+4G0=
Expand Down Expand Up @@ -55,8 +57,8 @@ github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwP
github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo=
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ=
github.com/consensys/gnark-crypto v0.18.1 h1:RyLV6UhPRoYYzaFnPQA4qK3DyuDgkTgskDdoGqFt3fI=
github.com/consensys/gnark-crypto v0.18.1/go.mod h1:L3mXGFTe1ZN+RSJ+CLjUt9x7PNdx8ubaYfDROyp2Z8c=
github.com/consensys/gnark-crypto v0.18.0 h1:vIye/FqI50VeAr0B3dx+YjeIvmc3LWz4yEfbWBpTUf0=
github.com/consensys/gnark-crypto v0.18.0/go.mod h1:L3mXGFTe1ZN+RSJ+CLjUt9x7PNdx8ubaYfDROyp2Z8c=
github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
Expand Down Expand Up @@ -95,12 +97,12 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ethereum/c-kzg-4844/v2 v2.1.3 h1:DQ21UU0VSsuGy8+pcMJHDS0CV1bKmJmxsJYK8l3MiLU=
github.com/ethereum/c-kzg-4844/v2 v2.1.3/go.mod h1:fyNcYI/yAuLWJxf4uzVtS8VDKeoAaRM8G/+ADz/pRdA=
github.com/ethereum/c-kzg-4844/v2 v2.1.5 h1:aVtoLK5xwJ6c5RiqO8g8ptJ5KU+2Hdquf6G3aXiHh5s=
github.com/ethereum/c-kzg-4844/v2 v2.1.5/go.mod h1:u59hRTTah4Co6i9fDWtiCjTrblJv0UwsqZKCc0GfgUs=
github.com/ethereum/go-bigmodexpfix v0.0.0-20250911101455-f9e208c548ab h1:rvv6MJhy07IMfEKuARQ9TKojGqLVNxQajaXEp/BoqSk=
github.com/ethereum/go-bigmodexpfix v0.0.0-20250911101455-f9e208c548ab/go.mod h1:IuLm4IsPipXKF7CW5Lzf68PIbZ5yl7FFd74l/E0o9A8=
github.com/ethereum/go-ethereum v1.16.5 h1:GZI995PZkzP7ySCxEFaOPzS8+bd8NldE//1qvQDQpe0=
github.com/ethereum/go-ethereum v1.16.5/go.mod h1:kId9vOtlYg3PZk9VwKbGlQmSACB5ESPTBGT+M9zjmok=
github.com/ethereum/go-ethereum v1.16.7 h1:qeM4TvbrWK0UC0tgkZ7NiRsmBGwsjqc64BHo20U59UQ=
github.com/ethereum/go-ethereum v1.16.7/go.mod h1:Fs6QebQbavneQTYcA39PEKv2+zIjX7rPUZ14DER46wk=
github.com/ethereum/go-verkle v0.2.2 h1:I2W0WjnrFUIzzVPwm8ykY+7pL2d4VhlsePn4j7cnFk8=
github.com/ethereum/go-verkle v0.2.2/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk=
github.com/evstack/ev-node/execution/evm v1.0.0-beta.3 h1:xo0mZz3CJtntP1RPLFDBubBKpNkqStImt9H9N0xysj8=
Expand Down
31 changes: 30 additions & 1 deletion apps/grpc/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/rs/zerolog"
"github.com/spf13/cobra"

"github.com/evstack/ev-node/block"
"github.com/evstack/ev-node/core/da"
"github.com/evstack/ev-node/core/execution"
coresequencer "github.com/evstack/ev-node/core/sequencer"
Expand All @@ -22,6 +23,8 @@ import (
"github.com/evstack/ev-node/pkg/p2p"
"github.com/evstack/ev-node/pkg/p2p/key"
"github.com/evstack/ev-node/pkg/store"
"github.com/evstack/ev-node/sequencers/based"
seqcommon "github.com/evstack/ev-node/sequencers/common"
"github.com/evstack/ev-node/sequencers/single"
)

Expand Down Expand Up @@ -57,7 +60,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, rollcmd.DefaultMaxBlobSize)
daJrpc, err := jsonrpc.NewClient(cmd.Context(), logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, seqcommon.AbsoluteMaxBlobSize)
if err != nil {
return err
}
Expand Down Expand Up @@ -118,6 +121,25 @@ func createSequencer(
nodeConfig config.Config,
genesis genesis.Genesis,
) (coresequencer.Sequencer, error) {
daClient := block.NewDAClient(da, nodeConfig, logger)
fiRetriever := block.NewForcedInclusionRetriever(daClient, genesis, logger)

if nodeConfig.Node.BasedSequencer {
// Based sequencer mode - fetch transactions only from DA
if !nodeConfig.Node.Aggregator {
return nil, fmt.Errorf("based sequencer mode requires aggregator mode to be enabled")
}

basedSeq := based.NewBasedSequencer(fiRetriever, da, nodeConfig, genesis, logger)

logger.Info().
Str("forced_inclusion_namespace", nodeConfig.DA.GetForcedInclusionNamespace()).
Uint64("da_epoch", genesis.DAEpochForcedInclusion).
Msg("based sequencer initialized")

return basedSeq, nil
}

singleMetrics, err := single.NopMetrics()
if err != nil {
return nil, fmt.Errorf("failed to create single sequencer metrics: %w", err)
Expand All @@ -132,11 +154,18 @@ func createSequencer(
nodeConfig.Node.BlockTime.Duration,
singleMetrics,
nodeConfig.Node.Aggregator,
1000,
fiRetriever,
genesis,
)
if err != nil {
return nil, fmt.Errorf("failed to create single sequencer: %w", err)
}

logger.Info().
Str("forced_inclusion_namespace", nodeConfig.DA.GetForcedInclusionNamespace()).
Msg("single sequencer initialized")

return sequencer, nil
}

Expand Down
Loading
Loading