@@ -591,7 +591,7 @@ case object SSTORE extends OpCode(0x55, 2, 0, _.G_zero) {
591591 protected def exec [W <: WorldStateProxy [W , S ], S <: Storage [S ]](state : ProgramState [W , S ]): ProgramState [W , S ] = {
592592 val (Seq (offset, newValue), stack1) = state.stack.pop(2 )
593593 val currentValue = state.storage.load(offset)
594- val refund : BigInt = if (isAfterConstantinopleFork (state)) {
594+ val refund : BigInt = if (isEip1283Enabled (state)) {
595595 val originalValue = state.originalWorld.getStorage(state.ownAddress).load(offset)
596596 if (currentValue != newValue.toBigInt) {
597597 if (originalValue == currentValue) { // fresh slot
@@ -633,7 +633,7 @@ case object SSTORE extends OpCode(0x55, 2, 0, _.G_zero) {
633633 protected def varGas [W <: WorldStateProxy [W , S ], S <: Storage [S ]](state : ProgramState [W , S ]): BigInt = {
634634 val (Seq (offset, newValue), _) = state.stack.pop(2 )
635635 val currentValue = state.storage.load(offset)
636- if (isAfterConstantinopleFork (state)) {
636+ if (isEip1283Enabled (state)) {
637637 // https://eips.ethereum.org/EIPS/eip-1283
638638 if (currentValue == newValue.toBigInt) { // no-op
639639 state.config.feeSchedule.G_sload
@@ -659,8 +659,10 @@ case object SSTORE extends OpCode(0x55, 2, 0, _.G_zero) {
659659
660660 override protected def availableInContext [W <: WorldStateProxy [W , S ], S <: Storage [S ]]: ProgramState [W , S ] => Boolean = ! _.staticCtx
661661
662- private def isAfterConstantinopleFork [W <: WorldStateProxy [W , S ], S <: Storage [S ]](state : ProgramState [W , S ]): Boolean =
663- state.env.blockHeader.number >= state.config.blockchainConfig.constantinopleBlockNumber
662+ private def isEip1283Enabled [W <: WorldStateProxy [W , S ], S <: Storage [S ]](state : ProgramState [W , S ]): Boolean = {
663+ val blockNumber = state.env.blockHeader.number
664+ blockNumber >= state.config.blockchainConfig.constantinopleBlockNumber && blockNumber < state.config.blockchainConfig.petersburgBlockNumber
665+ }
664666}
665667
666668case object JUMP extends OpCode (0x56 , 1 , 0 , _.G_mid ) with ConstGas {
0 commit comments