-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
BaseApp cleanup #1663
BaseApp cleanup #1663
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1663 +/- ##
===========================================
- Coverage 62.77% 62.77% -0.01%
===========================================
Files 122 122
Lines 7125 7133 +8
===========================================
+ Hits 4473 4478 +5
- Misses 2390 2394 +4
+ Partials 262 261 -1 |
@AdityaSripal what's the plan for moving towards the breaking changes? Post Gaia 7000 launch? |
@alexanderbez Definitely think it should be post Gaia7000. Probably want to get the other stability stuff done first and then make the breaking changes. |
cmd/gaia/app/app.go
Outdated
@@ -60,7 +60,7 @@ type GaiaApp struct { | |||
func NewGaiaApp(logger log.Logger, db dbm.DB, traceStore io.Writer, baseAppOptions ...func(*bam.BaseApp)) *GaiaApp { | |||
cdc := MakeCodec() | |||
|
|||
bApp := bam.NewBaseApp(appName, cdc, logger, db, baseAppOptions...) | |||
bApp := bam.NewBaseAppNoCodec(appName, logger, db, auth.DefaultTxDecoder(cdc), baseAppOptions...) |
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 may want to revert this back to using deprecated NewBaseApp. Otherwise QueryResult will be encoded with json rather than amino. May be a breaking change even though tests pass.
@@ -17,32 +17,52 @@ const ( | |||
// NewAnteHandler returns an AnteHandler that checks | |||
// and increments sequence numbers, checks signatures & account numbers, | |||
// and deducts fees from the first signer. | |||
// nolint: gocyclo |
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.
Current cyclomatic complexity of 12, greater than max 11
docs/core/examples/app1.go
Outdated
@@ -18,17 +17,12 @@ const ( | |||
|
|||
func NewApp1(logger log.Logger, db dbm.DB) *bapp.BaseApp { |
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.
Not sure if we want to update docs now or after making the breaking changes.
Addresses #1592 |
Is this R4R? Looks like there are file conflicts. |
@cwgoes fixed |
@AdityaSripal could you link to an issue (if there is one) as well as describe the high level changes being made here - as I recall this is based out of some conversations that we want to be passing a edit: saw your later comment "Addresses #1592" this should be editted into the header comment probably |
baseapp/baseapp.go
Outdated
// Create and name new BaseApp | ||
// Does not set cdc and instead takes a user-defined txDecoder. | ||
// TODO: Rename to NewBaseApp and remove above constructor once auth, wire dependencies removed | ||
func NewBaseAppNoCodec(name string, logger log.Logger, db dbm.DB, txDecoder sdk.TxDecoder, options ...func(*BaseApp)) *BaseApp { |
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.
I don't think deprecating this API is worth it; adds cruft we have to clean up later. When we promise a stable baseapp
API, we can do this, but until then I think we should just refactor all calls.
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.
Should we punt this to next iteration then or... ?
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, let's go ahead and merge.
baseapp/baseapp.go
Outdated
value := app.cdc.MustMarshalBinary(result) | ||
|
||
// Encode with json | ||
value, err := json.Marshal(result) |
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.
Hmm - won't this marshal e.g. numbers different than Amino JSON? Maybe we should use an empty Amino codec (just for the custom JSON) to avoid returning different JSON formats in different places?
baseapp/baseapp.go
Outdated
// Accepts variable number of option functions, which act on the BaseApp to set configuration choices | ||
func NewBaseApp(name string, cdc *wire.Codec, logger log.Logger, db dbm.DB, options ...func(*BaseApp)) *BaseApp { | ||
// TODO: Rename to NewBaseApp and remove above constructor once auth, wire dependencies removed |
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.
Comment can be removed?
Gopkg.lock
Outdated
@@ -2,76 +2,57 @@ | |||
|
|||
|
|||
[[projects]] |
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.
Try running make update_deps
, looks like you're on an old dep version
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.
utACK
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.
Looks good
Addresses #1592