Refactor MerkleHederaState to make it interchangable with State
imalygin opened this issue · comments
Ivan Malygin commented
Eventually, as the design suggests , MerkleHederaState
must become a root of the merkle tree. Currently an instance of State
is a root. So, these two nodes must be compatible to be interchanged. To make it work, it's necessary to extract an interface and make both classes implement it.
First of all, this interface must extend MerkleInternal
interface, as both of these nodes implement it.
Here is the interface definition:
public interface RootNode extends MerkleInternal {
/**
* Get the application state.
*
* @return the application state
*/
SwirldState getSwirldState();
/**
* Set the platform state.
*
* @param platformState the platform state
*/
void setPlatformState(final PlatformState platformState);
/**
* Get the platform state.
*
* @return the platform state
*/
PlatformState getPlatformState();
/**
* Generate a string that describes this state.
*
* @param hashDepth the depth of the tree to visit and print
*/
String getInfoString(final int hashDepth);
}
This interface should be wherever the state is used right now.
Ivan Malygin commented
This ticket is required by #13692