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
git checkout -b fix/deploy-sh-missing-authorized-callers
- 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)"
- 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).
- 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.
- Test against a local Soroban sandbox / testnet deployment end-to-end: mint → list → fund →
repay, confirming no Unauthorized error occurs.
Acceptance Criteria
Guidelines: PR description must include Closes #<issue-number>.
Complexity: High (200 points)
Description
contracts/invoice_nft/src/lib.rs:271-282exposesset_authorized_callers(admin, marketplace, financing_pool), which stores the addresses invoice_nft will acceptset_listed/set_funded/set_repaidcalls 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_rejectedproves that withoutit,
set_fundedis rejected withUnauthorized.scripts/deploy.sh, however, deploys and initializes all 7 contracts(lines 146-213) and never once calls
set_authorized_callerson the deployedinvoice_nftinstance.
scripts/interact.shalso has nokora_set_authorized_callershelper. Grepping bothfiles confirms zero occurrences of
set_authorized_callersoutside of the test suite.Requirements and Context
This means any real testnet/mainnet deployment produced by
deploy.shas written isnon-functional for its core purpose:
marketplace.fund_invoice()'s call toinvoice_nft.set_funded()andfinancing_pool.repay()'s call toinvoice_nft.set_repaid()would both fail with
Unauthorizedagainst a freshly deployed protocol, because invoice_nftwas 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
git checkout -b fix/deploy-sh-missing-authorized-callersscripts/deploy.sh, immediately aftermarketplaceandfinancing_poolare deployed andinitialized, add:
kora_set_authorized_callershelper toscripts/interact.shfor manualpost-deploy repair/rotation scenarios (e.g. after redeploying just the marketplace contract).
scripts/health-check.sh) that verifies thewiring actually took effect, e.g. by attempting a read-only sanity check or documenting a
manual verification step in
docs/RELEASE.md.repay, confirming no
Unauthorizederror occurs.Acceptance Criteria
scripts/deploy.shcallsinvoice_nft.set_authorized_callerswith the deployed marketplace and financing_pool addresses as part of the standard deployment sequencescripts/interact.shexposes a callable helper for re-wiring authorized callers post-deployUnauthorizederrorsGuidelines: PR description must include
Closes #<issue-number>.Complexity: High (200 points)