Skip to content

Commit

Permalink
core/parsigdb: gate hash tree root keying behind feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
gsora committed Sep 18, 2024
1 parent 6cb6ab6 commit c1a97df
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/featureset/featureset.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ const (
// The feature gets automatically enabled when the current network is gnosis|chiado,
// unless the user disabled this feature explicitly.
GnosisBlockHotfix Feature = "gnosis_block_hotfix"

// HardenedParSigDB enables keying ParSigDB elements with their hash tree root
// on top of the core.Duty object.
// Since this is a breaking change, we'll gradually enable it in later releases.
HardenedParSigDB Feature = "hardened_par_sig_db"
)

var (
Expand Down
5 changes: 5 additions & 0 deletions core/parsigdb/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"sync"

"github.com/obolnetwork/charon/app/errors"
"github.com/obolnetwork/charon/app/featureset"
"github.com/obolnetwork/charon/app/log"
"github.com/obolnetwork/charon/app/z"
"github.com/obolnetwork/charon/core"
Expand Down Expand Up @@ -236,6 +237,10 @@ func getThresholdMatching(typ core.DutyType, sigs []core.ParSignedData, threshol
// rootFromParSigDataSet returns the MessageRoot of data only if the duty is supported,
// and only if data is not a core.Signature.
func rootFromParSigDataSet(duty core.Duty, data core.ParSignedData) ([32]byte, error) {
if !featureset.Enabled(featureset.HardenedParSigDB) {
return [32]byte{}, nil
}

// known limitation: sync message and contributions might have different hashes,
// ignore them for now.
// signature duties don't have a MessageRoot implementation at all, by design.
Expand Down

0 comments on commit c1a97df

Please sign in to comment.