Skip to content

Conversation

@franciszekjob
Copy link
Contributor

@franciszekjob franciszekjob commented Dec 12, 2025

Stack

Closes #3250

Introduced changes

Checklist

  • Linked relevant issue
  • Updated relevant documentation
  • Added relevant tests
  • Performed self-review of the code
  • Added changes to CHANGELOG.md

@franciszekjob franciszekjob requested a review from a team as a code owner December 12, 2025 18:12
@franciszekjob franciszekjob requested review from MKowalski8 and ksew1 and removed request for a team December 12, 2025 18:12
@franciszekjob franciszekjob marked this pull request as draft December 12, 2025 18:17
Copy link
Member

@cptartur cptartur left a comment

Choose a reason for hiding this comment

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

Left a comment

github-merge-queue bot pushed a commit that referenced this pull request Dec 17, 2025
…t` (#4013)

<!-- Reference any GitHub issues resolved by this PR -->

**Stack**
- #4020
- #4019
- #4017
- #4013 ⬅

Closes #

## Introduced changes

When using e.g. `account create` without explicitly passing `--url` or
`--network` and having `url` defined in `snfoundry.toml`, we should use
the one from config. This PR fixes that.

## Checklist

<!-- Make sure all of these are complete -->

- [ ] Linked relevant issue
- [x] Updated relevant documentation
- [x] Added relevant tests
- [x] Performed self-review of the code
- [x] Added changes to `CHANGELOG.md`
github-merge-queue bot pushed a commit that referenced this pull request Dec 19, 2025
<!-- Reference any GitHub issues resolved by this PR -->

**Stack**
- #4020
- #4019
- #4017 ⬅
- #4013

Closes #

## Introduced changes

<!-- A brief description of the changes -->

-

## Checklist

<!-- Make sure all of these are complete -->

- [ ] Linked relevant issue
- [ ] Updated relevant documentation
- [x] Added relevant tests
- [x] Performed self-review of the code
- [ ] Added changes to `CHANGELOG.md`
Base automatically changed from use-url-instead-of-string-in-cast-config to master December 19, 2025 16:31
Comment on lines +92 to +98
pub fn validate(&self) -> anyhow::Result<()> {
match (&self.url, &self.network) {
(Some(_), Some(_)) => {
anyhow::bail!("Only one of `url` or `network` may be specified")
}
_ => Ok(()),
}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe let's add an todo for your issue somewhere in code? #4027

} else {
unreachable!(
"`--url` or `--network` must be provided or url must be set in snfoundry.toml"
"`--url` or `--network` must be provided or url or network fields must be set in snfoundry.toml"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"`--url` or `--network` must be provided or url or network fields must be set in snfoundry.toml"
"`--url` or `--network` must be provided or one of url or network field must be set in snfoundry.toml"


#[derive(ValueEnum, Clone, Copy, Debug, PartialEq)]
#[derive(ValueEnum, Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need this change now?

Comment on lines +47 to +48
url = "http://some.url"
network = "sepolia"
Copy link
Member

Choose a reason for hiding this comment

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

Is having both correct? The validation we have for configs says it shouldn't be.

account: account_name.into(),
accounts_file: accounts_file.into(),
keystore,
keystore: keystore.map(std::convert::Into::into),
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need mapping here?

Comment on lines +190 to +194
let (url, network) = if rpc_args.url.is_some() || rpc_args.network.is_some() {
(rpc_args.url.clone(), rpc_args.network)
} else {
(config.url.clone(), config.network)
};
Copy link
Member

Choose a reason for hiding this comment

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

Is the case where network is in config and url in rpc_args and vice versa not possible?

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.

4 participants