diff --git a/README.md b/README.md index 271ef57265ad..38f71cd2cb2c 100644 --- a/README.md +++ b/README.md @@ -19,11 +19,11 @@ make geth ``` ``` -rm -rf da-test-chain-dir && ./build/bin/geth --datadir da-test-chain-dir --rpc --dev --rpcaddr "0.0.0.0" --rpccorsdomain "*" --networkid 108 --rpcapi 'eth,net' --gasprice '0' --targetgaslimit '4294967295' --nousb --gcmode=archive +rm -rf da-test-chain-dir && ./build/bin/geth --datadir da-test-chain-dir --rpc --dev --rpcaddr "0.0.0.0" --rpccorsdomain "*" --networkid 108 --rpcapi 'eth,net' --gasprice '0' --targetgaslimit '8000000' --nousb --gcmode=archive ``` You can also enable logs with ``` -rm -rf da-test-chain-dir && ./build/bin/geth --datadir da-test-chain-dir --rpc --dev --rpcaddr "0.0.0.0" --rpccorsdomain "*" --networkid 108 --rpcapi 'eth,net' --gasprice '0' --targetgaslimit '4294967295' --nousb --gcmode=archive --verbosity=5 +rm -rf da-test-chain-dir && ./build/bin/geth --datadir da-test-chain-dir --rpc --dev --rpcaddr "0.0.0.0" --rpccorsdomain "*" --networkid 108 --rpcapi 'eth,net' --gasprice '0' --targetgaslimit '8000000' --nousb --gcmode=archive --verbosity=5 ``` diff --git a/cmd/puppeth/testdata/stureby_aleth.json b/cmd/puppeth/testdata/stureby_aleth.json index 68380ed0aa6e..0051ca9391f6 100644 --- a/cmd/puppeth/testdata/stureby_aleth.json +++ b/cmd/puppeth/testdata/stureby_aleth.json @@ -11,7 +11,7 @@ "constantinopleForkBlock": "0x9c40", "constantinopleFixForkBlock": "0x9c40", "istanbulForkBlock": "0xc350", - "minGasLimit": "0xee6b2800", + "minGasLimit": "0x3d0900", "maxGasLimit": "0x7fffffffffffffff", "tieBreakingGas": false, "gasLimitBoundDivisor": "0x400", diff --git a/cmd/puppeth/testdata/stureby_parity.json b/cmd/puppeth/testdata/stureby_parity.json index 2ed5647dde24..de9146fe362e 100644 --- a/cmd/puppeth/testdata/stureby_parity.json +++ b/cmd/puppeth/testdata/stureby_parity.json @@ -24,7 +24,7 @@ "params": { "accountStartNonce": "0x0", "maximumExtraDataSize": "0x20", - "minGasLimit": "0xee6b2800", + "minGasLimit": "0x3d0900", "gasLimitBoundDivisor": "0x400", "networkID": "0x4cb2e", "chainID": "0x4cb2e", diff --git a/core/genesis.go b/core/genesis.go index 7dae026426a7..18bc1eaa2f9c 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -414,7 +414,7 @@ func DeveloperGenesisBlock(period uint64, faucet common.Address) *Genesis { return &Genesis{ Config: &config, ExtraData: append(append(make([]byte, 32), faucet[:]...), make([]byte, crypto.SignatureLength)...), - GasLimit: 4294967295, + GasLimit: 8000000, Difficulty: big.NewInt(1), Alloc: map[common.Address]GenesisAccount{ common.BytesToAddress([]byte{1}): {Balance: big.NewInt(1)}, // ECRecover diff --git a/docker/dev_entrypoint.sh b/docker/dev_entrypoint.sh index c05d174adfae..5c522823b8c2 100755 --- a/docker/dev_entrypoint.sh +++ b/docker/dev_entrypoint.sh @@ -14,7 +14,7 @@ fi echo "Starting Geth..." ## Command to kick off geth -TARGET_GAS_LIMIT=${TARGET_GAS_LIMIT:-4294967295} +TARGET_GAS_LIMIT=${TARGET_GAS_LIMIT:-8000000} ./build/bin/geth --dev \ --datadir $VOLUME_PATH \ --rpc \ @@ -28,4 +28,4 @@ TARGET_GAS_LIMIT=${TARGET_GAS_LIMIT:-4294967295} --targetgaslimit $TARGET_GAS_LIMIT \ --nousb \ --gcmode=archive \ - --verbosity "6" \ No newline at end of file + --verbosity "6" diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index df0e8bb68170..9631ec1991fe 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -5,7 +5,7 @@ # PORT=8545 # NETWORK_ID=108 CLEAR_DATA_FILE_PATH="${VOLUME_PATH}/.clear_data_key_${CLEAR_DATA_KEY}" -TARGET_GAS_LIMIT=${TARGET_GAS_LIMIT:-4294967295} +TARGET_GAS_LIMIT=${TARGET_GAS_LIMIT:-8000000} if [[ -n "$CLEAR_DATA_KEY" && ! -f "$CLEAR_DATA_FILE_PATH" ]]; then echo "Detected change in CLEAR_DATA_KEY. Purging data." diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 965f45c615d7..44cc530d564b 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -886,66 +886,13 @@ func (s *PublicBlockChainAPI) Call(ctx context.Context, args CallArgs, blockNrOr } func DoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrOrHash rpc.BlockNumberOrHash, gasCap *big.Int) (hexutil.Uint64, error) { - // Binary search the gas requirement, as it may be higher than the amount used - var ( - lo uint64 = params.TxGas - 1 - hi uint64 - cap uint64 - ) - if args.Gas != nil && uint64(*args.Gas) >= params.TxGas { - hi = uint64(*args.Gas) - } else { - // Retrieve the block to act as the gas ceiling - block, err := b.BlockByNumberOrHash(ctx, blockNrOrHash) - if err != nil { - return 0, err - } - hi = block.GasLimit() - } - if gasCap != nil && hi > gasCap.Uint64() { - log.Warn("Caller gas above allowance, capping", "requested", hi, "cap", gasCap) - hi = gasCap.Uint64() - } - cap = hi - - // Set sender address or use a default if none specified - if args.From == nil { - if wallets := b.AccountManager().Wallets(); len(wallets) > 0 { - if accounts := wallets[0].Accounts(); len(accounts) > 0 { - args.From = &accounts[0].Address - } - } - } - // Use zero-address if none other is available - if args.From == nil { - args.From = &common.Address{} - } - // Create a helper to check if a gas allowance results in an executable transaction - executable := func(gas uint64) bool { - args.Gas = (*hexutil.Uint64)(&gas) - - _, _, failed, err := DoCall(ctx, b, args, blockNrOrHash, nil, vm.Config{}, 0, gasCap) - if err != nil || failed { - return false - } - return true - } - // Execute the binary search and hone in on an executable gas limit - for lo+1 < hi { - mid := (hi + lo) / 2 - if !executable(mid) { - lo = mid - } else { - hi = mid - } - } - // Reject the transaction as invalid if it still fails at the highest allowance - if hi == cap { - if !executable(hi) { - return 0, fmt.Errorf("gas required exceeds allowance (%d) or always failing transaction", cap) - } + // Retrieve the block to act as the gas ceiling + block, err := b.BlockByNumberOrHash(ctx, blockNrOrHash) + if err != nil { + return 0, err } - return hexutil.Uint64(hi), nil + // For now always return the gas limit + return hexutil.Uint64(block.GasLimit() - 1), nil } // EstimateGas returns an estimate of the amount of gas needed to execute the diff --git a/params/protocol_params.go b/params/protocol_params.go index 70cba27c3d20..3151f39846fa 100644 --- a/params/protocol_params.go +++ b/params/protocol_params.go @@ -19,9 +19,9 @@ package params import "math/big" const ( - GasLimitBoundDivisor uint64 = 1024 // The bound divisor of the gas limit, used in update calculations. - MinGasLimit uint64 = 4000000000 // Minimum the gas limit may ever be. - GenesisGasLimit uint64 = 4294967295 // Gas limit of the Genesis block. + GasLimitBoundDivisor uint64 = 1024 // The bound divisor of the gas limit, used in update calculations. + MinGasLimit uint64 = 4000000 // Minimum the gas limit may ever be. + GenesisGasLimit uint64 = 8000000 // Gas limit of the Genesis block. MaximumExtraDataSize uint64 = 32 // Maximum size extra data may be after Genesis. ExpByteGas uint64 = 10 // Times ceil(log256(exponent)) for the EXP instruction. diff --git a/rpc/handler.go b/rpc/handler.go index 0e79eafe4532..a65aca59fc8b 100644 --- a/rpc/handler.go +++ b/rpc/handler.go @@ -368,12 +368,7 @@ func (h *handler) handleSubscribe(cp *callProc, msg *jsonrpcMessage) *jsonrpcMes func (h *handler) runMethod(ctx context.Context, msg *jsonrpcMessage, callb *callback, args []reflect.Value) *jsonrpcMessage { var result interface{} var err error - // TODO: think about long term maintainability of altered RPC methods - if msg.Method == "eth_estimateGas" { - result = 0xffffffff //Gas Limit - } else { - result, err = callb.call(ctx, msg.Method, args) - } + result, err = callb.call(ctx, msg.Method, args) if err != nil { return msg.errorResponse(err) }