Fix set_max_events resize corruption and validate ContractMeta fields - #34
Open
rudeus112266 wants to merge 2 commits into
Open
rudeus112266 wants to merge 2 commits into
rudeus112266 wants to merge 2 commits into
Conversation
…d update_co Closes octraban#29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_eventsinexplorer/src/lib.rsso 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), keepget_event/get_eventscorrect 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:
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).get_event/get_eventsreturn correct, correctly ordered events before and after a resize per the documented semantics.set_max_eventswrite.#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:
Changes
README.md(modify)docs/INTERFACE.md(modify)Approach
Issues
Closes #28
Closes #29