-
Notifications
You must be signed in to change notification settings - Fork 39
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
feat(cli): check user provided genesis if not first run #1278
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This comment was marked as off-topic.
This comment was marked as off-topic.
1 similar comment
This comment was marked as off-topic.
This comment was marked as off-topic.
yangby-cryptape
force-pushed
the
yangby/feature/check-genesis-state
branch
from
July 19, 2023 12:30
71978d5
to
7e65518
Compare
Flouse
requested review from
driftluo and
KaoImin
and removed request for
ashuralyk
July 19, 2023 12:41
This comment was marked as outdated.
This comment was marked as outdated.
2 tasks
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as outdated.
This comment was marked as outdated.
yangby-cryptape
force-pushed
the
yangby/feature/check-genesis-state
branch
from
July 20, 2023 02:46
7e65518
to
cb109ce
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as outdated.
This comment was marked as outdated.
KaoImin
reviewed
Jul 20, 2023
KaoImin
changed the title
feat(cli): check user provided genesis if not first run
feat(cli)!: check user provided genesis if not first run
Jul 20, 2023
12 tasks
yangby-cryptape
force-pushed
the
yangby/feature/check-genesis-state
branch
from
August 2, 2023 09:18
cb109ce
to
4c287a6
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as outdated.
This comment was marked as outdated.
yangby-cryptape
changed the title
feat(cli)!: check user provided genesis if not first run
feat(cli): check user provided genesis if not first run
Aug 2, 2023
yangby-cryptape
force-pushed
the
yangby/feature/check-genesis-state
branch
from
August 2, 2023 09:59
4c287a6
to
1d52850
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as off-topic.
This comment was marked as off-topic.
driftluo
approved these changes
Aug 3, 2023
KaoImin
approved these changes
Aug 3, 2023
12 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
This PR add a feature that:
Check user provided genesis if not first run (ref: The executable binary still can run normally even the genesis state is changed. #1275).
And this PR fixes a potential issue:
If it's not the first run, the
genesis
inAxon
struct is incorrect.Because the
state_root
andreceipts_root
will be set to the correct values only when it is the first run.They are set in the method
execute_transactions(..)
:axon/core/run/src/lib.rs
Lines 206 to 207 in 1f34617
But if it's not first run,
execute_transactions(..)
will not be called.axon/core/run/src/lib.rs
Lines 127 to 131 in 1f34617
axon/core/run/src/lib.rs
Line 149 in 1f34617
This is not a bug currently, because these fields are not used.
Which issue(s) this PR fixes:
Fixes #1275.
Which toolchain this PR adaption:
No Breaking Change
Special notes for your reviewer:Since it has to run a temporary empty chain to generate the genesis state, so it uses temporary directories to createRocksAdapter
andRocksTrieDB
.Butsystem_contract::init(..)
sets a global environment variable, so it has to be called with the real path.I am not sure whether it OK or not:Couldsystem_contract::init(..)
be called twice?Issystem_contract::init(..)
sensitive with the height?Because the first time it is called, the height will always be0
after this PR.CI Description
cargo clippy --all --all-targets --all-features
cargo +nightly fmt --all -- --check
andcargo sort -gwc
CI Usage
CI Switch