-
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
Regen network/skip upgrade #5367
Regen network/skip upgrade #5367
Conversation
395c40e
to
324bf3c
Compare
Made requested changes except workaround on viper, will update once I change how the array of heights is being read |
@alexanderbez @fedekunze all the changes are updated. It's ready for review. |
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.
Looking good @anilcse -- left a few more comments 👍
Question: skipUpgradeHeights
are provided to the module from user CLI input, no? This array/map dictates the control flow of BeginBlock
(in that it clears the plan). What if different nodes set (or dont set at all) different values of skipUpgradeHeights
? Is this OK?
@@ -131,7 +131,7 @@ type SimApp struct { | |||
|
|||
// NewSimApp returns a reference to an initialized SimApp. | |||
func NewSimApp( |
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.
TBH, I'm not totally thrilled about updating the app's constructor this way simply to proxy the argument to the upgrade module's constructor. But I cannot think of a cleaner way of doing it :-/
Thoughts @aaronc @ethanfrey?
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 blocking, but I think we can think of cleaner way by passing in keeper "option" functions similar to the way we handle baseapp. However, this requires more plumbing and most notably requires the semantics of keepers to chance by operating on references and not copies.
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 like your approach @alexanderbez
@alexanderbez thanks for the quick review. Updated all the suggestions. |
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.
ACK -- left two more (non-blocking) comments. Thanks @anilcse 🎉
@fedekunze please re-review at your earliest convenience.
Name: test | ||
Height: 100 | ||
Info: `, upgrade.Plan{Name: "test", Height: 100}.String()) | ||
} | ||
|
||
func TestTestSuite(t *testing.T) { | ||
suite.Run(t, new(TestSuite)) | ||
func VerifyNotDone(t *testing.T, newCtx sdk.Context, name string) { |
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.
nit/non-blocking: the structure & style of tests and comments can definitely be cleaned up. e.g.
- space between
//
and start comment - avoid punctuation unless it's a sentence
- avoid group var statements when you assign values
- remove commented-out code
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.
Noted. We'll ensure these things are taken care from next time. Any specific reason to avoid group var statements
?
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.
var (
foo int64 = 4
bar bool = true
)
Instead,
foo := 4 // or foo := int64(4)
bar := true
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 understand. Just wanted to know if there's any specific reason to avoid group declarations. I think having group declartion for this particular scenario is needed as it is making more readable. It is creating a bit of inconsistency in the code, too. We can take a call.
@@ -131,7 +131,7 @@ type SimApp struct { | |||
|
|||
// NewSimApp returns a reference to an initialized SimApp. | |||
func NewSimApp( |
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 blocking, but I think we can think of cleaner way by passing in keeper "option" functions similar to the way we handle baseapp. However, this requires more plumbing and most notably requires the semantics of keepers to chance by operating on references and not copies.
…ork/skip-upgrade # Conflicts: # x/upgrade/abci_test.go # x/upgrade/internal/keeper/keeper.go
@@ -131,7 +131,7 @@ type SimApp struct { | |||
|
|||
// NewSimApp returns a reference to an initialized SimApp. | |||
func NewSimApp( |
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 like your approach @alexanderbez
module module.AppModule | ||
keeper upgrade.Keeper | ||
querier sdk.Querier | ||
handler gov.Handler | ||
ctx sdk.Context | ||
} | ||
|
||
func (s *TestSuite) SetupTest() { |
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 did this change? It was cleaner before imo
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 were using viper
previously and after your review we understood viper
should be sticked to cli
and it should not be used inside keeper
. The change in code needed a way to set different skipUpgradeHeights
everytime, so we had to replace the Suite
with this setupTest
to expect skipUpgradeHeights
as a param
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
Codecov Report
@@ Coverage Diff @@
## master #5367 +/- ##
==========================================
+ Coverage 54.38% 54.52% +0.13%
==========================================
Files 313 318 +5
Lines 18836 19137 +301
==========================================
+ Hits 10244 10434 +190
- Misses 7807 7917 +110
- Partials 785 786 +1
|
Closes: regen-network#5
Description
For contributor use:
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerFor admin use:
WIP
,R4R
,docs
, etc)