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

add spam prevention antehandler #2262

Merged
merged 9 commits into from
Mar 9, 2023
Merged

add spam prevention antehandler #2262

merged 9 commits into from
Mar 9, 2023

Conversation

MSalopek
Copy link
Contributor

@MSalopek MSalopek commented Mar 6, 2023

This PR adds governance spam prevention antehandler and minimal testing.

Earlier, a github member opened a PR which they closed after receiving feedback:

The changes were modelled after:

Closes: #2246

@codecov
Copy link

codecov bot commented Mar 6, 2023

Codecov Report

Merging #2262 (250cd4c) into main (e3448f9) will decrease coverage by 0.93%.
The diff coverage is 59.64%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2262      +/-   ##
==========================================
- Coverage   84.76%   83.83%   -0.93%     
==========================================
  Files          21       22       +1     
  Lines        1483     1540      +57     
==========================================
+ Hits         1257     1291      +34     
- Misses        181      201      +20     
- Partials       45       48       +3     
Impacted Files Coverage Δ
ante/ante.go 50.00% <25.00%> (-2.28%) ⬇️
ante/gov_ante.go 60.78% <60.78%> (ø)
app/app.go 75.43% <100.00%> (+0.21%) ⬆️

Copy link
Contributor

@sainoe sainoe left a comment

Choose a reason for hiding this comment

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

Nice work @MSalopek! LGTM

@MSalopek
Copy link
Contributor Author

MSalopek commented Mar 6, 2023

Let's not merge this yet, global fee e2e tests are not working. I'm trying to figure out why

Done, tests are up to date.

@mpoke mpoke merged commit 23d9f67 into main Mar 9, 2023
@mpoke mpoke deleted the gov-antehandler branch March 9, 2023 15:34
mergify bot pushed a commit that referenced this pull request Mar 9, 2023
* add spam prevention antehandler

* sort imports

* run make format

* fix misleading var names

* update wrong test cases

* fix failing gov tests

* fix linter errors

* uncomment e2e gov steps logs

(cherry picked from commit 23d9f67)
shaspitz pushed a commit that referenced this pull request Mar 9, 2023
* add spam prevention antehandler

* sort imports

* run make format

* fix misleading var names

* update wrong test cases

* fix failing gov tests

* fix linter errors

* uncomment e2e gov steps logs

(cherry picked from commit 23d9f67)

Co-authored-by: MSalopek <[email protected]>
Comment on lines +60 to +64
for _, v := range execMsg.Msgs {
var innerMsg sdk.Msg
if err := g.cdc.UnpackAny(v, &innerMsg); err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "cannot unmarshal authz exec msgs")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

@MSalopek Sorry to ask after the merge, but couldn't this code be simplified by calling MsgExec.GetMessages() ?

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.

Gov Spam Prevention Mechanism
4 participants