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

Expose method to fetch internal state on an OffchainStateInstance #1953

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hattyhattington17
Copy link

Created to address 1935.

Exposes a method on OffchainStateInstance fetchInternalState which fetches settled actions from the archive node and rebuilds the internal state trees.

@hattyhattington17 hattyhattington17 marked this pull request as ready for review December 16, 2024 20:26
@hattyhattington17 hattyhattington17 requested review from a team as code owners December 16, 2024 20:26
@45930
Copy link
Contributor

45930 commented Dec 16, 2024

This looks like the right change. Did you test with any examples?

@hattyhattington17
Copy link
Author

I was actually pretty unsure of how to unit test this! First I tried creating separate instances of OffchainStateInstance and generating a settlement proof on one, but then the other was also updated because internally they're the same instance (both memoized by address). I was thinking of creating a totally separate OffchainState and smart contract and then instantiating them at the same address as the existing one would create two actually separate OffchainStateInstances, but then I also thought that it might be kind of a heavy test for a small method. Think it's worth adding?

@45930
Copy link
Contributor

45930 commented Dec 16, 2024

I think it would be easiest to test on lightnet or devnet so you can have 2 different nodeJS threads running different instances of offchain state and talk to the same blockchain... that ought to work. You could add it to the integration tests, or just run a test yourself to make sure this let's you sync back up with the chain after the chain diverges from your local state.

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