Skip to content

Commit

Permalink
core/aggsigdb: refactor MemDB (#2950)
Browse files Browse the repository at this point in the history
Introduce MemDBV2: instead of relying on a complex system based on channels and read/write queries, simply store objects in a `sync/map`.

Simpler to read and potentially faster in systems in which there's a high rate of goroutine contention.

Add the `aggsigdb_v2` feature flag to enable/disable this feature.

category: refactor
ticket: #1951  
feature_flag: aggsigdb_v2
  • Loading branch information
gsora authored Mar 14, 2024
1 parent f8836b8 commit 8704789
Show file tree
Hide file tree
Showing 6 changed files with 409 additions and 147 deletions.
7 changes: 6 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,12 @@ func wireCoreWorkflow(ctx context.Context, life *lifecycle.Manager, conf Config,
return err
}

aggSigDB := aggsigdb.NewMemDB(deadlinerFunc("aggsigdb"))
var aggSigDB core.AggSigDB
if featureset.Enabled(featureset.AggSigDBV2) {
aggSigDB = aggsigdb.NewMemDBV2(deadlinerFunc("aggsigdb"))
} else {
aggSigDB = aggsigdb.NewMemDB(deadlinerFunc("aggsigdb"))
}

broadcaster, err := bcast.New(ctx, eth2Cl)
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions app/featureset/featureset.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ const (
// ConsensusParticipate enables consensus participate feature in order to participate in an ongoing consensus
// round while still waiting for an unsigned data from beacon node.
ConsensusParticipate Feature = "consensus_participate"

AggSigDBV2 Feature = "aggsigdb_v2"
)

var (
Expand All @@ -42,6 +44,7 @@ var (
MockAlpha: statusAlpha,
EagerDoubleLinear: statusAlpha,
ConsensusParticipate: statusAlpha,
AggSigDBV2: statusAlpha,
// Add all features and there status here.
}

Expand Down
Loading

0 comments on commit 8704789

Please sign in to comment.