Problem
register_contract (and the corresponding update_contract) in explorer/src/lib.rs store the caller-supplied ContractMeta after checking pause state, admin authorization, and existence, but they do not validate the contents of meta. Fields such as names, symbols, or ABI strings are written to persistent storage without length or emptiness bounds, allowing malformed or oversized metadata that bloats persistent storage (and its rent) and can produce nonsensical registry entries the indexer must then handle.
What needs to be done
- Define and enforce bounds on
ContractMeta fields: reject empty required fields and enforce maximum lengths for strings/collections.
- Return typed
Error variants for invalid metadata (add variants as needed).
- Apply the same validation in both
register_contract and update_contract.
- Document the accepted field constraints alongside the interface/event documentation.
Files
Acceptance deliverables
- Malformed or oversized metadata is rejected with a typed error at write time.
- Registered/updated entries always satisfy the documented constraints.
- All CI checks pass; the change cannot be merged until CI is green.
Tests to pass
- Test: registering with an empty required field returns a typed error.
- Test: registering with an over-length field returns a typed error.
- Test: valid metadata registers successfully and reads back unchanged.
Problem
register_contract(and the correspondingupdate_contract) inexplorer/src/lib.rsstore the caller-suppliedContractMetaafter checking pause state, admin authorization, and existence, but they do not validate the contents ofmeta. Fields such as names, symbols, or ABI strings are written to persistent storage without length or emptiness bounds, allowing malformed or oversized metadata that bloats persistent storage (and its rent) and can produce nonsensical registry entries the indexer must then handle.What needs to be done
ContractMetafields: reject empty required fields and enforce maximum lengths for strings/collections.Errorvariants for invalid metadata (add variants as needed).register_contractandupdate_contract.Files
explorer/src/lib.rsAcceptance deliverables
Tests to pass