Skip to content

Commit

Permalink
Merge pull request ethereum#47 from bas-vk/quorum-gaslimit
Browse files Browse the repository at this point in the history
params: raise gas limit parameter values
  • Loading branch information
jpmsam authored Feb 8, 2017
2 parents 7614a70 + b7ebb71 commit 95d4681
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ func calcDifficultyFrontier(time, parentTime uint64, parentNumber, parentDiff *b
// The result may be modified by the caller.
// This is miner strategy, not consensus protocol.
func CalcGasLimit(parent *types.Block) *big.Int {
// contrib = (parentGasUsed * 3 / 2) / 1024
// contrib = (parentGasUsed * 3 / 2) / 4096
contrib := new(big.Int).Mul(parent.GasUsed(), big.NewInt(3))
contrib = contrib.Div(contrib, big.NewInt(2))
contrib = contrib.Div(contrib, params.GasLimitBoundDivisor)
Expand Down
2 changes: 1 addition & 1 deletion core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func TestNetGenesisBlock() string {
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x",
"gasLimit": "0x2FEFD8",
"gasLimit": "0x2FAF0800",
"alloc": {
"0000000000000000000000000000000000000001": { "balance": "1" },
"0000000000000000000000000000000000000002": { "balance": "1" },
Expand Down
7 changes: 3 additions & 4 deletions params/protocol_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ var (
EcrecoverGas = big.NewInt(3000) //
Sha256WordGas = big.NewInt(12) //

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

Sha3Gas = big.NewInt(30) // Once per SHA3 operation.
Expand All @@ -53,7 +53,7 @@ var (
SstoreRefundGas = big.NewInt(15000) // Once per SSTORE operation if the zeroness changes to zero.
JumpdestGas = big.NewInt(1) // Refunded gas, once per SSTORE operation if the zeroness changes to zero.
IdentityGas = big.NewInt(15) //
GasLimitBoundDivisor = big.NewInt(1024) // The bound divisor of the gas limit, used in update calculations.
GasLimitBoundDivisor = big.NewInt(4096) // The bound divisor of the gas limit, used in update calculations.
EpochDuration = big.NewInt(30000) // Duration between proof-of-work epochs.
CallGas = big.NewInt(40) // Once per CALL operation & message call transaction.
CreateDataGas = big.NewInt(200) //
Expand All @@ -71,5 +71,4 @@ var (
SuicideRefundGas = big.NewInt(24000) // Refunded following a suicide operation.
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.
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.

)
10 changes: 10 additions & 0 deletions tests/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"net/http"
"os"
"path/filepath"
"github.com/ethereum/go-ethereum/params"
)

var (
Expand Down Expand Up @@ -62,6 +63,15 @@ var (
VmSkipTests = []string{}
)

func init() {
// Quorum uses different gas limit parameter values as Ethereum.
// By overwriting these custom parameters to Ethereum values it's
// possible to use the test data from Ethereum.
params.MinGasLimit.SetString("5000", 10)
params.TargetGasLimit.SetString("4712388", 10)
params.GasLimitBoundDivisor.SetString("1024", 10)
}

func readJson(reader io.Reader, value interface{}) error {
data, err := ioutil.ReadAll(reader)
if err != nil {
Expand Down

0 comments on commit 95d4681

Please sign in to comment.