@@ -336,7 +336,7 @@ export default class Common extends EventEmitter {
336336 }
337337 let existing = false
338338 for ( const hfChanges of HARDFORK_CHANGES ) {
339- if ( hfChanges [ 0 ] === hardfork ) {
339+ if ( this . hardforkIsActiveOnChain ( hfChanges [ 0 ] ) && hfChanges [ 0 ] === hardfork ) {
340340 if ( this . _hardfork !== hardfork ) {
341341 this . _hardfork = hardfork
342342 this . emit ( 'hardforkChanged' , hardfork )
@@ -489,21 +489,24 @@ export default class Common extends EventEmitter {
489489
490490 let value = null
491491 for ( const hfChanges of HARDFORK_CHANGES ) {
492- // EIP-referencing HF file (e.g. berlin.json)
493- if ( hfChanges [ 1 ] . hasOwnProperty ( 'eips' ) ) {
494- // eslint-disable-line
495- const hfEIPs = hfChanges [ 1 ] [ 'eips' ]
496- for ( const eip of hfEIPs ) {
497- const valueEIP = this . paramByEIP ( topic , name , eip )
498- value = valueEIP !== null ? valueEIP : value
499- }
500- // Paramater-inlining HF file (e.g. istanbul.json)
501- } else {
502- if ( ! hfChanges [ 1 ] [ topic ] ) {
503- throw new Error ( `Topic ${ topic } not defined` )
504- }
505- if ( hfChanges [ 1 ] [ topic ] [ name ] !== undefined ) {
506- value = hfChanges [ 1 ] [ topic ] [ name ] . v
492+ // the hardfork must be activated
493+ if ( this . hardforkIsActiveOnChain ( hfChanges [ 0 ] ) ) {
494+ // EIP-referencing HF file (e.g. berlin.json)
495+ if ( hfChanges [ 1 ] . hasOwnProperty ( 'eips' ) ) {
496+ // eslint-disable-line
497+ const hfEIPs = hfChanges [ 1 ] [ 'eips' ]
498+ for ( const eip of hfEIPs ) {
499+ const valueEIP = this . paramByEIP ( topic , name , eip )
500+ value = valueEIP !== null ? valueEIP : value
501+ }
502+ // Paramater-inlining HF file (e.g. istanbul.json)
503+ } else {
504+ if ( ! hfChanges [ 1 ] [ topic ] ) {
505+ throw new Error ( `Topic ${ topic } not defined` )
506+ }
507+ if ( hfChanges [ 1 ] [ topic ] [ name ] !== undefined ) {
508+ value = hfChanges [ 1 ] [ topic ] [ name ] . v
509+ }
507510 }
508511 }
509512 if ( hfChanges [ 0 ] === hardfork ) break
@@ -560,10 +563,12 @@ export default class Common extends EventEmitter {
560563 return true
561564 }
562565 for ( const hfChanges of HARDFORK_CHANGES ) {
563- const hf = hfChanges [ 1 ]
564- if ( this . gteHardfork ( hf [ 'name' ] ) && 'eips' in hf ) {
565- if ( hf [ 'eips' ] . includes ( eip ) ) {
566- return true
566+ if ( this . hardforkIsActiveOnChain ( hfChanges [ 0 ] ) ) {
567+ const hf = hfChanges [ 1 ]
568+ if ( this . gteHardfork ( hf [ 'name' ] , { onlyActive : true } ) && 'eips' in hf ) {
569+ if ( hf [ 'eips' ] . includes ( eip ) ) {
570+ return true
571+ }
567572 }
568573 }
569574 }
0 commit comments