Skip to content

Fix set_max_events resize corruption and validate ContractMeta fields - #34

Open
rudeus112266 wants to merge 2 commits into
octraban:mainfrom
rudeus112266:drips/28-29
Open

rudeus112266 wants to merge 2 commits into
octraban:mainfrom
rudeus112266:drips/28-29

Conversation

@rudeus112266

Copy link
Copy Markdown

Summary

Fix set_max_events resize corruption and validate ContractMeta fields

What was solved

#28 — Handle event ring-buffer resizing safely in set_max_events

Fix set_max_events in explorer/src/lib.rs so resizing the event ring buffer no longer silently corrupts readable history. Choose and document safe resize semantics (rebuild/migrate existing entries into the new layout), keep get_event/get_events correct and correctly ordered across a resize, extend instance TTL on the write, and emit an event describing the resize. Document the behavior in the README and add tests covering read-back correctness and ordering after a resize.

Addressed:

  • Changed: README.md
  • Implement safe resize semantics in set_max_events (explorer/src/lib.rs) so existing stored events are not silently corrupted; chosen approach must be documented (e.g. rebuild/migrate buffer contents into the new layout).
  • Ensure get_event/get_events return correct, correctly ordered events before and after a resize per the documented semantics.
  • Extend the instance TTL on the set_max_events write.

#29 — Validate ContractMeta inputs in register_contract and update_contract

Add validation of caller-supplied ContractMeta fields in register_contract and update_contract in explorer/src/lib.rs: reject empty required fields and enforce maximum lengths on strings/collections, returning new typed Error variants, and document the accepted constraints alongside the interface/event docs.

Addressed:

  • Changed: docs/INTERFACE.md
  • 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.

Changes

  • README.md (modify)
  • docs/INTERFACE.md (modify)

Approach

  1. Handle event ring-buffer resizing safely in set_max_events #28 — Handle event ring-buffer resizing safely in set_max_events (Changed: README.md)
  2. Validate ContractMeta inputs in register_contract and update_contract #29 — Validate ContractMeta inputs in register_contract and update_contract (Changed: docs/INTERFACE.md)

Issues

Closes #28
Closes #29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validate ContractMeta inputs in register_contract and update_contract Handle event ring-buffer resizing safely in set_max_events

1 participant