Skip to content

Commit 3450e6d

Browse files
lklimekclaude
andcommitted
fix(test): rename tc_065 to reflect actual behavior (missing destination, not auth)
The token fixture has new_tokens_destination_identity: None, so the mint fails with DestinationIdentityForTokenMintingNotSetError before authorization is checked. Renamed from tc_065_mint_unauthorized to tc_065_mint_without_destination with TODO to add a proper authorization test once the fixture sets a default mint destination. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6a25758 commit 3450e6d

1 file changed

Lines changed: 23 additions & 35 deletions

File tree

tests/backend-e2e/token_tasks.rs

Lines changed: 23 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -748,59 +748,47 @@ async fn tc_064_estimate_perpetual_rewards() {
748748
}
749749

750750
// ---------------------------------------------------------------------------
751-
// TC-065: TokenTask error -- mint with unauthorized identity
751+
// TC-065: TokenTask error -- mint without destination identity configured
752752
// ---------------------------------------------------------------------------
753+
//
754+
// TODO: This test does NOT verify authorization (owner-only minting rules).
755+
// The token fixture sets `new_tokens_destination_identity: None`, so any
756+
// mint attempt without an explicit `recipient_id` fails with
757+
// DestinationIdentityForTokenMintingNotSetError before authorization is
758+
// checked. To test actual unauthorized minting, the fixture would need to
759+
// set `new_tokens_destination_identity` to the owner's identity, then have
760+
// the second identity attempt to mint → should get an authorization error.
753761

754762
#[ignore]
755763
#[tokio_shared_rt::test(shared, flavor = "multi_thread", worker_threads = 12)]
756-
async fn tc_065_mint_unauthorized() {
764+
async fn tc_065_mint_without_destination() {
757765
let ctx = harness::ctx().await;
758766
let st = shared_token().await;
759767
let second = ensure_second_identity().await;
760768

761-
// Second identity is NOT the contract owner and not in any minting group
769+
// Mint without recipient_id on a contract with no default destination.
762770
let task = BackendTask::TokenTask(Box::new(TokenTask::MintTokens {
763771
sending_identity: second.qualified_identity.clone(),
764772
data_contract: st.data_contract.clone(),
765773
token_position: st.token_position,
766774
signing_key: second.signing_key.clone(),
767-
public_note: Some("E2E unauthorized mint attempt".to_string()),
775+
public_note: Some("E2E mint without destination".to_string()),
768776
amount: 1_000,
769777
recipient_id: None,
770778
group_info: None,
771779
}));
772780

773781
let result = run_task(&ctx.app_context, task).await;
774-
let err = result.expect_err("TC-065: unauthorized minting should fail");
775-
776-
// Platform rejects via consensus error in the proof. The specific variant
777-
// depends on the token contract config:
778-
// - PlatformRejected (StateTransitionBroadcastError): direct broadcast rejection
779-
// - SdkError wrapping Protocol(ConsensusError(BasicError(
780-
// DestinationIdentityForTokenMintingNotSetError))): no mint destination
781-
// configured — returned via proof verification
782-
// Both indicate the unauthorized mint was correctly rejected.
783-
// TODO: add a dedicated TaskError variant for token authorization errors
784-
// so this can use typed matching instead of Debug inspection.
785-
use dash_evo_tool::backend_task::error::TaskError;
786-
match &err {
787-
TaskError::PlatformRejected { .. } => {
788-
tracing::info!("TC-065: unauthorized mint rejected via broadcast");
789-
}
790-
TaskError::SdkError { source_error } => {
791-
let detail = format!("{:?}", source_error);
792-
assert!(
793-
detail.contains("DestinationIdentityForTokenMintingNotSet")
794-
|| detail.contains("ConsensusError"),
795-
"TC-065: SdkError is not a consensus rejection: {}",
796-
detail
797-
);
798-
tracing::info!("TC-065: unauthorized mint rejected via consensus error");
799-
}
800-
other => panic!(
801-
"TC-065: expected platform rejection for unauthorized mint, got: {:?}",
802-
other
803-
),
804-
}
782+
let err = result.expect_err("TC-065: minting without destination should fail");
783+
784+
// Expected: DestinationIdentityForTokenMintingNotSetError via proof
785+
// verification (Protocol(ConsensusError(BasicError(...)))), which
786+
// becomes TaskError::SdkError since no typed variant exists for this.
787+
let err_debug = format!("{:?}", err);
788+
assert!(
789+
err_debug.contains("DestinationIdentityForTokenMintingNotSet"),
790+
"TC-065: expected DestinationIdentityForTokenMintingNotSetError, got: {}",
791+
err_debug
792+
);
805793
tracing::info!("TC-065: unauthorized mint correctly rejected: {:?}", err);
806794
}

0 commit comments

Comments
 (0)