Skip to content

Commit 7d65062

Browse files
committed
Fix return value computation
1 parent bfb14c5 commit 7d65062

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

packages/evm/src/precompiles/12-execute.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export async function precompile12(opts: PrecompileInput): Promise<ExecResult> {
118118
const stem = stateDiff.stem
119119
await tree.put(stem, suffixes, values)
120120
}
121-
const executionResult = true
121+
let executionResult = true
122122

123123
const stateManager = new StatefulVerkleStateManager({ common: opts.common, trie: tree })
124124
const l2EVM = await createEVM({ stateManager, common: opts.common })
@@ -146,12 +146,12 @@ export async function precompile12(opts: PrecompileInput): Promise<ExecResult> {
146146

147147
if (computedGasUsed !== executeGasUsed) {
148148
opts._debug?.(`${pName} gas used mismatch: ${computedGasUsed} !== ${executeGasUsed}`)
149-
return EvmErrorResult(new EvmError(ERROR.REVERT), opts.gasLimit)
149+
executionResult = false
150150
}
151151

152152
if (!equalsBytes(postStateRoot, tree.root())) {
153153
opts._debug?.(`${pName} post state root mismatch`)
154-
return EvmErrorResult(new EvmError(ERROR.REVERT), opts.gasLimit)
154+
executionResult = false
155155
}
156156

157157
opts._debug?.(`${pName} trace executed successfully=${executionResult}`)

packages/evm/test/precompiles/12-execute.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ describe('Precompiles: EXECUTE', () => {
5050
const tree = await createVerkleTree({ verkleCrypto: verkle })
5151
const stateManager = new StatefulVerkleStateManager({ common, trie: tree })
5252
await stateManager.putAccount(address, account)
53+
5354
const preStateRoot = tree.root()
5455
const evm = await createEVM({ stateManager, common })
5556

@@ -83,8 +84,8 @@ describe('Precompiles: EXECUTE', () => {
8384
}
8485
const traceBytes = traceContainer.encode(trace)
8586

86-
// We use the hash as a reference to the trace. This should be replaced with a proper blob commitment (or versionedHash)
87-
// and the data should be stored as a proper Ethereum blob
87+
// We use the sha256 hash of the serialized trace as a reference. This is standing in for the versionedHash that we should use
88+
// once we have the trace properly converted to an Ethereum blob.
8889
const hash = bytesToHex(sha256(traceBytes))
8990
evm['executionBlobs'].set(hash, traceBytes)
9091

0 commit comments

Comments
 (0)