Compare commits
21 Commits
stale-peer
...
v1.4.15
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec318b9c97 | ||
|
|
6624522423 | ||
|
|
206c3b0ab0 | ||
|
|
089064c1ff | ||
|
|
5289ecdfe2 | ||
|
|
d141ff06c3 | ||
|
|
9cbac84363 | ||
|
|
21faa2de3f | ||
|
|
34059cb144 | ||
|
|
3e44dcaa55 | ||
|
|
282aee5856 | ||
|
|
44e91bba23 | ||
|
|
774d1b7ddb | ||
|
|
8bbd8fbf48 | ||
|
|
a28262b3ec | ||
|
|
7de27ca9e9 | ||
|
|
03069a7703 | ||
|
|
24a46de5b2 | ||
|
|
75af65dbf2 | ||
|
|
26a4d4fda6 | ||
|
|
83a9b13771 |
8
.github/workflows/pre-release.yml
vendored
8
.github/workflows/pre-release.yml
vendored
@@ -82,28 +82,28 @@ jobs:
|
||||
# ==============================
|
||||
|
||||
- name: Upload Linux Build
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4.3.3
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
with:
|
||||
name: linux
|
||||
path: ./build/bin/geth
|
||||
|
||||
- name: Upload MacOS Build
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4.3.3
|
||||
if: matrix.os == 'macos-latest'
|
||||
with:
|
||||
name: macos
|
||||
path: ./build/bin/geth
|
||||
|
||||
- name: Upload Windows Build
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4.3.3
|
||||
if: matrix.os == 'windows-latest'
|
||||
with:
|
||||
name: windows
|
||||
path: ./build/bin/geth.exe
|
||||
|
||||
- name: Upload ARM-64 Build
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4.3.3
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
with:
|
||||
name: arm64
|
||||
|
||||
8
.github/workflows/release.yml
vendored
8
.github/workflows/release.yml
vendored
@@ -81,28 +81,28 @@ jobs:
|
||||
# ==============================
|
||||
|
||||
- name: Upload Linux Build
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4.3.3
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
with:
|
||||
name: linux
|
||||
path: ./build/bin/geth
|
||||
|
||||
- name: Upload MacOS Build
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4.3.3
|
||||
if: matrix.os == 'macos-latest'
|
||||
with:
|
||||
name: macos
|
||||
path: ./build/bin/geth
|
||||
|
||||
- name: Upload Windows Build
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4.3.3
|
||||
if: matrix.os == 'windows-latest'
|
||||
with:
|
||||
name: windows
|
||||
path: ./build/bin/geth.exe
|
||||
|
||||
- name: Upload ARM-64 Build
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4.3.3
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
with:
|
||||
name: arm64
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
CVE-2024-34478 # "CWE-754: Improper Check for Unusual or Exceptional Conditions." This vulnerability is BTC only, BSC does not have the issue.
|
||||
CVE-2024-6104 # "CWE-532: Information Exposure Through Log Files" This is caused by the vulnerabilities go-retryablehttp@v0.7.4, it is only used in cmd devp2p, impact is limited. will upgrade to v0.7.7 later
|
||||
CVE-2024-8421 # "CWE-400: Uncontrolled Resource Consumption (Resource Exhaustion)" This vulnerability is caused by issues in the golang.org/x/net package. Even the latest version(v0.29.0) has not yet addressed it, but we will continue to monitor updates closely.
|
||||
22
CHANGELOG.md
22
CHANGELOG.md
@@ -1,4 +1,26 @@
|
||||
# Changelog
|
||||
## v1.4.15
|
||||
### BUGFIX
|
||||
* [\#2680](https://github.com/bnb-chain/bsc/pull/2680) txpool: apply miner's gasceil to txpool
|
||||
* [\#2688](https://github.com/bnb-chain/bsc/pull/2688) txpool: set default GasCeil from 30M to 0
|
||||
* [\#2696](https://github.com/bnb-chain/bsc/pull/2696) miner: limit block size to eth protocol msg size
|
||||
* [\#2684](https://github.com/bnb-chain/bsc/pull/2684) eth: Add sidecars when available to broadcasted current block
|
||||
|
||||
### FEATURE
|
||||
* [\#2672](https://github.com/bnb-chain/bsc/pull/2672) faucet: with mainnet balance check, 0.002BNB at least
|
||||
* [\#2678](https://github.com/bnb-chain/bsc/pull/2678) beaconserver: simulated beacon api server for op-stack
|
||||
* [\#2687](https://github.com/bnb-chain/bsc/pull/2687) faucet: support customized token
|
||||
* [\#2698](https://github.com/bnb-chain/bsc/pull/2698) faucet: add example for custimized token
|
||||
* [\#2706](https://github.com/bnb-chain/bsc/pull/2706) faucet: update DIN token faucet support
|
||||
|
||||
### IMPROVEMENT
|
||||
* [\#2677](https://github.com/bnb-chain/bsc/pull/2677) log: add some p2p log
|
||||
* [\#2679](https://github.com/bnb-chain/bsc/pull/2679) build(deps): bump actions/download-artifact in /.github/workflows
|
||||
* [\#2662](https://github.com/bnb-chain/bsc/pull/2662) metrics: add some extra feature flags as node stats
|
||||
* [\#2675](https://github.com/bnb-chain/bsc/pull/2675) fetcher: Sleep after marking block as done when requeuing
|
||||
* [\#2695](https://github.com/bnb-chain/bsc/pull/2695) CI: nancy ignore CVE-2024-8421
|
||||
* [\#2689](https://github.com/bnb-chain/bsc/pull/2689) consensus/parlia: wait more time when processing huge blocks
|
||||
|
||||
## v1.4.14
|
||||
|
||||
### BUGFIX
|
||||
|
||||
26
README.md
26
README.md
@@ -9,16 +9,15 @@ https://pkg.go.dev/badge/github.com/ethereum/go-ethereum
|
||||
)](https://pkg.go.dev/github.com/ethereum/go-ethereum?tab=doc)
|
||||
[](https://discord.gg/z2VpC455eU)
|
||||
|
||||
But from that baseline of EVM compatible, BNB Smart Chain introduces a system of 21 validators with Proof of Staked Authority (PoSA) consensus that can support short block time and lower fees. The most bonded validator candidates of staking will become validators and produce blocks. The double-sign detection and other slashing logic guarantee security, stability, and chain finality.
|
||||
But from that baseline of EVM compatible, BNB Smart Chain introduces a system of 21 validators with Proof of Staked Authority (PoSA) consensus that can support short block time and lower fees. The most bonded validator candidates of staking will become validators and produce blocks. The double-sign detection and other slashing logic guarantee security, stability, and chain finality.
|
||||
|
||||
Cross-chain transfer and other communication are possible due to native support of interoperability. Relayers and on-chain contracts are developed to support that. BNB Beacon Chain DEX remains a liquid venue of the exchange of assets on both chains. This dual-chain architecture will be ideal for users to take advantage of the fast trading on one side and build their decentralized apps on the other side. **The BNB Smart Chain** will be:
|
||||
**The BNB Smart Chain** will be:
|
||||
|
||||
- **A self-sovereign blockchain**: Provides security and safety with elected validators.
|
||||
- **EVM-compatible**: Supports all the existing Ethereum tooling along with faster finality and cheaper transaction fees.
|
||||
- **Interoperable**: Comes with efficient native dual chain communication; Optimized for scaling high-performance dApps that require fast and smooth user experience.
|
||||
- **Distributed with on-chain governance**: Proof of Staked Authority brings in decentralization and community participants. As the native token, BNB will serve as both the gas of smart contract execution and tokens for staking.
|
||||
|
||||
More details in [White Paper](https://www.bnbchain.org/en#smartChain).
|
||||
More details in [White Paper](https://github.com/bnb-chain/whitepaper/blob/master/WHITEPAPER.md).
|
||||
|
||||
## Key features
|
||||
|
||||
@@ -34,18 +33,8 @@ To combine DPoS and PoA for consensus, BNB Smart Chain implement a novel consens
|
||||
|
||||
1. Blocks are produced by a limited set of validators.
|
||||
2. Validators take turns to produce blocks in a PoA manner, similar to Ethereum's Clique consensus engine.
|
||||
3. Validator set are elected in and out based on a staking based governance on BNB Beacon Chain.
|
||||
4. The validator set change is relayed via a cross-chain communication mechanism.
|
||||
5. Parlia consensus engine will interact with a set of [system contracts](https://docs.bnbchain.org/bnb-smart-chain/staking/overview/#system-contracts) to achieve liveness slash, revenue distributing and validator set renewing func.
|
||||
|
||||
|
||||
### Light Client of BNB Beacon Chain
|
||||
|
||||
To achieve the cross-chain communication from BNB Beacon Chain to BNB Smart Chain, need introduce a on-chain light client verification algorithm.
|
||||
It contains two parts:
|
||||
|
||||
1. [Stateless Precompiled contracts](https://github.com/bnb-chain/bsc/blob/master/core/vm/contracts_lightclient.go) to do tendermint header verification and Merkle Proof verification.
|
||||
2. [Stateful solidity contracts](https://github.com/bnb-chain/bsc-genesis-contract/blob/master/contracts/TendermintLightClient.sol) to store validator set and trusted appHash.
|
||||
3. Validator set are elected in and out based on a staking based governance on BNB Smart Chain.
|
||||
4. Parlia consensus engine will interact with a set of [system contracts](https://docs.bnbchain.org/bnb-smart-chain/staking/overview/#system-contracts) to achieve liveness slash, revenue distributing and validator set renewing func.
|
||||
|
||||
## Native Token
|
||||
|
||||
@@ -53,7 +42,6 @@ BNB will run on BNB Smart Chain in the same way as ETH runs on Ethereum so that
|
||||
BNB will be used to:
|
||||
|
||||
1. pay `gas` to deploy or invoke Smart Contract on BSC
|
||||
2. perform cross-chain operations, such as transfer token assets across BNB Smart Chain and BNB Beacon Chain.
|
||||
|
||||
## Building the source
|
||||
|
||||
@@ -247,9 +235,7 @@ running web servers, so malicious web pages could try to subvert locally availab
|
||||
APIs!**
|
||||
|
||||
### Operating a private network
|
||||
- [BSC-Deploy](https://github.com/bnb-chain/node-deploy/): deploy tool for setting up both BNB Beacon Chain, BNB Smart Chain and the cross chain infrastructure between them.
|
||||
- [BSC-Docker](https://github.com/bnb-chain/bsc-docker): deploy tool for setting up local BSC cluster in container.
|
||||
|
||||
- [BSC-Deploy](https://github.com/bnb-chain/node-deploy/): deploy tool for setting up BNB Smart Chain.
|
||||
|
||||
## Running a bootnode
|
||||
|
||||
|
||||
BIN
cmd/faucet/customized/DIN.png
Normal file
BIN
cmd/faucet/customized/DIN.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
23
cmd/faucet/customized/README.md
Normal file
23
cmd/faucet/customized/README.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# 1.Background
|
||||
This is to support some projects with customized tokens that they want to integrate into the BSC faucet tool.
|
||||
|
||||
## 1.1. How to Integrate Your Token
|
||||
- Step 1: Fund the faucet address by sending a specific amount of your BEP-20 token to the faucet address (0xaa25aa7a19f9c426e07dee59b12f944f4d9f1dd3) on the BSC testnet.
|
||||
- Step 2: Update this README.md file and create a Pull Request on [bsc github](https://github.com/bnb-chain/bsc) with relevant information.
|
||||
|
||||
We will review the request, and once it is approved, the faucet tool will start to support the customized token and list it on https://www.bnbchain.org/en/testnet-faucet.
|
||||
|
||||
# 2.Token List
|
||||
## 2.1.DemoToken
|
||||
- symbol: DEMO
|
||||
- amount: 10000000000000000000
|
||||
- icon: ./demotoken.png
|
||||
- addr: https://testnet.bscscan.com/address/0xe15c158d768c306dae87b96430a94f884333e55d
|
||||
- fundTx: [0xa499dc9aaf918aff0507538a8aa80a88d0af6ca15054e6acc57b69c651945280](https://testnet.bscscan.com/tx/0x2a3f334b6ca756b64331bdec9e6cf3207ac50a4839fda6379e909de4d9a194ca)
|
||||
-
|
||||
## 2.2.DIN token
|
||||
- symbol: DIN
|
||||
- amount: 10000000000000000000
|
||||
- icon: ./DIN.png
|
||||
- addr: https://testnet.bscscan.com/address/0xb8b40FcC5B4519Dba0E07Ac8821884CE90BdE677
|
||||
- fundTx: [0x17fc4c1db133830c7c146a0d41ca1df31cb446989ec11b382d58bb6176d6fde3](https://testnet.bscscan.com/tx/0x17fc4c1db133830c7c146a0d41ca1df31cb446989ec11b382d58bb6176d6fde3)
|
||||
BIN
cmd/faucet/customized/demotoken.png
Normal file
BIN
cmd/faucet/customized/demotoken.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
@@ -500,7 +500,7 @@ func (f *faucet) apiHandler(w http.ResponseWriter, r *http.Request) {
|
||||
continue
|
||||
}
|
||||
|
||||
// check #2: check IP and ID(address) to ensure the user didn't request funds too recently,
|
||||
// check #2: check IP and ID(address) to ensure the user didn't request funds too frequently
|
||||
f.lock.Lock()
|
||||
|
||||
if ipTimeout := f.timeouts[ips[len(ips)-2]]; time.Now().Before(ipTimeout) {
|
||||
|
||||
@@ -68,7 +68,6 @@ const (
|
||||
|
||||
wiggleTime = uint64(1) // second, Random delay (per signer) to allow concurrent signers
|
||||
initialBackOffTime = uint64(1) // second
|
||||
processBackOffTime = uint64(1) // second
|
||||
|
||||
systemRewardPercent = 4 // it means 1/2^4 = 1/16 percentage of gas fee incoming will be distributed to system
|
||||
|
||||
@@ -1616,12 +1615,15 @@ func (p *Parlia) Seal(chain consensus.ChainHeaderReader, block *types.Block, res
|
||||
copy(header.Extra[len(header.Extra)-extraSeal:], sig)
|
||||
|
||||
if p.shouldWaitForCurrentBlockProcess(chain, header, snap) {
|
||||
log.Info("Waiting for received in turn block to process")
|
||||
highestVerifiedHeader := chain.GetHighestVerifiedHeader()
|
||||
// including time for writing and committing blocks
|
||||
waitProcessEstimate := math.Ceil(float64(highestVerifiedHeader.GasUsed) / float64(100_000_000))
|
||||
log.Info("Waiting for received in turn block to process", "waitProcessEstimate(Seconds)", waitProcessEstimate)
|
||||
select {
|
||||
case <-stop:
|
||||
log.Info("Received block process finished, abort block seal")
|
||||
return
|
||||
case <-time.After(time.Duration(processBackOffTime) * time.Second):
|
||||
case <-time.After(time.Duration(waitProcessEstimate) * time.Second):
|
||||
if chain.CurrentHeader().Number.Uint64() >= header.Number.Uint64() {
|
||||
log.Info("Process backoff time exhausted, and current header has updated to abort this seal")
|
||||
return
|
||||
|
||||
@@ -66,31 +66,6 @@ func NewBlockValidator(config *params.ChainConfig, blockchain *BlockChain, engin
|
||||
return validator
|
||||
}
|
||||
|
||||
// ValidateListsInBody validates that UncleHash, WithdrawalsHash, and WithdrawalsHash correspond to the lists in the block body, respectively.
|
||||
func ValidateListsInBody(block *types.Block) error {
|
||||
header := block.Header()
|
||||
if hash := types.CalcUncleHash(block.Uncles()); hash != header.UncleHash {
|
||||
return fmt.Errorf("uncle root hash mismatch (header value %x, calculated %x)", header.UncleHash, hash)
|
||||
}
|
||||
if hash := types.DeriveSha(block.Transactions(), trie.NewStackTrie(nil)); hash != header.TxHash {
|
||||
return fmt.Errorf("transaction root hash mismatch: have %x, want %x", hash, header.TxHash)
|
||||
}
|
||||
// Withdrawals are present after the Shanghai fork.
|
||||
if header.WithdrawalsHash != nil {
|
||||
// Withdrawals list must be present in body after Shanghai.
|
||||
if block.Withdrawals() == nil {
|
||||
return errors.New("missing withdrawals in block body")
|
||||
}
|
||||
if hash := types.DeriveSha(block.Withdrawals(), trie.NewStackTrie(nil)); hash != *header.WithdrawalsHash {
|
||||
return fmt.Errorf("withdrawals root hash mismatch (header value %x, calculated %x)", *header.WithdrawalsHash, hash)
|
||||
}
|
||||
} else if block.Withdrawals() != nil { // Withdrawals turn into empty from nil when BlockBody has Sidecars
|
||||
// Withdrawals are not allowed prior to shanghai fork
|
||||
return errors.New("withdrawals present in block body")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ValidateBody validates the given block's uncles and verifies the block
|
||||
// header's transaction and uncle roots. The headers are assumed to be already
|
||||
// validated at this point.
|
||||
@@ -108,12 +83,31 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error {
|
||||
if err := v.engine.VerifyUncles(v.bc, block); err != nil {
|
||||
return err
|
||||
}
|
||||
if hash := types.CalcUncleHash(block.Uncles()); hash != header.UncleHash {
|
||||
return fmt.Errorf("uncle root hash mismatch (header value %x, calculated %x)", header.UncleHash, hash)
|
||||
}
|
||||
|
||||
validateFuns := []func() error{
|
||||
func() error {
|
||||
return ValidateListsInBody(block)
|
||||
if hash := types.DeriveSha(block.Transactions(), trie.NewStackTrie(nil)); hash != header.TxHash {
|
||||
return fmt.Errorf("transaction root hash mismatch: have %x, want %x", hash, header.TxHash)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
func() error {
|
||||
// Withdrawals are present after the Shanghai fork.
|
||||
if header.WithdrawalsHash != nil {
|
||||
// Withdrawals list must be present in body after Shanghai.
|
||||
if block.Withdrawals() == nil {
|
||||
return errors.New("missing withdrawals in block body")
|
||||
}
|
||||
if hash := types.DeriveSha(block.Withdrawals(), trie.NewStackTrie(nil)); hash != *header.WithdrawalsHash {
|
||||
return fmt.Errorf("withdrawals root hash mismatch (header value %x, calculated %x)", *header.WithdrawalsHash, hash)
|
||||
}
|
||||
} else if block.Withdrawals() != nil { // Withdrawals turn into empty from nil when BlockBody has Sidecars
|
||||
// Withdrawals are not allowed prior to shanghai fork
|
||||
return errors.New("withdrawals present in block body")
|
||||
}
|
||||
// Blob transactions may be present after the Cancun fork.
|
||||
var blobs int
|
||||
for i, tx := range block.Transactions() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package bn256
|
||||
|
||||
// For details of the algorithms used, see "Multiplication and Squaring on
|
||||
// Pairing-Friendly Fields, Devegili et al.
|
||||
// Pairing-Friendly Fields", Devegili et al.
|
||||
// http://eprint.iacr.org/2006/471.pdf.
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package bn256
|
||||
|
||||
// For details of the algorithms used, see "Multiplication and Squaring on
|
||||
// Pairing-Friendly Fields, Devegili et al.
|
||||
// Pairing-Friendly Fields", Devegili et al.
|
||||
// http://eprint.iacr.org/2006/471.pdf.
|
||||
|
||||
// gfP2 implements a field of size p² as a quadratic extension of the base field
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package bn256
|
||||
|
||||
// For details of the algorithms used, see "Multiplication and Squaring on
|
||||
// Pairing-Friendly Fields, Devegili et al.
|
||||
// Pairing-Friendly Fields", Devegili et al.
|
||||
// http://eprint.iacr.org/2006/471.pdf.
|
||||
|
||||
// gfP6 implements the field of size p⁶ as a cubic extension of gfP2 where τ³=ξ
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package bn256
|
||||
|
||||
// For details of the algorithms used, see "Multiplication and Squaring on
|
||||
// Pairing-Friendly Fields, Devegili et al.
|
||||
// Pairing-Friendly Fields", Devegili et al.
|
||||
// http://eprint.iacr.org/2006/471.pdf.
|
||||
|
||||
import (
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package bn256
|
||||
|
||||
// For details of the algorithms used, see "Multiplication and Squaring on
|
||||
// Pairing-Friendly Fields, Devegili et al.
|
||||
// Pairing-Friendly Fields", Devegili et al.
|
||||
// http://eprint.iacr.org/2006/471.pdf.
|
||||
|
||||
import (
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package bn256
|
||||
|
||||
// For details of the algorithms used, see "Multiplication and Squaring on
|
||||
// Pairing-Friendly Fields, Devegili et al.
|
||||
// Pairing-Friendly Fields", Devegili et al.
|
||||
// http://eprint.iacr.org/2006/471.pdf.
|
||||
|
||||
import (
|
||||
|
||||
@@ -868,9 +868,9 @@ func (f *BlockFetcher) importHeaders(op *blockOrHeaderInject) {
|
||||
parent := f.getHeader(header.ParentHash)
|
||||
if parent == nil {
|
||||
log.Debug("Unknown parent of propagated header", "peer", peer, "number", header.Number, "hash", hash, "parent", header.ParentHash)
|
||||
time.Sleep(reQueueBlockTimeout)
|
||||
// forget block first, then re-queue
|
||||
f.done <- hash
|
||||
time.Sleep(reQueueBlockTimeout)
|
||||
f.requeue <- op
|
||||
return
|
||||
}
|
||||
@@ -909,9 +909,9 @@ func (f *BlockFetcher) importBlocks(op *blockOrHeaderInject) {
|
||||
parent := f.getBlock(block.ParentHash())
|
||||
if parent == nil {
|
||||
log.Debug("Unknown parent of propagated block", "peer", peer, "number", block.Number(), "hash", hash, "parent", block.ParentHash())
|
||||
time.Sleep(reQueueBlockTimeout)
|
||||
// forget block first, then re-queue
|
||||
f.done <- hash
|
||||
time.Sleep(reQueueBlockTimeout)
|
||||
f.requeue <- op
|
||||
return
|
||||
}
|
||||
|
||||
@@ -321,21 +321,14 @@ func newHandler(config *handlerConfig) (*handler, error) {
|
||||
|
||||
broadcastBlockWithCheck := func(block *types.Block, propagate bool) {
|
||||
if propagate {
|
||||
checkErrs := make(chan error, 2)
|
||||
|
||||
go func() {
|
||||
checkErrs <- core.ValidateListsInBody(block)
|
||||
}()
|
||||
go func() {
|
||||
checkErrs <- core.IsDataAvailable(h.chain, block)
|
||||
}()
|
||||
|
||||
for i := 0; i < cap(checkErrs); i++ {
|
||||
err := <-checkErrs
|
||||
if err != nil {
|
||||
log.Error("Propagating invalid block", "number", block.Number(), "hash", block.Hash(), "err", err)
|
||||
return
|
||||
}
|
||||
if !(block.Header().WithdrawalsHash == nil && block.Withdrawals() == nil) &&
|
||||
!(block.Header().EmptyWithdrawalsHash() && block.Withdrawals() != nil && len(block.Withdrawals()) == 0) {
|
||||
log.Error("Propagated block has invalid withdrawals")
|
||||
return
|
||||
}
|
||||
if err := core.IsDataAvailable(h.chain, block); err != nil {
|
||||
log.Error("Propagating block with invalid sidecars", "number", block.Number(), "hash", block.Hash(), "err", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
h.BroadcastBlock(block, propagate)
|
||||
|
||||
@@ -25,6 +25,7 @@ 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"
|
||||
)
|
||||
|
||||
@@ -46,7 +47,7 @@ var ProtocolVersions = []uint{ETH68}
|
||||
var protocolLengths = map[uint]uint64{ETH68: 17}
|
||||
|
||||
// maxMessageSize is the maximum cap on the size of a protocol message.
|
||||
const maxMessageSize = 10 * 1024 * 1024
|
||||
var maxMessageSize = params.MaxMessageSize
|
||||
|
||||
const (
|
||||
StatusMsg = 0x00
|
||||
|
||||
@@ -248,6 +248,9 @@ func (h *handler) doSync(op *chainSyncOp) error {
|
||||
// degenerate connectivity, but it should be healthy for the mainnet too to
|
||||
// more reliably update peers or the local TD state.
|
||||
if block := h.chain.GetBlock(head.Hash(), head.Number.Uint64()); block != nil {
|
||||
if h.chain.Config().IsCancun(block.Number(), block.Time()) {
|
||||
block = block.WithSidecars(h.chain.GetSidecarsByHash(block.Hash()))
|
||||
}
|
||||
h.BroadcastBlock(block, false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -692,6 +692,14 @@ 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 {
|
||||
log.Info("[BID RESULT]", "win", "true[first]", "builder", bidRuntime.bid.Builder, "hash", bidRuntime.bid.Hash().TerminalString())
|
||||
@@ -858,6 +866,7 @@ func (r *BidRuntime) commitTransaction(chain *core.BlockChain, chainConfig *para
|
||||
}
|
||||
|
||||
r.env.tcount++
|
||||
r.env.size += uint32(tx.Size())
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -70,6 +70,12 @@ const (
|
||||
|
||||
// the default to wait for the mev miner to finish
|
||||
waitMEVMinerEndTimeLimit = 50 * time.Millisecond
|
||||
|
||||
// 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 (
|
||||
@@ -89,6 +95,7 @@ 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
|
||||
|
||||
@@ -105,6 +112,7 @@ 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),
|
||||
@@ -895,6 +903,13 @@ 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 is the transaction pool.
|
||||
from, _ := types.Sender(env.signer, tx)
|
||||
@@ -920,6 +935,7 @@ 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:
|
||||
@@ -1055,6 +1071,9 @@ func (w *worker) prepareWork(genParams *generateParams) (*environment, error) {
|
||||
vmenv := vm.NewEVM(context, vm.TxContext{}, env.state, w.chainConfig, vm.Config{})
|
||||
core.ProcessBeaconBlockRoot(*header.ParentBeaconRoot, vmenv, env.state)
|
||||
}
|
||||
|
||||
env.size = uint32(env.header.Size())
|
||||
|
||||
return env, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@ 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.
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
const (
|
||||
VersionMajor = 1 // Major version component of the current release
|
||||
VersionMinor = 4 // Minor version component of the current release
|
||||
VersionPatch = 14 // Patch version component of the current release
|
||||
VersionPatch = 15 // Patch version component of the current release
|
||||
VersionMeta = "" // Version metadata to append to the version string
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user