Availability API
(deftype :signature (:byte-vector 64)) ;; ????
(deftype :hash (:byte-vector 32))
(deftype :topic :hash)
(deftype :data-block :byte-vector)
(deftype :block-certificate :signature)
(deftype :sky-connection ...)
signature(top_state)
top_state = committee_public_keys * dadata
;; The Bridge contract doesn't care about the dadata,
;; only about the chain of updates of the committee_public_keys
;; Client contracts care about the topicdata buried inside the dadata,
;; and not too much about the rest of the public keys and metadata.
;; Question: who cares about the intermediate metadata? Mostly the nodes between each other.
;; by sharing the data structure, we minimize the signatures needed.
;; For each topic, the data for the topic
dadata = trie(topicmetadata*topicdata)
;; The management data for each topic: who is part of the committee when
;; (in the future also throughput limits for the topic?
;; also certificate chains for each committee to the next?)
topicmetadata = trie(committee_public_keys * timestamp)
;; The stuff the users are actually interested about
topicdata = trie(metadata * data)
metadata = size * timestamp
data = bytevector
proof = {merkle proof that data included at given height in trie}
Design: each topic has its consensus.
;; (:parameter :sky-connection)
(current-sky-connection)
;; :node-spec -> :connection
(sky-connect spec)
: :topic :block-data -> :block-certificate
(publish-block topic block-data)
Returns a certificate that the block was included in the DA
: :hash -> (:stream :topic)
(get-topics from)
Return a list of topics supported on this node, starting from the given topic.
: :topic -> :topic-spec
(describe-topic topic)
Return the spec for a topic. (For now, it's the unit type, in the future: max throughput, etc.)
: :topic -> :nat :certificate
(poll-topic topic)
Returns the latest height for the topic on the current node.
: :topic :nat -> :certificate
(get-topic-certificate topic height)
Returns a certificate for the data in the topic at the given height:
- a signature for a height no less than the given height
- a merkle proof of inclusion for the data at given height in the signed data structure
: :topic :nat -> (:stream :block)
(read-topic topic last)
Read the blocks in the topic backwards starting from last block of given height, until the server runs out of blocks, or the client closes the connection.
Bridge: update the state (update-bridge old-committee-public-keys old-data-hash signature new-state-hash):
- verify ( state-hash == hash(hash(old-committee-public-keys), old-data-hash) )
- verify ( isSignature(signature, old-committee-public-keys, new-state-hash) )
- state-hash := new-state-hash
Client: check that some data was indeed included in the DA (verify-da-inclusion metadata proof) check that proof is a merkle proof of inclusion of some data element with given metadata in the dadata of the bridge.
Simple bounty contract: use client above to check that data of given size was in the DA; verify that the inclusion timestamp is a deadline; after another deadline (> the DA deadline), revert the bounty to the offerer.