From 38f54c3c30d369b385a48a5a87a436ffcf98f45f Mon Sep 17 00:00:00 2001 From: Hussam Date: Fri, 22 Nov 2024 17:09:58 -0600 Subject: [PATCH] Remove references to GoldenAgeForkV2 --- consensus/misc/statefee.go | 4 +-- core/block_validator.go | 21 ++++------- core/state_processor.go | 73 ++++++++++++-------------------------- core/types/utxo.go | 12 +++---- core/worker.go | 57 ++++++++--------------------- p2p/node/p2p_services.go | 5 +-- params/protocol_params.go | 6 ---- 7 files changed, 53 insertions(+), 125 deletions(-) diff --git a/consensus/misc/statefee.go b/consensus/misc/statefee.go index fb44fc7bd..83c429f30 100644 --- a/consensus/misc/statefee.go +++ b/consensus/misc/statefee.go @@ -15,7 +15,7 @@ func CalcStateLimit(parent *types.WorkObject, stateCeil uint64) uint64 { // If parent gas is zero and we have passed the 5 day threshold, we can set the first block gas limit to min gas limit if parent.StateLimit() == 0 { - return params.MinGasLimit(parent.NumberU64(common.ZONE_CTX)) + return params.MinGasLimit(parent.NumberU64(common.PRIME_CTX)) } parentStateLimit := parent.StateLimit() @@ -33,7 +33,7 @@ func CalcStateLimit(parent *types.WorkObject, stateCeil uint64) uint64 { return limit + delta } } else { - desiredLimit = params.MinGasLimit(parent.NumberU64(common.ZONE_CTX)) + desiredLimit = params.MinGasLimit(parent.NumberU64(common.PRIME_CTX)) if limit-delta/2 < desiredLimit { return desiredLimit } else { diff --git a/core/block_validator.go b/core/block_validator.go index e344bedec..14eb8772b 100644 --- a/core/block_validator.go +++ b/core/block_validator.go @@ -157,10 +157,8 @@ func (v *BlockValidator) SanityCheckWorkObjectBlockViewBody(wo *types.WorkObject } } } else { - // If the fork has been triggered and within some grace period the nodes - // have not upgraded we reject the block validation - if wo.GasLimit() < params.MinGasLimit(wo.NumberU64(common.ZONE_CTX)) { - return fmt.Errorf("zone gas limit is less than the new fork gas limit") + if wo.GasLimit() < params.MinGasLimit(wo.NumberU64(common.PRIME_CTX)) { + return fmt.Errorf("zone gas limit is less than the required gas limit") } if len(wo.Manifest()) != 0 { return fmt.Errorf("zone body has non zero manifests") @@ -283,12 +281,8 @@ func (v *BlockValidator) SanityCheckWorkObjectHeaderViewBody(wo *types.WorkObjec } } } else { - // If the fork has been triggered and within some grace period the nodes - // have not upgraded we reject the block validation - if wo.NumberU64(common.ZONE_CTX) > params.GoldenAgeForkNumberV2+params.GoldenAgeForkGraceNumber { - if wo.GasLimit() < params.MinGasLimit(params.GoldenAgeForkNumberV2) { - return fmt.Errorf("zone gas limit is less than the new fork gas limit") - } + if wo.GasLimit() < params.MinGasLimit(wo.NumberU64(common.PRIME_CTX)) { + return fmt.Errorf("zone gas limit is less than the required gas limit") } // Transactions, SubManifestHash, InterlinkHashes should be nil in the workshare in Zone context if len(wo.Transactions()) != 0 { @@ -419,16 +413,13 @@ func CalcGasLimit(parent *types.WorkObject, gasCeil uint64) uint64 { // If parent gas is zero and we have passed the 5 day threshold, we can set the first block gas limit to min gas limit if parent.GasLimit() == 0 { - return params.MinGasLimit(parent.NumberU64(common.ZONE_CTX)) + return params.MinGasLimit(parent.NumberU64(common.PRIME_CTX)) } parentGasLimit := parent.GasLimit() delta := parentGasLimit/params.GasLimitBoundDivisor - 1 limit := parentGasLimit - if parent.NumberU64(common.ZONE_CTX) == params.GoldenAgeForkNumberV2 { - limit = params.MinGasLimit(parent.NumberU64(common.ZONE_CTX)) - } var desiredLimit uint64 percentGasUsed := parent.GasUsed() * 100 / parent.GasLimit() @@ -440,7 +431,7 @@ func CalcGasLimit(parent *types.WorkObject, gasCeil uint64) uint64 { return limit + delta } } else { - desiredLimit = params.MinGasLimit(parent.NumberU64(common.ZONE_CTX)) + desiredLimit = params.MinGasLimit(parent.NumberU64(common.PRIME_CTX)) if limit-delta/2 < desiredLimit { return desiredLimit } else { diff --git a/core/state_processor.go b/core/state_processor.go index fbb57117f..fb036d529 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -1030,7 +1030,7 @@ func ValidateQiTxInputs(tx *types.Transaction, chain ChainContext, db ethdb.Read types.MaxDenomination) return nil, errors.New(str) } - if currentHeader.NumberU64(common.ZONE_CTX) >= params.GoldenAgeForkNumberV2 && txOut.Lock != nil && txOut.Lock.Sign() != 0 { + if txOut.Lock != nil && txOut.Lock.Sign() != 0 { return nil, errors.New("QiTx output has non-zero lock") } outputs[uint(txOut.Denomination)]++ @@ -1074,7 +1074,7 @@ func ValidateQiTxOutputsAndSignature(tx *types.Transaction, chain ChainContext, if txOutIdx > types.MaxOutputIndex { return nil, fmt.Errorf("tx [%v] exceeds max output index of %d", tx.Hash().Hex(), types.MaxOutputIndex) } - if currentHeader.NumberU64(common.ZONE_CTX) >= params.GoldenAgeForkNumberV2 && txOut.Lock != nil && txOut.Lock.Sign() != 0 { + if txOut.Lock != nil && txOut.Lock.Sign() != 0 { return nil, errors.New("QiTx output has non-zero lock") } if txOut.Denomination > types.MaxDenomination { @@ -1096,7 +1096,7 @@ func ValidateQiTxOutputsAndSignature(tx *types.Transaction, chain ChainContext, if toAddr.Location().Equal(location) && toAddr.IsInQuaiLedgerScope() { // Qi->Quai conversion conversion = true - if currentHeader.NumberU64(common.ZONE_CTX) < params.GoldenAgeForkNumberV2 && txOut.Denomination < params.MinQiConversionDenomination { + if txOut.Denomination < params.MinQiConversionDenomination { return nil, fmt.Errorf("tx %v emits UTXO with value %d less than minimum denomination %d", tx.Hash().Hex(), txOut.Denomination, params.MinQiConversionDenomination) } totalConvertQitOut.Add(totalConvertQitOut, types.Denominations[txOut.Denomination]) // Add to total conversion output for aggregation @@ -1161,18 +1161,16 @@ func ValidateQiTxOutputsAndSignature(tx *types.Transaction, chain ChainContext, return nil, fmt.Errorf("tx %032x has insufficient fee for base fee, have %d want %d", tx.Hash(), txFeeInQuai.Uint64(), minimumFeeInQuai.Uint64()) } if conversion { - if currentHeader.NumberU64(common.ZONE_CTX) >= params.GoldenAgeForkNumberV2 && totalConvertQitOut.Cmp(types.Denominations[params.MinQiConversionDenomination]) < 0 { + if totalConvertQitOut.Cmp(types.Denominations[params.MinQiConversionDenomination]) < 0 { return nil, fmt.Errorf("tx %032x emits convert UTXO with value %d less than minimum conversion denomination", tx.Hash(), totalConvertQitOut.Uint64()) } - if currentHeader.NumberU64(common.ZONE_CTX) >= params.GoldenAgeForkNumberV2 { - // Since this transaction contains a conversion, check if the required conversion gas is paid - // The user must pay this to the miner now, but it is only added to the block gas limit when the ETX is played in the destination - requiredGas += params.QiToQuaiConversionGas - minimumFeeInQuai = new(big.Int).Mul(new(big.Int).SetUint64(requiredGas), currentHeader.BaseFee()) - if txFeeInQuai.Cmp(minimumFeeInQuai) < 0 { - return nil, fmt.Errorf("tx %032x has insufficient fee for base fee * gas, have %d want %d", tx.Hash(), txFeeInQit.Uint64(), minimumFeeInQuai.Uint64()) - } + // Since this transaction contains a conversion, check if the required conversion gas is paid + // The user must pay this to the miner now, but it is only added to the block gas limit when the ETX is played in the destination + requiredGas += params.QiToQuaiConversionGas + minimumFeeInQuai = new(big.Int).Mul(new(big.Int).SetUint64(requiredGas), currentHeader.BaseFee()) + if txFeeInQuai.Cmp(minimumFeeInQuai) < 0 { + return nil, fmt.Errorf("tx %032x has insufficient fee for base fee * gas, have %d want %d", tx.Hash(), txFeeInQit.Uint64(), minimumFeeInQuai.Uint64()) } ETXPCount++ if ETXPCount > etxPLimit { @@ -1180,9 +1178,6 @@ func ValidateQiTxOutputsAndSignature(tx *types.Transaction, chain ChainContext, } usedGas += params.ETXGas - if currentHeader.NumberU64(common.ZONE_CTX) < params.GoldenAgeForkNumberV2 { - txFeeInQit.Sub(txFeeInQit, txFeeInQit) // Fee goes entirely to gas to pay for conversion - } } if usedGas > currentHeader.GasLimit() { @@ -1330,9 +1325,6 @@ func ProcessQiTx(tx *types.Transaction, chain ChainContext, checkSig bool, isFir if toAddr.Location().Equal(location) && toAddr.IsInQuaiLedgerScope() { // Qi->Quai conversion conversion = true convertAddress = toAddr - if currentHeader.NumberU64(common.ZONE_CTX) < params.GoldenAgeForkNumberV2 && txOut.Denomination < params.MinQiConversionDenomination { - return nil, nil, nil, fmt.Errorf("tx %v emits UTXO with value %d less than minimum denomination %d", tx.Hash().Hex(), txOut.Denomination, params.MinQiConversionDenomination), nil - } totalConvertQitOut.Add(totalConvertQitOut, types.Denominations[txOut.Denomination]) // Add to total conversion output for aggregation outputs[uint(txOut.Denomination)] -= 1 // This output no longer exists because it has been aggregated delete(addresses, toAddr.Bytes20()) @@ -1412,46 +1404,27 @@ func ProcessQiTx(tx *types.Transaction, chain ChainContext, checkSig bool, isFir return nil, nil, nil, fmt.Errorf("tx %032x has insufficient fee for base fee, have %d want %d", tx.Hash(), txFeeInQuai.Uint64(), minimumFeeInQuai.Uint64()), nil } if conversion { - if currentHeader.NumberU64(common.ZONE_CTX) >= params.GoldenAgeForkNumberV2 && totalConvertQitOut.Cmp(types.Denominations[params.MinQiConversionDenomination]) < 0 { + if totalConvertQitOut.Cmp(types.Denominations[params.MinQiConversionDenomination]) < 0 { return nil, nil, nil, fmt.Errorf("tx %032x emits convert UTXO with value %d less than minimum conversion denomination", tx.Hash(), totalConvertQitOut.Uint64()), nil } - var etxInner types.ExternalTx - if currentHeader.NumberU64(common.ZONE_CTX) < params.GoldenAgeForkNumberV2 { - // Since this transaction contains a conversion, the rest of the tx gas is given to conversion - remainingTxFeeInQuai := misc.QiToQuai(parent, txFeeInQit) - // Fee is basefee * gas, so gas remaining is fee remaining / basefee - remainingGas := new(big.Int).Div(remainingTxFeeInQuai, currentHeader.BaseFee()) - if remainingGas.Uint64() > (currentHeader.GasLimit() / params.MinimumEtxGasDivisor) { - // Limit ETX gas to max ETX gas limit (the rest is burned) - remainingGas = new(big.Int).SetUint64(currentHeader.GasLimit() / params.MinimumEtxGasDivisor) - } - ETXPCount++ - if ETXPCount > *etxPLimit { - return nil, nil, nil, fmt.Errorf("tx [%v] emits too many cross-prime ETXs for block. emitted: %d, limit: %d", tx.Hash().Hex(), ETXPCount, etxPLimit), nil - } - etxInner = types.ExternalTx{Value: totalConvertQitOut, To: &convertAddress, Sender: common.ZeroAddress(location), EtxType: types.ConversionType, OriginatingTxHash: tx.Hash(), Gas: remainingGas.Uint64()} // Value is in Qits not Denomination - } else { - // Since this transaction contains a conversion, check if the required conversion gas is paid - // The user must pay this to the miner now, but it is only added to the block gas limit when the ETX is played in the destination - requiredGas += params.QiToQuaiConversionGas - minimumFeeInQuai = new(big.Int).Mul(new(big.Int).SetUint64(requiredGas), currentHeader.BaseFee()) - if txFeeInQuai.Cmp(minimumFeeInQuai) < 0 { - return nil, nil, nil, fmt.Errorf("tx %032x has insufficient fee for base fee * gas: %d, have %d want %d", tx.Hash(), requiredGas, txFeeInQit.Uint64(), minimumFeeInQuai.Uint64()), nil - } - ETXPCount++ - if ETXPCount > *etxPLimit { - return nil, nil, nil, fmt.Errorf("tx [%v] emits too many cross-prime ETXs for block. emitted: %d, limit: %d", tx.Hash().Hex(), ETXPCount, etxPLimit), nil - } - etxInner = types.ExternalTx{Value: totalConvertQitOut, To: &convertAddress, Sender: common.ZeroAddress(location), EtxType: types.ConversionType, OriginatingTxHash: tx.Hash(), Gas: 0} // Value is in Qits not Denomination + + // Since this transaction contains a conversion, check if the required conversion gas is paid + // The user must pay this to the miner now, but it is only added to the block gas limit when the ETX is played in the destination + requiredGas += params.QiToQuaiConversionGas + minimumFeeInQuai = new(big.Int).Mul(new(big.Int).SetUint64(requiredGas), currentHeader.BaseFee()) + if txFeeInQuai.Cmp(minimumFeeInQuai) < 0 { + return nil, nil, nil, fmt.Errorf("tx %032x has insufficient fee for base fee * gas: %d, have %d want %d", tx.Hash(), requiredGas, txFeeInQit.Uint64(), minimumFeeInQuai.Uint64()), nil + } + ETXPCount++ + if ETXPCount > *etxPLimit { + return nil, nil, nil, fmt.Errorf("tx [%v] emits too many cross-prime ETXs for block. emitted: %d, limit: %d", tx.Hash().Hex(), ETXPCount, etxPLimit), nil } + etxInner := types.ExternalTx{Value: totalConvertQitOut, To: &convertAddress, Sender: common.ZeroAddress(location), EtxType: types.ConversionType, OriginatingTxHash: tx.Hash(), Gas: 0} // Value is in Qits not Denomination *usedGas += params.ETXGas if err := gp.SubGas(params.ETXGas); err != nil { return nil, nil, nil, err, nil } etxs = append(etxs, &etxInner) - if currentHeader.NumberU64(common.ZONE_CTX) < params.GoldenAgeForkNumberV2 { - txFeeInQit.Sub(txFeeInQit, txFeeInQit) // Fee goes entirely to gas to pay for conversion - } } elapsedTime = time.Since(stepStart) stepTimings["Fee Verification"] = elapsedTime diff --git a/core/types/utxo.go b/core/types/utxo.go index 2ead36f23..3ecd0bca7 100644 --- a/core/types/utxo.go +++ b/core/types/utxo.go @@ -47,12 +47,12 @@ func init() { Denominations[14] = big.NewInt(1000000000) // 1000000 Qi TrimDepths = make(map[uint8]uint64) - TrimDepths[0] = params.GoldenAgeForkNumberV2 + 720 // 2 hours after fork starts from block 1 - TrimDepths[1] = params.GoldenAgeForkNumberV2 + 720 // 2 hours - TrimDepths[2] = params.GoldenAgeForkNumberV2 + 1080 // 3 hours - TrimDepths[3] = params.GoldenAgeForkNumberV2 + 1080 // 3 hours - TrimDepths[4] = params.GoldenAgeForkNumberV2 + 2160 // 6 hours - TrimDepths[5] = params.GoldenAgeForkNumberV2 + 4320 // 12 hours + TrimDepths[0] = 720 // 2 hours after fork starts from block 1 + TrimDepths[1] = 720 // 2 hours + TrimDepths[2] = 1080 // 3 hours + TrimDepths[3] = 1080 // 3 hours + TrimDepths[4] = 2160 // 6 hours + TrimDepths[5] = 4320 // 12 hours } type TxIns []TxIn diff --git a/core/worker.go b/core/worker.go index a6ab2ea7a..c99af8a0a 100644 --- a/core/worker.go +++ b/core/worker.go @@ -247,7 +247,7 @@ func newWorker(config *Config, chainConfig *params.ChainConfig, db ethdb.Databas uncles, _ := lru.New[common.Hash, types.WorkObjectHeader](c_uncleCacheSize) worker.uncles = uncles // Set the GasFloor of the worker to the minGasLimit - worker.config.GasFloor = params.MinGasLimit(headerchain.CurrentHeader().NumberU64(common.ZONE_CTX)) + worker.config.GasFloor = params.MinGasLimit(headerchain.CurrentHeader().NumberU64(common.PRIME_CTX)) phBodyCache, _ := lru.New[common.Hash, types.WorkObject](pendingBlockBodyLimit) worker.pendingBlockBody = phBodyCache @@ -2074,7 +2074,7 @@ func (w *worker) processQiTx(tx *types.Transaction, env *environment, primeTermi types.MaxDenomination) return errors.New(str) } - if env.wo.NumberU64(common.ZONE_CTX) >= params.GoldenAgeForkNumberV2 && txOut.Lock != nil && txOut.Lock.Sign() != 0 { + if txOut.Lock != nil && txOut.Lock.Sign() != 0 { return errors.New("QiTx output has non-zero lock") } outputs[uint(txOut.Denomination)] += 1 @@ -2091,9 +2091,6 @@ func (w *worker) processQiTx(tx *types.Transaction, env *environment, primeTermi } conversion = true convertAddress = toAddr - if txOut.Denomination < params.MinQiConversionDenomination && env.wo.NumberU64(common.ZONE_CTX) < params.GoldenAgeForkNumberV2 { - return fmt.Errorf("tx %032x emits convert UTXO with value %d less than minimum conversion denomination", tx.Hash(), txOut.Denomination) - } totalConvertQitOut.Add(totalConvertQitOut, types.Denominations[txOut.Denomination]) // Add to total conversion output for aggregation outputs[uint(txOut.Denomination)] -= 1 // This output no longer exists because it has been aggregated delete(addresses, toAddr.Bytes20()) @@ -2170,51 +2167,27 @@ func (w *worker) processQiTx(tx *types.Transaction, env *environment, primeTermi return fmt.Errorf("tx %032x has insufficient fee for base fee * gas, have %d want %d", tx.Hash(), txFeeInQit.Uint64(), minimumFeeInQuai.Uint64()) } if conversion { - if env.wo.NumberU64(common.ZONE_CTX) >= params.GoldenAgeForkNumberV2 && totalConvertQitOut.Cmp(types.Denominations[params.MinQiConversionDenomination]) < 0 { + if totalConvertQitOut.Cmp(types.Denominations[params.MinQiConversionDenomination]) < 0 { return fmt.Errorf("tx %032x emits convert UTXO with value %d less than minimum conversion denomination", tx.Hash(), totalConvertQitOut.Uint64()) } - var etxInner types.ExternalTx - if env.wo.NumberU64(common.ZONE_CTX) < params.GoldenAgeForkNumberV2 { - // Since this transaction contains a conversion, the rest of the tx gas is given to conversion - remainingTxFeeInQuai := misc.QiToQuai(parent, txFeeInQit) - // Fee is basefee * gas, so gas remaining is fee remaining / basefee - remainingGas := new(big.Int).Div(remainingTxFeeInQuai, env.wo.BaseFee()) - if remainingGas.Uint64() > (env.wo.GasLimit() / params.MinimumEtxGasDivisor) { - // Limit ETX gas to max ETX gas limit (the rest is burned) - remainingGas = new(big.Int).SetUint64(env.wo.GasLimit() / params.MinimumEtxGasDivisor) - } - if remainingGas.Uint64() < params.TxGas { - // Minimum gas for ETX is TxGas - return fmt.Errorf("tx %032x has insufficient remaining gas for conversion ETX, have %d want %d", tx.Hash(), remainingGas.Uint64(), params.TxGas) - } - ETXPCount++ // conversion is technically a cross-prime ETX - if ETXPCount > env.etxPLimit { - return fmt.Errorf("tx [%v] emits too many cross-prime ETXs for block. emitted: %d, limit: %d", tx.Hash().Hex(), ETXPCount, env.etxPLimit) - } - etxInner = types.ExternalTx{Value: totalConvertQitOut, To: &convertAddress, Sender: common.ZeroAddress(location), EtxType: types.ConversionType, OriginatingTxHash: tx.Hash(), Gas: remainingGas.Uint64()} // Value is in Qits not Denomination - } else { - // Since this transaction contains a conversion, check if the required conversion gas is paid - // The user must pay this to the miner now, but it is only added to the block gas limit when the ETX is played in the destination - requiredGas += params.QiToQuaiConversionGas - minimumFeeInQuai = new(big.Int).Mul(new(big.Int).SetUint64(requiredGas), env.wo.BaseFee()) - if txFeeInQuai.Cmp(minimumFeeInQuai) < 0 { - return fmt.Errorf("tx %032x has insufficient fee for base fee * gas, have %d want %d", tx.Hash(), txFeeInQit.Uint64(), minimumFeeInQuai.Uint64()) - } - ETXPCount++ // conversion is technically a cross-prime ETX - if ETXPCount > env.etxPLimit { - return fmt.Errorf("tx [%v] emits too many cross-prime ETXs for block. emitted: %d, limit: %d", tx.Hash().Hex(), ETXPCount, env.etxPLimit) - } - // Value is in Qits not Denomination - etxInner = types.ExternalTx{Value: totalConvertQitOut, To: &convertAddress, Sender: common.ZeroAddress(location), EtxType: types.ConversionType, OriginatingTxHash: tx.Hash(), Gas: 0} // Conversion gas is paid from the converted Quai balance (for new account creation, when redeemed) + // Since this transaction contains a conversion, check if the required conversion gas is paid + // The user must pay this to the miner now, but it is only added to the block gas limit when the ETX is played in the destination + requiredGas += params.QiToQuaiConversionGas + minimumFeeInQuai = new(big.Int).Mul(new(big.Int).SetUint64(requiredGas), env.wo.BaseFee()) + if txFeeInQuai.Cmp(minimumFeeInQuai) < 0 { + return fmt.Errorf("tx %032x has insufficient fee for base fee * gas, have %d want %d", tx.Hash(), txFeeInQit.Uint64(), minimumFeeInQuai.Uint64()) + } + ETXPCount++ // conversion is technically a cross-prime ETX + if ETXPCount > env.etxPLimit { + return fmt.Errorf("tx [%v] emits too many cross-prime ETXs for block. emitted: %d, limit: %d", tx.Hash().Hex(), ETXPCount, env.etxPLimit) } + // Value is in Qits not Denomination + etxInner := types.ExternalTx{Value: totalConvertQitOut, To: &convertAddress, Sender: common.ZeroAddress(location), EtxType: types.ConversionType, OriginatingTxHash: tx.Hash(), Gas: 0} // Conversion gas is paid from the converted Quai balance (for new account creation, when redeemed) gasUsed += params.ETXGas if err := env.gasPool.SubGas(params.ETXGas); err != nil { return err } etxs = append(etxs, &etxInner) - if env.wo.NumberU64(common.ZONE_CTX) < params.GoldenAgeForkNumberV2 { - txFeeInQit.Sub(txFeeInQit, txFeeInQit) // Fee goes entirely to gas to pay for conversion - } } if gasUsed > env.wo.GasLimit() { return fmt.Errorf("tx %032x uses too much gas, have used %d out of %d", tx.Hash(), gasUsed, env.wo.GasLimit()) diff --git a/p2p/node/p2p_services.go b/p2p/node/p2p_services.go index 84f6053e2..13e26f0fb 100644 --- a/p2p/node/p2p_services.go +++ b/p2p/node/p2p_services.go @@ -127,10 +127,7 @@ func (p *P2PNode) requestFromPeer(peerID peer.ID, topic *pubsubManager.Topic, re } case []*types.WorkObjectBlockView: for _, block := range recvdType.([]*types.WorkObjectBlockView) { - // If a block is received which has a number greater than - // the goldenage fork number and does not have the updated - // gas limit, reject the response - if block != nil && block.NumberU64(common.ZONE_CTX) >= params.GoldenAgeForkNumberV2 && block.GasLimit() < params.MinGasLimit(params.GoldenAgeForkNumberV2) { + if block != nil && block.GasLimit() < params.MinGasLimit(block.NumberU64(common.PRIME_CTX)) { p.AdjustPeerQuality(peerID, topic.String(), p2p.QualityAdjOnBadResponse) return nil, errors.New("invalid response") } diff --git a/params/protocol_params.go b/params/protocol_params.go index b923c0bb9..eb86c9c61 100644 --- a/params/protocol_params.go +++ b/params/protocol_params.go @@ -193,12 +193,6 @@ var ( BaseFeeMultiplier = big.NewInt(50) ) -const ( - GoldenAgeForkNumberV2 = 588000 - GoldenAgeForkGraceNumber = 100 - GoldenAgeGracePaymentPeriod = 6000 -) - func init() { LockupByteToBlockDepth[0] = OldConversionLockPeriod LockupByteToBlockDepth[1] = 30240 // 1.75 days