Repository navigation
Description
Follow-up from #1548 (issue #1491). That PR fixed this defect class in assign, revoke, and request-vetting; namespace_create is the last caller still carrying it.
Problem
crates/cli/src/commands/publish.rs namespace_create (~:216-252):
let receipt = decdn_incentive::tx::send_for_receipt(
contract.createNamespace(), "createNamespace", …, &mut outcome.tx,
).await?;
let tx = receipt.transaction_hash;
let created = receipt.inner.logs().iter()
.find(|log| log.topic0() == Some(&PublisherRegistry::NamespaceCreated::SIGNATURE_HASH))
.context("createNamespace succeeded on-chain but its receipt carried no NamespaceCreated log (…check the tx on a block explorer)")?
.log_decode::<PublisherRegistry::NamespaceCreated>()
.context("…ABI mismatch…")?;
let id_u64 = u64::try_from(created.inner.data.namespaceId)
.context("namespace id exceeds u64 …")?;All three ?s fire after createNamespace has confirmed successfully on-chain. Each short-circuits before write_namespace_outcome at :249, so:
- the receipt never prints — on
--json, stdout is empty; outcome.txis dropped with the struct, even thoughsend_for_receiptdeliberately recorded the hash before awaiting the receipt (crates/incentive/src/tx.rs:88-93) precisely so this case can report it;- the first message tells the operator to "check the tx on a block explorer" while withholding the tx.
The namespace exists and is owned by the signer, but its id is unrecoverable from the CLI. Recovery means finding the transaction by hand and decoding NamespaceCreated — and namespaceCount went up, counting against maxNamespacesPerPublisher, so a blind retry silently burns quota.
Why it matters more now
#1548 established the opposite convention in the same file. assign (:685-697), revoke, and request-vetting all capture the error, print the receipt, and then propagate through a shared propagate helper, on the stated principle that "an operator who only sees the error has no way to tell which [writes] landed." namespace_create is now the sole inconsistent caller, which makes the file's behaviour unpredictable rather than merely imperfect.
Suggested fix
Mirror request_vetting (:333-380): extract the log lookup + decode into a decode_created_namespace(&receipt) -> anyhow::Result<u64>, stash its Err, print the outcome (with tx: Some, namespace_id: None), then propagate(chain_err, write_err, …). NamespaceOutcome already renders tx without namespace_id, so no shape change is needed — only the ordering.
Worth a status field for parity with the sibling receipts, so a --json consumer can distinguish "created, id unrecoverable" from "not created". Today both render submitted=false-shaped output.
Acceptance
- A post-receipt failure prints the receipt (with the tx hash) before exiting non-zero.
- A unit test over the writer for the created-but-id-unknown state.
- No behaviour change on the success or dry-run paths.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity