github.com/core-coin/go-core/v2@v2.1.9/params/protocol_params.go (about) 1 // Copyright 2015 by the Authors 2 // This file is part of the go-core library. 3 // 4 // The go-core 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-core 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-core library. If not, see <http://www.gnu.org/licenses/>. 16 17 package params 18 19 import "math/big" 20 21 const ( 22 EnergyLimitBoundDivisor uint64 = 1024 // The bound divisor of the energy limit, used in update calculations. 23 MinEnergyLimit uint64 = 5000 // Minimum the energy limit may ever be. 24 GenesisEnergyLimit uint64 = 4712388 // Energy limit of the Genesis block. 25 26 MaximumExtraDataSize uint64 = 32 // Maximum size extra data may be after Genesis. 27 CallValueTransferEnergy uint64 = 9000 // Paid for CALL when the value transfer is non-zero. 28 CallNewAccountEnergy uint64 = 25000 // Paid for CALL when the destination address didn't exist prior. 29 TxEnergy uint64 = 21000 // Per transaction not creating a contract. NOTE: Not payable on data of calls between transactions. 30 TxEnergyContractCreation uint64 = 53000 // Per transaction that creates a contract. NOTE: Not payable on data of calls between transactions. 31 TxDataZeroEnergy uint64 = 4 // Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions. 32 QuadCoeffDiv uint64 = 512 // Divisor for the quadratic particle of the memory cost equation. 33 LogDataEnergy uint64 = 8 // Per byte in a LOG* operation's data. 34 CallStipend uint64 = 2300 // Free energy given at beginning of call. 35 36 Sha3Energy uint64 = 30 // Once per SHA3 operation. 37 Sha3WordEnergy uint64 = 6 // Once per word of the SHA3 operation's data. 38 39 SstoreSentryEnergy uint64 = 2300 // Minimum energy required to be present for an SSTORE call, not consumed 40 SstoreNoopEnergy uint64 = 800 // Once per SSTORE operation if the value doesn't change. 41 SstoreDirtyEnergy uint64 = 800 // Once per SSTORE operation if a dirty value is changed. 42 SstoreInitEnergy uint64 = 20000 // Once per SSTORE operation from clean zero to non-zero 43 SstoreInitRefund uint64 = 19200 // Once per SSTORE operation for resetting to the original zero value 44 SstoreCleanEnergy uint64 = 5000 // Once per SSTORE operation from clean non-zero to something else 45 SstoreCleanRefund uint64 = 4200 // Once per SSTORE operation for resetting to the original non-zero value 46 SstoreClearRefund uint64 = 15000 // Once per SSTORE operation for clearing an originally existing storage slot 47 48 JumpdestEnergy uint64 = 1 // Once per JUMPDEST operation. 49 50 CreateDataEnergy uint64 = 200 // 51 CallCreateDepth uint64 = 1024 // Maximum depth of call/create stack. 52 ExpEnergy uint64 = 10 // Once per EXP instruction 53 LogEnergy uint64 = 375 // Per LOG* operation. 54 CopyEnergy uint64 = 3 // 55 StackLimit uint64 = 1024 // Maximum size of VM stack allowed. 56 LogTopicEnergy uint64 = 375 // Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicEnergy, LOG4 incurs 4 * c_txLogTopicEnergy. 57 CreateEnergy uint64 = 32000 // Once per CREATE operation & contract-creation transaction. 58 Create2Energy uint64 = 32000 // Once per CREATE2 operation 59 SelfdestructRefundEnergy uint64 = 24000 // Refunded following a selfdestruct operation. 60 MemoryEnergy 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. 61 TxDataNonZeroEnergy uint64 = 16 // Per byte of non zero data attached to a transaction 62 63 // These have been changed during the course of the chain 64 CallEnergy uint64 = 700 // Static portion of energy for CALL-derivates 65 BalanceEnergy uint64 = 700 // The cost of a BALANCE operation 66 ExtcodeSizeEnergy uint64 = 700 // Cost of EXTCODESIZE 67 SloadEnergy uint64 = 800 // Cost of SLOAD 68 ExtcodeHashEnergy uint64 = 700 // Cost of EXTCODEHASH 69 SelfdestructEnergy uint64 = 5000 // Cost of SELFDESTRUCT 70 71 // EXP has a dynamic portion depending on the size of the exponent 72 ExpByte uint64 = 50 // was raised to 50 73 74 // Extcodecopy has a dynamic AND a static cost. This represents only the 75 // static portion of the energy. 76 ExtcodeCopyBase uint64 = 700 77 78 // CreateBySelfdestructEnergy is used when the refunded account is one that does 79 // not exist. This logic is similar to call. 80 CreateBySelfdestructEnergy uint64 = 25000 81 82 MaxCodeSize = 50000 // Maximum bytecode to permit for a contract 83 84 // Precompiled contract energy prices 85 86 EcrecoverEnergy uint64 = 3000 // Elliptic curve sender recovery energy price 87 Sha256BaseEnergy uint64 = 60 // Base price for a SHA256 operation 88 Sha256PerWordEnergy uint64 = 12 // Per-word price for a SHA256 operation 89 Ripemd160BaseEnergy uint64 = 600 // Base price for a RIPEMD160 operation 90 Ripemd160PerWordEnergy uint64 = 120 // Per-word price for a RIPEMD160 operation 91 IdentityBaseEnergy uint64 = 15 // Base price for a data copy operation 92 IdentityPerWordEnergy uint64 = 3 // Per-work price for a data copy operation 93 ModExpQuadCoeffDiv uint64 = 20 // Divisor for the quadratic particle of the big int modular exponentiation 94 95 Bn256AddEnergy uint64 = 150 // Energy needed for an elliptic curve addition 96 Bn256ScalarMulEnergy uint64 = 6000 // Energy needed for an elliptic curve scalar multiplication 97 Bn256PairingBaseEnergy uint64 = 45000 // Base price for an elliptic curve pairing check 98 Bn256PairingPerPointEnergy uint64 = 34000 // Per-point price for an elliptic curve pairing check 99 ) 100 101 var ( 102 DifficultyBoundDivisor = big.NewInt(2048) // The bound divisor of the difficulty, used in the update calculations. 103 GenesisDifficulty = big.NewInt(8192) // Difficulty of the Genesis block. 104 MinimumDifficulty = big.NewInt(8192) // The minimum that the difficulty may ever be. 105 DurationLimit = big.NewInt(6) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not. 106 )