Implement the ProtocolStateChain structure and its associated methods to satisfy the functionality described in the provided test cases. The requirements are as follows:
Structure Definition:
Define the ProtocolStateChain struct which should hold a vector of ProtocolState.
Methods to Implement:
Implement the following methods on ProtocolStateChain:
length(&self) -> usize: Returns the number of ProtocolState elements in the chain.
Adds a new ProtocolState to the chain if its blockchain_length is exactly one greater than the current length of the chain.
Returns ChainError::InvalidHeight if the blockchain_length is not valid.
top(&self) -> Option<&ProtocolState>: Returns a reference to the last ProtocolState in the chain, or None if the chain is empty.
epoch_slot(&self) -> Option<usize>: Calculates and returns the epoch slot based on the curr_global_slot of the most recent state.
state_hash(&self) -> Result<Hash, SomeError>: Computes and returns a hash representing the state of the chain.
last_vrf(&self) -> Option<String>: Returns the last VRF output in hex representation.
Additional Structures:
Implement or ensure the existence of any supporting structures such as ProtocolState, ChainError, Length, GlobalSlot, and Hash, to be compatible with the methods described.