-
Notifications
You must be signed in to change notification settings - Fork 75
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
#1682: fix help tests #1734
Open
Ifropc
wants to merge
5
commits into
main
Choose a base branch
from
1682-help-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+96
−66
Open
#1682: fix help tests #1734
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2b58f20
fix help tests
Ifropc 1516b88
Merge remote-tracking branch 'origin/main' into 1682-help-tests
Ifropc 19ae5ba
Update cmd/soroban-cli/src/commands/contract/arg_parsing.rs
Ifropc 2523975
Get rid of either
Ifropc bdbccae
Merge remote-tracking branch 'origin/main' into 1682-help-tests
Ifropc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,12 +6,13 @@ use std::str::FromStr; | |
use std::{fmt::Debug, fs, io}; | ||
|
||
use clap::{arg, command, Parser, ValueEnum}; | ||
|
||
use soroban_rpc::{Client, SimulateHostFunctionResult, SimulateTransactionResponse}; | ||
use soroban_spec::read::FromWasmError; | ||
|
||
use super::super::events; | ||
use super::arg_parsing; | ||
use crate::commands::contract::arg_parsing::Error::HelpMessage; | ||
use crate::commands::contract::invoke::Error::ArgParsing; | ||
use crate::{ | ||
assembled::simulate_and_assemble_transaction, | ||
commands::{ | ||
|
@@ -131,12 +132,20 @@ impl From<Infallible> for Error { | |
|
||
impl Cmd { | ||
pub async fn run(&self, global_args: &global::Args) -> Result<(), Error> { | ||
let res = self.invoke(global_args).await?.to_envelope(); | ||
let res = self.invoke(global_args).await; | ||
match res { | ||
TxnEnvelopeResult::TxnEnvelope(tx) => println!("{}", tx.to_xdr_base64(Limits::none())?), | ||
TxnEnvelopeResult::Res(output) => { | ||
println!("{output}"); | ||
Ok(res) => match res.to_envelope() { | ||
TxnEnvelopeResult::TxnEnvelope(tx) => { | ||
println!("{}", tx.to_xdr_base64(Limits::none())?); | ||
} | ||
TxnEnvelopeResult::Res(output) => { | ||
println!("{output}"); | ||
} | ||
}, | ||
Err(ArgParsing(HelpMessage(help))) => { | ||
println!("{help}"); | ||
} | ||
Comment on lines
+145
to
147
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. Same comment about doing this at the top level. |
||
Err(e) => return Err(e), | ||
} | ||
Ok(()) | ||
} | ||
|
@@ -221,7 +230,7 @@ impl NetworkRunnable for Cmd { | |
let spec_entries = self.spec_entries()?; | ||
if let Some(spec_entries) = &spec_entries { | ||
// For testing wasm arg parsing | ||
let _ = build_host_function_parameters(&contract_id, &self.slop, spec_entries, config)?; | ||
build_host_function_parameters(&contract_id, &self.slop, spec_entries, config)?; | ||
} | ||
let client = network.rpc_client()?; | ||
|
||
|
@@ -235,9 +244,11 @@ impl NetworkRunnable for Cmd { | |
.await | ||
.map_err(Error::from)?; | ||
|
||
let (function, spec, host_function_params, signers) = | ||
let params = | ||
build_host_function_parameters(&contract_id, &self.slop, &spec_entries, config)?; | ||
|
||
let (function, spec, host_function_params, signers) = params; | ||
|
||
let should_send_tx = self | ||
.should_send_after_sim(host_function_params.clone(), client.clone()) | ||
.await?; | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think we need to do this at the top level, rather than inside the arg parsing, otherwise the exit codes will be incorrect when generating the help when no
--help
is passed. It's a small thing, but also I believe a small fix to keep passing the error as is up the chain, and at the top level doing as you do here.