-
Notifications
You must be signed in to change notification settings - Fork 298
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
feat: Allow concurrent world state access #11216
Conversation
Changes to circuit sizes
🧾 Summary (100% most significant diffs)
Full diff report 👇
|
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.
LGTM. Just a question on queue draining. Everything is else is minor
const { block: block1 } = await mockBlock(1, 8, fork); | ||
const { block: block2 } = await mockBlock(2, 8, fork); |
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.
IIRC mockBlock
modified the fork parameter with the block info (in order to create the correct block header).
Writing the same block data to the same fork inserts empty leaves into the public data tree so the sibling path will still change. The test is still correct but we might want to use two different forks: one for building the blocks and the other to test the writes.
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.
Oh thats was stupid. The test should be using a different fork!
// As many non-mutating requests as we encounter until | ||
// we exhaust the queue or we reach a mutating request | ||
while (this.requests.length > 0) { | ||
const next = this.requests[0]; |
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.
Was going to suggest using shfit
here but not all branches of the if statemnent remove the head of the list
op.request() | ||
.then(resp => { | ||
op.promise.resolve(resp); | ||
this.ops.delete(op.requestId); | ||
}) | ||
.catch(err => { | ||
op.promise.reject(err); | ||
this.ops.delete(op.requestId); | ||
}); |
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 can be simplified slightly
op.request() | |
.then(resp => { | |
op.promise.resolve(resp); | |
this.ops.delete(op.requestId); | |
}) | |
.catch(err => { | |
op.promise.reject(err); | |
this.ops.delete(op.requestId); | |
}); | |
op.request().then(op.promise.resolve, op.promise.reject) | |
.finally(() => { | |
this.ops.delete(op.requestId); | |
}) |
op.request() | ||
.then(resp => { | ||
op.promise.resolve(resp); | ||
this.checkAndEnqueue(op); | ||
this.ops.delete(op.requestId); | ||
}) | ||
.catch(err => { | ||
op.promise.reject(err); | ||
this.checkAndEnqueue(op); | ||
this.ops.delete(op.requestId); | ||
}); |
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.
Same as above. If the ops.delete was moved inside checkAndEnqueue
it could be even cleaner I think
op.request() | |
.then(resp => { | |
op.promise.resolve(resp); | |
this.checkAndEnqueue(op); | |
this.ops.delete(op.requestId); | |
}) | |
.catch(err => { | |
op.promise.reject(err); | |
this.checkAndEnqueue(op); | |
this.ops.delete(op.requestId); | |
}); | |
op.request().then(op.promise.resolve, op.promise.reject) | |
.finally(resp => { | |
this.checkAndEnqueue(op); | |
this.ops.delete(op.requestId); | |
}) |
Implements per-fork queues for requests to the native world state following it's concurrency rules. Also tightens up aspects of the cached store to ensure reads of committed data don't access anything uncommitted.