[sui 2/x]: state
, batch_price_attestation
, set
#710
Merged
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.
Updates
We migrate
batch_price_attestation.move
andstate.move
from Aptos-Pyth, while making adaptations for Sui, such as removing the centralized mappingLatestPriceInfo
fromState
and use the deployer capability pattern for initializingState
.State
can be used as a lightweight, read-only config store that does not interfere with the updating ofPriceInfo
/PriceFeed
, which are modeled as Sui objects.We expect to use
Sui::clock
to mark the arrival time of abatch_price_attestation
when it becomes available in0.28.0
. For now, we use the less granular epoch number.batch_price_attestation.move
batch_price_attestation.move
.batch_price_attestation.move
tou64
as necessarytx_context::epoch
for putting a timestamp on batch price attestation arrival time, since the Sui Clock feature is not available yet. The Sui clock would allow us to generate timestamps to 1 millisecond of precision and not use actx
parameter.state.move
LatestPriceInfo
(Mapping of cached price information) is no longer a thing, because we no longer maintain a centralized mapping ofPriceInfo
s. This is because we want to be able to parallelize the updating of PriceInfo (which contains the PriceFeeds).state:: price_info_cached
,state:: get_latest_price_info
. In the future, we may want to think about maintaining a lookup table forprice_identifier => price_info
without compromising on parallel updates.State
object.State
object. This is needed because theinit
function (called automatically upon package deployment) does not take any custom inputs. The deployer cap is granted to sender upon init. Then the sender passes it toinit_and_share_state(...args)
to initialize state.Dependencies & Misc
sui/wormhole-cleanup
to sui/integration_v2, since most recent Wormhole core bridge clean-up PR was recently merged.set.move
Set
does not have theempty
function, so we instead migrate the Aptos-Pythset.move
and adapt it for Suistore
abilityIntegration Remaining TODOs
errors.move
(redefine error codes, because they are done differently in Sui compared to Aptos)pyth.move
(contains init functions and price feed update functions)Testing
sui move test
ormake test
Sui version:
sui 0.27.1-157ac7203