-
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
Initialize Genesis State #416
Conversation
9db8b2f
to
6c2ef50
Compare
Codecov Report
@@ Coverage Diff @@
## develop #416 +/- ##
===========================================
+ Coverage 52.13% 52.18% +0.05%
===========================================
Files 34 35 +1
Lines 1619 1671 +52
===========================================
+ Hits 844 872 +28
- Misses 721 742 +21
- Partials 54 57 +3 |
f72a3fb
to
6eaafa4
Compare
@@ -32,33 +32,37 @@ type BaseApp struct { | |||
// Main (uncached) state | |||
cms sdk.CommitMultiStore | |||
|
|||
// Unmarshal []byte into sdk.Tx | |||
// unmarshal []byte into sdk.Tx |
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.
Let's try to keep comments well formed (capitalized and with periods). https://github.com/tendermint/coding/blob/master/go/coding_standard.md#various
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.
Did go-lint really complain about this ?
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.
no, there are not sentences, as in the spec, only sentences should start capitalized. Everything else should start lowercase and end without a period... We should further clarify this in the spec
@@ -174,7 +183,7 @@ func (app *BaseApp) initFromStore(mainKey sdk.StoreKey) error { | |||
|
|||
//---------------------------------------- | |||
|
|||
// Implements ABCI. | |||
// Implements ABCI |
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.
Why get rid of periods? It's also in the coding conventions
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.
See my previous comment (not a sentence)
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.
Thanks Rige. I'll try to wrap this up tonight
baseapp/genesis.go
Outdated
// TODO this is dup code from tendermint-core to avoid dep issues | ||
// should probably remove from both SDK / Tendermint and move to tmlibs | ||
// ^^^^^^^^^^^^^ This is my preference to avoid DEP hell | ||
// or sync up versioning and just reference tendermint |
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.
lol our deps are in a brutal state :(
we need to make sure it never happens again. obscene.
examples/basecoin/app/app.go
Outdated
} | ||
app.BaseApp.BeginBlock(abci.RequestBeginBlock{ | ||
Hash: nil, | ||
Header: header, |
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.
why do we need this ?!
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.
to set up the multistore cache wrap for deliver store used in NewContext, I just made this code considerably smaller
@@ -26,3 +33,68 @@ func (app *BasecoinApp) initBaseAppTxDecoder() { | |||
return tx, nil | |||
}) | |||
} | |||
|
|||
// We use GenesisAccount instead of types.AppAccount for cleaner json input of PubKey |
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.
is this because we don't have go-wire JSON yet ?
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.
no, json representation of the new PubKey is a byte array... I'd obviously rather not use an input struct, if you have any other ideas lmn
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.
Oh, we don't even need PubKeys for accounts in the genesis file!
return nil | ||
} | ||
|
||
var gaccs []*GenesisAccount |
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.
we should more clearly state this expectation somewhere - probably define an AppGenesis type that is a []*GenesisAccount
... or probably better to use a struct containing a []*GenesisAccount.
ie. we want to make clear somewhere outside this function what the json in the genesis should look like
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.
good point, an alternative design should actually be used for custom genesis types which defines its own unmarshalling. aka AppAccount should actually exist as a custom module within basecoin which defines genesis unmarshalling... right now everything is just kind of unmarshalled here, I'm going to integrate this change in with the basecoin refactor
|
||
func main() { | ||
fmt.Println("TODO: move examples/basecoin/main.go here and refactor") | ||
// TODO CREATE CLI |
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.
++
types/errors.go
Outdated
CodeUnknownRequest CodeType = 6 | ||
CodeUnrecognizedAddress CodeType = 7 | ||
CodeInvalidSequence CodeType = 8 | ||
CodeGenesisParse CodeType = 3 |
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.
weird seeing this in here. InitChain doesn't even return a code - do we need this ?
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.
SetInitStater can return error when initializing genesis - what error code would you use otherwise? CodeInternal?
* Alter identifier requirements * Rebuild PDF
* Fix merge conflict * Run go mod tidy
closes #339
This PR includes some cleanup to make go-lint compliant