feat: add oracle hint mechanism in Rex2 spec #117
Draft
+719
−42
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
Add the oracle hint mechanism for Rex2, enabling on-chain contracts to signal the off-chain oracle service about upcoming data needs.
Changes
sendHint(bytes32 topic, bytes data)function to Oracle contract (v1.1.0)Hint(bytes32 indexed topic, bytes data)event for signaling oracle serviceon_hintcallback toOracleEnvtrait for receiving hintsHow It Works
Oracle.sendHint(topic, data)to emit aHinteventOracleEnv::on_hintTest plan
test_on_hint_called_on_rex2- verifies hints work on Rex2test_on_hint_not_called_on_rex1- verifies hints don't trigger pre-Rex2test_on_hint_not_called_for_non_oracle_contract- verifies only oracle contract triggers hintstest_multiple_hints_recorded- verifies multiple hints in one txtest_on_hint_direct_oracle_call- verifies direct calls to oracle work