Unverified Commit b362e886 by dependabot-preview[bot] Committed by GitHub

Bump ethereumjs-util from 6.2.0 to 7.0.0 (#2222)

* Bump ethereumjs-util from 6.2.0 to 7.0.0

Bumps [ethereumjs-util](https://github.com/ethereumjs/ethereumjs-util) from 6.2.0 to 7.0.0.
- [Release notes](https://github.com/ethereumjs/ethereumjs-util/releases)
- [Changelog](https://github.com/ethereumjs/ethereumjs-util/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ethereumjs/ethereumjs-util/compare/v6.2.0...v7.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* update use of ethereumjs-util

* fix use of keccak hash function

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
parent ca38899e
......@@ -3,7 +3,7 @@ const { contract } = require('@openzeppelin/test-environment');
require('@openzeppelin/test-helpers');
const { MerkleTree } = require('../helpers/merkleTree.js');
const { keccak256, bufferToHex } = require('ethereumjs-util');
const { keccakFromString, bufferToHex } = require('ethereumjs-util');
const { expect } = require('chai');
......@@ -23,7 +23,7 @@ describe('MerkleProof', function () {
const proof = merkleTree.getHexProof(elements[0]);
const leaf = bufferToHex(keccak256(elements[0]));
const leaf = bufferToHex(keccakFromString(elements[0]));
expect(await this.merkleProof.verify(proof, root, leaf)).to.equal(true);
});
......@@ -34,7 +34,7 @@ describe('MerkleProof', function () {
const correctRoot = correctMerkleTree.getHexRoot();
const correctLeaf = bufferToHex(keccak256(correctElements[0]));
const correctLeaf = bufferToHex(keccakFromString(correctElements[0]));
const badElements = ['d', 'e', 'f'];
const badMerkleTree = new MerkleTree(badElements);
......@@ -53,7 +53,7 @@ describe('MerkleProof', function () {
const proof = merkleTree.getHexProof(elements[0]);
const badProof = proof.slice(0, proof.length - 5);
const leaf = bufferToHex(keccak256(elements[0]));
const leaf = bufferToHex(keccakFromString(elements[0]));
expect(await this.merkleProof.verify(badProof, root, leaf)).to.equal(false);
});
......
const { keccak256, bufferToHex } = require('ethereumjs-util');
const { keccak256, keccakFromString, bufferToHex } = require('ethereumjs-util');
class MerkleTree {
constructor (elements) {
// Filter empty strings and hash elements
this.elements = elements.filter(el => el).map(el => keccak256(el));
this.elements = elements.filter(el => el).map(el => keccakFromString(el));
// Sort elements
this.elements.sort(Buffer.compare);
......@@ -97,7 +97,7 @@ class MerkleTree {
// Convert element to 32 byte hash if it is not one already
if (el.length !== 32 || !Buffer.isBuffer(el)) {
hash = keccak256(el);
hash = keccakFromString(el);
} else {
hash = el;
}
......
const { accounts, contract } = require('@openzeppelin/test-environment');
const { expectRevert, singletons } = require('@openzeppelin/test-helpers');
const { bufferToHex, keccak256 } = require('ethereumjs-util');
const { bufferToHex, keccakFromString } = require('ethereumjs-util');
const { expect } = require('chai');
......@@ -10,14 +10,14 @@ const ERC1820ImplementerMock = contract.fromArtifact('ERC1820ImplementerMock');
describe('ERC1820Implementer', function () {
const [ registryFunder, implementee, other ] = accounts;
const ERC1820_ACCEPT_MAGIC = bufferToHex(keccak256('ERC1820_ACCEPT_MAGIC'));
const ERC1820_ACCEPT_MAGIC = bufferToHex(keccakFromString('ERC1820_ACCEPT_MAGIC'));
beforeEach(async function () {
this.implementer = await ERC1820ImplementerMock.new();
this.registry = await singletons.ERC1820Registry(registryFunder);
this.interfaceA = bufferToHex(keccak256('interfaceA'));
this.interfaceB = bufferToHex(keccak256('interfaceB'));
this.interfaceA = bufferToHex(keccakFromString('interfaceA'));
this.interfaceB = bufferToHex(keccakFromString('interfaceB'));
});
context('with no registered interfaces', function () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment