-
Notifications
You must be signed in to change notification settings - Fork 636
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
Make state witness possible to implement. #9327
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, I have several questions:
- Should we also uncomment all code marked with
TODO (#6316)
? It includes challenge-related tests which are partially related. - Don't we need to check correctness of all other
ApplyResult
fields, likeoutcomes
? I don't understand why we ignore it. - Test request: if partial storage is invalid,
transition_for_replay
must return some error (RuntimeError::StorageError
?)
@Longarithm Hmm, I tried this out on a live node but I'm almost never getting a consistent gas calculation using the recording storage. The only thing different I guess is the mem/db counters? But I don't see why they would be different. Any ideas you might have, since you're way more knowledgeable about storage costs? Here's an example mismatch: Normal execution outgoing receipts:
Recording execution outgoing receipts for the same chunk (literally executed right after this, no parameters changed):
As you can see, everything's the same except the deposit amount - which means that the gas spent was different. |
I think the problem here is that flat storage is not taken into account for this TrieStorage type. And it's not very straight forward to integrate flat storage into it. |
Makes sense. Interesting.
So I'd say the only purpose of |
Mmm no, it's not easy. At the same time, we want to have some way to simulate flat storage without actually having it. #8741 is waiting for it. First way: we can create a trait Second way: implement long-standing refactoring idea discussed here https://near.zulipchat.com/#narrow/stream/313099-pagoda.2Fstorage/topic/handling.20storage.20metrics/near/353884494 In this context, it means:
If this is done correctly, FlatStorage mode just means that costs are smaller but storage implementation doesn't need to have flat storage view. I'd go with the second way and perhaps show the PR tomorrow - what do you think? |
As this implementation is incorrect, I'm closing this in favor of #9350 |
State witness is the complete data needed to execute a chunk and verify the outcome, which includes the state proof (the proof of the current state) as well as the resulting new state root.
The code to produce a state proof already existed as part of the challenge infrastructure, but was disabled due to a minor issue in the trie code (#6316 ). This PR resolves that, and adds a test that indeed, a state witness is feasible to produce and use.
#9292