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

Explain usage of <T: Config> in FRAME storage + Update parachain pallet template #4941

Merged
merged 27 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
df831b6
omni-node basics
kianenigma Jun 1, 2024
110f282
Fix --help commands
serban300 Jun 12, 2024
df08dba
`--execution` has no effect and a warning is printed
serban300 Jun 14, 2024
d2e8881
Cosmetics
serban300 Jun 14, 2024
e0a3e1f
Remove unneeded Runtime variant
serban300 Jun 14, 2024
84b1d32
polkadot-parachain-omni-node v0.1.0
serban300 Jun 17, 2024
2c36b25
Remove manual testing chain specs
serban300 Jun 18, 2024
e766b02
Revert renaming
serban300 Jun 19, 2024
37cf6dd
Avoid using hardcoded binary name
serban300 Jun 19, 2024
52c3551
Remove banner
serban300 Jun 19, 2024
a796cd8
polkadot-parachain-bin
serban300 Jun 19, 2024
f758ade
Cargo.lock
serban300 Jun 19, 2024
819d06d
Merge branch 'master' into polkadot-parachain-omni-node
serban300 Jun 20, 2024
db414bd
small fixes
serban300 Jun 20, 2024
afee2dc
Merge remote-tracking branch 'upstream/master' into polkadot-parachai…
serban300 Jun 27, 2024
df2a0a5
Remove more unneeded Runtime variants
serban300 Jun 27, 2024
c19b29a
Fix typo
serban300 Jun 27, 2024
5ad5db6
Merge branch 'master' of github.com:paritytech/polkadot-sdk
kianenigma Jun 28, 2024
ae5fecc
Master.into()
kianenigma Jul 3, 2024
d5a7084
explain how to make FRAME storage generic over <T> + update in pallet…
kianenigma Jul 4, 2024
ce9f542
Merge branch 'master' into kiz-update-tempalates-and-t-in-storage
kianenigma Jul 4, 2024
bb45cd5
fmt
kianenigma Jul 5, 2024
79b25f6
fix
kianenigma Jul 5, 2024
91f3cba
".git/.scripts/commands/fmt/fmt.sh"
Jul 5, 2024
4350d46
Master.into()
kianenigma Jul 10, 2024
211c185
update
kianenigma Jul 10, 2024
6f3193c
Merge branch 'kiz-update-tempalates-and-t-in-storage' of github.com:p…
kianenigma Jul 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix --help commands
Also we can't have the banner printed all the time, because it leads to
printing malformed chain specs.
  • Loading branch information
serban300 committed Jun 17, 2024
commit 110f282848a1da63a100c717b014296d8e85d165
23 changes: 18 additions & 5 deletions cumulus/polkadot-parachain/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.

use clap::{CommandFactory, FromArgMatches};
use clap::{Command, CommandFactory, FromArgMatches};
use std::path::PathBuf;

/// Sub-commands supported by the collator.
Expand Down Expand Up @@ -62,9 +62,9 @@ pub enum Subcommand {
#[command(
propagate_version = true,
args_conflicts_with_subcommands = true,
subcommand_negates_reqs = true
subcommand_negates_reqs = true,
after_help = crate::EXAMPLES
)]
#[clap(after_help = crate::EXAMPLES)]
pub struct Cli {
#[command(subcommand)]
pub subcommand: Option<Subcommand>,
Expand All @@ -84,7 +84,7 @@ pub struct Cli {

/// Relay chain arguments
#[arg(raw = true)]
pub relaychain_args: Vec<String>,
pub relay_chain_args: Vec<String>,
}

#[derive(Debug)]
Expand All @@ -100,12 +100,25 @@ pub struct RelayChainCli {
}

impl RelayChainCli {
fn polkadot_cmd() -> Command {
let help_template = color_print::cformat!(
"The arguments that are passed to the relay chain node. \n\
\n\
<bold><underline>RELAY_CHAIN_ARGS:</></> \n\
{{options}}",
);

polkadot_cli::RunCmd::command()
.no_binary_name(true)
.help_template(help_template)
}

/// Parse the relay chain CLI parameters using the parachain `Configuration`.
pub fn new<'a>(
para_config: &sc_service::Configuration,
relay_chain_args: impl Iterator<Item = &'a String>,
) -> Self {
let polkadot_cmd = polkadot_cli::RunCmd::command().no_binary_name(true);
let polkadot_cmd = Self::polkadot_cmd();
let matches = polkadot_cmd.get_matches_from(relay_chain_args);
let base = FromArgMatches::from_arg_matches(&matches).unwrap_or_else(|e| e.exit());

Expand Down
18 changes: 9 additions & 9 deletions cumulus/polkadot-parachain/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,13 +349,13 @@ impl SubstrateCli for Cli {

fn description() -> String {
format!(
"{}
The command-line arguments provided first will be passed to the parachain node, and
the arguments provided after -- will be passed to the relay chain node.

Example:

{} [parachain-args] -- [relay_chain-args]",
"{} \n\
The command-line arguments provided first will be passed to the parachain node, \n\
and the arguments provided after -- will be passed to the relay chain node. \n\
\n\
Example: \n\
\n\
{} [parachain-args] -- [relay-chain-args]",
crate::BANNER,
Self::executable_name()
)
Expand Down Expand Up @@ -591,7 +591,7 @@ pub fn run() -> Result<()> {
}),
Some(Subcommand::PurgeChain(cmd)) => {
let runner = cli.create_runner(cmd)?;
let polkadot_cli = RelayChainCli::new(runner.config(), cli.relaychain_args.iter());
let polkadot_cli = RelayChainCli::new(runner.config(), cli.relay_chain_args.iter());

runner.sync_run(|config| {
let polkadot_config = SubstrateCli::create_configuration(
Expand Down Expand Up @@ -660,7 +660,7 @@ pub fn run() -> Result<()> {
Some(Subcommand::Key(cmd)) => Ok(cmd.run(&cli)?),
None => {
let runner = cli.create_runner(&cli.run.normalize())?;
let polkadot_cli = RelayChainCli::new(runner.config(), cli.relaychain_args.iter());
let polkadot_cli = RelayChainCli::new(runner.config(), cli.relay_chain_args.iter());
let collator_options = cli.run.collator_options();

runner.run_node_until_exit(|config| async move {
Expand Down
6 changes: 2 additions & 4 deletions cumulus/polkadot-parachain/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@
#![warn(missing_docs)]
#![warn(unused_extern_crates)]

// TODO: help in the relay chian args should also imply this
// TODO: ensure execution is not set to native anywhere

pub(crate) const EXAMPLES: &str = color_print::cstr!(
r#"<bold><underline>Examples:</></>

<bold>polkadot-parachain-omni-node --chain para.json --sync warp -- --chain relay.json --sync warp</>
Launch a warp-syncing full node of the a given para's chain-spec, and a given relay's chain-spec.
Launch a warp-syncing full node of a given para's chain-spec, and a given relay's chain-spec.

<green><italic>The above approach is the most flexible, and the most forward-compatible use to use the omni-node.</></>
<green><italic>The above approach is the most flexible, and the most forward-compatible used to spawn an omni-node.</></>

You can find the chain-spec of some networks in:

Expand Down Expand Up @@ -86,6 +85,5 @@ mod rpc;
mod service;

fn main() -> sc_cli::Result<()> {
println!("{}", BANNER);
command::run()
}