Skip to content
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

Merged
merged 24 commits into from
Jul 23, 2018
Merged

BaseApp cleanup #1663

merged 24 commits into from
Jul 23, 2018

Conversation

AdityaSripal
Copy link
Member

@AdityaSripal AdityaSripal commented Jul 13, 2018

Addresses #1592

  • Updated all relevant documentation in docs
  • Updated all code comments where relevant
  • Wrote tests
  • Updated CHANGELOG.md
  • Updated Gaia/Examples
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)
  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)

@codecov
Copy link

codecov bot commented Jul 13, 2018

Codecov Report

Merging #1663 into develop will decrease coverage by <.01%.
The diff coverage is 71.05%.

@@             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

@alexanderbez
Copy link
Contributor

@AdityaSripal what's the plan for moving towards the breaking changes? Post Gaia 7000 launch?

@AdityaSripal
Copy link
Member Author

@alexanderbez Definitely think it should be post Gaia7000. Probably want to get the other stability stuff done first and then make the breaking changes.

@@ -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...)
Copy link
Member Author

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
Copy link
Member Author

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

@AdityaSripal AdityaSripal changed the title WIP: BaseApp cleanup non-breaking BaseApp cleanup non-breaking Jul 13, 2018
@AdityaSripal AdityaSripal added API and removed wip labels Jul 13, 2018
@@ -18,17 +17,12 @@ const (

func NewApp1(logger log.Logger, db dbm.DB) *bapp.BaseApp {
Copy link
Member Author

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.

@AdityaSripal
Copy link
Member Author

Addresses #1592

@cwgoes
Copy link
Contributor

cwgoes commented Jul 14, 2018

Is this R4R? Looks like there are file conflicts.

@AdityaSripal
Copy link
Member Author

@cwgoes fixed

@ebuchman ebuchman changed the base branch from master to develop July 16, 2018 15:36
@rigelrozanski
Copy link
Contributor

rigelrozanski commented Jul 18, 2018

@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 txDecoder to bassapp instead of a ctx -> This type of information should be added to the PR description (aka the header comment of the PR), it's good context for reviewers

edit: saw your later comment "Addresses #1592" this should be editted into the header comment probably

// 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 {
Copy link
Contributor

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.

Copy link
Member Author

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... ?

Copy link
Contributor

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.

@AdityaSripal AdityaSripal changed the title BaseApp cleanup non-breaking BaseApp cleanup breaking Jul 19, 2018
@AdityaSripal AdityaSripal changed the title BaseApp cleanup breaking BaseApp cleanup Jul 19, 2018
value := app.cdc.MustMarshalBinary(result)

// Encode with json
value, err := json.Marshal(result)
Copy link
Contributor

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?

// 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
Copy link
Contributor

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]]
Copy link
Contributor

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

Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

Copy link
Contributor

@rigelrozanski rigelrozanski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@rigelrozanski rigelrozanski merged commit fae728f into develop Jul 23, 2018
@rigelrozanski rigelrozanski deleted the aditya/cleanup branch July 23, 2018 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants