input-output-hk / mithril

Stake-based threshold multi-signatures protocol
https://mithril.network
Apache License 2.0
122 stars 37 forks source link

`ChainObserver` supports retrieving the Chain Point of the tip of the chain #1589

Closed jpraynaud closed 3 months ago

jpraynaud commented 5 months ago

Why

We need to retrieve the block number of the tip of the Cardano chain with the Chain observer to use it to create new types of beacons.

What

Add a new function in the ChainObserver trait:

async fn get_current_chain_point(&self) -> Result<Option<ChainPoint>, ChainObserverError>;

And a new entity type:

struct ChainPoint {
    slot_number: u64,
    block_number: u64,
    block_hash: String //hex encoded bytes Vec<u8>
}

And implement this function for the:

See

How

jpraynaud commented 4 months ago

Hi @falcucci, the PR #1623 has been merged 👍 You can work on the implementation of the new function in the ChainObserver trait in the PallasChainObserver: https://github.com/input-output-hk/mithril/blob/f700c4692b26c4b78ed9c83515af8992461a3040/mithril-common/src/chain_observer/pallas_observer.rs#L387

falcucci commented 4 months ago

thank you! @jpraynaud