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
Verkle checkpoint db tests #3407
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. |
packages/verkle/src/db/checkpoint.ts
Outdated
@@ -109,6 +109,7 @@ export class CheckpointDB implements DB { | |||
opts: { keyEncoding: KeyEncoding.Bytes, valueEncoding: ValueEncoding.Bytes }, | |||
}) | |||
} | |||
this._stats.db.writes += 1 |
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.
In the trie package checkpoint, we only add writes for del
operations and put
operations. Why do we add it here to commit
?
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.
See bellow for full response: #3407 (comment)
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.
Nice! Really like the additional tests, and it's great to see you guys jumping in and getting your hands dirty with the verkle work :)
Left one small question concerning the db.writes stats, as there seems to be an inconsistency in the way that we are doing this here vs. in the trie package.
The actual behavior seems to be consistent, but at the trie level, we are incrementing the db.writes count whenever there is a put operations and hasCheckpoints
is false. See https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/db/checkpoint.ts#L185-L200
I have limited familiarity with that section (i.e. the stats handling) of the code, but shouldn't this be done as low-level as possible (at the level where the actual db writes are happening), to avoid the need to manually increment in multiple places? Curious to hear your thoughts.
Can be merged once that's discussed/resolved.
…hereumjs-monorepo into verkle-checkpoint-db-tests
I did some more digging into the discrepancy and added some more tests for the |
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.
thanks for addressing the review! lgtm
This change adds some unit testing to the
verkle
package and fixes an issue where db stats aren't being updated in the commit function when write operations are being written to the db.