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

R4R: Auth Module Param Store #2998

Merged
merged 28 commits into from
Dec 20, 2018
Merged

R4R: Auth Module Param Store #2998

merged 28 commits into from
Dec 20, 2018

Conversation

alexanderbez
Copy link
Contributor

@alexanderbez alexanderbez commented Dec 4, 2018

  • Drastically cleanup/DRY unit tests (via testInput type)
  • Remove remnants of old am variable and receiver usage
  • Implement new Params type
  • Update ante handler to use params (notably: consumeSignatureVerificationGas)

closes: #2996


  • Targeted PR against correct branch (see CONTRIBUTING.md)

  • Linked to github-issue with discussion and accepted design OR link to spec that describes this work.

  • Wrote tests

  • Updated relevant documentation (docs/)

  • Added entries in PENDING.md with issue #

  • rereviewed Files changed in the github PR explorer


For Admin Use:

  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)
  • Reviewers Assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@alexanderbez alexanderbez added the Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity. label Dec 4, 2018
@alexanderbez alexanderbez changed the title WIP: Auth Module Param Store WIP: Auth Module Param Store - Pt I Dec 4, 2018
@alexanderbez alexanderbez reopened this Dec 5, 2018
@alexanderbez alexanderbez changed the title WIP: Auth Module Param Store - Pt I WIP: Auth Module Param Store Dec 5, 2018
x/auth/ante.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Dec 5, 2018

Codecov Report

Merging #2998 into develop will increase coverage by 0.13%.
The diff coverage is 70.14%.

@@             Coverage Diff             @@
##           develop    #2998      +/-   ##
===========================================
+ Coverage    54.72%   54.86%   +0.13%     
===========================================
  Files          132      133       +1     
  Lines         9425     9546     +121     
===========================================
+ Hits          5158     5237      +79     
- Misses        3949     3988      +39     
- Partials       318      321       +3

@alexanderbez alexanderbez added the T: API Breaking Breaking changes that impact APIs and the SDK only (not state machine). label Dec 6, 2018
Copy link
Member

@jackzampolin jackzampolin left a comment

Choose a reason for hiding this comment

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

Was looking through here for the client functionality and not seeing it. Shouldn't we be able to query these params from both the LCD and CLI?

Also we might want to add genesis validation like #3006

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.

Quick review, structural changes look fine, a few suggestions and I would second @ValarDragon / @jackzampolin's comments.

x/auth/ante.go Show resolved Hide resolved
x/auth/context.go Outdated Show resolved Hide resolved
@@ -55,28 +55,21 @@ func (tx StdTx) ValidateBasic() sdk.Error {
if len(stdSigs) != len(tx.GetSigners()) {
return sdk.ErrUnauthorized("wrong number of signers")
}
if len(tx.GetMemo()) > maxMemoCharacters {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, what about having ValidateBasic require a params? I like separating the stateless checks, it's cleaner.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! That would require updating the Tx interface. Are we OK with this?

Copy link
Contributor

Choose a reason for hiding this comment

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

That seems fine, maybe we could have a sub-struct in Params just for tx validation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See comment below.


sigCount := 0
for i := 0; i < len(stdSigs); i++ {
sigCount += countSubKeys(stdSigs[i].PubKey)
if sigCount > txSigLimit {
if uint64(sigCount) > DefaultTxSigLimit {
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like it should definitely be a param

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very strange. It is a param. Must've forgotten to update this.

Copy link
Contributor Author

@alexanderbez alexanderbez Dec 13, 2018

Choose a reason for hiding this comment

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

Ohhh wait, this is because it's in ValidateBasic too. I don't know of a clean way really to support this. Maybe ValidateBasic can take a params interface{}...? Keep in mind, the Tx interface is defined in /types.

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this is OK for now. Maybe let's discuss in an issue

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created an issue here: #3164

@alexanderbez
Copy link
Contributor Author

@cwgoes updated.

@cwgoes
Copy link
Contributor

cwgoes commented Dec 18, 2018

Needs a rebase.

@alexanderbez
Copy link
Contributor Author

@cwgoes rebased.

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.

Tested ACK

A few remaining concerns, but they don't need to block merge. This should see an additional review.

switch {
case strings.Contains(pubkeyType, "ed25519"):
meter.ConsumeGas(params.SigVerifyCostED25519, "ante verify: ed25519")
case strings.Contains(pubkeyType, "secp256k1"):
Copy link
Contributor

Choose a reason for hiding this comment

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

This does add quite a bit of technical debt, although the struct names are unlikely to change. At minimum let's create an issue upstream.


sigCount := 0
for i := 0; i < len(stdSigs); i++ {
sigCount += countSubKeys(stdSigs[i].PubKey)
if sigCount > txSigLimit {
if uint64(sigCount) > DefaultTxSigLimit {
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this is OK for now. Maybe let's discuss in an issue

@cwgoes
Copy link
Contributor

cwgoes commented Dec 19, 2018

Needs a rebase now @alexanderbez (sorry) - and also another review.

Copy link
Member

@jackzampolin jackzampolin left a comment

Choose a reason for hiding this comment

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

This is a great addition. Tested locally and all working for me. I think this just needs a rebase.

@jackzampolin jackzampolin merged commit 217a292 into develop Dec 20, 2018
@jackzampolin jackzampolin deleted the bez/2996-auth-param-store branch December 20, 2018 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: API Breaking Breaking changes that impact APIs and the SDK only (not state machine). Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

x/auth: Param Store
5 participants