Commit 8329e9e7 authored by Dev Ojha's avatar Dev Ojha
Browse files

Cherry-pick code fix

parent aa727b5b
Showing with 31 additions and 2 deletions
+31 -2
......@@ -40,6 +40,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## v13.0.0
## v12.0.0
This release includes several cosmwasm-developer and appchain-ecosystem affecting upgrades:
......
......@@ -167,6 +167,11 @@ func orderBeginBlockers(allModuleNames []string) []string {
// OrderEndBlockers returns EndBlockers (crisis, govtypes, staking) with no relative order.
func OrderEndBlockers(allModuleNames []string) []string {
ord := partialord.NewPartialOrdering(allModuleNames)
// Staking must be after gov.
ord.FirstElements(govtypes.ModuleName)
ord.LastElements(stakingtypes.ModuleName)
// only Osmosis modules with endblock code are: twap, crisis, govtypes, staking
// we don't care about the relative ordering between them.
return ord.TotalOrdering()
......
package app
import (
"reflect"
"testing"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"
)
func TestOrderEndBlockers_Determinism(t *testing.T) {
db := dbm.NewMemDB()
app := NewOsmosisApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, 5, simapp.EmptyAppOptions{}, GetWasmEnabledProposals(), EmptyWasmOpts)
for i := 0; i < 1000; i++ {
a := OrderEndBlockers(app.mm.ModuleNames())
b := OrderEndBlockers(app.mm.ModuleNames())
require.True(t, reflect.DeepEqual(a, b))
}
}
......@@ -21,7 +21,7 @@ func NewPartialOrdering(elements []string) PartialOrdering {
copy(elementsCopy, elements)
sort.Strings(elementsCopy)
return PartialOrdering{
dag: dag.NewDAG(elements),
dag: dag.NewDAG(elementsCopy),
firstSealed: false,
lastSealed: false,
}
......
......@@ -26,7 +26,7 @@ func TestAPI(t *testing.T) {
totalOrd := beginBlockOrd.TotalOrdering()
expTotalOrd := []string{
"upgrades", "epochs", "capabilities",
"bank", "staking", "mint", "ibc", "distribution", "ibctransfers",
"bank", "ibc", "mint", "staking", "ibctransfers", "distribution",
"auth", "authz", "wasm",
}
require.Equal(t, expTotalOrd, totalOrd)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment