Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
imalygin opened this issue Feb 12, 2025 · 0 comments
Assignees
Milestone

Comments

@imalygin
Copy link
Contributor

imalygin commented Feb 12, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant