Repository navigation
feat(contract): implement oracle data expiry logic and stale age verification - #521
Open
Ranjeet2063 wants to merge 1 commit into
Open
Ranjeet2063 wants to merge 1 commit into
Ranjeet2063 wants to merge 1 commit into
Conversation
…fication - Add StaleData error code to contract error enum - Define MAX_STALE_AGE and MAX_STALE_AGE_TEMPERATURE constants - Store and expose OracleData struct with feed_id, value, and timestamp - Implement record_oracle_data and get_oracle_data - Implement verify_condition, verify_data_condition, and verify_temperature_condition - Add comprehensive test suite covering stale age validation, boundary timestamps, and cold-chain window
|
@Ranjeet2063 is attempting to deploy a commit to the Ebeleokolo's projects Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
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.
Closes #390
Summary of Changes
This pull request implements the oracle data expiry logic and stale age verification for the oracle security smart contract:
Error Enum Extension:
StaleData = 170error code toErrorenum for signaling expired or stale oracle data readings.Constants & Types:
MAX_STALE_AGE(3600 seconds / 1 hour) as the default allowable stale age window.MAX_STALE_AGE_TEMPERATURE(300 seconds / 5 minutes) for cold-chain and time-sensitive readings.DataKey::OracleDataandOracleDatastruct (feed_id: Symbol,value: i128,timestamp: u64).Storage & State Transitions:
record_oracle_datato store authenticated oracle data points on-chain.submit_reportto automatically synchronize persistentOracleDatastorage upon consensus snapshot calculation.get_oracle_datato query the latest recorded feed data.Condition Verification with Expiry Gates:
verify_condition(env, feed_id, min, max)enforcingnow - data.timestamp <= max_age_seconds(orMAX_STALE_AGE), returningErr(Error::StaleData)if exceeded.verify_data_condition(env, data, min, max, custom_max_age)for custom SLA verification windows.verify_temperature_condition(env, feed_id, min_temp, max_temp)enforcing the tight 5-minute cold-chain expiry window.Test Coverage:
max_age_secondsenforcement.