-
Notifications
You must be signed in to change notification settings - Fork 778
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vm/tests: ensure tests run with EIPs activated (#2108)
* vm/tests: ensure tests run with EIPs activated * vm/tests: fix common * vm: add test runner tests * vm: testloader tests; add extra check * vm/tests: cleanup * vm: lint Co-authored-by: Brian Faust <[email protected]>
- Loading branch information
1 parent
d210bda
commit f0516de
Showing
2 changed files
with
77 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { Hardfork } from '@ethereumjs/common' | ||
import * as tape from 'tape' | ||
|
||
import { getCommon } from '../../tester/config' | ||
|
||
tape('bloom', (t: tape.Test) => { | ||
t.test('should initialize common with the right hardfork', (st) => { | ||
const common = getCommon('byzantium') | ||
st.ok(common.hardfork() === Hardfork.Byzantium) | ||
st.end() | ||
}) | ||
t.test('should initialize common with the right hardfork uppercased', (st) => { | ||
let common = getCommon('Byzantium') | ||
st.ok(common.hardfork() === Hardfork.Byzantium) | ||
common = getCommon('BYZANTIUM') | ||
st.ok(common.hardfork() === Hardfork.Byzantium) | ||
st.end() | ||
}) | ||
t.test('should always activate EIP 3607', (st) => { | ||
let common = getCommon('byzantium') | ||
st.ok(common.isActivatedEIP(3607)) | ||
common = getCommon('ArrowGlacierToMergeAtDiffC0000') | ||
st.ok(common.isActivatedEIP(3607)) | ||
common = getCommon('ByzantiumToConstantinopleFixAt5') | ||
st.ok(common.isActivatedEIP(3607)) | ||
st.end() | ||
}) | ||
t.test('should be able to activate hardforks with EIPs enabled', (st) => { | ||
let common = getCommon('byzantium+2537') | ||
st.ok(common.isActivatedEIP(2537)) | ||
common = getCommon('byzantium+2537+2929') | ||
st.ok(common.isActivatedEIP(2537)) | ||
st.ok(common.isActivatedEIP(2929)) | ||
st.end() | ||
}) | ||
t.test('should be able to activate transition forks', (st) => { | ||
st.doesNotThrow(() => getCommon('ByzantiumToConstantinopleFixAt5')) | ||
st.end() | ||
}) | ||
t.test('should be able to activate merge transition fork with the correct TTD set', (st) => { | ||
const forks = [ | ||
{ hf: 'arrowGlacier', TTD: 20000 }, | ||
{ hf: 'london', TTD: 20000 }, | ||
{ hf: 'arrowGlacier', TTD: 40000 }, | ||
] | ||
forks.map((testCase) => { | ||
const str = testCase.hf + 'ToMergeAtDiff' + testCase.TTD.toString(16) | ||
const common = getCommon(str) | ||
st.ok(common.hardfork() === testCase.hf) | ||
st.ok(common.hardforkTTD('merge') === BigInt(testCase.TTD)) | ||
}) | ||
st.end() | ||
}) | ||
t.test('should throw on a non-existing fork', (st) => { | ||
st.throws(() => getCommon('NonExistingFork')) | ||
st.end() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters