Skip to content

Commit 7ecb12b

Browse files
redhdxpythonberg1997irrunbuddh0unclezoro
authored
bsc builder diff (#2)
* builder: implement BEP322 builder-api (bnb-chain#7) * feat: mev-builder * consesus: add a interface to set validator at runtime * core/txpool: add bundlepool to maintain bundle txs * core/type: define bundle * internal/ethapi: add sendBundle, bundlePrice, unregis * ethclient: add SendBundle * miner: add fillTransacitonsAndBundles, add Bidder to sendBid to validators * add README.builder.md --------- Co-authored-by: raina <[email protected]> * fix: index out of range (bnb-chain#10) * feat: call mev_params before send bid (bnb-chain#12) * fix: NPE and wrong profit (bnb-chain#13) * doc: update README.builder.md (bnb-chain#14) * fix: concurrent map write issue (bnb-chain#15) * fix: wrongly switch sync mode from full sync to snap sync issue (bnb-chain#17) * fix: add missing part when preparing env in `SimulateBundle` (bnb-chain#19) * feat: sendBundle return bundle hash (bnb-chain#20) * fix: some builder issues (bnb-chain#22) * fix: allow fast node to rewind after abnormal shutdown (bnb-chain#2401) (cherry picked from commit fb435eb) * fix: bundlepool concurrent read and write and commit blob tx issue * feat: set MaxBundleAliveBlock as bundle's default ddl --------- Co-authored-by: buddho <[email protected]> Co-authored-by: irrun <[email protected]> * fix: typo in `BundlePool.AllBundles` (bnb-chain#24) * feat: add `reconnectLoop` for mev validators (bnb-chain#25) * feat: add `reconnectLoop` for mev validators * fix lint issue * fix review comments * fix review comments * feat: ethclient of bundle (bnb-chain#23) * fix: a nil pointer when query bundle price (bnb-chain#28) * feat: set unrevertible tx hashes when sendBid --------- Co-authored-by: Roshan <[email protected]> Co-authored-by: raina <[email protected]> Co-authored-by: Roshan <[email protected]> Co-authored-by: buddho <[email protected]> Co-authored-by: zoro <[email protected]>
1 parent 63e7eac commit 7ecb12b

30 files changed

+2017
-320
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ truffle-test:
3030
docker build . -f ./docker/Dockerfile --target bsc -t bsc
3131
docker build . -f ./docker/Dockerfile.truffle -t truffle-test
3232
docker-compose -f ./tests/truffle/docker-compose.yml up genesis
33-
docker-compose -f ./tests/truffle/docker-compose.yml up -d bsc-rpc bsc-validator1
33+
docker-compose -f ./tests/truffle/docker-compose.yml up -d bsc-rpc
3434
sleep 30
3535
docker-compose -f ./tests/truffle/docker-compose.yml up --exit-code-from truffle-test truffle-test
3636
docker-compose -f ./tests/truffle/docker-compose.yml down

README.md

+50-278
Large diffs are not rendered by default.

consensus/consensus.go

+1
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,5 @@ type PoSA interface {
163163
GetFinalizedHeader(chain ChainHeaderReader, header *types.Header) *types.Header
164164
VerifyVote(chain ChainHeaderReader, vote *types.VoteEnvelope) error
165165
IsActiveValidatorAt(chain ChainHeaderReader, header *types.Header, checkVoteKeyFn func(bLSPublicKey *types.BLSPublicKey) bool) bool
166+
SetValidator(validator common.Address)
166167
}

consensus/parlia/parlia.go

+11
Original file line numberDiff line numberDiff line change
@@ -1897,6 +1897,17 @@ func (p *Parlia) GetFinalizedHeader(chain consensus.ChainHeaderReader, header *t
18971897
return chain.GetHeader(snap.Attestation.SourceHash, snap.Attestation.SourceNumber)
18981898
}
18991899

1900+
// SetValidator set the validator of parlia engine
1901+
// It is used for builder
1902+
func (p *Parlia) SetValidator(val common.Address) {
1903+
if val == (common.Address{}) {
1904+
return
1905+
}
1906+
p.lock.Lock()
1907+
defer p.lock.Unlock()
1908+
p.val = val
1909+
}
1910+
19001911
// =========================== utility function ==========================
19011912
func (p *Parlia) backOffTime(snap *Snapshot, header *types.Header, val common.Address) uint64 {
19021913
if snap.inturn(val) {

core/blockchain.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
mapset "github.com/deckarep/golang-set/v2"
3232
exlru "github.com/hashicorp/golang-lru"
3333
"golang.org/x/crypto/sha3"
34+
"golang.org/x/exp/slices"
3435

3536
"github.com/ethereum/go-ethereum/common"
3637
"github.com/ethereum/go-ethereum/common/lru"
@@ -56,7 +57,6 @@ import (
5657
"github.com/ethereum/go-ethereum/triedb"
5758
"github.com/ethereum/go-ethereum/triedb/hashdb"
5859
"github.com/ethereum/go-ethereum/triedb/pathdb"
59-
"golang.org/x/exp/slices"
6060
)
6161

6262
var (

0 commit comments

Comments
 (0)