You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once Fossil is ready to send proofs, adjust client contract as needed.
Pt1
The expected flow is that Fossil will first send the results through a verifier. If the proof verification is a success, the data is then transferred to the client (and then the correct vault). This means we can remove all references of proofs in the Client contract (since they will be handled before the data reaches this contract). We should also adjust the naming of the variables in the contract from fossil_processor to fossil_verifier to better reflect this logic.
Pt2
We will also need to make an adjustment to the callback logic. Currently, the Client::fossil_callback(request, result) function takes in the (serialized) request & result objects like so:
fnfossil_callback(request:Span<felt252>,result:Span<felt252>);structJobRequest{vault_address:ContractAddress,// Which vault is this request fortimestamp:u64,// The timestamp the results are forprogram_id:felt252,// // 'PITCH_LAKE_V1' }// serialized is: [vault_address, timestamp, program_id]structFossilResult{l1_data:L1Data,// TWAP, volatility, reserve price
~~proof:Span<felt252>~~,// Was for proof data but can remove now}structL1Data{twap:u256,volatility:u128,reserve_price:u256,}// serialized is: [TWAP.low, TWAP.high, volatility, reserve_price.low, reserve_price.high]
The fossil_callback function verifies that the program_id matches whats expected, then sends the L1 data and timestamp to the corresponding vault address like this:
This allows the vault to verify that the L1 data is ok (timestamp matches the expected to_timestamp) before it is saved for round settlement. The issue with this approach is that the L1 data (3 data points) is calculated on various intervals (TWAP is a calculated over 1 month, reserve price and vol are both calculated over 3 months). This means the vault can verify the L1 data’s to_timestamp, but cannot verify the L1 data’s from_timestamps.
This means we need to modify the structs so that Fossil sends the from timestamps (not just the to timestamp) to the client contract. Then we need to modify the Vault::fossil_client_callback function to accept these new params, and check them in the functions assertions. This will also require an update to the off chain processing repo as well.
We can also probably simplify the structs since we no longer need to wrap the L1Data and proof into the same struct.
Tasks:
Remove proof logic from Client contract
Update whitelist logic to reference fossil verifier instead of fossil processor
Add from timestamps to job request struct (to timestamp is the same for each data point but from timestamps may vary)
Once Fossil is ready to send proofs, adjust client contract as needed.
Pt1
The expected flow is that Fossil will first send the results through a verifier. If the proof verification is a success, the data is then transferred to the client (and then the correct vault). This means we can remove all references of proofs in the
Client
contract (since they will be handled before the data reaches this contract). We should also adjust the naming of the variables in the contract fromfossil_processor
tofossil_verifier
to better reflect this logic.Pt2
We will also need to make an adjustment to the callback logic. Currently, the
Client::fossil_callback(request, result)
function takes in the (serialized) request & result objects like so:The
fossil_callback
function verifies that the program_id matches whats expected, then sends the L1 data and timestamp to the corresponding vault address like this:This allows the vault to verify that the L1 data is ok (
timestamp
matches the expectedto_timestamp
) before it is saved for round settlement. The issue with this approach is that the L1 data (3 data points) is calculated on various intervals (TWAP is a calculated over 1 month, reserve price and vol are both calculated over 3 months). This means the vault can verify the L1 data’sto_timestamp
, but cannot verify the L1 data’sfrom_timestamps
.This means we need to modify the structs so that Fossil sends the
from timestamps
(not just theto timestamp
) to the client contract. Then we need to modify theVault::fossil_client_callback
function to accept these new params, and check them in the functions assertions. This will also require an update to the off chain processing repo as well.L1Data
andproof
into the same struct.Tasks:
Client
contractfossil verifier
instead offossil processor
from timestamps
to job request struct (to timestamp
is the same for each data point butfrom timestamps
may vary)Client::fossil_callback()
accordinglyVault::fossil_client_callback()
accordinglyThe text was updated successfully, but these errors were encountered: