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

pallet-initializer new session is applied immediately #288

Merged
merged 5 commits into from
Oct 17, 2023

Conversation

fgamundi
Copy link
Contributor

@fgamundi fgamundi commented Oct 16, 2023

Delaying the application of a new session until on_finalize was producing unwanted behavior. This changes it to be applied immediately on apply_new_session, and removes BufferedSessionChange as it was only used to temporarily save the session change until on_finalize

@fgamundi fgamundi marked this pull request as ready for review October 16, 2023 17:33
Copy link
Collaborator

@girazoki girazoki left a comment

Choose a reason for hiding this comment

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

LGTM

@girazoki girazoki merged commit 51f6ca6 into moondance-labs:master Oct 17, 2023
19 checks passed
@fgamundi fgamundi deleted the fg-initializer-new-session branch October 17, 2023 08:32
tmpolaczyk added a commit that referenced this pull request Oct 17, 2023
Because since #288 collator rotation is handled in on_initialize, and we
can only read the relay randomness after the set_validation_data
inherent, which happens after on_initialize.

The solution is to read the randomness on the on_finalize hook of the
previous block, store it in pallet_collator_assignment, and delete it
when reading it.
tmpolaczyk added a commit that referenced this pull request Oct 19, 2023
* Add randomness to pallet-collator-assignment

* Mock randomness inherent in tests

* Do not shuffle collators if seed is 0

* Merge the functions to add and fill new container chains into one

* Rotate collators according to config param

* Use per-block randomness instead of per-epoch randomness

* Dont check collator2002-01 dbpath

Because a different collator may be assigned to container 2002

* Add zombie_tanssi_rotation test suite

* Unit test collator assignment rotation

* Fix integration test by killing storage value

* Rename para-rotation suite to avoid moonwall bug

* Increase zombienet test timeout

* Mix subject with relay randomness, and fix bug all seeds starting with 1

There was a bug because we tried to read an Option<Hash> as a Hash, and
this results in the first byte of the [u8; 32] being always 1, which is
the marker for "Some"

* Fix collators rotating 1 block too early

* Add event CollatorAssignment::NewPendingAssignment

* Fix tests after 1.1.0 upgrade

* Make full_rotation_period configurable, defined in pallet_configuration

* Use fast_or_prod macro to set full_rotation_period = 5 for tests

* Store randomness from previous relay block in pallet storage

Because since #288 collator rotation is handled in on_initialize, and we
can only read the relay randomness after the set_validation_data
inherent, which happens after on_initialize.

The solution is to read the randomness on the on_finalize hook of the
previous block, store it in pallet_collator_assignment, and delete it
when reading it.

* Change para-rotation test to rotate every 5 sessions instead of every 1

Rotating every session does not leave enough time for collators to
detect their assignment, and some tests result in timeout

* Rewrite migration using get_raw and put_raw

* Rotation period of 0 disables rotation
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.

3 participants