github.com/dominant-strategies/go-quai@v0.28.2/params/protocol_params.go (about) 1 // Copyright 2015 The go-ethereum Authors 2 // This file is part of the go-ethereum library. 3 // 4 // The go-ethereum library is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU Lesser General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // The go-ethereum library is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU Lesser General Public License for more details. 13 // 14 // You should have received a copy of the GNU Lesser General Public License 15 // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. 16 17 package params 18 19 import ( 20 "math/big" 21 22 "github.com/dominant-strategies/go-quai/common" 23 ) 24 25 const ( 26 GasLimitBoundDivisor uint64 = 1024 // The bound divisor of the gas limit, used in update calculations. 27 PercentGasUsedThreshold uint64 = 50 // Percent Gas used threshold at which the gas limit adjusts 28 GasLimitStepOneBlockThreshold uint64 = 150000 29 GasLimitStepTwoBlockThreshold uint64 = 300000 30 GasLimitStepThreeBlockThreshold uint64 = 450000 31 MinGasLimit uint64 = 5000000 // Minimum the gas limit may ever be. 32 GenesisGasLimit uint64 = 5000000 // Gas limit of the Genesis block. 33 CarbonForkBlockNumber uint64 = 690000 34 CarbonForkSyncThreshold uint64 = 100 35 36 MaximumExtraDataSize uint64 = 32 // Maximum size extra data may be after Genesis. 37 ExpByteGas uint64 = 10 // Times ceil(log256(exponent)) for the EXP instruction. 38 CallValueTransferGas uint64 = 9000 // Paid for CALL when the value transfer is non-zero. 39 CallNewAccountGas uint64 = 25000 // Paid for CALL when the destination address didn't exist prior. 40 TxGas uint64 = 21000 // Per transaction not creating a contract. NOTE: Not payable on data of calls between transactions. 41 TxGasContractCreation uint64 = 53000 // Per transaction that creates a contract. NOTE: Not payable on data of calls between transactions. 42 TxDataZeroGas uint64 = 4 // Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions. 43 QuadCoeffDiv uint64 = 512 // Divisor for the quadratic particle of the memory cost equation. 44 LogDataGas uint64 = 8 // Per byte in a LOG* operation's data. 45 CallStipend uint64 = 2300 // Free gas given at beginning of call. 46 ETXGas uint64 = 21000 // Per ETX generated by opETX or normal cross-chain transfer. 47 ETXRegionMaxFraction int = common.NumRegionsInPrime * (common.NumZonesInRegion - 1) // The maximum fraction of transactions for cross-region ETXs 48 ETXPrimeMaxFraction int = common.NumRegionsInPrime * common.NumZonesInRegion // The maximum fraction of transactions for cross-prime ETXs 49 ETXRLimitMin int = 10 // Minimum possible cross-region ETX limit 50 ETXPLimitMin int = 10 // Minimum possible cross-prime ETX limit 51 EtxExpirationAge uint64 = 100 // Number of blocks an ETX may wait for inclusion at the destination 52 53 Sha3Gas uint64 = 30 // Once per SHA3 operation. 54 Sha3WordGas uint64 = 6 // Once per word of the SHA3 operation's data. 55 56 SstoreClearGas uint64 = 5000 // Once per SSTORE operation if the zeroness doesn't change. 57 SstoreRefundGas uint64 = 15000 // Once per SSTORE operation if the zeroness changes to zero. 58 59 NetSstoreNoopGas uint64 = 200 // Once per SSTORE operation if the value doesn't change. 60 NetSstoreInitGas uint64 = 20000 // Once per SSTORE operation from clean zero. 61 NetSstoreCleanGas uint64 = 5000 // Once per SSTORE operation from clean non-zero. 62 NetSstoreDirtyGas uint64 = 200 // Once per SSTORE operation from dirty. 63 64 NetSstoreClearRefund uint64 = 15000 // Once per SSTORE operation for clearing an originally existing storage slot 65 NetSstoreResetRefund uint64 = 4800 // Once per SSTORE operation for resetting to the original non-zero value 66 NetSstoreResetClearRefund uint64 = 19800 // Once per SSTORE operation for resetting to the original zero value 67 68 SstoreSentryGas uint64 = 2300 // Minimum gas required to be present for an SSTORE call, not consumed 69 SstoreSetGas uint64 = 20000 // Once per SSTORE operation from clean zero to non-zero 70 SstoreResetGas uint64 = 5000 // Once per SSTORE operation from clean non-zero to something else 71 72 ColdAccountAccessCost = uint64(2600) // COLD_ACCOUNT_ACCESS_COST 73 ColdSloadCost = uint64(2100) // COLD_SLOAD_COST 74 WarmStorageReadCost = uint64(100) // WARM_STORAGE_READ_COST 75 76 // SSTORE_CLEARS_SCHEDULE is defined as SSTORE_RESET_GAS + ACCESS_LIST_STORAGE_KEY_COST 77 // Which becomes: 5000 - 2100 + 1900 = 4800 78 SstoreClearsScheduleRefund uint64 = SstoreResetGas - ColdSloadCost + TxAccessListStorageKeyGas // Once per SSTORE operation for clearing an originally existing storage slot 79 80 JumpdestGas uint64 = 1 // Once per JUMPDEST operation. 81 EpochDuration uint64 = 30000 // Duration between proof-of-work epochs. 82 83 CreateDataGas uint64 = 200 // 84 CallCreateDepth uint64 = 1024 // Maximum depth of call/create stack. 85 ExpGas uint64 = 10 // Once per EXP instruction 86 LogGas uint64 = 375 // Per LOG* operation. 87 CopyGas uint64 = 3 // 88 StackLimit uint64 = 1024 // Maximum size of VM stack allowed. 89 TierStepGas uint64 = 0 // Once per operation, for a selection of them. 90 LogTopicGas uint64 = 375 // Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas. 91 CreateGas uint64 = 32000 // Once per CREATE operation & contract-creation transaction. 92 Create2Gas uint64 = 32000 // Once per CREATE2 operation 93 SelfdestructRefundGas uint64 = 24000 // Refunded following a selfdestruct operation. 94 MemoryGas uint64 = 3 // Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL. 95 96 TxDataNonZeroGas uint64 = 16 // Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions. 97 TxAccessListAddressGas uint64 = 2400 // Per address specified in access list 98 TxAccessListStorageKeyGas uint64 = 1900 // Per storage key specified in access list 99 100 // These have been changed during the course of the chain 101 CallGas uint64 = 700 // Static portion of gas for CALL-derivates 102 BalanceGas uint64 = 700 // The cost of a BALANCE operation 103 ExtcodeSizeGas uint64 = 700 // Cost of EXTCODESIZE 104 SloadGas uint64 = 800 105 ExtcodeHashGas uint64 = 700 // Cost of EXTCODEHASH 106 SelfdestructGas uint64 = 5000 // Cost of SELFDESTRUCT 107 108 // EXP has a dynamic portion depending on the size of the exponent 109 ExpByte uint64 = 50 // was raised to 50 110 111 // Extcodecopy has a dynamic AND a static cost. This represents only the 112 // static portion of the gas. 113 ExtcodeCopyBase uint64 = 700 114 115 // CreateBySelfdestructGas is used when the refunded account is one that does 116 // not exist. This logic is similar to call. 117 CreateBySelfdestructGas uint64 = 25000 118 119 BaseFeeChangeDenominator = 8 // Bounds the amount the base fee can change between blocks. 120 ElasticityMultiplier = 2 // Bounds the maximum gas limit a block may have. 121 InitialBaseFee = 1 * GWei // Initial base fee for blocks. 122 MaxBaseFee = 100 * GWei // Maximum base fee for blocks. 123 124 MaxCodeSize = 24576 // Maximum bytecode to permit for a contract 125 126 // Precompiled contract gas prices 127 128 EcrecoverGas uint64 = 3000 // Elliptic curve sender recovery gas price 129 Sha256BaseGas uint64 = 60 // Base price for a SHA256 operation 130 Sha256PerWordGas uint64 = 12 // Per-word price for a SHA256 operation 131 Ripemd160BaseGas uint64 = 600 // Base price for a RIPEMD160 operation 132 Ripemd160PerWordGas uint64 = 120 // Per-word price for a RIPEMD160 operation 133 IdentityBaseGas uint64 = 15 // Base price for a data copy operation 134 IdentityPerWordGas uint64 = 3 // Per-work price for a data copy operation 135 136 Bn256AddGas uint64 = 150 // Gas needed for an elliptic curve addition 137 Bn256ScalarMulGas uint64 = 6000 // Gas needed for an elliptic curve scalar multiplication 138 Bn256PairingBaseGas uint64 = 45000 // Base price for an elliptic curve pairing check 139 Bn256PairingPerPointGas uint64 = 34000 // Per-point price for an elliptic curve pairing check 140 141 // The Refund Quotient is the cap on how much of the used gas can be refunded 142 RefundQuotient uint64 = 5 143 144 MaxAddressGrindAttempts int = 1000 // Maximum number of attempts to grind an address to a valid one 145 ) 146 147 var ( 148 GasCeil uint64 = 20000000 149 ColosseumGasCeil uint64 = 70000000 150 GardenGasCeil uint64 = 160000000 151 OrchardGasCeil uint64 = 50000000 152 LighthouseGasCeil uint64 = 160000000 153 LocalGasCeil uint64 = 20000000 154 DifficultyBoundDivisor = big.NewInt(2048) // The bound divisor of the difficulty, used in the update calculations. 155 ZoneMinDifficulty = big.NewInt(1000) // The minimum difficulty in a zone. Prime & regions should be multiples of this value 156 MinimumDifficulty = ZoneMinDifficulty // The minimum that the difficulty may ever be. 157 GenesisDifficulty = ZoneMinDifficulty // Difficulty of the Genesis block. 158 DurationLimit = big.NewInt(12) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not. 159 GardenDurationLimit = big.NewInt(7) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not. 160 OrchardDurationLimit = big.NewInt(12) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not. 161 LighthouseDurationLimit = big.NewInt(7) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not. 162 LocalDurationLimit = big.NewInt(2) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not. 163 TimeFactor = big.NewInt(7) 164 PrimeEntropyTarget = big.NewInt(441) // This is TimeFactor*TimeFactor*common.NumZonesInRegion*common.NumRegionsInPrime 165 RegionEntropyTarget = big.NewInt(21) // This is TimeFactor*common.NumZonesInRegion 166 DifficultyAdjustmentPeriod = big.NewInt(360) // This is the number of blocks over which the average has to be taken 167 DifficultyAdjustmentFactor int64 = 40 // This is the factor that divides the log of the change in the difficulty 168 )