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

Preserve historic state for reorgs and unmined witness txes #166

Merged
merged 2 commits into from
Jul 8, 2023

Conversation

dr-orlovsky
Copy link
Member

Fixes RGB-WG/rgb-std#81 (comment)

In simple terms, we were removing previous state from the contract state data once we add a new state transition. However, this new state transition may not be yet final (its witness transaction is not mined), or may become invalid due to a blockchain re-org. Thus, I suggest to keep the historic state here (wallets do filter it anyway, so if it is assigned to a tx output which is already spent it will not be shown to the user).

Since the historic data will accumulate over the time, I plan to add an API to prune them with the wallet deciding which witness transactions are deep enough to safely remove the state.

Copy link
Contributor

@zoedberg zoedberg left a comment

Choose a reason for hiding this comment

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

I confirm that this PR, along with RGB-WG/rgb-std#81, solves RGB-WG/rgb-std#80 and RGB-WG/rgb-std#81 (comment).

While executing rgb-lib tests I've found a test that fails in a non-deterministic way with a Lnpbp4Mismatch error. But I checked and it happens also without these PRs, so I'll open a dedicated issue for that. In the meantime I think these PRs can be merged.

@dr-orlovsky dr-orlovsky merged commit 3bc8347 into master Jul 8, 2023
19 checks passed
@dr-orlovsky dr-orlovsky deleted the preserve-historic-state branch July 10, 2023 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

2 participants