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 --block-{verification,production}-method flags (noop atm) #30746

Merged
merged 11 commits into from
Mar 23, 2023

Conversation

ryoqun
Copy link
Member

@ryoqun ryoqun commented Mar 16, 2023

Problem

There's no way to switch block verification/production implementations from cli in the replay/banking stages.

Summary of Changes

Add minimal cli-side plumbing so that we can add actual impls.

Hope, my unified scheduler for replaying can come soon....

Anyway, let's focus to battle for naming of cli args and descriptions here. :)

Conclusion

bike shed battle ended:

$ SOLANA_NO_HIDDEN_CLI_ARGS_= ./target/release/solana-ledger-tool verify --help
...
        --block-production-method <METHOD>
            Switch transaction scheduling method for producing ledger entries [default: thread-local-multi-iterator]
            [possible values: thread-local-multi-iterator]
        --block-verification-method <METHOD>
            Switch transaction scheduling method for verifying ledger entries [default: blockstore-processor] [possible
            values: blockstore-processor, unified-scheduler]
...

validator/src/cli.rs Outdated Show resolved Hide resolved
validator/src/cli.rs Outdated Show resolved Hide resolved
validator/src/cli.rs Outdated Show resolved Hide resolved
core/src/validator.rs Outdated Show resolved Hide resolved
core/src/validator.rs Outdated Show resolved Hide resolved
core/src/validator.rs Outdated Show resolved Hide resolved
core/src/validator.rs Outdated Show resolved Hide resolved
core/src/validator.rs Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Mar 16, 2023

Codecov Report

Merging #30746 (428fcfd) into master (721719d) will decrease coverage by 0.1%.
The diff coverage is 48.2%.

@@            Coverage Diff            @@
##           master   #30746     +/-   ##
=========================================
- Coverage    81.5%    81.4%   -0.1%     
=========================================
  Files         723      723             
  Lines      203577   203616     +39     
=========================================
- Hits       165923   165913     -10     
- Misses      37654    37703     +49     

core/src/validator.rs Outdated Show resolved Hide resolved
core/src/validator.rs Outdated Show resolved Hide resolved
core/src/validator.rs Outdated Show resolved Hide resolved
ledger-tool/src/main.rs Outdated Show resolved Hide resolved
ledger-tool/src/main.rs Outdated Show resolved Hide resolved
ledger-tool/src/main.rs Outdated Show resolved Hide resolved
@t-nelson
Copy link
Contributor

i don't imagine the interfaces here are clean enough that we could dyload the impl(s)?

Copy link
Contributor

@tao-stones tao-stones left a comment

Choose a reason for hiding this comment

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

Think I am missing context, this ability of switching replaying/banking implementation is for testing purpose, or to allow mainnet validators to configure their s/w (practically to have two versions of labs validators in mainnet)?

core/src/validator.rs Outdated Show resolved Hide resolved
ledger-tool/src/main.rs Outdated Show resolved Hide resolved
@ryoqun
Copy link
Member Author

ryoqun commented Mar 17, 2023

i don't imagine the interfaces here are clean enough that we could dyload the impl(s)?

yep. so i avoided dyn naming.

core/src/validator.rs Outdated Show resolved Hide resolved
clap-utils/src/lib.rs Outdated Show resolved Hide resolved
@ryoqun
Copy link
Member Author

ryoqun commented Mar 17, 2023

@brooksprumo @apfitzge @taozhu-chicago @t-nelson thanks for reviewing! I think I've relied to all. :) the hottest topic would be engine or else: #30746 (comment)

@ryoqun ryoqun force-pushed the replaying-banking-backends-cli branch from a6fcaea to 68a0eac Compare March 18, 2023 01:38
@ryoqun ryoqun mentioned this pull request Mar 20, 2023
@brooksprumo
Copy link
Contributor

I defer the naming to y'all. As I haven't worked on much of this code, I trust your judgement as domain experts here!

@brooksprumo brooksprumo removed their request for review March 21, 2023 00:03
@apfitzge
Copy link
Contributor

i don't imagine the interfaces here are clean enough that we could dyload the impl(s)?

this is actually something I'd like to eventually support for bank scheduling (now block-production arg?). Final interface is still in-flight, so not thinking too much about it yet.

However, I don't think that option will play very nicely with the use of strum here if we want to pass the library path as a cli arg along lines of --block-production-method dynamic-lib PATH

core/src/validator.rs Outdated Show resolved Hide resolved
core/src/validator.rs Outdated Show resolved Hide resolved
ledger-tool/src/main.rs Outdated Show resolved Hide resolved
ledger-tool/src/main.rs Outdated Show resolved Hide resolved
Comment on lines 1707 to 1708
.possible_values(ReplayingBackend::cli_names())
.default_value(ReplayingBackend::default().into())
Copy link
Contributor

Choose a reason for hiding this comment

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

Not super familiar with how clap validation works, or if this is a product of us using strum.

I tested this and passing --replaying-backend (note I didn't specify the variant) works fine and results in the default.

That seemed a bit odd to me.

Copy link
Member Author

Choose a reason for hiding this comment

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

ugh, so much thanks for catching this: d1d317e + 14c0f88

@ryoqun ryoqun force-pushed the replaying-banking-backends-cli branch from 68a0eac to d1d317e Compare March 22, 2023 13:15
@ryoqun ryoqun changed the title Add --{replaying,banking}-backend flags (noop atm) Add --block-{verification,production}-method flags (noop atm) Mar 22, 2023
@ryoqun ryoqun force-pushed the replaying-banking-backends-cli branch from 49eb374 to 296b909 Compare March 22, 2023 14:17
@ryoqun ryoqun requested a review from apfitzge March 22, 2023 14:50
@ryoqun
Copy link
Member Author

ryoqun commented Mar 22, 2023

@apfitzge could you review this to merge. I've finished off all review comments and renamed. :)

@ryoqun
Copy link
Member Author

ryoqun commented Mar 22, 2023

However, I don't think that option will play very nicely with the use of strum here if we want to pass the library path as a cli arg along lines of --block-production-method dynamic-lib PATH

in short, these will be possible, if desired. clap is very customizable if wanted...

@apfitzge
Copy link
Contributor

However, I don't think that option will play very nicely with the use of strum here if we want to pass the library path as a cli arg along lines of --block-production-method dynamic-lib PATH

in short, these will be possible, if desired. clap is very customizable if wanted...

Yeah, definitely possible with clap. Just not sure we can still use the simple EnumIter stuff from strum

Copy link
Contributor

@apfitzge apfitzge left a comment

Choose a reason for hiding this comment

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

A few more changes - sorry the review took a while this morning...I always try to give suggestions instead of just saying I don't like something. But it took me a while to figure out how to do it more cleanly (imo)

core/src/validator.rs Outdated Show resolved Hide resolved
validator/src/cli.rs Outdated Show resolved Hide resolved
@ryoqun ryoqun requested a review from apfitzge March 23, 2023 00:49
Copy link
Contributor

@apfitzge apfitzge left a comment

Choose a reason for hiding this comment

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

lgtm - thanks for all the work to get this ready for us both!

@ryoqun ryoqun merged commit 6c444df into solana-labs:master Mar 23, 2023
Comment on lines +140 to +147
lazy_static! {
static ref MESSAGE: String = format!(
"Switch transaction scheduling method for verifying ledger entries [default: {}]",
BlockVerificationMethod::default()
);
};

&MESSAGE
Copy link
Member Author

Choose a reason for hiding this comment

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

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.

5 participants