# Observer state and proofs
Work related to implementing proof / observer node where the observer node waits for a proof before updating state to that height / hash.
Signing
ZK proofs already commit to the block height and hash. These values can be decoded from the deserialised receipt.
Signed data does not automatically contain the block height and hash that produced it.
Add in helpers to automatically sign over the derived data and the block height / block hash. This will require making a wrapper like:
pub struct Location {
pub block_height: u64,
pub block_hash: [u8; 32],
}
pub struct FromBlock<T> {
pub location: Location,
pub data: T,
}
Then the signature will be something like:
Signed<FromBlock<DerivedData>>;
The signature will have to be over the hash(block_height, block_hash, digest).
Block buffering
Add a helper to buffer blocks until a proof at that height / hash has been received. This will also need to buffer received proof block hash / heights.
The stream will need to be woken up when a new proof arrives or a block arrives. This can be done by effectively selecting over `Select<Stream<Item = Block>, Stream<Item = Location>
The stream will return a front of the buffer block if the proof is found at this location.
Proof locations can be deleted once the block is returned.
The buffer should be a queue.
State
State needs to have it's location stored with it so when the user queries for a proof we can match the proof location with the state location to provide the merkle proofs.
Proofs
Some configurable amount of proofs should be kept in the db so that there's always overlap with the current state. If not the proof could be always in front of the state.
# Observer state and proofs
Work related to implementing proof / observer node where the observer node waits for a proof before updating state to that height / hash.
Signing
ZK proofs already commit to the block height and hash. These values can be decoded from the deserialised receipt.
Signed data does not automatically contain the block height and hash that produced it.
Add in helpers to automatically sign over the derived data and the block height / block hash. This will require making a wrapper like:
Then the signature will be something like:
The signature will have to be over the
hash(block_height, block_hash, digest).Block buffering
Add a helper to buffer blocks until a proof at that height / hash has been received. This will also need to buffer received proof block hash / heights.
The stream will need to be woken up when a new proof arrives or a block arrives. This can be done by effectively selecting over `Select<Stream<Item = Block>, Stream<Item = Location>
The stream will return a front of the buffer block if the proof is found at this location.
Proof locations can be deleted once the block is returned.
The buffer should be a queue.
State
State needs to have it's location stored with it so when the user queries for a proof we can match the proof location with the state location to provide the merkle proofs.
Proofs
Some configurable amount of proofs should be kept in the db so that there's always overlap with the current state. If not the proof could be always in front of the state.