forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge PR cosmos#4686: v0.36 supply changes to genesis migration
- Loading branch information
1 parent
257d3bf
commit a922dad
Showing
35 changed files
with
1,531 additions
and
1,250 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// DONTCOVER | ||
// nolint | ||
package v0_34 | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
const ( | ||
ModuleName = "auth" | ||
) | ||
|
||
type ( | ||
Params struct { | ||
MaxMemoCharacters uint64 `json:"max_memo_characters"` | ||
TxSigLimit uint64 `json:"tx_sig_limit"` | ||
TxSizeCostPerByte uint64 `json:"tx_size_cost_per_byte"` | ||
SigVerifyCostED25519 uint64 `json:"sig_verify_cost_ed25519"` | ||
SigVerifyCostSecp256k1 uint64 `json:"sig_verify_cost_secp256k1"` | ||
} | ||
|
||
GenesisState struct { | ||
CollectedFees sdk.Coins `json:"collected_fees"` | ||
Params Params `json:"params"` | ||
} | ||
) |
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,14 @@ | ||
// DONTCOVER | ||
// nolint | ||
package v0_36 | ||
|
||
import ( | ||
v034auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v0_34" | ||
) | ||
|
||
// Migrate accepts exported genesis state from v0.34 and migrates it to v0.36 | ||
// genesis state. This migration removes the CollectedFees coins from the old | ||
// FeeCollectorKeeper. | ||
func Migrate(oldGenState v034auth.GenesisState) GenesisState { | ||
return NewGenesisState(oldGenState.Params) | ||
} |
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,25 @@ | ||
package v0_36 | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/types" | ||
v034auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v0_34" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestMigrate(t *testing.T) { | ||
var genesisState GenesisState | ||
require.NotPanics(t, func() { | ||
genesisState = Migrate(v034auth.GenesisState{ | ||
CollectedFees: types.Coins{ | ||
{ | ||
Amount: types.NewInt(10), | ||
Denom: "stake", | ||
}, | ||
}, | ||
Params: v034auth.Params{}, // forwarded structure: filling and checking will be testing a no-op | ||
}) | ||
}) | ||
require.Equal(t, genesisState, GenesisState{Params: v034auth.Params{}}) | ||
} |
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,19 @@ | ||
// DONTCOVER | ||
// nolint | ||
package v0_36 | ||
|
||
import v034auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v0_34" | ||
|
||
const ( | ||
ModuleName = "auth" | ||
) | ||
|
||
type ( | ||
GenesisState struct { | ||
Params v034auth.Params `json:"params"` | ||
} | ||
) | ||
|
||
func NewGenesisState(params v034auth.Params) GenesisState { | ||
return GenesisState{params} | ||
} |
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
Oops, something went wrong.