Skip to content

Commit 95d4681

Browse files
authored
Merge pull request #47 from bas-vk/quorum-gaslimit
params: raise gas limit parameter values
2 parents 7614a70 + b7ebb71 commit 95d4681

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

core/block_validator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ func calcDifficultyFrontier(time, parentTime uint64, parentNumber, parentDiff *b
460460
// The result may be modified by the caller.
461461
// This is miner strategy, not consensus protocol.
462462
func CalcGasLimit(parent *types.Block) *big.Int {
463-
// contrib = (parentGasUsed * 3 / 2) / 1024
463+
// contrib = (parentGasUsed * 3 / 2) / 4096
464464
contrib := new(big.Int).Mul(parent.GasUsed(), big.NewInt(3))
465465
contrib = contrib.Div(contrib, big.NewInt(2))
466466
contrib = contrib.Div(contrib, params.GasLimitBoundDivisor)

core/genesis.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ func TestNetGenesisBlock() string {
232232
"timestamp": "0x00",
233233
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
234234
"extraData": "0x",
235-
"gasLimit": "0x2FEFD8",
235+
"gasLimit": "0x2FAF0800",
236236
"alloc": {
237237
"0000000000000000000000000000000000000001": { "balance": "1" },
238238
"0000000000000000000000000000000000000002": { "balance": "1" },

params/protocol_params.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ var (
4040
EcrecoverGas = big.NewInt(3000) //
4141
Sha256WordGas = big.NewInt(12) //
4242

43-
MinGasLimit = big.NewInt(5000) // Minimum the gas limit may ever be.
44-
GenesisGasLimit = big.NewInt(4712388) // Gas limit of the Genesis block.
43+
MinGasLimit = big.NewInt(700000000) // Minimum the gas limit may ever be.
44+
GenesisGasLimit = big.NewInt(800000000) // Gas limit of the Genesis block.
4545
TargetGasLimit = new(big.Int).Set(GenesisGasLimit) // The artificial target
4646

4747
Sha3Gas = big.NewInt(30) // Once per SHA3 operation.
@@ -53,7 +53,7 @@ var (
5353
SstoreRefundGas = big.NewInt(15000) // Once per SSTORE operation if the zeroness changes to zero.
5454
JumpdestGas = big.NewInt(1) // Refunded gas, once per SSTORE operation if the zeroness changes to zero.
5555
IdentityGas = big.NewInt(15) //
56-
GasLimitBoundDivisor = big.NewInt(1024) // The bound divisor of the gas limit, used in update calculations.
56+
GasLimitBoundDivisor = big.NewInt(4096) // The bound divisor of the gas limit, used in update calculations.
5757
EpochDuration = big.NewInt(30000) // Duration between proof-of-work epochs.
5858
CallGas = big.NewInt(40) // Once per CALL operation & message call transaction.
5959
CreateDataGas = big.NewInt(200) //
@@ -71,5 +71,4 @@ var (
7171
SuicideRefundGas = big.NewInt(24000) // Refunded following a suicide operation.
7272
MemoryGas = big.NewInt(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.
7373
TxDataNonZeroGas = big.NewInt(68) // Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions.
74-
7574
)

tests/init.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"net/http"
2626
"os"
2727
"path/filepath"
28+
"github.com/ethereum/go-ethereum/params"
2829
)
2930

3031
var (
@@ -62,6 +63,15 @@ var (
6263
VmSkipTests = []string{}
6364
)
6465

66+
func init() {
67+
// Quorum uses different gas limit parameter values as Ethereum.
68+
// By overwriting these custom parameters to Ethereum values it's
69+
// possible to use the test data from Ethereum.
70+
params.MinGasLimit.SetString("5000", 10)
71+
params.TargetGasLimit.SetString("4712388", 10)
72+
params.GasLimitBoundDivisor.SetString("1024", 10)
73+
}
74+
6575
func readJson(reader io.Reader, value interface{}) error {
6676
data, err := ioutil.ReadAll(reader)
6777
if err != nil {

0 commit comments

Comments
 (0)