-
Notifications
You must be signed in to change notification settings - Fork 1.2k
statement-store: build local affinity from a configured source #12316
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
base: andrei/explicit-affinity-local-topic-set
Are you sure you want to change the base?
Changes from 5 commits
a0fb23b
701f303
fb39d1d
5fa411c
899780c
317837d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -262,6 +262,17 @@ pub struct Cli<Config: CliConfig> { | |
| #[arg(long, default_value_t = sc_statement_store::DEFAULT_PURGE_AFTER_SEC)] | ||
| pub statement_store_purge_after_sec: u64, | ||
|
|
||
| /// Affinity topic advertised by this node. Repeatable; each value is a 32-byte hex | ||
| /// hash. | ||
| /// | ||
| /// Only relevant when `--enable-statement-store` is used. | ||
| #[arg( | ||
| long = "statement-affinity-topic", | ||
| value_name = "TOPIC", | ||
| num_args = 1.., | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the combination of
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not necessary here, removed. IIUC we receive an empty vec if nothing was provided |
||
| )] | ||
| pub statement_affinity_topics: Vec<sc_statement_store::Topic>, | ||
|
|
||
| /// HOP (Hand-Off Protocol) configuration parameters. | ||
| #[command(flatten)] | ||
| pub hop: sc_hop::HopParams, | ||
|
|
@@ -317,6 +328,7 @@ impl<Config: CliConfig> Cli<Config> { | |
| purge_after_sec: self.statement_store_purge_after_sec, | ||
| network_workers: self.statement_network_workers, | ||
| rate_limit: self.statement_rate_limit, | ||
| affinity_topics: self.statement_affinity_topics.clone(), | ||
| }, | ||
| ), | ||
| storage_monitor: self.storage_monitor.clone(), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,6 +82,17 @@ pub struct Cli { | |
| #[arg(long, default_value_t = sc_statement_store::DEFAULT_PURGE_AFTER_SEC)] | ||
| pub statement_store_purge_after_sec: u64, | ||
|
|
||
| /// Affinity topic advertised by this node. Repeatable; each value is a 32-byte hex | ||
| /// hash. | ||
| /// | ||
| /// Only relevant when `--enable-statement-store` is used. | ||
| #[arg( | ||
| long = "statement-affinity-topic", | ||
| value_name = "TOPIC", | ||
| num_args = 1.., | ||
| )] | ||
| pub statement_affinity_topics: Vec<sc_statement_store::Topic>, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes, me wonder if at least for doing proper E2E testing we should have a test RPC to be able to manipulate this somehow at runtime. |
||
|
|
||
| #[allow(missing_docs)] | ||
| #[clap(flatten)] | ||
| pub storage_monitor: sc_storage_monitor::StorageMonitorParams, | ||
|
|
@@ -148,3 +159,26 @@ pub enum Subcommand { | |
| /// Db meta columns information. | ||
| ChainInfo(sc_cli::ChainInfoCmd), | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
|
|
||
| #[test] | ||
| fn statement_affinity_topics_accumulate_repeated_flags() { | ||
| use clap::Parser; | ||
| let topic_a = "11".repeat(32); | ||
| let topic_b = "22".repeat(32); | ||
| let cli = Cli::parse_from([ | ||
| "substrate-node", | ||
| "--statement-affinity-topic", | ||
| &format!("0x{topic_a}"), | ||
| "--statement-affinity-topic", | ||
| &format!("0x{topic_b}"), | ||
| ]); | ||
| assert_eq!( | ||
| cli.statement_affinity_topics, | ||
| vec![sc_statement_store::Topic([0x11; 32]), sc_statement_store::Topic([0x22; 32])] | ||
| ); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.