Contracts: remove the commented-out contract_setup

The separate contract_setup step is superseded by contract_sign, which runs
setup internally. Remove the dead commented-out function (libwallet, controller,
api), its CLI subcommand (grin-wallet.yml), and its dispatch arm (wallet_args).
The contract_sign path and the parse_contract_setup_args parser are unaffected.

Addresses PR #754 review (command.rs, owner.rs).
This commit is contained in:
jwinterm
2026-06-07 19:07:24 -04:00
parent 756664e654
commit bcea98be2a
5 changed files with 0 additions and 142 deletions
-13
View File
@@ -785,19 +785,6 @@ where
owner::contract_new(&mut **w, keychain_mask, &args)
}
// /// TODO
// pub fn contract_setup(
// &self,
// keychain_mask: Option<&SecretKey>,
// slate: &Slate,
// args: &ContractSetupArgsAPI,
// ) -> Result<Slate, Error> {
// let mut w_lock = self.wallet_inst.lock();
// let w = w_lock.lc_provider()?.wallet_inst()?;
// // TODO: self.doctest_mode ?
// owner::contract_setup(&mut **w, keychain_mask, &args, &slate)
// }
/// TODO
pub fn contract_sign(
&self,
-66
View File
@@ -1790,72 +1790,6 @@ impl ContractSetupArgs {
}
}
// pub fn contract_setup<L, C, K>(
// owner_api: &mut Owner<L, C, K>,
// keychain_mask: Option<&SecretKey>,
// args: ContractSetupArgs,
// ) -> Result<(), Error>
// where
// L: WalletLCProvider<'static, C, K>,
// C: NodeClient + 'static,
// K: keychain::Keychain + 'static,
// {
// controller::owner_single_use(None, keychain_mask, Some(owner_api), |api, m| {
// // Read the slatepack from stdin
// println!("Paste slatepack:");
// let mut slatepack_msg = String::new();
// io::stdin()
// .read_line(&mut slatepack_msg)
// .expect("Failed to read from stdin");
// let mut contract_setup_args = args.to_api_args();
// // Decrypt the slate, perform setup on it and encrypt it for the next party
// // TODO: Make sure you get the counterparty_addr and slate with 1 call.
// let slatepack = owner::decode_slatepack_message(
// api.wallet_inst.clone(),
// keychain_mask,
// String::from(slatepack_msg.clone()),
// vec![0],
// )?;
// let counterparty_addr =
// if args.counterparty_addr.is_some() {
// args.counterparty_addr.unwrap()
// } else {
// if !slatepack.sender.is_some() {
// panic!("No address to encrypt for. Contracts only support encrypted slates right now.");
// }
// String::try_from(&slatepack.sender.unwrap())?
// };
// let mut slate = owner::slate_from_slatepack_message(
// api.wallet_inst.clone(),
// keychain_mask,
// String::from(slatepack_msg),
// vec![0],
// )?;
// // We read the number of participants from the slate that was already created. We need this to
// // avoid taking the default value of 2 in case of 3-party computation and thus incorrectly computing
// // our kernel cost contribution.
// contract_setup_args.num_participants = slate.num_participants;
// slate = api.contract_setup(m, &slate, &contract_setup_args)?;
// print_slatepack(
// api,
// keychain_mask,
// &slate,
// &counterparty_addr,
// args.outfile,
// args.as_json,
// );
// Ok(())
// })?;
// Ok(())
// }
pub fn contract_sign<L, C, K>(
owner_api: &mut Owner<L, C, K>,
keychain_mask: Option<&SecretKey>,
-16
View File
@@ -1564,22 +1564,6 @@ where
contract::new(&mut *w, keychain_mask, &args.setup_args)
}
// /// Setup transaction contract
// pub fn contract_setup<'a, T: ?Sized, C, K>(
// w: &mut T,
// keychain_mask: Option<&SecretKey>,
// args: &ContractSetupArgsAPI,
// slate: &Slate,
// // use_test_rng: bool,
// ) -> Result<Slate, Error>
// where
// T: WalletBackend<'a, C, K>,
// C: NodeClient + 'a,
// K: Keychain + 'a,
// {
// contract::setup(&mut *w, keychain_mask, slate, &args)
// }
/// Sign transaction contract
pub fn contract_sign<'a, T: ?Sized, C, K>(
w: &mut T,
-43
View File
@@ -497,49 +497,6 @@ subcommands:
short: o
long: make-outputs
takes_value: true
# - setup:
# about: Perform a key setup on a contract
# args:
# - encrypt-for:
# help: The counter party grin address
# short: e
# long: encrypt-for
# takes_value: true
# # index: 1
# - receive:
# help: How much you want to receive
# short: r
# long: receive
# takes_value: true
# - send:
# help: How much you want to send
# short: s
# long: send
# takes_value: true
# - as-json:
# help: Show result as JSON
# short: j
# long: as-json
# takes_value: false
# - no-payjoin:
# help: Don't make it a payjoin (if receiver)
# long: no-payjoin
# takes_value: false
# - add-outputs:
# help: Defines whether we should pick inputs/outputs in the setup step.
# short: a
# long: add-outputs
# takes_value: false
# - use-inputs:
# help: Which inputs you want to use (provide comma separated commitments)
# short: i
# long: use-inputs
# takes_value: true
# - make-outputs:
# help: Which outputs should we create? (provide comma separated amounts)
# short: o
# long: make-outputs
# takes_value: true
- sign:
about: Sign a contract
args:
-4
View File
@@ -1478,10 +1478,6 @@ where
let a = arg_parse!(parse_contract_new_args(&new_args, account));
command::contract_new(owner_api, km, a)
}
// ("setup", Some(setup_args)) => {
// let a = arg_parse!(parse_contract_setup_args(&setup_args));
// command::contract_setup(owner_api, km, a)
// }
("sign", Some(sign_args)) => {
// Sign command takes setup_args so we use the same parser
let setup_args = arg_parse!(parse_contract_setup_args(&sign_args));