Skip to content

Commit

Permalink
util,evm: cleanup and fix some verkle related issues (#3405)
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech committed May 6, 2024
1 parent 018245b commit 0ed0a07
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/evm/src/interpreter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,7 @@ export class Interpreter {
isStatic: this._env.isStatic,
depth: this._env.depth + 1,
blobVersionedHashes: this._env.blobVersionedHashes,
accessWitness: this._env.accessWitness,
})

return this._baseCall(msg)
Expand All @@ -870,6 +871,7 @@ export class Interpreter {
depth: this._env.depth + 1,
authcallOrigin: this._env.address,
blobVersionedHashes: this._env.blobVersionedHashes,
accessWitness: this._env.accessWitness,
})

return this._baseCall(msg)
Expand All @@ -894,6 +896,7 @@ export class Interpreter {
isStatic: this._env.isStatic,
depth: this._env.depth + 1,
blobVersionedHashes: this._env.blobVersionedHashes,
accessWitness: this._env.accessWitness,
})

return this._baseCall(msg)
Expand All @@ -919,6 +922,7 @@ export class Interpreter {
isStatic: true,
depth: this._env.depth + 1,
blobVersionedHashes: this._env.blobVersionedHashes,
accessWitness: this._env.accessWitness,
})

return this._baseCall(msg)
Expand All @@ -945,6 +949,7 @@ export class Interpreter {
delegatecall: true,
depth: this._env.depth + 1,
blobVersionedHashes: this._env.blobVersionedHashes,
accessWitness: this._env.accessWitness,
})

return this._baseCall(msg)
Expand Down
11 changes: 10 additions & 1 deletion packages/util/src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class Account {
if (this._balance !== null) {
return this._balance
} else {
throw Error(`bonce=${this._balance} not loaded`)
throw Error(`balance=${this._balance} not loaded`)
}
}
set balance(_balance: bigint) {
Expand Down Expand Up @@ -393,6 +393,15 @@ export class Account {
* "An account is considered empty when it has no code and zero nonce and zero balance."
*/
isEmpty(): boolean {
// helpful for determination in partial accounts
if (
(this._balance !== null && this.balance !== BIGINT_0) ||
(this._nonce === null && this.nonce !== BIGINT_0) ||
(this._codeHash !== null && !equalsBytes(this.codeHash, KECCAK256_NULL))
) {
return false
}

return (
this.balance === BIGINT_0 &&
this.nonce === BIGINT_0 &&
Expand Down

0 comments on commit 0ed0a07

Please sign in to comment.