mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-23 23:05:18 +00:00
Auth migration (#667)
* draft auth migration from kava-3 to kava-4 * add harvest module accounts to auth state * check account state equality * add supply reconciliation to auth migration * add gov migration * add exact json test (#674) Co-authored-by: rhuairahrighairigh <ruaridh.odonnell@gmail.com> * fix: check err variable * correct import path * feat: add hard accounts Co-authored-by: rhuairahrighairigh <ruaridh.odonnell@gmail.com>
This commit is contained in:
parent
ed7ce81e30
commit
495898170c
66
migrate/v0_11/legacy/cosmos-sdk/v0.38.5/auth/account.go
Normal file
66
migrate/v0_11/legacy/cosmos-sdk/v0.38.5/auth/account.go
Normal file
@ -0,0 +1,66 @@
|
||||
package v38_5
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
// BaseAccount - a base account structure.
|
||||
// This can be extended by embedding within in your AppAccount.
|
||||
// However one doesn't have to use BaseAccount as long as your struct
|
||||
// implements Account.
|
||||
type BaseAccount struct {
|
||||
Address sdk.AccAddress `json:"address" yaml:"address"`
|
||||
Coins sdk.Coins `json:"coins" yaml:"coins"`
|
||||
PubKey crypto.PubKey `json:"public_key" yaml:"public_key"`
|
||||
AccountNumber uint64 `json:"account_number" yaml:"account_number"`
|
||||
Sequence uint64 `json:"sequence" yaml:"sequence"`
|
||||
}
|
||||
|
||||
// NewBaseAccount creates a new BaseAccount object
|
||||
func NewBaseAccount(address sdk.AccAddress, coins sdk.Coins,
|
||||
pubKey crypto.PubKey, accountNumber uint64, sequence uint64) *BaseAccount {
|
||||
|
||||
return &BaseAccount{
|
||||
Address: address,
|
||||
Coins: coins,
|
||||
PubKey: pubKey,
|
||||
AccountNumber: accountNumber,
|
||||
Sequence: sequence,
|
||||
}
|
||||
}
|
||||
|
||||
type baseAccountPretty struct {
|
||||
Address sdk.AccAddress `json:"address" yaml:"address"`
|
||||
Coins sdk.Coins `json:"coins" yaml:"coins"`
|
||||
PubKey string `json:"public_key" yaml:"public_key"`
|
||||
AccountNumber uint64 `json:"account_number" yaml:"account_number"`
|
||||
Sequence uint64 `json:"sequence" yaml:"sequence"`
|
||||
}
|
||||
|
||||
// UnmarshalJSON unmarshals raw JSON bytes into a BaseAccount.
|
||||
func (acc *BaseAccount) UnmarshalJSON(bz []byte) error {
|
||||
var alias baseAccountPretty
|
||||
if err := json.Unmarshal(bz, &alias); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if alias.PubKey != "" {
|
||||
pk, err := sdk.GetPubKeyFromBech32(sdk.Bech32PubKeyTypeAccPub, alias.PubKey)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
acc.PubKey = pk
|
||||
}
|
||||
|
||||
acc.Address = alias.Address
|
||||
acc.Coins = alias.Coins
|
||||
acc.AccountNumber = alias.AccountNumber
|
||||
acc.Sequence = alias.Sequence
|
||||
|
||||
return nil
|
||||
}
|
14
migrate/v0_11/legacy/cosmos-sdk/v0.38.5/auth/auth_codec.go
Normal file
14
migrate/v0_11/legacy/cosmos-sdk/v0.38.5/auth/auth_codec.go
Normal file
@ -0,0 +1,14 @@
|
||||
package v38_5
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
)
|
||||
|
||||
const ModuleName = "auth"
|
||||
|
||||
// RegisterCodec registers concrete types on the codec
|
||||
func RegisterCodec(cdc *codec.Codec) {
|
||||
cdc.RegisterInterface((*GenesisAccount)(nil), nil)
|
||||
cdc.RegisterInterface((*Account)(nil), nil)
|
||||
cdc.RegisterConcrete(&BaseAccount{}, "cosmos-sdk/Account", nil)
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package v38_5
|
||||
|
||||
// Account is an interface used to store coins at a given address within state.
|
||||
// It presumes a notion of sequence numbers for replay protection,
|
||||
// a notion of account numbers for replay protection for previously pruned accounts,
|
||||
// and a pubkey for authentication purposes.
|
||||
//
|
||||
// Many complex conditions can be used in the concrete struct which implements Account.
|
||||
type Account interface {
|
||||
}
|
||||
|
||||
// GenesisAccounts defines a slice of GenesisAccount objects
|
||||
type GenesisAccounts []GenesisAccount
|
||||
|
||||
// GenesisAccount defines a genesis account that embeds an Account with validation capabilities.
|
||||
type GenesisAccount interface {
|
||||
Account
|
||||
}
|
7
migrate/v0_11/legacy/cosmos-sdk/v0.38.5/auth/genesis.go
Normal file
7
migrate/v0_11/legacy/cosmos-sdk/v0.38.5/auth/genesis.go
Normal file
@ -0,0 +1,7 @@
|
||||
package v38_5
|
||||
|
||||
// GenesisState - all auth state that must be provided at genesis
|
||||
type GenesisState struct {
|
||||
Params Params `json:"params" yaml:"params"`
|
||||
Accounts GenesisAccounts `json:"accounts" yaml:"accounts"`
|
||||
}
|
10
migrate/v0_11/legacy/cosmos-sdk/v0.38.5/auth/params.go
Normal file
10
migrate/v0_11/legacy/cosmos-sdk/v0.38.5/auth/params.go
Normal file
@ -0,0 +1,10 @@
|
||||
package v38_5
|
||||
|
||||
// Params defines the parameters for the auth module.
|
||||
type Params struct {
|
||||
MaxMemoCharacters uint64 `json:"max_memo_characters" yaml:"max_memo_characters"`
|
||||
TxSigLimit uint64 `json:"tx_sig_limit" yaml:"tx_sig_limit"`
|
||||
TxSizeCostPerByte uint64 `json:"tx_size_cost_per_byte" yaml:"tx_size_cost_per_byte"`
|
||||
SigVerifyCostED25519 uint64 `json:"sig_verify_cost_ed25519" yaml:"sig_verify_cost_ed25519"`
|
||||
SigVerifyCostSecp256k1 uint64 `json:"sig_verify_cost_secp256k1" yaml:"sig_verify_cost_secp256k1"`
|
||||
}
|
14
migrate/v0_11/legacy/cosmos-sdk/v0.38.5/auth/period.go
Normal file
14
migrate/v0_11/legacy/cosmos-sdk/v0.38.5/auth/period.go
Normal file
@ -0,0 +1,14 @@
|
||||
package v38_5
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
// Period defines a length of time and amount of coins that will vest
|
||||
type Period struct {
|
||||
Length int64 `json:"length" yaml:"length"` // length of the period, in seconds
|
||||
Amount sdk.Coins `json:"amount" yaml:"amount"` // amount of coins vesting during this period
|
||||
}
|
||||
|
||||
// Periods stores all vesting periods passed as part of a PeriodicVestingAccount
|
||||
type Periods []Period
|
194
migrate/v0_11/legacy/cosmos-sdk/v0.38.5/auth/vesting_account.go
Normal file
194
migrate/v0_11/legacy/cosmos-sdk/v0.38.5/auth/vesting_account.go
Normal file
@ -0,0 +1,194 @@
|
||||
package v38_5
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
)
|
||||
|
||||
// VestingAccount defines an account type that vests coins via a vesting schedule.
|
||||
type VestingAccount interface {
|
||||
Account
|
||||
}
|
||||
|
||||
// BaseVestingAccount implements the VestingAccount interface. It contains all
|
||||
// the necessary fields needed for any vesting account implementation.
|
||||
type BaseVestingAccount struct {
|
||||
*BaseAccount
|
||||
|
||||
OriginalVesting sdk.Coins `json:"original_vesting" yaml:"original_vesting"` // coins in account upon initialization
|
||||
DelegatedFree sdk.Coins `json:"delegated_free" yaml:"delegated_free"` // coins that are vested and delegated
|
||||
DelegatedVesting sdk.Coins `json:"delegated_vesting" yaml:"delegated_vesting"` // coins that vesting and delegated
|
||||
EndTime int64 `json:"end_time" yaml:"end_time"` // when the coins become unlocked
|
||||
}
|
||||
|
||||
type vestingAccountPretty struct {
|
||||
Address sdk.AccAddress `json:"address" yaml:"address"`
|
||||
Coins sdk.Coins `json:"coins" yaml:"coins"`
|
||||
PubKey string `json:"public_key" yaml:"public_key"`
|
||||
AccountNumber uint64 `json:"account_number" yaml:"account_number"`
|
||||
Sequence uint64 `json:"sequence" yaml:"sequence"`
|
||||
OriginalVesting sdk.Coins `json:"original_vesting" yaml:"original_vesting"`
|
||||
DelegatedFree sdk.Coins `json:"delegated_free" yaml:"delegated_free"`
|
||||
DelegatedVesting sdk.Coins `json:"delegated_vesting" yaml:"delegated_vesting"`
|
||||
EndTime int64 `json:"end_time" yaml:"end_time"`
|
||||
|
||||
// custom fields based on concrete vesting type which can be omitted
|
||||
StartTime int64 `json:"start_time,omitempty" yaml:"start_time,omitempty"`
|
||||
VestingPeriods Periods `json:"vesting_periods,omitempty" yaml:"vesting_periods,omitempty"`
|
||||
}
|
||||
|
||||
// UnmarshalJSON unmarshals raw JSON bytes into a BaseVestingAccount.
|
||||
func (bva *BaseVestingAccount) UnmarshalJSON(bz []byte) error {
|
||||
var alias vestingAccountPretty
|
||||
if err := json.Unmarshal(bz, &alias); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var (
|
||||
pk crypto.PubKey
|
||||
err error
|
||||
)
|
||||
|
||||
if alias.PubKey != "" {
|
||||
pk, err = sdk.GetPubKeyFromBech32(sdk.Bech32PubKeyTypeAccPub, alias.PubKey)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
bva.BaseAccount = NewBaseAccount(alias.Address, alias.Coins, pk, alias.AccountNumber, alias.Sequence)
|
||||
bva.OriginalVesting = alias.OriginalVesting
|
||||
bva.DelegatedFree = alias.DelegatedFree
|
||||
bva.DelegatedVesting = alias.DelegatedVesting
|
||||
bva.EndTime = alias.EndTime
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContinuousVestingAccount implements the VestingAccount interface. It
|
||||
// continuously vests by unlocking coins linearly with respect to time.
|
||||
type ContinuousVestingAccount struct {
|
||||
*BaseVestingAccount
|
||||
|
||||
StartTime int64 `json:"start_time" yaml:"start_time"` // when the coins start to vest
|
||||
}
|
||||
|
||||
// UnmarshalJSON unmarshals raw JSON bytes into a ContinuousVestingAccount.
|
||||
func (cva *ContinuousVestingAccount) UnmarshalJSON(bz []byte) error {
|
||||
var alias vestingAccountPretty
|
||||
if err := json.Unmarshal(bz, &alias); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var (
|
||||
pk crypto.PubKey
|
||||
err error
|
||||
)
|
||||
|
||||
if alias.PubKey != "" {
|
||||
pk, err = sdk.GetPubKeyFromBech32(sdk.Bech32PubKeyTypeAccPub, alias.PubKey)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
cva.BaseVestingAccount = &BaseVestingAccount{
|
||||
BaseAccount: NewBaseAccount(alias.Address, alias.Coins, pk, alias.AccountNumber, alias.Sequence),
|
||||
OriginalVesting: alias.OriginalVesting,
|
||||
DelegatedFree: alias.DelegatedFree,
|
||||
DelegatedVesting: alias.DelegatedVesting,
|
||||
EndTime: alias.EndTime,
|
||||
}
|
||||
cva.StartTime = alias.StartTime
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// PeriodicVestingAccount implements the VestingAccount interface. It
|
||||
// periodically vests by unlocking coins during each specified period
|
||||
type PeriodicVestingAccount struct {
|
||||
*BaseVestingAccount
|
||||
StartTime int64 `json:"start_time" yaml:"start_time"` // when the coins start to vest
|
||||
VestingPeriods Periods `json:"vesting_periods" yaml:"vesting_periods"` // the vesting schedule
|
||||
}
|
||||
|
||||
// NewPeriodicVestingAccountRaw creates a new PeriodicVestingAccount object from BaseVestingAccount
|
||||
func NewPeriodicVestingAccountRaw(bva *BaseVestingAccount, startTime int64, periods Periods) *PeriodicVestingAccount {
|
||||
return &PeriodicVestingAccount{
|
||||
BaseVestingAccount: bva,
|
||||
StartTime: startTime,
|
||||
VestingPeriods: periods,
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalJSON unmarshals raw JSON bytes into a PeriodicVestingAccount.
|
||||
func (pva *PeriodicVestingAccount) UnmarshalJSON(bz []byte) error {
|
||||
var alias vestingAccountPretty
|
||||
if err := json.Unmarshal(bz, &alias); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var (
|
||||
pk crypto.PubKey
|
||||
err error
|
||||
)
|
||||
|
||||
if alias.PubKey != "" {
|
||||
pk, err = sdk.GetPubKeyFromBech32(sdk.Bech32PubKeyTypeAccPub, alias.PubKey)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
pva.BaseVestingAccount = &BaseVestingAccount{
|
||||
BaseAccount: NewBaseAccount(alias.Address, alias.Coins, pk, alias.AccountNumber, alias.Sequence),
|
||||
OriginalVesting: alias.OriginalVesting,
|
||||
DelegatedFree: alias.DelegatedFree,
|
||||
DelegatedVesting: alias.DelegatedVesting,
|
||||
EndTime: alias.EndTime,
|
||||
}
|
||||
pva.StartTime = alias.StartTime
|
||||
pva.VestingPeriods = alias.VestingPeriods
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// DelayedVestingAccount implements the VestingAccount interface. It vests all
|
||||
// coins after a specific time, but non prior. In other words, it keeps them
|
||||
// locked until a specified time.
|
||||
type DelayedVestingAccount struct {
|
||||
*BaseVestingAccount
|
||||
}
|
||||
|
||||
// UnmarshalJSON unmarshals raw JSON bytes into a DelayedVestingAccount.
|
||||
func (dva *DelayedVestingAccount) UnmarshalJSON(bz []byte) error {
|
||||
var alias vestingAccountPretty
|
||||
if err := json.Unmarshal(bz, &alias); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var (
|
||||
pk crypto.PubKey
|
||||
err error
|
||||
)
|
||||
|
||||
if alias.PubKey != "" {
|
||||
pk, err = sdk.GetPubKeyFromBech32(sdk.Bech32PubKeyTypeAccPub, alias.PubKey)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
dva.BaseVestingAccount = &BaseVestingAccount{
|
||||
BaseAccount: NewBaseAccount(alias.Address, alias.Coins, pk, alias.AccountNumber, alias.Sequence),
|
||||
OriginalVesting: alias.OriginalVesting,
|
||||
DelegatedFree: alias.DelegatedFree,
|
||||
DelegatedVesting: alias.DelegatedVesting,
|
||||
EndTime: alias.EndTime,
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package v38_5
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
)
|
||||
|
||||
// RegisterCodecVesting registers concrete types on the codec
|
||||
func RegisterCodecVesting(cdc *codec.Codec) { // renamed to avoid conflict as packages are combined
|
||||
cdc.RegisterInterface((*VestingAccount)(nil), nil)
|
||||
cdc.RegisterConcrete(&BaseVestingAccount{}, "cosmos-sdk/BaseVestingAccount", nil)
|
||||
cdc.RegisterConcrete(&ContinuousVestingAccount{}, "cosmos-sdk/ContinuousVestingAccount", nil)
|
||||
cdc.RegisterConcrete(&DelayedVestingAccount{}, "cosmos-sdk/DelayedVestingAccount", nil)
|
||||
cdc.RegisterConcrete(&PeriodicVestingAccount{}, "cosmos-sdk/PeriodicVestingAccount", nil)
|
||||
}
|
46
migrate/v0_11/legacy/cosmos-sdk/v0.38.5/supply/types.go
Normal file
46
migrate/v0_11/legacy/cosmos-sdk/v0.38.5/supply/types.go
Normal file
@ -0,0 +1,46 @@
|
||||
package v38_5
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
authtypes "github.com/kava-labs/kava/migrate/v0_11/legacy/cosmos-sdk/v0.38.5/auth"
|
||||
)
|
||||
|
||||
// ModuleAccount defines an account for modules that holds coins on a pool
|
||||
type ModuleAccount struct {
|
||||
*authtypes.BaseAccount
|
||||
Name string `json:"name" yaml:"name"` // name of the module
|
||||
Permissions []string `json:"permissions" yaml:"permissions"` // permissions of module account
|
||||
}
|
||||
|
||||
type moduleAccountPretty struct {
|
||||
Address sdk.AccAddress `json:"address" yaml:"address"`
|
||||
Coins sdk.Coins `json:"coins" yaml:"coins"`
|
||||
PubKey string `json:"public_key" yaml:"public_key"`
|
||||
AccountNumber uint64 `json:"account_number" yaml:"account_number"`
|
||||
Sequence uint64 `json:"sequence" yaml:"sequence"`
|
||||
Name string `json:"name" yaml:"name"`
|
||||
Permissions []string `json:"permissions" yaml:"permissions"`
|
||||
}
|
||||
|
||||
// UnmarshalJSON unmarshals raw JSON bytes into a ModuleAccount.
|
||||
func (ma *ModuleAccount) UnmarshalJSON(bz []byte) error {
|
||||
var alias moduleAccountPretty
|
||||
if err := json.Unmarshal(bz, &alias); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ma.BaseAccount = authtypes.NewBaseAccount(alias.Address, alias.Coins, nil, alias.AccountNumber, alias.Sequence)
|
||||
ma.Name = alias.Name
|
||||
ma.Permissions = alias.Permissions
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterCodec registers the account types and interface
|
||||
func RegisterCodec(cdc *codec.Codec) {
|
||||
cdc.RegisterConcrete(&ModuleAccount{}, "cosmos-sdk/ModuleAccount", nil)
|
||||
}
|
@ -1,10 +1,19 @@
|
||||
package v0_11
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
v39_1auth "github.com/cosmos/cosmos-sdk/x/auth"
|
||||
v39_1authexported "github.com/cosmos/cosmos-sdk/x/auth/exported"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
|
||||
v39_1vesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
|
||||
v39_1gov "github.com/cosmos/cosmos-sdk/x/gov"
|
||||
v39_1supply "github.com/cosmos/cosmos-sdk/x/supply"
|
||||
|
||||
v38_5auth "github.com/kava-labs/kava/migrate/v0_11/legacy/cosmos-sdk/v0.38.5/auth"
|
||||
v38_5supply "github.com/kava-labs/kava/migrate/v0_11/legacy/cosmos-sdk/v0.38.5/supply"
|
||||
v0_11bep3 "github.com/kava-labs/kava/x/bep3/legacy/v0_11"
|
||||
v0_9bep3 "github.com/kava-labs/kava/x/bep3/legacy/v0_9"
|
||||
v0_11cdp "github.com/kava-labs/kava/x/cdp"
|
||||
@ -14,8 +23,13 @@ import (
|
||||
v0_9incentive "github.com/kava-labs/kava/x/incentive/legacy/v0_9"
|
||||
v0_11pricefeed "github.com/kava-labs/kava/x/pricefeed"
|
||||
v0_9pricefeed "github.com/kava-labs/kava/x/pricefeed/legacy/v0_9"
|
||||
v0_11validator_vesting "github.com/kava-labs/kava/x/validator-vesting"
|
||||
v0_9validator_vesting "github.com/kava-labs/kava/x/validator-vesting/legacy/v0_9"
|
||||
)
|
||||
|
||||
var deputyBnbBalance sdk.Coin
|
||||
var hardBalance sdk.Coin
|
||||
|
||||
// MigrateBep3 migrates from a v0.9 (or v0.10) bep3 genesis state to a v0.11 bep3 genesis state
|
||||
func MigrateBep3(oldGenState v0_9bep3.GenesisState) v0_11bep3.GenesisState {
|
||||
var assetParams v0_11bep3.AssetParams
|
||||
@ -73,6 +87,172 @@ func MigrateBep3(oldGenState v0_9bep3.GenesisState) v0_11bep3.GenesisState {
|
||||
}
|
||||
}
|
||||
|
||||
// MigrateAuth migrates from a v0.38.5 auth genesis state to a v0.39.1 auth genesis state
|
||||
func MigrateAuth(oldGenState v38_5auth.GenesisState) v39_1auth.GenesisState {
|
||||
var newAccounts v39_1authexported.GenesisAccounts
|
||||
deputyAddr, err := sdk.AccAddressFromBech32("kava1r4v2zdhdalfj2ydazallqvrus9fkphmglhn6u6")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for _, account := range oldGenState.Accounts {
|
||||
switch acc := account.(type) {
|
||||
case *v38_5auth.BaseAccount:
|
||||
a := v39_1auth.BaseAccount(*acc)
|
||||
// Remove deputy bnb
|
||||
if a.GetAddress().Equals(deputyAddr) {
|
||||
deputyBnbBalance = sdk.NewCoin("bnb", a.GetCoins().AmountOf("bnb"))
|
||||
err := a.SetCoins(a.GetCoins().Sub(sdk.NewCoins(sdk.NewCoin("bnb", a.GetCoins().AmountOf("bnb")))))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
newAccounts = append(newAccounts, v39_1authexported.GenesisAccount(&a))
|
||||
|
||||
case *v38_5auth.BaseVestingAccount:
|
||||
ba := v39_1auth.BaseAccount(*(acc.BaseAccount))
|
||||
bva := v39_1vesting.BaseVestingAccount{
|
||||
BaseAccount: &ba,
|
||||
OriginalVesting: acc.OriginalVesting,
|
||||
DelegatedFree: acc.DelegatedFree,
|
||||
DelegatedVesting: acc.DelegatedVesting,
|
||||
EndTime: acc.EndTime,
|
||||
}
|
||||
newAccounts = append(newAccounts, v39_1authexported.GenesisAccount(&bva))
|
||||
|
||||
case *v38_5auth.ContinuousVestingAccount:
|
||||
ba := v39_1auth.BaseAccount(*(acc.BaseVestingAccount.BaseAccount))
|
||||
bva := v39_1vesting.BaseVestingAccount{
|
||||
BaseAccount: &ba,
|
||||
OriginalVesting: acc.BaseVestingAccount.OriginalVesting,
|
||||
DelegatedFree: acc.BaseVestingAccount.DelegatedFree,
|
||||
DelegatedVesting: acc.BaseVestingAccount.DelegatedVesting,
|
||||
EndTime: acc.BaseVestingAccount.EndTime,
|
||||
}
|
||||
cva := v39_1vesting.ContinuousVestingAccount{
|
||||
BaseVestingAccount: &bva,
|
||||
StartTime: acc.StartTime,
|
||||
}
|
||||
newAccounts = append(newAccounts, v39_1authexported.GenesisAccount(&cva))
|
||||
|
||||
case *v38_5auth.DelayedVestingAccount:
|
||||
ba := v39_1auth.BaseAccount(*(acc.BaseVestingAccount.BaseAccount))
|
||||
bva := v39_1vesting.BaseVestingAccount{
|
||||
BaseAccount: &ba,
|
||||
OriginalVesting: acc.BaseVestingAccount.OriginalVesting,
|
||||
DelegatedFree: acc.BaseVestingAccount.DelegatedFree,
|
||||
DelegatedVesting: acc.BaseVestingAccount.DelegatedVesting,
|
||||
EndTime: acc.BaseVestingAccount.EndTime,
|
||||
}
|
||||
dva := v39_1vesting.DelayedVestingAccount{
|
||||
BaseVestingAccount: &bva,
|
||||
}
|
||||
newAccounts = append(newAccounts, v39_1authexported.GenesisAccount(&dva))
|
||||
|
||||
case *v38_5auth.PeriodicVestingAccount:
|
||||
ba := v39_1auth.BaseAccount(*(acc.BaseVestingAccount.BaseAccount))
|
||||
bva := v39_1vesting.BaseVestingAccount{
|
||||
BaseAccount: &ba,
|
||||
OriginalVesting: acc.BaseVestingAccount.OriginalVesting,
|
||||
DelegatedFree: acc.BaseVestingAccount.DelegatedFree,
|
||||
DelegatedVesting: acc.BaseVestingAccount.DelegatedVesting,
|
||||
EndTime: acc.BaseVestingAccount.EndTime,
|
||||
}
|
||||
var newPeriods v39_1vesting.Periods
|
||||
for _, p := range acc.VestingPeriods {
|
||||
newPeriods = append(newPeriods, v39_1vesting.Period(p))
|
||||
}
|
||||
pva := v39_1vesting.PeriodicVestingAccount{
|
||||
BaseVestingAccount: &bva,
|
||||
StartTime: acc.StartTime,
|
||||
VestingPeriods: newPeriods,
|
||||
}
|
||||
newAccounts = append(newAccounts, v39_1authexported.GenesisAccount(&pva))
|
||||
|
||||
case *v38_5supply.ModuleAccount:
|
||||
ba := v39_1auth.BaseAccount(*(acc.BaseAccount))
|
||||
ma := v39_1supply.ModuleAccount{
|
||||
BaseAccount: &ba,
|
||||
Name: acc.Name,
|
||||
Permissions: acc.Permissions,
|
||||
}
|
||||
newAccounts = append(newAccounts, v39_1authexported.GenesisAccount(&ma))
|
||||
|
||||
case *v0_9validator_vesting.ValidatorVestingAccount:
|
||||
ba := v39_1auth.BaseAccount(*(acc.BaseAccount))
|
||||
bva := v39_1vesting.BaseVestingAccount{
|
||||
BaseAccount: &ba,
|
||||
OriginalVesting: acc.BaseVestingAccount.OriginalVesting,
|
||||
DelegatedFree: acc.BaseVestingAccount.DelegatedFree,
|
||||
DelegatedVesting: acc.BaseVestingAccount.DelegatedVesting,
|
||||
EndTime: acc.BaseVestingAccount.EndTime,
|
||||
}
|
||||
var newPeriods v39_1vesting.Periods
|
||||
for _, p := range acc.VestingPeriods {
|
||||
newPeriods = append(newPeriods, v39_1vesting.Period(p))
|
||||
}
|
||||
pva := v39_1vesting.PeriodicVestingAccount{
|
||||
BaseVestingAccount: &bva,
|
||||
StartTime: acc.StartTime,
|
||||
VestingPeriods: newPeriods,
|
||||
}
|
||||
var newVestingProgress []v0_11validator_vesting.VestingProgress
|
||||
for _, p := range acc.VestingPeriodProgress {
|
||||
newVestingProgress = append(newVestingProgress, v0_11validator_vesting.VestingProgress(p))
|
||||
}
|
||||
vva := v0_11validator_vesting.ValidatorVestingAccount{
|
||||
PeriodicVestingAccount: &pva,
|
||||
ValidatorAddress: acc.ValidatorAddress,
|
||||
ReturnAddress: acc.ReturnAddress,
|
||||
SigningThreshold: acc.SigningThreshold,
|
||||
CurrentPeriodProgress: v0_11validator_vesting.CurrentPeriodProgress(acc.CurrentPeriodProgress),
|
||||
VestingPeriodProgress: newVestingProgress,
|
||||
DebtAfterFailedVesting: acc.DebtAfterFailedVesting,
|
||||
}
|
||||
newAccounts = append(newAccounts, v39_1authexported.GenesisAccount(&vva))
|
||||
|
||||
default:
|
||||
panic(fmt.Sprintf("unrecognized account type: %T", acc))
|
||||
}
|
||||
}
|
||||
|
||||
// ---- add harvest module accounts -------
|
||||
lpMacc := v39_1supply.NewEmptyModuleAccount(v0_11harvest.LPAccount, v39_1supply.Minter, v39_1supply.Burner)
|
||||
err = lpMacc.SetCoins(sdk.NewCoins(sdk.NewCoin("hard", sdk.NewInt(80000000000000))))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
newAccounts = append(newAccounts, v39_1authexported.GenesisAccount(lpMacc))
|
||||
delegatorMacc := v39_1supply.NewEmptyModuleAccount(v0_11harvest.DelegatorAccount, v39_1supply.Minter, v39_1supply.Burner)
|
||||
err = delegatorMacc.SetCoins(sdk.NewCoins(sdk.NewCoin("hard", sdk.NewInt(40000000000000))))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
newAccounts = append(newAccounts, v39_1authexported.GenesisAccount(delegatorMacc))
|
||||
hardBalance = sdk.NewCoin("hard", sdk.NewInt(200000000000000))
|
||||
|
||||
hardTeam := createHardTeamVestingAccount()
|
||||
hardTreasury := createHardTreasuryVestingAccount()
|
||||
hardIEO := createHardIEOAccount()
|
||||
newAccounts = append(newAccounts, hardTeam, hardTreasury, &hardIEO)
|
||||
|
||||
return v39_1auth.NewGenesisState(v39_1auth.Params(oldGenState.Params), newAccounts)
|
||||
|
||||
}
|
||||
|
||||
// MigrateSupply reconciles supply from kava-3 to kava-4
|
||||
// deputy balance of bnb coins is removed (deputy now mints coins)
|
||||
// hard token supply is added
|
||||
func MigrateSupply(oldGenState v39_1supply.GenesisState, deputyBalance sdk.Coin, hardBalance sdk.Coin) v39_1supply.GenesisState {
|
||||
oldGenState.Supply = oldGenState.Supply.Sub(sdk.Coins{deputyBalance}).Add(hardBalance)
|
||||
return oldGenState
|
||||
}
|
||||
|
||||
// MigrateGov migrates gov genesis state
|
||||
func MigrateGov(oldGenState v39_1gov.GenesisState) v39_1gov.GenesisState {
|
||||
oldGenState.VotingParams.VotingPeriod = time.Hour * 24 * 7
|
||||
return oldGenState
|
||||
}
|
||||
|
||||
// MigrateHarvest initializes the harvest genesis state for kava-4
|
||||
func MigrateHarvest() v0_11harvest.GenesisState {
|
||||
// total HARD per second for lps (week one): 633761
|
||||
@ -215,3 +395,85 @@ func MigratePricefeed(oldGenState v0_9pricefeed.GenesisState) v0_11pricefeed.Gen
|
||||
|
||||
return v0_11pricefeed.NewGenesisState(newParams, newPostedPrices)
|
||||
}
|
||||
|
||||
func mustAccAddressFromBech32(bech32Addr string) sdk.AccAddress {
|
||||
addr, err := sdk.AccAddressFromBech32(bech32Addr)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return addr
|
||||
}
|
||||
|
||||
func createHardTeamVestingAccount() *v39_1vesting.PeriodicVestingAccount {
|
||||
bacc := v39_1auth.NewBaseAccountWithAddress(mustAccAddressFromBech32("kava17a9m9zxs3r5zhxnultt5k5kyer0afd7kc8dq80"))
|
||||
coins := sdk.NewCoin("hard", sdk.NewInt(20000000000000))
|
||||
tokenSchedule := []sdk.Coin{
|
||||
sdk.NewCoin("hard", sdk.NewInt(6666666720000)),
|
||||
sdk.NewCoin("hard", sdk.NewInt(1666666660000)),
|
||||
sdk.NewCoin("hard", sdk.NewInt(1666666660000)),
|
||||
sdk.NewCoin("hard", sdk.NewInt(1666666660000)),
|
||||
sdk.NewCoin("hard", sdk.NewInt(1666666660000)),
|
||||
sdk.NewCoin("hard", sdk.NewInt(1666666660000)),
|
||||
sdk.NewCoin("hard", sdk.NewInt(1666666660000)),
|
||||
sdk.NewCoin("hard", sdk.NewInt(1666666660000)),
|
||||
sdk.NewCoin("hard", sdk.NewInt(1666666660000)),
|
||||
}
|
||||
err := bacc.SetCoins(sdk.NewCoins(coins))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
bva, err := v39_1vesting.NewBaseVestingAccount(&bacc, sdk.NewCoins(coins), 1697378400)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
vestingPeriodLengths := []int64{31536000, 7948800, 7776000, 7862400, 7948800, 7948800, 7776000, 7862400, 7948800}
|
||||
|
||||
periods := v39_1vesting.Periods{}
|
||||
for i, vestingCoin := range tokenSchedule {
|
||||
period := v39_1vesting.Period{Length: vestingPeriodLengths[i], Amount: sdk.NewCoins(vestingCoin)}
|
||||
periods = append(periods, period)
|
||||
}
|
||||
return vesting.NewPeriodicVestingAccountRaw(bva, 1602770400, periods)
|
||||
}
|
||||
|
||||
func createHardTreasuryVestingAccount() *v39_1vesting.PeriodicVestingAccount {
|
||||
bacc := v39_1auth.NewBaseAccountWithAddress(mustAccAddressFromBech32("kava1yqt02z2e4gpt4w0jnw9n0hnqyfu45afns669r2"))
|
||||
coins := sdk.NewCoin("hard", sdk.NewInt(50000000000000))
|
||||
originalVestingCoins := sdk.NewCoin("hard", sdk.NewInt(35000000000000))
|
||||
tokenSchedule := []sdk.Coin{
|
||||
sdk.NewCoin("hard", sdk.NewInt(4375000000000)),
|
||||
sdk.NewCoin("hard", sdk.NewInt(4375000000000)),
|
||||
sdk.NewCoin("hard", sdk.NewInt(4375000000000)),
|
||||
sdk.NewCoin("hard", sdk.NewInt(4375000000000)),
|
||||
sdk.NewCoin("hard", sdk.NewInt(4375000000000)),
|
||||
sdk.NewCoin("hard", sdk.NewInt(4375000000000)),
|
||||
sdk.NewCoin("hard", sdk.NewInt(4375000000000)),
|
||||
sdk.NewCoin("hard", sdk.NewInt(4375000000000)),
|
||||
}
|
||||
err := bacc.SetCoins(sdk.NewCoins(coins))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
bva, err := v39_1vesting.NewBaseVestingAccount(&bacc, sdk.NewCoins(originalVestingCoins), 1665842400)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
vestingPeriodLengths := []int64{7948800, 7776000, 7862400, 7948800, 7948800, 7776000, 7862400, 7948800}
|
||||
|
||||
periods := v39_1vesting.Periods{}
|
||||
for i, vestingCoin := range tokenSchedule {
|
||||
period := v39_1vesting.Period{Length: vestingPeriodLengths[i], Amount: sdk.NewCoins(vestingCoin)}
|
||||
periods = append(periods, period)
|
||||
}
|
||||
return vesting.NewPeriodicVestingAccountRaw(bva, 1602770400, periods)
|
||||
}
|
||||
|
||||
func createHardIEOAccount() v39_1auth.BaseAccount {
|
||||
bacc := v39_1auth.NewBaseAccountWithAddress(mustAccAddressFromBech32("kava16yapwtdxm5hkjfpeatr39vhu5c336fgf4utlyf"))
|
||||
coins := sdk.NewCoin("hard", sdk.NewInt(10000000000000))
|
||||
err := bacc.SetCoins(sdk.NewCoins(coins))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return bacc
|
||||
}
|
||||
|
@ -8,13 +8,22 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
v39_1auth "github.com/cosmos/cosmos-sdk/x/auth"
|
||||
v39_1auth_vesting "github.com/cosmos/cosmos-sdk/x/auth/vesting"
|
||||
v39_1supply "github.com/cosmos/cosmos-sdk/x/supply"
|
||||
|
||||
"github.com/kava-labs/kava/app"
|
||||
v38_5auth "github.com/kava-labs/kava/migrate/v0_11/legacy/cosmos-sdk/v0.38.5/auth"
|
||||
v38_5supply "github.com/kava-labs/kava/migrate/v0_11/legacy/cosmos-sdk/v0.38.5/supply"
|
||||
v0_9bep3 "github.com/kava-labs/kava/x/bep3/legacy/v0_9"
|
||||
v0_9cdp "github.com/kava-labs/kava/x/cdp/legacy/v0_9"
|
||||
v0_9incentive "github.com/kava-labs/kava/x/incentive/legacy/v0_9"
|
||||
v0_9pricefeed "github.com/kava-labs/kava/x/pricefeed/legacy/v0_9"
|
||||
v0_11validator_vesting "github.com/kava-labs/kava/x/validator-vesting"
|
||||
v0_9validator_vesting "github.com/kava-labs/kava/x/validator-vesting/legacy/v0_9"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@ -39,6 +48,63 @@ func TestMigrateBep3(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestMigrateAuth(t *testing.T) {
|
||||
bz, err := ioutil.ReadFile(filepath.Join("testdata", "auth-v09.json"))
|
||||
require.NoError(t, err)
|
||||
var oldGenState v38_5auth.GenesisState
|
||||
cdc := codec.New()
|
||||
codec.RegisterCrypto(cdc)
|
||||
v38_5auth.RegisterCodec(cdc)
|
||||
v38_5auth.RegisterCodecVesting(cdc)
|
||||
v38_5supply.RegisterCodec(cdc)
|
||||
v0_9validator_vesting.RegisterCodec(cdc)
|
||||
|
||||
require.NotPanics(t, func() {
|
||||
cdc.MustUnmarshalJSON(bz, &oldGenState)
|
||||
})
|
||||
|
||||
newGenState := MigrateAuth(oldGenState)
|
||||
err = v39_1auth.ValidateGenesis(newGenState)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, len(oldGenState.Accounts)+5, len(newGenState.Accounts))
|
||||
}
|
||||
|
||||
func TestMigrateAuthExact(t *testing.T) {
|
||||
bz, err := ioutil.ReadFile(filepath.Join("testdata", "auth-v09-simplified.json"))
|
||||
require.NoError(t, err)
|
||||
|
||||
var oldGenState v38_5auth.GenesisState
|
||||
|
||||
v09_cdc := codec.New()
|
||||
codec.RegisterCrypto(v09_cdc)
|
||||
v38_5auth.RegisterCodec(v09_cdc)
|
||||
v38_5auth.RegisterCodecVesting(v09_cdc)
|
||||
v38_5supply.RegisterCodec(v09_cdc)
|
||||
v0_9validator_vesting.RegisterCodec(v09_cdc)
|
||||
|
||||
require.NotPanics(t, func() {
|
||||
v09_cdc.MustUnmarshalJSON(bz, &oldGenState)
|
||||
})
|
||||
|
||||
newGenState := MigrateAuth(oldGenState)
|
||||
|
||||
v011_cdc := codec.New()
|
||||
codec.RegisterCrypto(v011_cdc)
|
||||
v39_1auth.RegisterCodec(v011_cdc)
|
||||
v39_1auth_vesting.RegisterCodec(v011_cdc)
|
||||
v39_1supply.RegisterCodec(v011_cdc)
|
||||
v0_11validator_vesting.RegisterCodec(v011_cdc)
|
||||
|
||||
newGenStateBz, err := v011_cdc.MarshalJSON(newGenState)
|
||||
require.NoError(t, err)
|
||||
|
||||
expectedGenStateBz, err := ioutil.ReadFile(filepath.Join("testdata", "auth-v011-simplified.json"))
|
||||
require.NoError(t, err)
|
||||
|
||||
require.JSONEq(t, string(expectedGenStateBz), string(newGenStateBz))
|
||||
|
||||
}
|
||||
|
||||
func TestMigrateHarvest(t *testing.T) {
|
||||
newGenState := MigrateHarvest()
|
||||
err := newGenState.Validate()
|
||||
|
683
migrate/v0_11/testdata/auth-v011-simplified.json
vendored
Normal file
683
migrate/v0_11/testdata/auth-v011-simplified.json
vendored
Normal file
@ -0,0 +1,683 @@
|
||||
{
|
||||
"params": {
|
||||
"max_memo_characters": "512",
|
||||
"sig_verify_cost_ed25519": "590",
|
||||
"sig_verify_cost_secp256k1": "1000",
|
||||
"tx_sig_limit": "7",
|
||||
"tx_size_cost_per_byte": "10"
|
||||
},
|
||||
"accounts": [
|
||||
{
|
||||
"type": "cosmos-sdk/Account",
|
||||
"value": {
|
||||
"account_number": "10145",
|
||||
"address": "kava1llungtpe0aku8c2gqpm23jvs4r0caqdwjzq078",
|
||||
"coins": [
|
||||
{
|
||||
"amount": "92810900",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"public_key": null,
|
||||
"sequence": "0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cosmos-sdk/Account",
|
||||
"value": {
|
||||
"account_number": "96",
|
||||
"address": "kava1ceun2qqw65qce5la33j8zv8ltyyaqqfcxftutz",
|
||||
"coins": [
|
||||
{
|
||||
"amount": "1095029582",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"public_key": {
|
||||
"type": "tendermint/PubKeyMultisigThreshold",
|
||||
"value": {
|
||||
"pubkeys": [
|
||||
{
|
||||
"type": "tendermint/PubKeySecp256k1",
|
||||
"value": "AxUMR/GKoycWplR+2otzaQZ9zhHRQWJFt3h1bPg1ltha"
|
||||
},
|
||||
{
|
||||
"type": "tendermint/PubKeySecp256k1",
|
||||
"value": "Az/Xn9XKadn79UpA8TRVrHKbi64QGTxjVSKR9tzMy15o"
|
||||
},
|
||||
{
|
||||
"type": "tendermint/PubKeySecp256k1",
|
||||
"value": "As7R9fDUnwsUVLDr1cxspp+cY9UfXfUf7i9/w+N0EzKA"
|
||||
},
|
||||
{
|
||||
"type": "tendermint/PubKeySecp256k1",
|
||||
"value": "A708lKSSivhkgH3n1UGy/AlfWyiehRVAp9G+Nlsy+rDj"
|
||||
},
|
||||
{
|
||||
"type": "tendermint/PubKeySecp256k1",
|
||||
"value": "ArixmwMR2HoBdIzWiUT6HZFMScZv8odQ0KkIMcoqXHwq"
|
||||
}
|
||||
],
|
||||
"threshold": "2"
|
||||
}
|
||||
},
|
||||
"sequence": "8"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cosmos-sdk/ValidatorVestingAccount",
|
||||
"value": {
|
||||
"account_number": "4",
|
||||
"address": "kava1qzvq736hxfwdqgxwek3229z7ec4rfmc6s4kdc2",
|
||||
"coins": [
|
||||
{
|
||||
"amount": "1829450",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"current_period_progress": {
|
||||
"missed_blocks": "1540",
|
||||
"total_blocks": "3468891"
|
||||
},
|
||||
"debt_after_failed_vesting": [],
|
||||
"delegated_free": [
|
||||
{
|
||||
"amount": "9990000",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"delegated_vesting": [
|
||||
{
|
||||
"amount": "333317710000",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"end_time": "1636120800",
|
||||
"original_vesting": [
|
||||
{
|
||||
"amount": "333317710000",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"public_key": {
|
||||
"type": "tendermint/PubKeySecp256k1",
|
||||
"value": "A9hxcErxj1laSwp7Ipj1eiCDtyqKG18xYFPjknoc0keG"
|
||||
},
|
||||
"return_address": "kava1qvsus5qg8yhre7k2c78xkkw4nvqqgev7ezrja8",
|
||||
"sequence": "24",
|
||||
"signing_threshold": "90",
|
||||
"start_time": "1572962400",
|
||||
"validator_address": "kavavalcons16mkm6ggf280kjtsxnvzur7tnqttgavj4mzr4zf",
|
||||
"vesting_period_progress": [
|
||||
{
|
||||
"period_complete": false,
|
||||
"vesting_successful": false
|
||||
},
|
||||
{
|
||||
"period_complete": false,
|
||||
"vesting_successful": false
|
||||
},
|
||||
{
|
||||
"period_complete": false,
|
||||
"vesting_successful": false
|
||||
},
|
||||
{
|
||||
"period_complete": false,
|
||||
"vesting_successful": false
|
||||
},
|
||||
{
|
||||
"period_complete": false,
|
||||
"vesting_successful": false
|
||||
}
|
||||
],
|
||||
"vesting_periods": [
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "92588250185",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "31622400"
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "60182345788",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "7948800"
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "60182345788",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "7689600"
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "60182345788",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "7948800"
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "60182422451",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "7948800"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cosmos-sdk/PeriodicVestingAccount",
|
||||
"value": {
|
||||
"account_number": "159",
|
||||
"address": "kava1qvsus5qg8yhre7k2c78xkkw4nvqqgev7ezrja8",
|
||||
"coins": [
|
||||
{
|
||||
"amount": "899999001",
|
||||
"denom": "bnb"
|
||||
},
|
||||
{
|
||||
"amount": "2200212895",
|
||||
"denom": "ukava"
|
||||
},
|
||||
{
|
||||
"amount": "1004240",
|
||||
"denom": "usdx"
|
||||
}
|
||||
],
|
||||
"delegated_free": [],
|
||||
"delegated_vesting": [
|
||||
{
|
||||
"amount": "4147313000000",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"end_time": "1636120800",
|
||||
"original_vesting": [
|
||||
{
|
||||
"amount": "5177909376500",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"public_key": {
|
||||
"type": "tendermint/PubKeySecp256k1",
|
||||
"value": "A5HnBfmGgoeySJ1vZZ7tT1RMhSBuw6V2XfazETdfupQd"
|
||||
},
|
||||
"sequence": "184",
|
||||
"start_time": "1572962400",
|
||||
"vesting_periods": [
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "247437068100",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "7948800"
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "484707541700",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "7776000"
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "19235194400",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "2678400"
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "19235194400",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "2592000"
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "606688729200",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "2678400"
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "19235194400",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "2678400"
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "19235194400",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "2592000"
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "760072166700",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "2678400"
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "19235194400",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "2592000"
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "19235194400",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "2678400"
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "910727972900",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "2678400"
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "20971305600",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "2419200"
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "20971305600",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "2678400"
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "912464084000",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "2592000"
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "20971305600",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "2678400"
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "20971305600",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "2592000"
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "818755417400",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "2678400"
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "21492138900",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "2678400"
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "21492138900",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "2592000"
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "194775729900",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": "2678400"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cosmos-sdk/Account",
|
||||
"value": {
|
||||
"account_number": "3",
|
||||
"address": "kava1r4v2zdhdalfj2ydazallqvrus9fkphmglhn6u6",
|
||||
"coins": [
|
||||
{
|
||||
"amount": "9900",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"public_key": null,
|
||||
"sequence": "1234"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cosmos-sdk/ModuleAccount",
|
||||
"value": {
|
||||
"account_number": "0",
|
||||
"address": "kava1nzenvfcapyjr9qe3cr3c5k2aucssg6wnknlvll",
|
||||
"coins": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "80000000000000"
|
||||
}
|
||||
],
|
||||
"name": "harvest_lp_distribution",
|
||||
"permissions": [
|
||||
"minter",
|
||||
"burner"
|
||||
],
|
||||
"public_key": "",
|
||||
"sequence": "0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cosmos-sdk/ModuleAccount",
|
||||
"value": {
|
||||
"account_number": "0",
|
||||
"address": "kava1e3qvdzau5ww0m43d00gqj0ncgy8j03ndge6c2c",
|
||||
"coins": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "40000000000000"
|
||||
}
|
||||
],
|
||||
"name": "harvest_delegator_distribution",
|
||||
"permissions": [
|
||||
"minter",
|
||||
"burner"
|
||||
],
|
||||
"public_key": "",
|
||||
"sequence": "0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cosmos-sdk/PeriodicVestingAccount",
|
||||
"value": {
|
||||
"address": "kava17a9m9zxs3r5zhxnultt5k5kyer0afd7kc8dq80",
|
||||
"coins": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "20000000000000"
|
||||
}
|
||||
],
|
||||
"public_key": null,
|
||||
"account_number": "0",
|
||||
"sequence": "0",
|
||||
"original_vesting": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "20000000000000"
|
||||
}
|
||||
],
|
||||
"delegated_free": [],
|
||||
"delegated_vesting": [],
|
||||
"end_time": "1697378400",
|
||||
"start_time": "1602770400",
|
||||
"vesting_periods": [
|
||||
{
|
||||
"length": "31536000",
|
||||
"amount": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "6666666720000"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"length": "7948800",
|
||||
"amount": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "1666666660000"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"length": "7776000",
|
||||
"amount": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "1666666660000"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"length": "7862400",
|
||||
"amount": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "1666666660000"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"length": "7948800",
|
||||
"amount": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "1666666660000"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"length": "7948800",
|
||||
"amount": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "1666666660000"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"length": "7776000",
|
||||
"amount": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "1666666660000"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"length": "7862400",
|
||||
"amount": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "1666666660000"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"length": "7948800",
|
||||
"amount": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "1666666660000"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cosmos-sdk/PeriodicVestingAccount",
|
||||
"value": {
|
||||
"address": "kava1yqt02z2e4gpt4w0jnw9n0hnqyfu45afns669r2",
|
||||
"coins": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "50000000000000"
|
||||
}
|
||||
],
|
||||
"public_key": null,
|
||||
"account_number": "0",
|
||||
"sequence": "0",
|
||||
"original_vesting": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "35000000000000"
|
||||
}
|
||||
],
|
||||
"delegated_free": [],
|
||||
"delegated_vesting": [],
|
||||
"end_time": "1665842400",
|
||||
"start_time": "1602770400",
|
||||
"vesting_periods": [
|
||||
{
|
||||
"length": "7948800",
|
||||
"amount": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "4375000000000"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"length": "7776000",
|
||||
"amount": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "4375000000000"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"length": "7862400",
|
||||
"amount": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "4375000000000"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"length": "7948800",
|
||||
"amount": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "4375000000000"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"length": "7948800",
|
||||
"amount": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "4375000000000"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"length": "7776000",
|
||||
"amount": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "4375000000000"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"length": "7862400",
|
||||
"amount": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "4375000000000"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"length": "7948800",
|
||||
"amount": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "4375000000000"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cosmos-sdk/Account",
|
||||
"value": {
|
||||
"address": "kava16yapwtdxm5hkjfpeatr39vhu5c336fgf4utlyf",
|
||||
"coins": [
|
||||
{
|
||||
"denom": "hard",
|
||||
"amount": "10000000000000"
|
||||
}
|
||||
],
|
||||
"public_key": null,
|
||||
"account_number": "0",
|
||||
"sequence": "0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
392
migrate/v0_11/testdata/auth-v09-simplified.json
vendored
Normal file
392
migrate/v0_11/testdata/auth-v09-simplified.json
vendored
Normal file
@ -0,0 +1,392 @@
|
||||
{
|
||||
"params": {
|
||||
"max_memo_characters": "512",
|
||||
"sig_verify_cost_ed25519": "590",
|
||||
"sig_verify_cost_secp256k1": "1000",
|
||||
"tx_sig_limit": "7",
|
||||
"tx_size_cost_per_byte": "10"
|
||||
},
|
||||
"accounts": [
|
||||
{
|
||||
"type": "cosmos-sdk/Account",
|
||||
"value": {
|
||||
"account_number": 10145,
|
||||
"address": "kava1llungtpe0aku8c2gqpm23jvs4r0caqdwjzq078",
|
||||
"coins": [
|
||||
{
|
||||
"amount": "92810900",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"public_key": "",
|
||||
"sequence": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cosmos-sdk/Account",
|
||||
"value": {
|
||||
"account_number": 96,
|
||||
"address": "kava1ceun2qqw65qce5la33j8zv8ltyyaqqfcxftutz",
|
||||
"coins": [
|
||||
{
|
||||
"amount": "1095029582",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"public_key": "kavapub1ytql0csgqgfzd666axrjzqc4p3rlrz4ryut2v4r7m29hx6gx0h8pr52pvfzmw7r4dnurt9kctgfzd666axrjzqel670atjnfm8al2jjq7y69ttrjnw96uyqe83342g537mwvej67dqfzd666axrjzqkw686lp4ylpv29fv8t6hxxef5ln33a286a7507utmlc03hgyejsqfzd666axrjzqaa8j22fy52lpjgql0864qm9lqftadj3859z4q205d7xedn974suvfzd666axrjzq4ckxdsxywc0gqhfrxk39z058v3f3yuvmljsagdp2ggx89z5hru9gx07cnh",
|
||||
"sequence": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cosmos-sdk/ValidatorVestingAccount",
|
||||
"value": {
|
||||
"account_number": 4,
|
||||
"address": "kava1qzvq736hxfwdqgxwek3229z7ec4rfmc6s4kdc2",
|
||||
"coins": [
|
||||
{
|
||||
"amount": "1829450",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"current_period_progress": {
|
||||
"missed_blocks": 1540,
|
||||
"total_blocks": 3468891
|
||||
},
|
||||
"debt_after_failed_vesting": [],
|
||||
"delegated_free": [
|
||||
{
|
||||
"amount": "9990000",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"delegated_vesting": [
|
||||
{
|
||||
"amount": "333317710000",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"end_time": 1636120800,
|
||||
"original_vesting": [
|
||||
{
|
||||
"amount": "333317710000",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"public_key": "kavapub1addwnpepq0v8zuz27x84jkjtpfaj9x840gsg8de23gd47vtq203ey7su6frcv5edh9v",
|
||||
"return_address": "kava1qvsus5qg8yhre7k2c78xkkw4nvqqgev7ezrja8",
|
||||
"sequence": 24,
|
||||
"signing_threshold": 90,
|
||||
"start_time": 1572962400,
|
||||
"validator_address": "kavavalcons16mkm6ggf280kjtsxnvzur7tnqttgavj4mzr4zf",
|
||||
"vesting_period_progress": [
|
||||
{
|
||||
"period_complete": false,
|
||||
"vesting_successful": false
|
||||
},
|
||||
{
|
||||
"period_complete": false,
|
||||
"vesting_successful": false
|
||||
},
|
||||
{
|
||||
"period_complete": false,
|
||||
"vesting_successful": false
|
||||
},
|
||||
{
|
||||
"period_complete": false,
|
||||
"vesting_successful": false
|
||||
},
|
||||
{
|
||||
"period_complete": false,
|
||||
"vesting_successful": false
|
||||
}
|
||||
],
|
||||
"vesting_periods": [
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "92588250185",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 31622400
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "60182345788",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 7948800
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "60182345788",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 7689600
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "60182345788",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 7948800
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "60182422451",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 7948800
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cosmos-sdk/PeriodicVestingAccount",
|
||||
"value": {
|
||||
"account_number": 159,
|
||||
"address": "kava1qvsus5qg8yhre7k2c78xkkw4nvqqgev7ezrja8",
|
||||
"coins": [
|
||||
{
|
||||
"amount": "899999001",
|
||||
"denom": "bnb"
|
||||
},
|
||||
{
|
||||
"amount": "2200212895",
|
||||
"denom": "ukava"
|
||||
},
|
||||
{
|
||||
"amount": "1004240",
|
||||
"denom": "usdx"
|
||||
}
|
||||
],
|
||||
"delegated_free": [],
|
||||
"delegated_vesting": [
|
||||
{
|
||||
"amount": "4147313000000",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"end_time": 1636120800,
|
||||
"original_vesting": [
|
||||
{
|
||||
"amount": "5177909376500",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"public_key": "kavapub1addwnpepqwg7wp0es6pg0vjgn4hkt8hdfa2yepfqdmp62aja76e3zd6lh22p6f9jte2",
|
||||
"sequence": 184,
|
||||
"start_time": 1572962400,
|
||||
"vesting_periods": [
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "247437068100",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 7948800
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "484707541700",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 7776000
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "19235194400",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 2678400
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "19235194400",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 2592000
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "606688729200",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 2678400
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "19235194400",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 2678400
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "19235194400",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 2592000
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "760072166700",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 2678400
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "19235194400",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 2592000
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "19235194400",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 2678400
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "910727972900",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 2678400
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "20971305600",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 2419200
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "20971305600",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 2678400
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "912464084000",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 2592000
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "20971305600",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 2678400
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "20971305600",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 2592000
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "818755417400",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 2678400
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "21492138900",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 2678400
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "21492138900",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 2592000
|
||||
},
|
||||
{
|
||||
"amount": [
|
||||
{
|
||||
"amount": "194775729900",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"length": 2678400
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cosmos-sdk/Account",
|
||||
"value": {
|
||||
"account_number": 3,
|
||||
"address": "kava1r4v2zdhdalfj2ydazallqvrus9fkphmglhn6u6",
|
||||
"coins": [
|
||||
{
|
||||
"amount": "100200300",
|
||||
"denom": "bnb"
|
||||
},
|
||||
{
|
||||
"amount": "9900",
|
||||
"denom": "ukava"
|
||||
}
|
||||
],
|
||||
"public_key": "",
|
||||
"sequence": 1234
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
199436
migrate/v0_11/testdata/auth-v09.json
vendored
Normal file
199436
migrate/v0_11/testdata/auth-v09.json
vendored
Normal file
File diff suppressed because it is too large
Load Diff
104
x/validator-vesting/legacy/v0_9/types.go
Normal file
104
x/validator-vesting/legacy/v0_9/types.go
Normal file
@ -0,0 +1,104 @@
|
||||
package v0_9
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
|
||||
authtypes "github.com/kava-labs/kava/migrate/v0_11/legacy/cosmos-sdk/v0.38.5/auth"
|
||||
)
|
||||
|
||||
// VestingProgress tracks the status of each vesting period
|
||||
type VestingProgress struct {
|
||||
PeriodComplete bool `json:"period_complete" yaml:"period_complete"`
|
||||
VestingSuccessful bool `json:"vesting_successful" yaml:"vesting_successful"`
|
||||
}
|
||||
|
||||
// CurrentPeriodProgress tracks the progress of the current vesting period
|
||||
type CurrentPeriodProgress struct {
|
||||
MissedBlocks int64 `json:"missed_blocks" yaml:"missed_blocks"`
|
||||
TotalBlocks int64 `json:"total_blocks" yaml:"total_blocks"`
|
||||
}
|
||||
|
||||
// ValidatorVestingAccount implements the VestingAccount interface. It
|
||||
// conditionally vests by unlocking coins during each specified period, provided
|
||||
// that the validator address has validated at least **SigningThreshold** blocks during
|
||||
// the previous vesting period. The signing threshold takes values 0 to 100 are represents the
|
||||
// percentage of blocks that must be signed each period for the vesting to complete successfully.
|
||||
// If the validator has not signed at least the threshold percentage of blocks during a period,
|
||||
// the coins are returned to the return address, or burned if the return address is null.
|
||||
type ValidatorVestingAccount struct {
|
||||
*authtypes.PeriodicVestingAccount
|
||||
ValidatorAddress sdk.ConsAddress `json:"validator_address" yaml:"validator_address"`
|
||||
ReturnAddress sdk.AccAddress `json:"return_address" yaml:"return_address"`
|
||||
SigningThreshold int64 `json:"signing_threshold" yaml:"signing_threshold"`
|
||||
CurrentPeriodProgress CurrentPeriodProgress `json:"current_period_progress" yaml:"current_period_progress"`
|
||||
VestingPeriodProgress []VestingProgress `json:"vesting_period_progress" yaml:"vesting_period_progress"`
|
||||
DebtAfterFailedVesting sdk.Coins `json:"debt_after_failed_vesting" yaml:"debt_after_failed_vesting"`
|
||||
}
|
||||
|
||||
type validatorVestingAccountPretty struct {
|
||||
Address sdk.AccAddress `json:"address" yaml:"address"`
|
||||
Coins sdk.Coins `json:"coins" yaml:"coins"`
|
||||
PubKey string `json:"public_key" yaml:"public_key"`
|
||||
AccountNumber uint64 `json:"account_number" yaml:"account_number"`
|
||||
Sequence uint64 `json:"sequence" yaml:"sequence"`
|
||||
OriginalVesting sdk.Coins `json:"original_vesting" yaml:"original_vesting"`
|
||||
DelegatedFree sdk.Coins `json:"delegated_free" yaml:"delegated_free"`
|
||||
DelegatedVesting sdk.Coins `json:"delegated_vesting" yaml:"delegated_vesting"`
|
||||
EndTime int64 `json:"end_time" yaml:"end_time"`
|
||||
StartTime int64 `json:"start_time" yaml:"start_time"`
|
||||
VestingPeriods authtypes.Periods `json:"vesting_periods" yaml:"vesting_periods"`
|
||||
ValidatorAddress sdk.ConsAddress `json:"validator_address" yaml:"validator_address"`
|
||||
ReturnAddress sdk.AccAddress `json:"return_address" yaml:"return_address"`
|
||||
SigningThreshold int64 `json:"signing_threshold" yaml:"signing_threshold"`
|
||||
CurrentPeriodProgress CurrentPeriodProgress `json:"current_period_progress" yaml:"current_period_progress"`
|
||||
VestingPeriodProgress []VestingProgress `json:"vesting_period_progress" yaml:"vesting_period_progress"`
|
||||
DebtAfterFailedVesting sdk.Coins `json:"debt_after_failed_vesting" yaml:"debt_after_failed_vesting"`
|
||||
}
|
||||
|
||||
// UnmarshalJSON unmarshals raw JSON bytes into a PeriodicVestingAccount.
|
||||
func (vva *ValidatorVestingAccount) UnmarshalJSON(bz []byte) error {
|
||||
var alias validatorVestingAccountPretty
|
||||
if err := json.Unmarshal(bz, &alias); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var (
|
||||
pk crypto.PubKey
|
||||
err error
|
||||
)
|
||||
|
||||
if alias.PubKey != "" {
|
||||
pk, err = sdk.GetPubKeyFromBech32(sdk.Bech32PubKeyTypeAccPub, alias.PubKey)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
ba := authtypes.NewBaseAccount(alias.Address, alias.Coins, pk, alias.AccountNumber, alias.Sequence)
|
||||
bva := &authtypes.BaseVestingAccount{
|
||||
BaseAccount: ba,
|
||||
OriginalVesting: alias.OriginalVesting,
|
||||
DelegatedFree: alias.DelegatedFree,
|
||||
DelegatedVesting: alias.DelegatedVesting,
|
||||
EndTime: alias.EndTime,
|
||||
}
|
||||
pva := authtypes.NewPeriodicVestingAccountRaw(bva, alias.StartTime, alias.VestingPeriods)
|
||||
vva.PeriodicVestingAccount = pva
|
||||
vva.ValidatorAddress = alias.ValidatorAddress
|
||||
vva.ReturnAddress = alias.ReturnAddress
|
||||
vva.SigningThreshold = alias.SigningThreshold
|
||||
vva.CurrentPeriodProgress = alias.CurrentPeriodProgress
|
||||
vva.VestingPeriodProgress = alias.VestingPeriodProgress
|
||||
vva.DebtAfterFailedVesting = alias.DebtAfterFailedVesting
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterCodec registers concrete types on the codec
|
||||
func RegisterCodec(cdc *codec.Codec) {
|
||||
cdc.RegisterConcrete(&ValidatorVestingAccount{}, "cosmos-sdk/ValidatorVestingAccount", nil)
|
||||
}
|
Loading…
Reference in New Issue
Block a user