Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICA Oracle #884

Merged
merged 94 commits into from
Aug 9, 2023
Merged

ICA Oracle #884

merged 94 commits into from
Aug 9, 2023

Conversation

sampocs
Copy link
Collaborator

@sampocs sampocs commented Aug 8, 2023

ICA Oracle

Goals

  • Easily adaptable: Minimal friction to add to other chains (e.g. ideally the chain would not have to add another module or upgrade)
  • Generic store: Should work with any stride metric with a generic key/value format
  • Robust to timeouts and failures
  • High throughput/ low latency (as much as possible): ICAs should trigger as soon as values update
  • Isolated from stakeibc logic (we don’t want an failure to update the oracle to impact stakeibc)

High Level Design (Stride)

  • Add new oracle module to stride
  • Setup:
    • Allow messages required on oracle chain: MsgExecuteContract and MsgInstantitateContract
    • Create connection
    • Upload CW contract
    • Send AddOracle tx to stride (with codeID) which will:
      • Register the ICA
      • Instantiate the contract with the ICA address included in the message
      • Save the contract address from the response
  • Pushing Metrics:
    • Save them in the oracle store
    • Every begin blocker, grab metrics and submit ICA
  • Stuck Packets
    • If a packet get stuck and the channel closes, anyone can submit a RestoreInterchainAccount message to create a new channel and re-push all pending metrics

Module Tasks

TODO

  • Scaffolding
    • Scaffold module
    • Enable IBC/ICA
    • Add types
      • Oracle
      • Metric
      • OracleCallback
      • ExecuteContractUpdateMetric
    • Scaffold queries
      • Oracle(moniker)
      • AllOracles(optional active filter)
      • PendingMetricsUpdates(optional key and chainId filters)
    • Scaffold user transactions
      • Add Oracle (admin)
      • RestoreOracleInterchainAccount
    • Scaffold gov transactions
      • RemoveOracle
      • ToggleOracle
      • UpdateOracleContract
    • Add icacallbacks
    • Add wasmd types
  • Implementation
    • Add Oracle Keeper Functions
      • SetOracle
      • GetOracle
      • GetAllOracles
      • RemoveOracle
      • ToggleOracle
    • Add Metric Queue Keeper Functions
      • QueueMetricUpdate
      • GetMetricFromQueue
      • GetAllMetricsFromQueue
      • RemoveMetricFromQueue
    • Add Metric Pending Keeper Functions
      • SetMetricUpdateInProgress
      • GetPendingMetricUpdate
      • GetAllPendingMetricUpdates
      • SetMetricUpdateComplete
    • Implement queries
      • Oracle(moniker)
      • AllOracles()
      • PendingMetricsUpdates(optional key and chainId filters)
      • AllPendingMetrics()
    • Implement governance transactions
      • RemoveOracle
      • ToggleOracle
      • UpdateOracleContract
    • Implement Core
      • AddOracle Tx [Admin]
      • OnChanOpenAck
      • InstantiateOracle [Admin]
      • SubmitMetricUpdate
      • Add redemption rate as metric
      • BeginBlocker
      • OnAckPacket
      • RestoreInterchainAccount Tx
  • Testing
    • Add integration tests
    • Add CLI unit tests
  • Finalize
    • Switch to expected keepers
    • Cleanup TODOs
    • Add upgrade handler
    • Add events (sent update, ack success/failure/timeout)
    • Update Init/Export Genesis
    • Revert config.sh and run_all_tests.sh
    • Add docs

Focused Review

Adding an Oracle

Instantiating Oracle

Posting Metric

Restoring Oracle ICA Channel

@github-actions github-actions bot added the C:docs label Aug 9, 2023
@sampocs sampocs merged commit e6c9032 into main Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants