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

Optimize storage of default values in VerkleNode #3476

Merged
merged 24 commits into from
Jul 4, 2024
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
55d425b
Add optimized default value storage
acolytec3 Jun 28, 2024
03534b1
lint
acolytec3 Jun 28, 2024
c3a4ffb
lint
acolytec3 Jun 28, 2024
132c9e4
Check for null instead of equalsBytes
acolytec3 Jul 1, 2024
b0d1523
Fix check for empty child references [no ci]
acolytec3 Jul 1, 2024
0b679a3
Remove unused constant [no ci]
acolytec3 Jul 1, 2024
ce24136
Reorganize tests
acolytec3 Jul 1, 2024
369477e
Fix test
acolytec3 Jul 2, 2024
cc40c72
Merge branch 'master' into optimize-node-value-storage
gabrocheleau Jul 3, 2024
c175633
verkle: enum instead of numbers
gabrocheleau Jul 3, 2024
78e300f
verkle: use enum
gabrocheleau Jul 3, 2024
9c19dfd
verkle: more enum cases
gabrocheleau Jul 3, 2024
320a733
verkle: address todo, use enum and remove now unnecessary typecast
gabrocheleau Jul 3, 2024
ecf4222
Remove obsolete comments
acolytec3 Jul 3, 2024
702b732
verkle: replace bigint conversion with direct bytes manipulation
gabrocheleau Jul 3, 2024
df19cbc
Merge branch 'optimize-node-value-storage' of https://github.com/ethe…
gabrocheleau Jul 3, 2024
5be4cb1
Merge branch 'master' into optimize-node-value-storage
gabrocheleau Jul 3, 2024
c25a93a
verkle: update constant helpers
gabrocheleau Jul 3, 2024
c05e941
Merge branch 'optimize-node-value-storage' of https://github.com/ethe…
gabrocheleau Jul 3, 2024
9c5e3ac
Accept VerkleLeafNodeValue in setValue
acolytec3 Jul 3, 2024
bcfb711
Update test
acolytec3 Jul 3, 2024
275909f
address feedback
acolytec3 Jul 4, 2024
f967f99
Merge branch 'master' into optimize-node-value-storage
acolytec3 Jul 4, 2024
bb7d30c
Merge branch 'master' into optimize-node-value-storage
acolytec3 Jul 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove unused constant [no ci]
  • Loading branch information
acolytec3 committed Jul 1, 2024
commit 0b679a3766e7d99803c1565d14ae7f2428c238bd
9 changes: 7 additions & 2 deletions packages/verkle/src/node/internalNode.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type VerkleCrypto } from '@ethereumjs/util'

import { BaseVerkleNode } from './baseVerkleNode.js'
import { EMPTY_CHILD, NODE_WIDTH, VerkleNodeType } from './types.js'
import { NODE_WIDTH, VerkleNodeType } from './types.js'

import type { ChildNode, VerkleNodeOptions } from './types.js'

@@ -19,7 +19,12 @@ export class InternalNode extends BaseVerkleNode<VerkleNodeType.Internal> {
setChild(childIndex: number, child: ChildNode) {
// Get previous child commitment at `index`
const oldChildReference =
this.children[childIndex] !== null ? this.children[childIndex] : EMPTY_CHILD
this.children[childIndex] !== null
? this.children[childIndex]
: {
commitment: this.verkleCrypto.zeroCommitment,
path: new Uint8Array(),
}
// Updates the commitment to the child node at `index`
this.children[childIndex] = { ...child }
// Updates the overall node commitment based on the update to this child
5 changes: 0 additions & 5 deletions packages/verkle/src/node/types.ts
Original file line number Diff line number Diff line change
@@ -47,11 +47,6 @@ export interface VerkleNodeOptions {

export const NODE_WIDTH = 256

export const EMPTY_CHILD: ChildNode = {
commitment: new Uint8Array(64),
path: new Uint8Array(),
}

export const ZERO_LEAF_VALUE = new Uint8Array(32)

export const DELETED_LEAF_VALUE = setLengthLeft(