-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5760 from oasisprotocol/peternose/internal/consen…
…sus-software-version go/consensus: Add the latest consensus-breaking software version
- Loading branch information
Showing
5 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
go/consensus: Add the latest consensus-breaking software feature version | ||
|
||
Useful for enabling new consensus-breaking features with upcoming releases. | ||
A feature is enabled if the latest consensus-breaking software feature | ||
version is not lower than the version in which the feature is to be enabled. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package api | ||
|
||
import ( | ||
"fmt" | ||
|
||
consensusState "github.com/oasisprotocol/oasis-core/go/consensus/cometbft/abci/state" | ||
tmapi "github.com/oasisprotocol/oasis-core/go/consensus/cometbft/api" | ||
) | ||
|
||
// IsFeatureVersion returns true iff the consensus feature version is high | ||
// enough for the feature to be enabled. | ||
func IsFeatureVersion(ctx *tmapi.Context, minVersion string) (bool, error) { | ||
// Consensus parameters. | ||
consState := consensusState.NewMutableState(ctx.State()) | ||
consParams, err := consState.ConsensusParameters(ctx) | ||
if err != nil { | ||
return false, fmt.Errorf("failed to load consensus parameters: %w", err) | ||
} | ||
|
||
return consParams.IsFeatureVersion(minVersion) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters