Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions eth/protocols/eth/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/forkid"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
)

Expand All @@ -47,7 +46,7 @@ var ProtocolVersions = []uint{ETH68}
var protocolLengths = map[uint]uint64{ETH68: 17}

// maxMessageSize is the maximum cap on the size of a protocol message.
var maxMessageSize = params.MaxMessageSize
const maxMessageSize = 10 * 1024 * 1024

const (
StatusMsg = 0x00
Expand Down
9 changes: 0 additions & 9 deletions miner/bid_simulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -832,14 +832,6 @@ func (b *bidSimulator) simBid(interruptCh chan int32, bidRuntime *BidRuntime) {
return
}

// check bid size
if bidRuntime.env.size+blockReserveSize > params.MaxMessageSize {
log.Error("BidSimulator: failed to check bid size", "builder", bidRuntime.bid.Builder,
"bidHash", bidRuntime.bid.Hash(), "env.size", bidRuntime.env.size)
err = errors.New("invalid bid size")
return
}

bestBid := b.GetBestBid(parentHash)
if bestBid == nil {
winResult := "true[first]"
Expand Down Expand Up @@ -1011,7 +1003,6 @@ func (r *BidRuntime) commitTransaction(chain *core.BlockChain, chainConfig *para
}

r.env.tcount++
r.env.size += uint32(tx.Size())

return nil
}
Expand Down
19 changes: 0 additions & 19 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@ const (
// the current 4 mining loops could have asynchronous risk of mining block with
// save height, keep recently mined blocks to avoid double sign for safety,
recentMinedCacheLimit = 20

// Reserve block size for the following 3 components:
// a. System transactions at the end of the block
// b. Seal in the block header
// c. Overhead from RLP encoding
blockReserveSize = 100 * 1024
)

var (
Expand All @@ -100,7 +94,6 @@ type environment struct {
signer types.Signer
state *state.StateDB // apply state changes here
tcount int // tx count in cycle
size uint32 // almost accurate block size,
gasPool *core.GasPool // available gas used to pack transactions
coinbase common.Address
evm *vm.EVM
Expand All @@ -120,7 +113,6 @@ func (env *environment) copy() *environment {
signer: env.signer,
state: env.state.Copy(),
tcount: env.tcount,
size: env.size,
coinbase: env.coinbase,
header: types.CopyHeader(env.header),
receipts: copyReceipts(env.receipts),
Expand Down Expand Up @@ -922,13 +914,6 @@ LOOP:
txs.Pop()
continue
}
// If we don't have enough size left for the next transaction, skip it.
if env.size+uint32(tx.Size())+blockReserveSize > params.MaxMessageSize {
log.Trace("Not enough size left for transaction", "hash", ltx.Hash,
"env.size", env.size, "needed", uint32(tx.Size()))
txs.Pop()
continue
}
// Error may be ignored here. The error has already been checked
// during transaction acceptance in the transaction pool.
from, _ := types.Sender(env.signer, tx)
Expand All @@ -954,7 +939,6 @@ LOOP:
// Everything ok, collect the logs and shift in the next transaction from the same account
coalescedLogs = append(coalescedLogs, logs...)
env.tcount++
env.size += uint32(tx.Size()) // size of BlobTxSidecar included
txs.Shift()

default:
Expand Down Expand Up @@ -1090,9 +1074,6 @@ func (w *worker) prepareWork(genParams *generateParams, witness bool) (*environm
if w.chainConfig.IsPrague(header.Number, header.Time) {
core.ProcessParentBlockHash(header.ParentHash, env.evm)
}

env.size = uint32(env.header.Size())

return env, nil
}

Expand Down
2 changes: 0 additions & 2 deletions params/protocol_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ const (
GenesisGasLimit uint64 = 4712388 // Gas limit of the Genesis block.
PayBidTxGasLimit uint64 = 25000 // Gas limit of the PayBidTx in the types.BidArgs.

MaxMessageSize uint32 = 10 * 1024 * 1024 // MaxMessageSize is the maximum cap on the size of a eth protocol message.

MaximumExtraDataSize uint64 = 32 // Maximum size extra data may be after Genesis.
ForkIDSize uint64 = 4 // The length of fork id
ExpByteGas uint64 = 10 // Times ceil(log256(exponent)) for the EXP instruction.
Expand Down