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

Add simple state persistence strategy #1301

Merged
merged 2 commits into from
Feb 18, 2022
Merged

Add simple state persistence strategy #1301

merged 2 commits into from
Feb 18, 2022

Conversation

t00ts
Copy link
Contributor

@t00ts t00ts commented Feb 17, 2022

Resolves: #1298

@t00ts t00ts added area:IPC Everything related to interoperation among components (Eventbus, RPCBus), with Rusk and the UI type:feature implementing a new feature mark:testnet labels Feb 17, 2022
@t00ts t00ts marked this pull request as ready for review February 17, 2022 18:00
@codecov-commenter
Copy link

Codecov Report

Merging #1301 (c3a3d08) into master (828364b) will decrease coverage by 8.69%.
The diff coverage is 48.14%.

❗ Current head c3a3d08 differs from pull request most recent head 27681d1. Consider uploading reports for the commit 27681d1 to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1301      +/-   ##
==========================================
- Coverage   50.51%   41.81%   -8.70%     
==========================================
  Files         145      144       -1     
  Lines        7544     9082    +1538     
==========================================
- Hits         3811     3798      -13     
- Misses       3066     4711    +1645     
+ Partials      667      573      -94     
Impacted Files Coverage Δ
pkg/config/genesis/config.go 0.00% <0.00%> (ø)
pkg/core/candidate/validator.go 64.00% <ø> (+6.85%) ⬆️
pkg/core/chain/mock.go 9.09% <ø> (+0.75%) ⬆️
...nsensus/blockgenerator/candidate/blockgenerator.go 0.00% <0.00%> (-64.29%) ⬇️
...core/consensus/blockgenerator/candidate/genesis.go 0.00% <0.00%> (-69.24%) ⬇️
...kg/core/consensus/blockgenerator/candidate/mock.go 0.00% <0.00%> (ø)
...ore/consensus/blockgenerator/candidate/testutil.go 0.00% <0.00%> (-90.91%) ⬇️
pkg/core/consensus/comms.go 0.00% <0.00%> (ø)
pkg/core/consensus/fixtures.go 0.00% <0.00%> (ø)
pkg/core/consensus/header/header.go 24.50% <0.00%> (+2.41%) ⬆️
... and 187 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7baab69...27681d1. Read the comment docs.

Copy link
Member

@herr-seppia herr-seppia left a comment

Choose a reason for hiding this comment

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

A nit about the log

}
}
} else {
l.Warn("State won't persist! Set `state.persistEvery` to a positive value")
Copy link
Member

Choose a reason for hiding this comment

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

Can you set to warn just for the first time or every n?
Otherwise it will spam the log

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's kind of the idea, one should never have this value at 0. But, I get that for some random test it could be useful. I see a couple things we could do:

  1. Add a "counter" member variable to Chain that helps us print "every n".
  2. Have a RNG and have it print with a 20% probability...

First case I dislike, putting a member variable just for a warn print is an ugly idea. Second case I like better, but it introduces overhead. What do you think?

@t00ts t00ts merged commit 5158b67 into master Feb 18, 2022
@t00ts t00ts deleted the fix-1298 branch February 18, 2022 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:IPC Everything related to interoperation among components (Eventbus, RPCBus), with Rusk and the UI type:feature implementing a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add persistence strategy
3 participants