Skip to content

scripts/deploy.sh never calls invoice_nft.set_authorized_callers — every fresh deployment leaves marketplace/financing_pool unauthorized to transition invoice status #511

Description

@OxDev-max

Description

contracts/invoice_nft/src/lib.rs:271-282 exposes set_authorized_callers(admin, marketplace, financing_pool), which stores the addresses invoice_nft will accept set_listed/set_funded/
set_repaid calls from. The integration test harness explicitly relies on this
(contracts/tests/src/lib.rs:77: nft.set_authorized_callers(&admin, &mp_id, &pool_id);
labeled "#209" in a comment), and test_unauthorized_set_funded_rejected proves that without
it, set_funded is rejected with Unauthorized.

scripts/deploy.sh, however, deploys and initializes all 7 contracts
(lines 146-213) and never once calls set_authorized_callers on the deployed invoice_nft
instance. scripts/interact.sh also has no kora_set_authorized_callers helper. Grepping both
files confirms zero occurrences of set_authorized_callers outside of the test suite.

Requirements and Context

This means any real testnet/mainnet deployment produced by deploy.sh as written is
non-functional for its core purpose: marketplace.fund_invoice()'s call to
invoice_nft.set_funded() and financing_pool.repay()'s call to invoice_nft.set_repaid()
would both fail with Unauthorized against a freshly deployed protocol, because invoice_nft
was never told those contracts are allowed to call it. This is a deploy-pipeline correctness
gap with no workaround short of a manual, undocumented follow-up call.

Suggested Execution

  1. git checkout -b fix/deploy-sh-missing-authorized-callers
  2. In scripts/deploy.sh, immediately after marketplace and financing_pool are deployed and
    initialized, add:
    invoke "$INVOICE_NFT_ID" set_authorized_callers \
      --admin "$ADMIN" \
      --marketplace "$MARKETPLACE_ID" \
      --financing_pool "$POOL_ID"
    echo "  invoice_nft authorized callers wired (marketplace + financing_pool)"
  3. Add a matching kora_set_authorized_callers helper to scripts/interact.sh for manual
    post-deploy repair/rotation scenarios (e.g. after redeploying just the marketplace contract).
  4. Add a post-deploy smoke-test step (or extend scripts/health-check.sh) that verifies the
    wiring actually took effect, e.g. by attempting a read-only sanity check or documenting a
    manual verification step in docs/RELEASE.md.
  5. Test against a local Soroban sandbox / testnet deployment end-to-end: mint → list → fund →
    repay, confirming no Unauthorized error occurs.

Acceptance Criteria

  • scripts/deploy.sh calls invoice_nft.set_authorized_callers with the deployed marketplace and financing_pool addresses as part of the standard deployment sequence
  • scripts/interact.sh exposes a callable helper for re-wiring authorized callers post-deploy
  • A full mint→list→fund→repay flow executed against a fresh deployment (local sandbox or testnet) succeeds without Unauthorized errors
  • The deployment manifest or a follow-up health check step confirms the wiring was applied

Guidelines: PR description must include Closes #<issue-number>.
Complexity: High (200 points)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions