From 8a445558024ff4a300659aaed37bab858d91aff6 Mon Sep 17 00:00:00 2001 From: Jose Hugo De la cruz Romero Date: Wed, 22 Jan 2020 20:09:24 -0600 Subject: [PATCH 1/3] use Common to set the hardfork name correctly --- package.json | 1 + src/relayer/lib.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index db54eac..dff76df 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "axios": "^0.19.0", "bn.js": "^5.0.0", "ethereumjs-account": "^3.0.0", + "ethereumjs-common": "^1.5.0", "ethereumjs-testing": "git+https://github.com/ethereumjs/ethereumjs-testing.git#v1.2.7", "ethereumjs-util": "^6.1.0", "ethereumjs-vm": "^4.1.0", diff --git a/src/relayer/lib.ts b/src/relayer/lib.ts index 5e9eae5..7d3e90f 100644 --- a/src/relayer/lib.ts +++ b/src/relayer/lib.ts @@ -11,6 +11,7 @@ const assert = require('assert') const { promisify } = require('util') const Wallet = require('ethereumjs-wallet') const Trie = require('merkle-patricia-tree/secure') +const Common = require('ethereumjs-common') export interface TestSuite { preStateRoot: Buffer @@ -401,8 +402,9 @@ export function rawMultiproof(proof: Multiproof, flatInstructions: boolean = fal } export function getBasicBlockIndices(code: Buffer): number[][] { + const hfIstanbul = new Common('istanbul') const TERMINATING_OPS = ['JUMP', 'JUMPI', 'STOP', 'RETURN', 'REVERT', 'SELFDESTRUCT'] - const opcodes = getOpcodesForHF('istanbul') + const opcodes = getOpcodesForHF(hfIstanbul) const getOp = (i: number) => (opcodes[code[i]] ? opcodes[code[i]].name : 'INVALID') // [start, end) indices From 94ca69dd59248cde1efbe021181970e595b21c68 Mon Sep 17 00:00:00 2001 From: Jose Hugo De la cruz Romero Date: Thu, 23 Jan 2020 19:17:40 -0600 Subject: [PATCH 2/3] update ethereumjs-vm to 4.1.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dff76df..5ffb6e3 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "ethereumjs-common": "^1.5.0", "ethereumjs-testing": "git+https://github.com/ethereumjs/ethereumjs-testing.git#v1.2.7", "ethereumjs-util": "^6.1.0", - "ethereumjs-vm": "^4.1.0", + "ethereumjs-vm": "^4.1.3", "ethereumjs-wallet": "^0.6.3", "merkle-patricia-tree": "^3.0.0", "rlp": "^2.2.3" From 4388bcd38856dc41d296edc5f08b2e20efe04291 Mon Sep 17 00:00:00 2001 From: Jose Hugo De la cruz Romero Date: Tue, 11 Feb 2020 17:15:11 -0600 Subject: [PATCH 3/3] specify chain --- src/relayer/lib.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/relayer/lib.ts b/src/relayer/lib.ts index 7d3e90f..6f9ddfd 100644 --- a/src/relayer/lib.ts +++ b/src/relayer/lib.ts @@ -6,12 +6,12 @@ import { Multiproof, verifyMultiproof, makeMultiproof, flatEncodeInstructions } import VM from 'ethereumjs-vm' import { Transaction } from 'ethereumjs-tx' import { getOpcodesForHF } from 'ethereumjs-vm/dist/evm/opcodes' +import Common from 'ethereumjs-common' const assert = require('assert') const { promisify } = require('util') const Wallet = require('ethereumjs-wallet') const Trie = require('merkle-patricia-tree/secure') -const Common = require('ethereumjs-common') export interface TestSuite { preStateRoot: Buffer @@ -402,7 +402,7 @@ export function rawMultiproof(proof: Multiproof, flatInstructions: boolean = fal } export function getBasicBlockIndices(code: Buffer): number[][] { - const hfIstanbul = new Common('istanbul') + const hfIstanbul = new Common('mainnet', 'istanbul') const TERMINATING_OPS = ['JUMP', 'JUMPI', 'STOP', 'RETURN', 'REVERT', 'SELFDESTRUCT'] const opcodes = getOpcodesForHF(hfIstanbul) const getOp = (i: number) => (opcodes[code[i]] ? opcodes[code[i]].name : 'INVALID')