Skip to content

Commit 9c41e90

Browse files
ryanios1na
authored andcommitted
chore: upgrade to ethereumjs-util 6.2.0 (ethereumjs#621)
fix: failing test cases due toBuffer validating input as hex prefixed (Closes ethereumjs#619)
1 parent 5ef5abb commit 9c41e90

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"ethereumjs-blockchain": "^4.0.2",
5858
"ethereumjs-common": "^1.3.2",
5959
"ethereumjs-tx": "^2.1.1",
60-
"ethereumjs-util": "~6.1.0",
60+
"ethereumjs-util": "^6.2.0",
6161
"fake-merkle-patricia-tree": "^1.0.1",
6262
"functional-red-black-tree": "^1.0.1",
6363
"merkle-patricia-tree": "^2.3.2",

tests/api/bloom.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -22,42 +22,42 @@ tape('bloom', (t) => {
2222
const vector = Buffer.from(hex, 'hex')
2323

2424
const b = new Bloom(vector)
25-
st.true(b.check(utils.toBuffer('value 1')), 'should contain string "value 1"')
26-
st.true(b.check(utils.toBuffer('value 2')), 'should contain string "value 2"')
25+
st.true(b.check(Buffer.from('value 1', 'utf8')), 'should contain string "value 1"')
26+
st.true(b.check(Buffer.from('value 2', 'utf8')), 'should contain string "value 2"')
2727
st.end()
2828
})
2929

3030
t.test('check shouldnt be tautology', (st) => {
3131
const b = new Bloom()
32-
st.false(b.check(utils.toBuffer('random value')), 'should not contain string "random value"')
32+
st.false(b.check(Buffer.from('random value', 'utf8')), 'should not contain string "random value"')
3333
st.end()
3434
})
3535

3636
t.test('should correctly add value', (st) => {
3737
const b = new Bloom()
38-
b.add(utils.toBuffer('value'))
39-
let found = b.check(utils.toBuffer('value'))
38+
b.add(Buffer.from('value', 'utf8'))
39+
let found = b.check(Buffer.from('value', 'utf8'))
4040
st.true(found, 'should contain added value')
4141
st.end()
4242
})
4343

4444
t.test('should check multiple values', (st) => {
4545
const b = new Bloom()
46-
b.add(utils.toBuffer('value 1'))
47-
b.add(utils.toBuffer('value 2'))
48-
let found = b.multiCheck([utils.toBuffer('value 1'), utils.toBuffer('value 2')])
46+
b.add(Buffer.from('value 1', 'utf8'))
47+
b.add(Buffer.from('value 2', 'utf8'))
48+
let found = b.multiCheck([Buffer.from('value 1'), Buffer.from('value 2')])
4949
st.true(found, 'should contain both values')
5050
st.end()
5151
})
5252

5353
t.test('should or two filters', (st) => {
5454
const b1 = new Bloom()
55-
b1.add(utils.toBuffer('value 1'))
55+
b1.add(Buffer.from('value 1', 'utf8'))
5656
const b2 = new Bloom()
57-
b2.add(utils.toBuffer('value 2'))
57+
b2.add(Buffer.from('value 2', 'utf8'))
5858

5959
b1.or(b2)
60-
st.true(b1.check(utils.toBuffer('value 2')), 'should contain "value 2" after or')
60+
st.true(b1.check(Buffer.from('value 2', 'utf-8')), 'should contain "value 2" after or')
6161
st.end()
6262
})
6363

tests/api/istanbul/eip-1884.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ tape('Istanbul: EIP-1884: SELFBALANCE', async (t) => {
2525
const common = new Common(testCase.chain, testCase.hardfork)
2626
const vm = new VM({ common })
2727
const state = new PStateManager(vm.stateManager)
28-
const account = createAccount('00', testCase.selfbalance)
28+
const account = createAccount('0x00', testCase.selfbalance)
2929
await state.putAccount(addr, account)
3030
try {
3131
const res = await vm.runCode(runCodeArgs)

tests/api/istanbul/eip-2200.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ tape('Istanbul: EIP-2200: net-metering SSTORE', async (t) => {
3737
const vm = new VM({ common })
3838
const state = new PStateManager(vm.stateManager)
3939

40-
const account = createAccount('00', '00')
40+
const account = createAccount('0x00', '0x00')
4141
await state.putAccount(addr, account)
4242
await state.putContractCode(addr, Buffer.from(testCase.code, 'hex'))
4343
if (!testCase.original.isZero()) {

0 commit comments

Comments
 (0)