Skip to content

Commit 32bef2f

Browse files
authored
Merge of #4816
2 parents 58a926b + 3394fd7 commit 32bef2f

File tree

15 files changed

+1752
-1346
lines changed

15 files changed

+1752
-1346
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
- Reworked SDK wrapping and signatures, including some breaking changes.
2+
More specifically:
3+
- The wrapper arguments have been extracted into a separate type and their
4+
presence signals the need to wrap the tx
5+
- The dump and dry-run arguments have been turned into enumerations
6+
- The wrapper signer data has been removed from SigningTxData and moved into
7+
SigningWrapperData
8+
- Simplified the interface of aux_signing_data
9+
- Removed redundant dispatcher functions
10+
- Prevent casting from a wrapped to a raw transaction type
11+
- Prevent submitting an unwrapped transaction
12+
- Avoided passing the MASP internal address as a transaction's owner
13+
- Updated the interface of build_batch
14+
- Removed the owner for reveal_pk
15+
([\#4816](https://github.com/anoma/namada/pull/4816))

.github/workflows/scripts/check-changelog.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ check_changelog_added_in_subfolders() {
88
fi
99
echo "Using sha: $head_commit"
1010

11-
subfolders=("ci" "bug-fixes" "improvements" "miscellaneous" "features" "testing" "docs")
11+
subfolders=("ci" "bug-fixes" "improvements" "miscellaneous" "features" "testing" "docs" "SDK")
1212

1313
subfolder_pattern=$(printf "|%s" "${subfolders[@]}")
1414
subfolder_pattern=${subfolder_pattern:1} # Remove the leading '|'
@@ -26,4 +26,4 @@ check_changelog_added_in_subfolders() {
2626
fi
2727
}
2828

29-
check_changelog_added_in_subfolders
29+
check_changelog_added_in_subfolders

crates/apps_lib/src/cli.rs

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7813,21 +7813,24 @@ pub mod args {
78137813
ctx: &mut Context,
78147814
) -> Result<Tx<SdkTypes>, Self::Error> {
78157815
let ctx = ctx.borrow_mut_chain_or_exit();
7816+
let wrapper = self.wrap_tx.map(|wrapper| Wrapper {
7817+
broadcast_only: wrapper.broadcast_only,
7818+
fee_amount: wrapper.fee_amount,
7819+
fee_token: ctx.get(&wrapper.fee_token).into(),
7820+
gas_limit: wrapper.gas_limit,
7821+
wrapper_fee_payer: wrapper
7822+
.wrapper_fee_payer
7823+
.map(|x| ctx.get(&x)),
7824+
});
78167825

78177826
Ok(Tx::<SdkTypes> {
78187827
dry_run: self.dry_run,
7819-
dry_run_wrapper: self.dry_run_wrapper,
78207828
dump_tx: self.dump_tx,
7821-
dump_wrapper_tx: self.dump_wrapper_tx,
78227829
output_folder: self.output_folder,
78237830
force: self.force,
7824-
broadcast_only: self.broadcast_only,
78257831
ledger_address: ctx.get(&self.ledger_address),
78267832
initialized_account_alias: self.initialized_account_alias,
78277833
wallet_alias_force: self.wallet_alias_force,
7828-
fee_amount: self.fee_amount,
7829-
fee_token: ctx.get(&self.fee_token).into(),
7830-
gas_limit: self.gas_limit,
78317834
signing_keys: self
78327835
.signing_keys
78337836
.iter()
@@ -7839,7 +7842,7 @@ pub mod args {
78397842
chain_id: self
78407843
.chain_id
78417844
.or_else(|| Some(ctx.config.ledger.chain_id.clone())),
7842-
wrapper_fee_payer: self.wrapper_fee_payer.map(|x| ctx.get(&x)),
7845+
wrap_tx: wrapper,
78437846
memo: self.memo,
78447847
use_device: self.use_device,
78457848
device_transport: self.device_transport,
@@ -7966,10 +7969,20 @@ pub mod args {
79667969
}
79677970

79687971
fn parse(matches: &ArgMatches) -> Self {
7969-
let dry_run = DRY_RUN_TX.parse(matches);
7970-
let dry_run_wrapper = DRY_RUN_WRAPPER_TX.parse(matches);
7971-
let dump_tx = DUMP_TX.parse(matches);
7972-
let dump_wrapper_tx = DUMP_WRAPPER_TX.parse(matches);
7972+
let dry_run = if DRY_RUN_TX.parse(matches) {
7973+
Some(DryRun::Inner)
7974+
} else if DRY_RUN_WRAPPER_TX.parse(matches) {
7975+
Some(DryRun::Wrapper)
7976+
} else {
7977+
None
7978+
};
7979+
let dump_tx = if DUMP_TX.parse(matches) {
7980+
Some(DumpTx::Inner)
7981+
} else if DUMP_WRAPPER_TX.parse(matches) {
7982+
Some(DumpTx::Wrapper)
7983+
} else {
7984+
None
7985+
};
79737986
let force = FORCE.parse(matches);
79747987
let broadcast_only = BROADCAST_ONLY.parse(matches);
79757988
let ledger_address = CONFIG_RPC_LEDGER_ADDRESS.parse(matches);
@@ -7998,25 +8011,30 @@ pub mod args {
79988011
}
79998012
};
80008013
let device_transport = DEVICE_TRANSPORT.parse(matches);
8014+
// Wrap the transaction unless we want to dump or dry-run the raw tx
8015+
let wrap_tx = match (&dump_tx, &dry_run) {
8016+
(_, Some(DryRun::Inner)) | (Some(DumpTx::Inner), _) => None,
8017+
_ => Some(Wrapper {
8018+
broadcast_only,
8019+
fee_amount,
8020+
wrapper_fee_payer,
8021+
fee_token,
8022+
gas_limit,
8023+
}),
8024+
};
80018025
Self {
80028026
dry_run,
8003-
dry_run_wrapper,
80048027
dump_tx,
8005-
dump_wrapper_tx,
80068028
force,
8007-
broadcast_only,
80088029
ledger_address,
80098030
initialized_account_alias,
80108031
wallet_alias_force,
8011-
fee_amount,
8012-
fee_token,
8013-
gas_limit,
80148032
expiration,
80158033
signing_keys,
80168034
tx_reveal_code_path,
80178035
password,
80188036
chain_id,
8019-
wrapper_fee_payer,
8037+
wrap_tx,
80208038
output_folder,
80218039
memo,
80228040
use_device,

crates/apps_lib/src/cli/client.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ impl CliApi {
3737
client.wait_until_node_is_synced(&io).await?;
3838
let args = args.to_sdk(&mut ctx)?;
3939
let namada = ctx.to_sdk(client, io);
40-
let dry_run =
41-
args.tx.dry_run || args.tx.dry_run_wrapper;
40+
let dry_run = args.tx.dry_run.is_some();
4241
tx::submit_custom(&namada, args).await?;
4342
if !dry_run {
4443
namada
@@ -193,8 +192,7 @@ impl CliApi {
193192
client.wait_until_node_is_synced(&io).await?;
194193
let args = args.to_sdk(&mut ctx)?;
195194
let namada = ctx.to_sdk(client, io);
196-
let dry_run =
197-
args.tx.dry_run || args.tx.dry_run_wrapper;
195+
let dry_run = args.tx.dry_run.is_some();
198196
tx::submit_init_account(&namada, args).await?;
199197
if !dry_run {
200198
namada

0 commit comments

Comments
 (0)