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: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,22 @@ 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)
- Split cache interface in `CacheManager` and `PendingManager` and create `da` client to easy DA handling. [#2878](https://github.com/evstack/ev-node/pull/2878)
- Improve startup da retrieval height when cache cleared or empty. [#2880](https://github.com/evstack/ev-node/pull/2880)

### Removed

- **BREAKING:** Removed unused and confusing metrics from sequencers and block processing, including sequencer-specific metrics (gas price, blob size, transaction status, pending blocks), channel buffer metrics, overly granular error metrics, block production categorization metrics, and sync lag metrics. Essential metrics for DA submission health, block production, and performance monitoring are retained. [#2904](https://github.com/evstack/ev-node/pull/2904)

## v1.0.0-beta.10

### Added
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 @@ -57,7 +60,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 @@ -103,6 +106,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 @@ -111,6 +116,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
}

sequencer, err := single.NewSequencer(
ctx,
logger,
Expand All @@ -119,11 +143,18 @@ func createSequencer(
[]byte(genesis.ChainID),
nodeConfig.Node.BlockTime.Duration,
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
4 changes: 2 additions & 2 deletions apps/evm/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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/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 @@ -34,7 +34,7 @@ require (
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 Down
4 changes: 2 additions & 2 deletions apps/evm/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -57,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
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 @@ -58,7 +61,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 @@ -119,6 +122,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
}

sequencer, err := single.NewSequencer(
ctx,
logger,
Expand All @@ -127,11 +149,18 @@ func createSequencer(
[]byte(genesis.ChainID),
nodeConfig.Node.BlockTime.Duration,
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
89 changes: 71 additions & 18 deletions apps/testapp/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,24 @@ import (
"fmt"
"path/filepath"

"github.com/ipfs/go-datastore"
"github.com/rs/zerolog"
"github.com/spf13/cobra"

kvexecutor "github.com/evstack/ev-node/apps/testapp/kv"
"github.com/evstack/ev-node/block"
"github.com/evstack/ev-node/core/da"
coresequencer "github.com/evstack/ev-node/core/sequencer"
"github.com/evstack/ev-node/da/jsonrpc"
"github.com/evstack/ev-node/node"
rollcmd "github.com/evstack/ev-node/pkg/cmd"
genesispkg "github.com/evstack/ev-node/pkg/genesis"
"github.com/evstack/ev-node/pkg/cmd"
"github.com/evstack/ev-node/pkg/config"
"github.com/evstack/ev-node/pkg/genesis"
"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 All @@ -25,16 +32,16 @@ var RunCmd = &cobra.Command{
Use: "start",
Aliases: []string{"node", "run"},
Short: "Run the testapp node",
RunE: func(cmd *cobra.Command, args []string) error {
nodeConfig, err := rollcmd.ParseConfig(cmd)
RunE: func(command *cobra.Command, args []string) error {
nodeConfig, err := cmd.ParseConfig(command)
if err != nil {
return err
}

logger := rollcmd.SetupLogger(nodeConfig.Log)
logger := cmd.SetupLogger(nodeConfig.Log)

// Get KV endpoint flag
kvEndpoint, _ := cmd.Flags().GetString(flagKVEndpoint)
kvEndpoint, _ := command.Flags().GetString(flagKVEndpoint)
if kvEndpoint == "" {
logger.Info().Msg("KV endpoint flag not set, using default from http_server")
}
Expand All @@ -53,7 +60,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, rollcmd.DefaultMaxBlobSize)
daJrpc, err := jsonrpc.NewClient(ctx, logger, nodeConfig.DA.Address, nodeConfig.DA.AuthToken, seqcommon.AbsoluteMaxBlobSize)
if err != nil {
return err
}
Expand All @@ -80,7 +87,7 @@ var RunCmd = &cobra.Command{
}

genesisPath := filepath.Join(filepath.Dir(nodeConfig.ConfigPath()), "genesis.json")
genesis, err := genesispkg.LoadGenesis(genesisPath)
genesis, err := genesis.LoadGenesis(genesisPath)
if err != nil {
return fmt.Errorf("failed to load genesis: %w", err)
}
Expand All @@ -89,15 +96,8 @@ var RunCmd = &cobra.Command{
logger.Warn().Msg("da_start_height is not set in genesis.json, ask your chain developer")
}

sequencer, err := single.NewSequencer(
ctx,
logger,
datastore,
&daJrpc.DA,
[]byte(genesis.ChainID),
nodeConfig.Node.BlockTime.Duration,
nodeConfig.Node.Aggregator,
)
// Create sequencer based on configuration
sequencer, err := createSequencer(ctx, logger, datastore, &daJrpc.DA, nodeConfig, genesis)
if err != nil {
return err
}
Expand All @@ -107,6 +107,59 @@ var RunCmd = &cobra.Command{
return err
}

return rollcmd.StartNode(logger, cmd, executor, sequencer, &daJrpc.DA, p2pClient, datastore, nodeConfig, genesis, node.NodeOptions{})
return cmd.StartNode(logger, command, executor, sequencer, &daJrpc.DA, p2pClient, datastore, nodeConfig, genesis, node.NodeOptions{})
},
}

// 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,
datastore datastore.Batching,
da da.DA,
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
}

sequencer, err := single.NewSequencer(
ctx,
logger,
datastore,
da,
[]byte(genesis.ChainID),
nodeConfig.Node.BlockTime.Duration,
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
}
4 changes: 2 additions & 2 deletions apps/testapp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ require (
github.com/evstack/ev-node/core v1.0.0-beta.5
github.com/evstack/ev-node/da v0.0.0-00010101000000-000000000000
github.com/ipfs/go-datastore v0.9.0
github.com/rs/zerolog v1.34.0
github.com/spf13/cobra v1.10.1
github.com/stretchr/testify v1.11.1
)
Expand Down Expand Up @@ -79,7 +80,7 @@ require (
github.com/libp2p/go-reuseport v0.4.0 // indirect
github.com/libp2p/go-yamux/v5 v5.0.1 // indirect
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/miekg/dns v1.1.68 // indirect
github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect
Expand Down Expand Up @@ -129,7 +130,6 @@ require (
github.com/quic-go/qpack v0.5.1 // indirect
github.com/quic-go/quic-go v0.55.0 // indirect
github.com/quic-go/webtransport-go v0.9.0 // indirect
github.com/rs/zerolog v1.34.0 // indirect
github.com/sagikazarmark/locafero v0.11.0 // indirect
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
Expand Down
3 changes: 2 additions & 1 deletion apps/testapp/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,9 @@ github.com/marcopolo/simnet v0.0.1 h1:rSMslhPz6q9IvJeFWDoMGxMIrlsbXau3NkuIXHGJxf
github.com/marcopolo/simnet v0.0.1/go.mod h1:WDaQkgLAjqDUEBAOXz22+1j6wXKfGlC5sD5XWt3ddOs=
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd h1:br0buuQ854V8u83wA0rVZ8ttrq5CpaPZdvrK0LP2lOk=
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd/go.mod h1:QuCEs1Nt24+FYQEqAAncTDPJIuGs+LxK1MCiFL25pMU=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
Expand Down
9 changes: 9 additions & 0 deletions block/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,15 @@ func NewAggregatorComponents(
return nil, fmt.Errorf("failed to create reaper: %w", err)
}

if config.Node.BasedSequencer { // no submissions needed for bases sequencer
return &Components{
Executor: executor,
Reaper: reaper,
Cache: cacheManager,
errorCh: errorCh,
}, nil
}

// Create DA client and submitter for aggregator nodes (with signer for submission)
daClient := NewDAClient(da, config, logger)
daSubmitter := submitting.NewDASubmitter(daClient, config, genesis, blockOpts, metrics, logger)
Expand Down
Loading
Loading