-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Decouple the session validators from im-online #7127
Decouple the session validators from im-online #7127
Conversation
… make-im-online-validator-set-flexiable
… make-im-online-validator-set-flexiable
|
Ping @andresilva @bkchr @tomusdrw |
tomusdrw
left a comment
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.
IMHO the decoupling is incomplete and may cause more harm than good in it's current form.
Add ValidatorId in im-online Trait Make im-online compile Make substrate binary compile
…ub.com/liuchengxu/substrate into make-im-online-validator-set-flexiable
… make-im-online-validator-set-flexiable
tomusdrw
left a comment
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 the direction it's going to.
Couple of suggestions:
- Merge
ValidatorSetandSessionInterface. I think thesession_indexandValidatorSetmust stay tightly coupled. - Add extra implementation docs to the join
ValidatorSettrait. AFAIU thevalidators()can only return different values in case thesession_index()changes as well. This stills also have to be coupled withon_before_session_endingcallbacks. I.e.session_index()must change after eachon_before_session_endingand thereforvalidators()may change as well. - Implement the joint
ValidatorSettrait inpallet_session, so that you can dotype ValidatorSet = Sessioninstead of implementing these extra traits for the entire runtime. - Remove
pallet-sessionfromim-online/Cargo.toml(or move it todev-dependencies).
baf5e4e to
2f87b4a
Compare
Wrap a few too long lines Add some docs
2f87b4a to
db2d1a4
Compare
|
@tomusdrw I have merged |
… make-im-online-validator-set-flexiable
… make-im-online-validator-set-flexiable
… make-im-online-validator-set-flexiable
|
@liuchengxu could you please merge master to this pr and your companion? |
… make-im-online-validator-set-flexiable
…ub.com/liuchengxu/substrate into make-im-online-validator-set-flexiable
|
@bkchr Done. |
|
@liuchengxu you did not update your companion pr :D Sorry for the complex process 🙈 |
|
@bkchr I'm pretty sure I have updated the companion paritytech/polkadot@08c14e7 :), the companion just needs approval IMO. |
|
Ahh had overseen this! However the pr is not building, I started the build another time to maybe catch some misalignment between the updates. Otherwise please fix the pr. Ty :) You can see the status here in |
… make-im-online-validator-set-flexiable
|
Hi @bkchr |
shawntabrizi
left a comment
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.
Looks good to me :)
… make-im-online-validator-set-flexiable
|
bot merge |
|
The PR is currently unmergeable. |
… make-im-online-validator-set-flexiable
bkchr
left a comment
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.
Sorry for never have looked over this, but here are really some changes that need to be done. Most of the stuff is also relative straightforward.
Some general comments. You should not bring FRAME concepts to the primitive crates and comments above traits should also be as much as possible generic. This mean, do not mention any particular pallet or whatever.
And again, sorry! If you have done these changes, I will merge this right away!
primitives/session/src/lib.rs
Outdated
| /// Returns all the validators ought to be online in a session. | ||
| /// | ||
| /// The returned validators are all expected to be running an authority node. |
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.
| /// Returns all the validators ought to be online in a session. | |
| /// | |
| /// The returned validators are all expected to be running an authority node. | |
| /// Returns the active set of validators. |
primitives/session/src/lib.rs
Outdated
| } | ||
|
|
||
| /// A session handler for specific key type. | ||
| pub trait OneSessionHandler<ValidatorId>: BoundToRuntimeAppPublic { |
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.
All these 3 traits here are frame specific. Please move them to frame-support. They do not belong here.
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.
@bkchr Please have another look, hopefully, I have applied all the suggestions, let me know if I miss anything.
bkchr
left a comment
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.
Ty for the fast integration!
|
bot merge |
|
Waiting for commit status. |
|
Head SHA changed; merge aborted. |
… make-im-online-validator-set-flexiable
|
bot merge |
|
Waiting for commit status. |
This PR decouples the session validators from im-online pallet, so that the user of im-online pallet can pass any specific validator list that are ought to be online, particularly useful for the projects having their own staking logic like ChainX.
Fixes #7124