diff --git a/Cargo.lock b/Cargo.lock index 991381b6d..1fdbc9705 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1142,7 +1142,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "stellar-xdr" version = "0.0.13" -source = "git+https://github.com/stellar/rs-stellar-xdr?rev=bd9deaf09fe86bd287d21527651b240e90c320b5#bd9deaf09fe86bd287d21527651b240e90c320b5" +source = "git+https://github.com/stellar/rs-stellar-xdr?rev=2ae9311ed1466270d8558f4c88c953644a48628e#2ae9311ed1466270d8558f4c88c953644a48628e" dependencies = [ "base64", "crate-git-revision", diff --git a/Cargo.toml b/Cargo.toml index a562a9766..64892ff45 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ soroban-native-sdk-macros = { version = "0.0.13", path = "soroban-native-sdk-mac [workspace.dependencies.stellar-xdr] version = "0.0.13" git = "https://github.com/stellar/rs-stellar-xdr" -rev = "bd9deaf09fe86bd287d21527651b240e90c320b5" +rev = "2ae9311ed1466270d8558f4c88c953644a48628e" default-features = false [workspace.dependencies.wasmi] diff --git a/soroban-env-host/src/auth.rs b/soroban-env-host/src/auth.rs index 32c1e54ee..77f268adc 100644 --- a/soroban-env-host/src/auth.rs +++ b/soroban-env-host/src/auth.rs @@ -816,6 +816,10 @@ impl AuthorizationTracker { host.with_ledger_info(|li| li.network_id.metered_clone(host.budget_ref()))?, ), invocation: self.invocation_to_xdr(host.budget_ref())?, + nonce: self + .nonce + .clone() + .ok_or(host.err_general("unexpected missing nonce"))?, }); host.metered_hash_xdr(&payload_preimage) diff --git a/soroban-env-host/src/native_contract/testutils.rs b/soroban-env-host/src/native_contract/testutils.rs index a1396372d..bea590bb7 100644 --- a/soroban-env-host/src/native_contract/testutils.rs +++ b/soroban-env-host/src/native_contract/testutils.rs @@ -170,15 +170,21 @@ pub(crate) fn authorize_single_invocation_with_nonce( sub_invocations: Default::default(), }; - let signature_payload_preimage = HashIdPreimage::ContractAuth(HashIdPreimageContractAuth { - network_id: host - .with_ledger_info(|li: &LedgerInfo| Ok(li.network_id.clone())) - .unwrap() - .try_into() - .unwrap(), - invocation: root_invocation.clone(), - }); - let signature_payload = host.metered_hash_xdr(&signature_payload_preimage).unwrap(); + let signature_payload = if let Some(addr_with_nonce) = &address_with_nonce { + let signature_payload_preimage = HashIdPreimage::ContractAuth(HashIdPreimageContractAuth { + network_id: host + .with_ledger_info(|li: &LedgerInfo| Ok(li.network_id.clone())) + .unwrap() + .try_into() + .unwrap(), + invocation: root_invocation.clone(), + nonce: addr_with_nonce.nonce, + }); + host.metered_hash_xdr(&signature_payload_preimage).unwrap() + } else { + [0; 32] + }; + let signature_args = signer.sign(host, &signature_payload); let auth_entry = ContractAuth { address_with_nonce,