Skip to content

Get rid of using MerkleStateRoot features on initialization in platform-core code #17868

Open
@imalygin

Description

Currently there are three classes left in platform-core production code that are still using MerkleStateRoot class:

  1. PlatformStateFacade. It casts State object to MerkleStateRoot to bypass normal access mechanism (via ReadableStates) because it's not initialized at the moment of invocation. Solution: we need to change the initialization so that we didn't have to do this direct access to Merkle tree node by index
  2. SignedStateFileReader. registerServiceState uses MerkleStateRoot#putServiceStateIfAbsent.
    There are two possible soltions:
  • putServiceStateIfAbsent can be elevated to State interface. This will require moving StateMetadata
  • registerServiceState can have a callback parameters passed by the hedera-app code
  1. SignedStateFileWriter casts state to initialize time field:
        if (state instanceof MerkleStateRoot merkleStateRoot) {
            merkleStateRoot.setTime(platformContext.getTime());
        }

It can be fixed by setting the time where it's more appropriate.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

PlatformTickets pertaining to the platform

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions