Skip to content

Commit 29f14fb

Browse files
committed
Clone refund counter in EVMResult, fix eip-2200 api tests
1 parent b0d71f0 commit 29f14fb

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/evm/evm.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ export interface EVMResult {
3434
* Contains the results from running the code, if any, as described in [[runCode]]
3535
*/
3636
execResult: ExecResult
37+
/**
38+
* Amount of gas to refund from deleting storage values
39+
*/
40+
gasRefund?: BN
3741
}
3842

3943
/**
@@ -121,6 +125,7 @@ export default class EVM {
121125
} else {
122126
result = await this._executeCreate(message)
123127
}
128+
result.gasRefund = this._refund.clone()
124129

125130
const err = result.execResult.exceptionError
126131
if (err) {

tests/api/istanbul/eip-2200.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ tape('Istanbul: EIP-2200: net-metering SSTORE', async (t) => {
5858
t.assert(res.execResult.exceptionError === undefined)
5959
}
6060
t.assert(new BN(testCase.used).eq(res.gasUsed))
61-
t.assert(new BN(testCase.refund).eq(res.execResult.gasRefund))
61+
t.assert(new BN(testCase.refund).eq(res.gasRefund))
6262
} catch (e) {
6363
t.fail(e.message)
6464
}

0 commit comments

Comments
 (0)