-
Notifications
You must be signed in to change notification settings - Fork 773
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
WIP removal of level DB stuff #2673
WIP removal of level DB stuff #2673
Conversation
@@ -177,12 +178,12 @@ export class CheckpointDB implements DB { | |||
async del(key: Uint8Array): Promise<void> { | |||
const keyHex = bytesToHex(key) | |||
if (this._cache !== undefined) { | |||
this._cache.set(keyHex, null) |
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 will likely not fully work. There are different semantics in the cache for „known to not exist“ (as meant here) which was null before and „not in the cache“ which was already undefined before, I battled with this a long time.
This comes into play when the cache get method is called, because this gives undefined when the key is not in the cache, now it also gives undefined for the above case (so there is this together-throwing).
This is why I added a somewhat more complex dict structure in the account cache for the account value or undefined, so there is an „outer“ and an „inner“ undefined, which makes up for the differentiation there.
Maybe it is easier to keep null here, I was actually never that happy with the account cache structure regarding this, since it creates some overhead.
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.
Understood, I haven't really dug into the trie
piece of it yet. I've been focused on trying to get blockchain
passing all the tests while removing as much of the dependence on try/catch
logic as possible.
Codecov Report
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. |
open() { | ||
return Promise.resolve() | ||
} |
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.
Does this actually do anything? Or is this added in to make the interface consistent with the expected types?
@@ -49,7 +50,7 @@ export class VMExecution extends Execution { | |||
|
|||
if (this.config.vm === undefined) { | |||
const trie = new Trie({ | |||
db: new LevelDB(this.stateDB), | |||
db: new LevelDB(this.stateDB) as DB<Uint8Array, Uint8Array>, |
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.
db: new LevelDB(this.stateDB) as DB<Uint8Array, Uint8Array>, | |
db: new LevelDB(this.stateDB) as DB, |
I don't think the types are necessary since this defaults to Uint8Array.
@@ -202,7 +203,7 @@ export class AccountFetcher extends Fetcher<JobTask, AccountData[], AccountData> | |||
} | |||
} | |||
|
|||
const trie = new Trie({ db: new LevelDB() }) | |||
const trie = new Trie({ db: new LevelDB() as DB<Uint8Array, Uint8Array> }) |
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
* blockchain: remove level dependency from blockchain * util: refactor DB types from trie to util * util: make db interface generic * blockchain: remove abstract-level usage in favor of DB interface and MapDB * WIP removal of level DB stuff (#2673) Co-authored-by: Gabriel Rocheleau <contact@rockwaterweb.com> * Add correct value encoding for keys in level * Apply correct db interface typing * Fix level encoding for strings * More typing fixes * Fix batch value encoding * fix deprecated property usage * Replace level with mapdb in VM * move mapDB to util * Cleanup * Add key/value encodings back to interface * Remove level dependency from ethash * Add db ops to blockchain * remove unused imports * remove leveldb * update trie to use strings * Slight fixes * lint * fix trie tests * cast trie db as any * client: improve levelDB types and remove unnecessary typecasting * client: remove additional unnecessary typecasting * client: type issue --------- Co-authored-by: acolytec3 <konjou@gmail.com> Co-authored-by: acolytec3 <17355484+acolytec3@users.noreply.github.com>
No description provided.