Skip to content

Commit 4836ea2

Browse files
author
Agustin Aguilar
committed
Fix, don't change codes constant, changed expected gas
1 parent f9e9787 commit 4836ea2

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/opcodes.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,13 @@ module.exports = function (op, full, freeLogs) {
182182
}
183183
}
184184

185+
var fee = code[1]
186+
185187
if (freeLogs) {
186188
if (opcode === 'LOG') {
187-
code[1] = 0
189+
fee = 0
188190
}
189191
}
190192

191-
return {name: opcode, opcode: op, fee: code[1], in: code[2], out: code[3], dynamic: code[4], async: code[5]}
193+
return {name: opcode, opcode: op, fee: fee, in: code[2], out: code[3], dynamic: code[4], async: code[5]}
192194
}

tests/api/freeLogs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ tape('VM with free logs', async (t) => {
2020
gasLimit: 1000
2121
}, function (err, val) {
2222
st.notOk(err)
23-
st.ok(val.runState.gasLeft >= 0x8e, 'should expend less gas')
23+
st.ok(val.runState.gasLeft >= 0x235, 'should expend less gas')
2424
st.ok(val.logs.length === 1, 'should emit event')
2525
st.end()
2626
})
@@ -32,7 +32,7 @@ tape('VM with free logs', async (t) => {
3232
gasLimit: 1000
3333
}, function (err, val) {
3434
st.notOk(err)
35-
st.ok(val.runState.gasLeft < 0x8e, 'should expend normal gas')
35+
st.ok(val.runState.gasLeft < 0x235, 'should expend normal gas')
3636
st.ok(val.logs.length === 1, 'should emit event')
3737
st.end()
3838
})

0 commit comments

Comments
 (0)