-
Notifications
You must be signed in to change notification settings - Fork 615
fix: store blockhash alongside blocks #3950
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
Changes from 3 commits
d28efb5
9921576
8014484
d1f610d
579bf75
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -321,9 +321,10 @@ export class L2Block { | |||
| /** | ||||
| * Deserializes L2 block without logs from a buffer. | ||||
| * @param buf - A serialized L2 block. | ||||
| * @param blockHash - The hash of the block. | ||||
| * @returns Deserialized L2 block. | ||||
| */ | ||||
| static fromBuffer(buf: Buffer | BufferReader) { | ||||
| static fromBuffer(buf: Buffer | BufferReader, blockHash?: Buffer) { | ||||
|
Comment on lines
-326
to
+
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Judging from this change, wouldn't it be easier to just squeeze
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like this is planned as part of #3938 ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't find it now but there was an issue/PR about blocks now being serialisable because they didn't logs. I'd consider doing this but only if I make |
||||
| const reader = BufferReader.asReader(buf); | ||||
| const globalVariables = reader.readObject(GlobalVariables); | ||||
| // TODO(#3938): update the encoding here | ||||
|
|
@@ -358,17 +359,20 @@ export class L2Block { | |||
| // TODO(#3938): populate bodyHash | ||||
| const header = new Header(startArchiveSnapshot, [Fr.ZERO, Fr.ZERO], state, globalVariables); | ||||
|
|
||||
| return L2Block.fromFields({ | ||||
| archive: endArchiveSnapshot, | ||||
| header, | ||||
| newCommitments, | ||||
| newNullifiers, | ||||
| newPublicDataWrites, | ||||
| newL2ToL1Msgs, | ||||
| newContracts, | ||||
| newContractData, | ||||
| newL1ToL2Messages, | ||||
| }); | ||||
| return L2Block.fromFields( | ||||
| { | ||||
| archive: endArchiveSnapshot, | ||||
| header, | ||||
| newCommitments, | ||||
| newNullifiers, | ||||
| newPublicDataWrites, | ||||
| newL2ToL1Msgs, | ||||
| newContracts, | ||||
| newContractData, | ||||
| newL1ToL2Messages, | ||||
| }, | ||||
| blockHash, | ||||
| ); | ||||
| } | ||||
|
|
||||
| /** | ||||
|
|
||||
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.
I'm worried that this change could mean that some consumers of L2Blocks will no longer be receiving their blocks. WDYT about having
L2BlockandL2BlockWithLogsas two separate interfaces, so it's absolutely clear when we are moving around an object with logs, and when it doesn't?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.
Not having an interface for L2Block is strange to me since it seems a major point of interaction for clients. Having two separate interfaces for blocks with/without logs feels like it would get painful as well. Maybe just:
then in the class implementation of
L2Block.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.
I agree with both of you, but changes are coming to this section of the code to bring it inline with the Yello paper and I'd prefer to wait for them to land before touching it more than needed if that's alright :)