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

Check SnapshotMap with multiple updated #187

Closed
ethanfrey opened this issue Dec 15, 2020 · 1 comment · Fixed by #189
Closed

Check SnapshotMap with multiple updated #187

ethanfrey opened this issue Dec 15, 2020 · 1 comment · Fixed by #189
Assignees

Comments

@ethanfrey
Copy link
Member

Double check how SnapshotMap handles multiple updates of one entry in one block.

If we move from 2 => 3 and then 3 => 5 in one block, we should store a diff of {old: 2, new: 5}.
That means queries at h should return 2 and queries at h+1 should return 5.

I don't think this is fully the case (I think it keeps {old: 2, new: 3} which is almost but not exactly correct

@ethanfrey ethanfrey self-assigned this Dec 15, 2020
@ethanfrey
Copy link
Member Author

Update: https://github.com/CosmWasm/cosmwasm-plus/blob/ee98e0167123a35bbad21f7309138252a959676d/packages/storage-plus/src/snapshot.rs#L129-L141

This is a larger error, we overwrite, so the case above would store {old: 3} and thus multiple updates in a block could trick the snapshotter.

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 a pull request may close this issue.

1 participant