Skip to content

As/multi app impl storage#119

Open
alsala wants to merge 9 commits intodevfrom
as/multi_app_impl_storage
Open

As/multi app impl storage#119
alsala wants to merge 9 commits intodevfrom
as/multi_app_impl_storage

Conversation

@alsala
Copy link
Contributor

@alsala alsala commented Mar 13, 2026

See Jira Task: https://horizenlabs.atlassian.net/browse/HZN-2802

This PR refactors the storage package to support per-application versioning. Each application now maintains its own independent version chain, enabling rollback, version listing, and state retrieval scoped to a single app without affecting others.

The ApplicationStateStore interface, LevelDB implementation, mock implementation, and manager calls are all updated accordingly.

Includes expanded test coverage for multi-app scenarios.

@alsala alsala marked this pull request as ready for review March 16, 2026 09:40
return &VersionedLevelDBAppStateStore{adapter: adapter}, nil
}

func (vdl *VersionedLevelDBAppStateStore) Store(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it is better to change this interface and to have as input params just 1 state and just 1 wasm. At the moment we need to store just one state for a single application. In the future maybe it will be useful to store state and wasm for different applications, but for now it is just an unnecessary complication

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok done

@alsala alsala requested a review from saratnt March 17, 2026 16:06
return fmt.Errorf("application state entry is nil")
}

if state != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does still make sense that we accept a state == nil? While it is normal to have wasm == nil, I don't have any scenario in mind where we need to store just the wasm, even because now we have the fingerprint in the state so an "update wasm" scenario would require a corresponding update state

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, and basing on this consideration, we can have separate func Store / StoreWithWasm on the storage interface, enforce non-nil state, and add expressive initAppStorage / storeStateToStorage helpers on the manager.

… expressive initAppStorage/storeStateToStorage helpers on the

  manager
@alsala alsala requested a review from saratnt March 18, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants