Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- [2189](https://github.com/FuelLabs/fuel-core/pull/2151): Select next DA height to never include more than u16::MAX -1 transactions from L1.
- [2162](https://github.com/FuelLabs/fuel-core/pull/2162): Pool structure with dependencies, etc.. for the next transaction pool module. Also adds insertion/verification process in PoolV2 and tests refactoring
- [2265](https://github.com/FuelLabs/fuel-core/pull/2265): Integrate Block Committer API for DA Block Costs.
- [2280](https://github.com/FuelLabs/fuel-core/pull/2280): Allow comma separated relayer addresses in cli

### Changed

Expand Down
26 changes: 25 additions & 1 deletion bin/fuel-core/src/cli/run/relayer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct RelayerArgs {

/// Uri addresses to ethereum client. It can be in format of `http://localhost:8545/` or `ws://localhost:8545/`.
/// If not set relayer will not start.
#[arg(long = "relayer", env)]
#[arg(long = "relayer", value_delimiter = ',', env)]
#[arg(required_if_eq("enable_relayer", "true"))]
#[arg(requires_if(IsPresent, "enable_relayer"))]
pub relayer: Option<Vec<url::Url>>,
Expand Down Expand Up @@ -70,3 +70,27 @@ impl RelayerArgs {
Some(config)
}
}

#[cfg(test)]
mod tests {
use super::*;
use clap::Parser;
use test_case::test_case;

#[derive(Debug, Clone, Parser)]
pub struct Command {
#[clap(flatten)]
relayer: RelayerArgs,
}

#[test_case(&[""] => Ok(None); "no args")]
#[test_case(&["", "--enable-relayer", "--relayer=https://test.com"] => Ok(Some(vec![url::Url::parse("https://test.com").unwrap()])); "one relayer")]
#[test_case(&["", "--enable-relayer", "--relayer=https://test.com", "--relayer=https://test2.com"] => Ok(Some(vec![url::Url::parse("https://test.com").unwrap(), url::Url::parse("https://test2.com").unwrap()])); "two relayers in different args")]
#[test_case(&["", "--enable-relayer", "--relayer=https://test.com,https://test2.com"] => Ok(Some(vec![url::Url::parse("https://test.com").unwrap(), url::Url::parse("https://test2.com").unwrap()])); "two relayers in same arg")]
fn parse_relayer_urls(args: &[&str]) -> Result<Option<Vec<url::Url>>, String> {
let command: Command =
Command::try_parse_from(args).map_err(|e| e.to_string())?;
let args = command.relayer;
Ok(args.relayer)
}
}