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

util,evm: cleanup and fix some verkle related issues #3405

Merged
merged 1 commit into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Loading