Skip to content

Commit 0850f68

Browse files
authored
Merge pull request ethereum#3668 from obscuren/revert-gas64
Revert "params: core, core/vm, miner: 64bit gas instructions (ethereum#3514)"
2 parents f8f428c + 57f4e90 commit 0850f68

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1068
-1320
lines changed

cmd/evm/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func run(ctx *cli.Context) error {
156156
ret, _, err = runtime.Create(input, &runtime.Config{
157157
Origin: sender.Address(),
158158
State: statedb,
159-
GasLimit: common.Big(ctx.GlobalString(GasFlag.Name)).Uint64(),
159+
GasLimit: common.Big(ctx.GlobalString(GasFlag.Name)),
160160
GasPrice: common.Big(ctx.GlobalString(PriceFlag.Name)),
161161
Value: common.Big(ctx.GlobalString(ValueFlag.Name)),
162162
EVMConfig: vm.Config{
@@ -172,7 +172,7 @@ func run(ctx *cli.Context) error {
172172
ret, err = runtime.Call(receiver.Address(), common.Hex2Bytes(ctx.GlobalString(InputFlag.Name)), &runtime.Config{
173173
Origin: sender.Address(),
174174
State: statedb,
175-
GasLimit: common.Big(ctx.GlobalString(GasFlag.Name)).Uint64(),
175+
GasLimit: common.Big(ctx.GlobalString(GasFlag.Name)),
176176
GasPrice: common.Big(ctx.GlobalString(PriceFlag.Name)),
177177
Value: common.Big(ctx.GlobalString(ValueFlag.Name)),
178178
EVMConfig: vm.Config{

cmd/geth/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ func makeFullNode(ctx *cli.Context) *node.Node {
205205
if err != nil {
206206
glog.V(logger.Warn).Infoln("error setting canonical miner information:", err)
207207
}
208-
if uint64(len(extra)) > params.MaximumExtraDataSize {
208+
if uint64(len(extra)) > params.MaximumExtraDataSize.Uint64() {
209209
glog.V(logger.Warn).Infoln("error setting canonical miner information: extra exceeds", params.MaximumExtraDataSize)
210210
glog.V(logger.Debug).Infof("extra: %x\n", extra)
211211
extra = nil

common/math/integer.go

Lines changed: 0 additions & 25 deletions
This file was deleted.

common/math/integer_test.go

Lines changed: 0 additions & 50 deletions
This file was deleted.

core/bench_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ func genValueTx(nbytes int) func(int, *BlockGen) {
9292
var (
9393
ringKeys = make([]*ecdsa.PrivateKey, 1000)
9494
ringAddrs = make([]common.Address, len(ringKeys))
95-
bigTxGas = new(big.Int).SetUint64(params.TxGas)
9695
)
9796

9897
func init() {
@@ -112,16 +111,16 @@ func genTxRing(naccounts int) func(int, *BlockGen) {
112111
return func(i int, gen *BlockGen) {
113112
gas := CalcGasLimit(gen.PrevBlock(i - 1))
114113
for {
115-
gas.Sub(gas, bigTxGas)
116-
if gas.Cmp(bigTxGas) < 0 {
114+
gas.Sub(gas, params.TxGas)
115+
if gas.Cmp(params.TxGas) < 0 {
117116
break
118117
}
119118
to := (from + 1) % naccounts
120119
tx := types.NewTransaction(
121120
gen.TxNonce(ringAddrs[from]),
122121
ringAddrs[to],
123122
benchRootFunds,
124-
bigTxGas,
123+
params.TxGas,
125124
nil,
126125
nil,
127126
)

core/block_validator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ func (v *BlockValidator) ValidateHeader(header, parent *types.Header, checkPow b
204204
//
205205
// See YP section 4.3.4. "Block Header Validity"
206206
func ValidateHeader(config *params.ChainConfig, pow pow.PoW, header *types.Header, parent *types.Header, checkPow, uncle bool) error {
207-
if uint64(len(header.Extra)) > params.MaximumExtraDataSize {
207+
if big.NewInt(int64(len(header.Extra))).Cmp(params.MaximumExtraDataSize) == 1 {
208208
return fmt.Errorf("Header extra data too long (%d)", len(header.Extra))
209209
}
210210

core/blockchain_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ func TestFastVsFullChains(t *testing.T) {
719719
// If the block number is multiple of 3, send a few bonus transactions to the miner
720720
if i%3 == 2 {
721721
for j := 0; j < i%4+1; j++ {
722-
tx, err := types.SignTx(types.NewTransaction(block.TxNonce(address), common.Address{0x00}, big.NewInt(1000), bigTxGas, nil, nil), signer, key)
722+
tx, err := types.SignTx(types.NewTransaction(block.TxNonce(address), common.Address{0x00}, big.NewInt(1000), params.TxGas, nil, nil), signer, key)
723723
if err != nil {
724724
panic(err)
725725
}
@@ -883,8 +883,8 @@ func TestChainTxReorgs(t *testing.T) {
883883
// Create two transactions shared between the chains:
884884
// - postponed: transaction included at a later block in the forked chain
885885
// - swapped: transaction included at the same block number in the forked chain
886-
postponed, _ := types.SignTx(types.NewTransaction(0, addr1, big.NewInt(1000), bigTxGas, nil, nil), signer, key1)
887-
swapped, _ := types.SignTx(types.NewTransaction(1, addr1, big.NewInt(1000), bigTxGas, nil, nil), signer, key1)
886+
postponed, _ := types.SignTx(types.NewTransaction(0, addr1, big.NewInt(1000), params.TxGas, nil, nil), signer, key1)
887+
swapped, _ := types.SignTx(types.NewTransaction(1, addr1, big.NewInt(1000), params.TxGas, nil, nil), signer, key1)
888888

889889
// Create two transactions that will be dropped by the forked chain:
890890
// - pastDrop: transaction dropped retroactively from a past block
@@ -900,13 +900,13 @@ func TestChainTxReorgs(t *testing.T) {
900900
chain, _ := GenerateChain(params.TestChainConfig, genesis, db, 3, func(i int, gen *BlockGen) {
901901
switch i {
902902
case 0:
903-
pastDrop, _ = types.SignTx(types.NewTransaction(gen.TxNonce(addr2), addr2, big.NewInt(1000), bigTxGas, nil, nil), signer, key2)
903+
pastDrop, _ = types.SignTx(types.NewTransaction(gen.TxNonce(addr2), addr2, big.NewInt(1000), params.TxGas, nil, nil), signer, key2)
904904

905905
gen.AddTx(pastDrop) // This transaction will be dropped in the fork from below the split point
906906
gen.AddTx(postponed) // This transaction will be postponed till block #3 in the fork
907907

908908
case 2:
909-
freshDrop, _ = types.SignTx(types.NewTransaction(gen.TxNonce(addr2), addr2, big.NewInt(1000), bigTxGas, nil, nil), signer, key2)
909+
freshDrop, _ = types.SignTx(types.NewTransaction(gen.TxNonce(addr2), addr2, big.NewInt(1000), params.TxGas, nil, nil), signer, key2)
910910

911911
gen.AddTx(freshDrop) // This transaction will be dropped in the fork from exactly at the split point
912912
gen.AddTx(swapped) // This transaction will be swapped out at the exact height
@@ -925,18 +925,18 @@ func TestChainTxReorgs(t *testing.T) {
925925
chain, _ = GenerateChain(params.TestChainConfig, genesis, db, 5, func(i int, gen *BlockGen) {
926926
switch i {
927927
case 0:
928-
pastAdd, _ = types.SignTx(types.NewTransaction(gen.TxNonce(addr3), addr3, big.NewInt(1000), bigTxGas, nil, nil), signer, key3)
928+
pastAdd, _ = types.SignTx(types.NewTransaction(gen.TxNonce(addr3), addr3, big.NewInt(1000), params.TxGas, nil, nil), signer, key3)
929929
gen.AddTx(pastAdd) // This transaction needs to be injected during reorg
930930

931931
case 2:
932932
gen.AddTx(postponed) // This transaction was postponed from block #1 in the original chain
933933
gen.AddTx(swapped) // This transaction was swapped from the exact current spot in the original chain
934934

935-
freshAdd, _ = types.SignTx(types.NewTransaction(gen.TxNonce(addr3), addr3, big.NewInt(1000), bigTxGas, nil, nil), signer, key3)
935+
freshAdd, _ = types.SignTx(types.NewTransaction(gen.TxNonce(addr3), addr3, big.NewInt(1000), params.TxGas, nil, nil), signer, key3)
936936
gen.AddTx(freshAdd) // This transaction will be added exactly at reorg time
937937

938938
case 3:
939-
futureAdd, _ = types.SignTx(types.NewTransaction(gen.TxNonce(addr3), addr3, big.NewInt(1000), bigTxGas, nil, nil), signer, key3)
939+
futureAdd, _ = types.SignTx(types.NewTransaction(gen.TxNonce(addr3), addr3, big.NewInt(1000), params.TxGas, nil, nil), signer, key3)
940940
gen.AddTx(futureAdd) // This transaction will be added after a full reorg
941941
}
942942
})

core/chain_makers_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ func ExampleGenerateChain() {
5656
switch i {
5757
case 0:
5858
// In block 1, addr1 sends addr2 some ether.
59-
tx, _ := types.SignTx(types.NewTransaction(gen.TxNonce(addr1), addr2, big.NewInt(10000), bigTxGas, nil, nil), signer, key1)
59+
tx, _ := types.SignTx(types.NewTransaction(gen.TxNonce(addr1), addr2, big.NewInt(10000), params.TxGas, nil, nil), signer, key1)
6060
gen.AddTx(tx)
6161
case 1:
6262
// In block 2, addr1 sends some more ether to addr2.
6363
// addr2 passes it on to addr3.
64-
tx1, _ := types.SignTx(types.NewTransaction(gen.TxNonce(addr1), addr2, big.NewInt(1000), bigTxGas, nil, nil), signer, key1)
65-
tx2, _ := types.SignTx(types.NewTransaction(gen.TxNonce(addr2), addr3, big.NewInt(1000), bigTxGas, nil, nil), signer, key2)
64+
tx1, _ := types.SignTx(types.NewTransaction(gen.TxNonce(addr1), addr2, big.NewInt(1000), params.TxGas, nil, nil), signer, key1)
65+
tx2, _ := types.SignTx(types.NewTransaction(gen.TxNonce(addr2), addr3, big.NewInt(1000), params.TxGas, nil, nil), signer, key2)
6666
gen.AddTx(tx1)
6767
gen.AddTx(tx2)
6868
case 2:

0 commit comments

Comments
 (0)