-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
R4R: Add Vesting Account Genesis Validation #3425
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
176cc7f
add vesting account genesis validation checks
09b2b86
remove vesting account genesis coin check due to exporting
5087197
add initial genesis doc/spec
ccd6516
Update docs/gaia/genesis.md
cwgoes 99208b9
Update cmd/gaia/app/genesis.go
cwgoes 632a8ef
update vesting account section in genesis doc
017b3f3
Merge remote-tracking branch 'origin/bez/3418-vesting-acc-gen-validat…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,60 @@ | ||
# Gaia Genesis State | ||
|
||
Gaia genesis state, `GenesisState`, is composed of accounts, various module | ||
states and metadata such as genesis transactions. Each module may specify its | ||
own `GenesisState`. In addition, each module may specify its own genesis state | ||
validation, import and export functionality. | ||
|
||
The Gaia genesis state is defined as follows: | ||
|
||
```go | ||
type GenesisState struct { | ||
Accounts []GenesisAccount `json:"accounts"` | ||
AuthData auth.GenesisState `json:"auth"` | ||
BankData bank.GenesisState `json:"bank"` | ||
StakingData staking.GenesisState `json:"staking"` | ||
MintData mint.GenesisState `json:"mint"` | ||
DistrData distr.GenesisState `json:"distr"` | ||
GovData gov.GenesisState `json:"gov"` | ||
SlashingData slashing.GenesisState `json:"slashing"` | ||
GenTxs []json.RawMessage `json:"gentxs"` | ||
} | ||
``` | ||
|
||
In the ABCI `initChainer` definition of Gaia the `initFromGenesisState` is called | ||
which internally calls each module's `InitGenesis` providing its own respective | ||
`GenesisState` as a parameter. | ||
|
||
## Accounts | ||
|
||
Genesis accounts defined in the `GenesisState` are defined as follows: | ||
|
||
```go | ||
type GenesisAccount struct { | ||
Address sdk.AccAddress `json:"address"` | ||
Coins sdk.Coins `json:"coins"` | ||
Sequence uint64 `json:"sequence_number"` | ||
AccountNumber uint64 `json:"account_number"` | ||
|
||
// vesting account fields | ||
OriginalVesting sdk.Coins `json:"original_vesting"` // total vesting coins upon initialization | ||
DelegatedFree sdk.Coins `json:"delegated_free"` // delegated vested coins at time of delegation | ||
DelegatedVesting sdk.Coins `json:"delegated_vesting"` // delegated vesting coins at time of delegation | ||
StartTime int64 `json:"start_time"` // vesting start time (UNIX Epoch time) | ||
EndTime int64 `json:"end_time"` // vesting end time (UNIX Epoch time) | ||
} | ||
``` | ||
|
||
Each account must have a valid and unique account number in addition to a | ||
sequence number (nonce) and address. | ||
|
||
Accounts may also be vesting, in which case they must provide the necessary vesting | ||
information. Vesting accounts must provide at a minimum `OriginalVesting` and | ||
`EndTime`. If `StartTime` is also provided, the account will be treated as a | ||
"continuous" vesting account in which it vests coins at a predefined schedule. | ||
Providing a `StartTime` must be less than `EndTime` but may be in the future. | ||
In other words, it does not have to be equal to the genesis time. In a new chain | ||
starting from a fresh state (not exported), `OriginalVesting` must be less than | ||
or equal to `Coins.` | ||
|
||
<!-- TODO: Remaining modules and components in GenesisState --> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++