Repository navigation
Conversation
|
Thanks for the contribution! We reviewed this PR while merging the open queue and couldn't merge it yet. Here's what needs fixing:
This branch also has merge conflicts with |
|
@greatest0fallt1me — both points are fixed on this branch. 1.
|
| Entrypoint | Gate | Behaviour |
|---|---|---|
update_offering_metadata(caller, offering_id, metadata) |
admin or the offering's current developer | re-validates the new metadata with the same validator registration uses (InvalidMetadata on rejection), re-publishes to the catalog, then rewrites the stored record; RegisteredCount unchanged |
transfer_offering(caller, offering_id, new_developer) |
admin | rejects a no-op transfer to the current developer and the registry contract itself with InvalidDeveloper (11), re-anchors the catalogue entry, then rewrites the record |
deregister_offering(caller, offering_id) |
admin | notifies the catalog with remove_offering, then deletes the record and decrements RegisteredCount by exactly one |
- Ordering. Each entrypoint looks the offering up first (
OfferingNotFoundfor unknown ids, before any mutation or catalog call) and performs the cross-contract call before the registry storage write, so a reverting or panicking catalog cannot leave the registry describing a change the catalogue never saw — the same guaranteeregister_offeringhas. catalog.rs.OfferingCataloggainsremove_offering(registry, offering_id). Both callee methods keep theregistry.require_auth()identity requirement from issue [Quality-2][High] Enforce cross-contract caller identity at trust boundaries #1060, so only the real registry can publish or remove.events.rs.offering_metadata_updated(topic = offering id, data = updated record),offering_transferred(data = previous + new developer),offering_deregistered(data = removed record), each with a byte-snapshot unit test.errors.rs.InvalidDeveloper = 11.admin.rs. Its module doc claimed every admin-gated entrypoint must take the per-developer registration cooldown. That is no longer true, and enforcing it would make a listing impossible to correct or retire for an hour after registering. The doc now states that the cooldown throttles registrations, not the lifecycle operations.
2. Merge conflicts
main has not moved since the branch's merge (2730f2d), so no further conflict resolution was needed. This is a normal commit on top of the existing head — not force-pushed, and no file outside contracts/registry/ is touched.
Tests
tests/xcontract.rs goes from 9 to 26 tests: the six acceptance tests added earlier are unchanged and pass, plus new coverage for authorization (stranger / current developer / registry address → Unauthorized / InvalidDeveloper), re-validation rejecting bad metadata before any catalog call, catalog-failure safety on both update and deregistration (record, metadata and RegisteredCount all survive a reverting callee), catalog propagation (put/remove counts and payloads), and id reuse after deregistration.
cargo test -p callora-registry --test xcontract -> 26 passed; 0 failed
cargo test -p callora-registry --lib -> 5 passed; 0 failed
cargo fmt -p callora-registry -- --check -> clean for every file this PR touches
cargo clippy -p callora-registry --all-targets --all-features -- -D warnings
-> same pre-existing diagnostics as main, none new
One honest note: cargo test -p callora-registry still reports the 9 pre-existing metadata_validation failures (rejects_*_offering_id, a should_panic message mismatch) that main has today. They are unrelated to this feature and I did not touch metadata_validation.rs, cooldown.rs, overflow_safe.rs or auth_snap.rs. Happy to fix those in a separate PR if you want them cleaned up.
|
@greatest0fallt1me the review point is already addressed at head
Verification: diffed all six changed files against |
f995d96 to
27ecff0
Compare
Overview
This PR extends the registry contract beyond registration-only support by adding admin/developer-gated lifecycle operations for existing offerings: metadata updates, developer transfer, and deregistration. Each operation re-validates input, propagates the change to the catalog contract, emits an event, and (on removal) decrements
RegisteredCount. Unknown offering ids returnOfferingNotFound.Related Issue
Changes
🗂️ Registry Lifecycle Operations
[MODIFY]
contracts/registry/src/lib.rsupdate_offering_metadata(developer-gated) — re-validates metadata via existing validators, updates the storedOfferingRecord, invokes the catalog callee, and emits an event.transfer_offering(new_developer)(admin-gated) — validates the new developer, updates the record's developer, propagates to the catalog, and emits an event.deregister_offering(admin-gated) — removes theOfferingRecord, decrementsRegisteredCount, notifies the catalog, and emits an event.OfferingNotFoundfor unknown ids.[MODIFY]
contracts/registry/src/errors.rsOfferingNotFounderror variant used by the new entry points.[MODIFY]
contracts/registry/src/events.rs[MODIFY]
contracts/registry/src/catalog.rs🧪 Tests
contracts/registry/tests/xcontract.rsRegisteredCountdecrement, catalog propagation, andOfferingNotFoundfor unknown ids.Verification Results
RegisteredCountdecrementedOfferingNotFoundOfferingNotFoundSecurity and Failure Modes
OfferingNotFoundbefore any mutation or catalog call.Compatibility
Additive only — existing
register_offeringandregister_offering_with_gatebehavior is unchanged. No storage layout changes beyond the new operations.Closes #1204