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

Execution test fails when changing the constant periods_per_cycle #3742

Closed
Leo-Besancon opened this issue Mar 30, 2023 · 1 comment
Closed
Labels
bug Something isn't working p2

Comments

@Leo-Besancon
Copy link
Collaborator

Describe the bug

In particular, the test tests::scenarios_mandatories::tests::events_from_switching_blockclique panics with a CycleUnavailable error after a block miss.

thread 'execution' panicked at 'couldn't get the expected block producer for a missed slot: CycleUnavailable(2)', massa-execution-worker\src\execution.rs:975:18

To Reproduce

In massa\massa-models\src\config\constants.rs, change:

pub const PERIODS_PER_CYCLE: u64 = 128;

to

pub const PERIODS_PER_CYCLE: u64 = 10;

Then run the tests: cargo test --features testing

Expected behavior
The test should pass.

@Leo-Besancon Leo-Besancon added the bug Something isn't working label Mar 30, 2023
Leo-Besancon added a commit that referenced this issue Mar 30, 2023
Leo-Besancon added a commit that referenced this issue Apr 4, 2023
* Initial commit for network restart: Archive read / write

Needs testing

* Skeleton of the snapshot creation workflow

* Removed archiving tests

* fmt

* cleaned a bit the FinalState init

* Cleaned (check / clippy)

* Added Pos deserialization

* Added final state serialization to file

* Refactoring + create final_state dir if it does not exist

* fixed path issue

* Reverted some commits of local config

* Don't reset ledger if from snapshot (will be changed for testnet21)

Indeed, we will always keep the ledger from now on.

* Compute and check hash of recovered final_state

* Don't replace old ledger

* Changed timestamps to account for LAST_START_PERIOD

But no finalized blocks are made anymore, I'll have to check the concensus rules...

* fmt

* Fixed some final_cursor issues

create_snapshot and --from_snapshot should work well in sandbox mode!

* clippy allow lint in case the constant is not 0

* Changed LAST_START_PERIOD from const to static ref

+ Ledger rollback based on genesis_timestamp

* Fixed cycle_history issue and block_header deserialize assumption

* fmt

* Fixed hash computation in --from_snapshot

* cleaned the code

* Rethought the cycle logic when LAST_STAR_PERIOD is not 0.

* Keep previous roll_counts

* fmt

* clippy

* Fixed initial_rolls when snapshotting

* Added feed_cycle_state_hash in --from_snapshot

Don't know if I should do it or not :/

* fmt

* Set up PoS_final_state after bootstrap

* fmt

* Added debug info

* Fix Mutex lock issue

* change config for tests

* Added bootstrap of initial pos_state info

- initial_cycle
- initial_rolls
- initial_ledger_hash

* Change desynchronisation checks

* Added cycle_history debug info

* Boostrapable last_start_period value

* Final_state in ledger

* Fixed final state in ledger

The dump / commit logic is probably false right now, need to investigate the best way to handle it

* doctest pass

* Fix bootstrap message deser

* disable desync detection + bootstrap fix

* Fixed deployment (lazy_static parsing fail) + fmt

* logs for cycle info changes

* Fixed execution cycle lookback

* Tried to fix the draws

* Updated deferred credit logic

* Fixed deferred credit hash for snapshot + removed info!()

* Make test pass + clean info!() logs

* Removed final_state_path setting, no longer used

* Added documentation, restored periods_per_cycle at 128

* Refactoring + Only bootstrap the initial_state once

* Update massa-final-state/src/final_state.rs

Co-authored-by: Ben <benphawke@gmail.com>

* fmt

* Cleaned the FinalState::from_snapshot() method

Created Ser/Deser helpers for FinalStateRaw.

* Better handle final_state in RocksDB

* Added a TODO for get_pinned

* Use range() on the BTreeMap to better filter the slot range.

* Fixed a regretion in the previous commit

* Doc comments lints

* Doc comment for final_state_data in ledger

* cleaned final_state_raw_deserializer args

* Used get_pinned_cf for final_state_hash

* fmt + _args => args

* Changed final_state dispatch in main

* Interpolate the cycles (untested)

* Small fixes and lints

* Delete intiial_state logic (bootstrap, deser, ...) + iniitial_cycle for pos_state

* fmt

* clippy fix

* update snapshot logic without get_final_state

* Set period_per_cycle to 10 for tests

* Fix feed_cycle_hash

* fmt

* Feed selector during downtime interpolation

* feed_selector and compute draws logic added

* clippy fix

* Don't dump the final_state on finalize()

* Added comments for periods_per_cycle

* small refactoring and docs update for pos_final_state

* Make CI pass

Cf #3742

* Small refactor of final_state

* Add TODO for commented imports

* Refactor final_state downtime interpolation

* Removed an unneeded rocks_db call

* Included (x-1) > Excluded (x) in bounds

* fmt

* Updated deferred_credits logic, TODO: TESTS

Inspired from #3740

* Small cleanup / renames

* Updated roll_sell test to test the new deferred_credits impl

* Cleanup after changes: no more last_start_period needed in pos_final_state

* TODO: CHANGE BACK CONST

* Fixed block_factory next_slot if before last_start_period

* Update final_state.rs

* Changed rng_seed push to avoid loops

* info > debug for all denuncuations

* Revert "info > debug for all denuncuations"

This reverts commit 2b28b33.

* Make PR Ready!

* Fix merge with GRPC

* Improved some docs

* Fix execution test after merge

* New pass over documentation

* Final doc improvements

* Apply suggestions from code review

Co-authored-by: Ben <benphawke@gmail.com>

* Applied most of the suggestions in review

* fmt

* fixed stats feature flags

* fmt

---------

Co-authored-by: Ben <benphawke@gmail.com>
@AurelienFT AurelienFT added the p2 label Jul 3, 2023
@Leo-Besancon
Copy link
Collaborator Author

Since the refactor and use of mock made in #4504, execution tests work now with a different periods_per_cycle.
#4539 also make generic checks in the selector, so cargo test is successful as a whole.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p2
Projects
None yet
Development

No branches or pull requests

2 participants