-
Notifications
You must be signed in to change notification settings - Fork 0
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
Implementation of stake module (which was named staking earlier) #17
Conversation
) | ||
|
||
// ExponentialBackoff performs exponential backoff attempts on a given action | ||
func ExponentialBackoff(action func() error, max uint, wait time.Duration) error { |
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.
What's the purpose of implementing this?
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 have removed this helper directory from stake PR and have raised separate PR for it.
) | ||
|
||
// FilterEvents filter events by fn | ||
func FilterEvents(events []sdk.StringEvent, fn func(sdk.StringEvent) bool) *sdk.StringEvent { |
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.
What's the use case for staking?
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.
It filter out the event emitted by the Heimdall and use the result in the bridge.
I have removed this helper directory from stake PR and have raised separate PR for it.
x/stake/keeper/migrations.go
Outdated
} | ||
} | ||
|
||
// Migrate1to2 migrates from version 1 to 2. |
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.
As there's nothing to migrate (first version of the module) there's no reason for these
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.
Okay, Removed the migration file completely.
@@ -7,6 +7,7 @@ import ( | |||
"os" | |||
"path/filepath" | |||
|
|||
"github.com/0xPolygon/heimdall-v2/helper" |
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.
Let's sort the imports.
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.
What to sort here?
@@ -116,7 +117,8 @@ type App struct { | |||
ParamsKeeper paramskeeper.Keeper | |||
ConsensusParamsKeeper consensusparamkeeper.Keeper | |||
|
|||
// Custom Keepers | |||
// contract keeper |
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.
you mean contract caller
? Anyway not a useful comment, I'd remove it.
@@ -297,6 +299,18 @@ func NewApp( | |||
authtypes.NewModuleAddress(govtypes.ModuleName).String(), | |||
) | |||
|
|||
// | |||
// Contract caller |
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.
Let's remove this useless comments section.
|
||
// contractCallerObj, err := helper.NewContractCaller() | ||
// if err != nil { | ||
// cmn.Exit(err.Error()) |
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.
cmn
exit?
@@ -0,0 +1,249 @@ | |||
[ |
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.
The contacts are already merged to develop
right? Let's remove them from this PR.
Please find my comments in the relative PR.
x/types/validator-set.go
Outdated
indent) | ||
} | ||
|
||
//------------------------------------- |
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.
Remove these useless separators
x/types/validator-set.go
Outdated
valz[j] = it | ||
} | ||
|
||
/////////////////////////////////////////////////////////////////////////////// |
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.
remove these useless separators
x/types/validator-set.go
Outdated
vals.Validators = merged[:i] | ||
} | ||
|
||
// Checks that the validators to be removed are part of the validator set. |
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.
Start the comment with the function's name
x/types/validator_test.go
Outdated
@@ -0,0 +1,134 @@ | |||
package types | |||
|
|||
// import ( |
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 is everything commented out?
In case this can't be tested jut yet, please, leave a TODO HV2
with such reasons, and some info on how/when to re-enable it.
Also, use multiline comments.
x/types/vote.go
Outdated
type Vote int32 | ||
|
||
const ( | ||
// TODO HV2: should we have an UNSPECIFIED value 0 tag as suggested here: https://protobuf.dev/programming-guides/dos-donts/#unspecified-enum ? |
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.
Yes, I think we should.
Left some comments to be addressed. |
x/types/validator-set.go
Outdated
@@ -0,0 +1,703 @@ | |||
package types |
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 believe package types
should go outside x
Also, please use naming conventions for this file, e.g. validator_set.go
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.
yes, chain level types
should be defined outside of x/
, and then each module will have its own types
directory
rpc StakingSequence(QueryStakingSequenceRequest) | ||
returns (QueryStakingSequenceResponse) { | ||
option (cosmos.query.v1.module_query_safe) = true; | ||
option (google.api.http).get = "/staking/isOldTx"; |
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 believe this is defined all as lower case in original heimdall, as in isoldtx
.
Let's make sure we don't break API compatibility with v1
Closing in favour of #39 |
Description
In this PR I have implemented the stake module(which was called staking module earlier).
There are these four txs types supported by this module-
1.MsgValidatorJoin
2.MsgStakeUpdate
3.MsgSignerUpdate
4.MsgValidatorExit