-
Notifications
You must be signed in to change notification settings - Fork 784
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
Stateless execution prototype #556
Conversation
This pull request introduces 1 alert when merging 8da663a into 4bbb6e3 - view on LGTM.com new alerts:
|
This pull request introduces 4 alerts when merging 5b309b5 into 4bbb6e3 - view on LGTM.com new alerts:
|
It turns out my initial approach was overly complicated and prone to edge cases. I managed to bring down the initial ~600 failing test cases to 18, but then realized there's a better approach: Instead of hooking The prover then collects all the pre-existing state items fetched from the db and sends them to verifier. The verifier saves all of these items in a new |
Currently all of the above is happening in the One option I can think of is to have a |
@s1na My understanding of the whole process structure is still limited, but my first impression is that it makes very much sense to add some experimental API on this and therefore integrate as a feature. Would these two new |
Yeah probably. It's also possible to have a simpler API for now. For example a |
Yeah, let's do the subclassing. This is really inviting for experimentation, and can't hurt if we clearly mark this as experimental. |
Just to get a bit up-to-date: what's your plan on this? Do you want to get this out with |
I was testing the logic a bit more last week. I think I can get something ready for v4.1. |
…on, added GitHub actions workflow
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. |
…fied StateManager
Rebased this, adopted this to the monorepo structure and updated the code to play well with changes within the test environment and directly use async functionality in several cases, so that test runs can now be executed again with Core logic itself needs still to be adopted. |
@holgerd77 Thanks for updating it! I was just reading the thread and I'm thinking maybe as a first approach just merge this as a test runner so we can come up with a way of integrating it into the library? Potentially we could move the stateless logic to a package under the monorepo which depends on the VM. In that case I'll have to look and see what's missing, if all tests pass etc. I don't remember what was the status of the PR last time I worked on it. |
@s1na Thanks, I was assuming we would be following this |
// Determine set of all node hashes in the database | ||
// before running the tx. | ||
const existingKeys = new Set() | ||
const it = stateManager._trie.db.iterator() |
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.
Can you also give me a hint where this iterator()
might have moved to? This was errored as not available when I last ran the code, got stock there to some extend.
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.
This was possibly a local change, can't find an iterator method in MPT too. Levelup has an iterator
method which I probably used. Maybe just replacing that line with stateManager._trie.db._leveldb.iterator()
would work.
Update: I don't seem to be the handling values, only keys. So maybe ..._leveldb.iterator({ keys: true, values: false })
Co-authored-by: Ryan Ghods <ryan@ryanio.com>
Is there value in keeping this PR open now that we're looking towards verkle tries as the way forward on stateless execution? |
Yeah, let's maybe keep at least a bit more open. I've the impression we are still extremely early with our own efforts and this might serve and some point of reference and/or inspiration. Once we are a bit further down the road and can judge better on the efforts made here we can close. |
One of the most interesting experiments being run during the history of this repository and far ahead of its time. ⭐ Nevertheless getting a bit outdated. 😂 Will close. 🙂 |
The goal of this PR is to prototype something akin to the stateless client concept. There are two "roles":
The prover currently works by hooking the
StateManager
and generating proofs on invocation ofgetAccount
,getContractCode
andgetContractStorage
.The verifier currently works by storing all received trie nodes in a new trie's db (with their hashes as keys), and using that trie in a new
StateManager
, and then running the tx.To test this, I'm running the
GeneralStateTests
suite, running each case twice. Once to generate all the proofs, and a second time to test the verifier given proofs generated during the first run. There are still some edge cases that need to be fixed (38 cases are failing).This also depends on a merkle-patricia-tree release (specifically ethereumjs/merkle-patricia-tree#82, and probably ethereumjs/merkle-patricia-tree#94).