Skip to content

Commit

Permalink
bsc builder diff (#2)
Browse files Browse the repository at this point in the history
* 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 <irunert@gmail.com>

* 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 <galaxystroller@gmail.com>
Co-authored-by: irrun <irunert@gmail.com>

* 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 <48975233+Pythonberg1997@users.noreply.github.com>
Co-authored-by: raina <irunert@gmail.com>
Co-authored-by: Roshan <luoshen1997@gmail.com>
Co-authored-by: buddho <galaxystroller@gmail.com>
Co-authored-by: zoro <296179868@qq.com>
6 people authored May 30, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 63e7eac commit 7ecb12b
Showing 30 changed files with 2,017 additions and 320 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ truffle-test:
docker build . -f ./docker/Dockerfile --target bsc -t bsc
docker build . -f ./docker/Dockerfile.truffle -t truffle-test
docker-compose -f ./tests/truffle/docker-compose.yml up genesis
docker-compose -f ./tests/truffle/docker-compose.yml up -d bsc-rpc bsc-validator1
docker-compose -f ./tests/truffle/docker-compose.yml up -d bsc-rpc
sleep 30
docker-compose -f ./tests/truffle/docker-compose.yml up --exit-code-from truffle-test truffle-test
docker-compose -f ./tests/truffle/docker-compose.yml down
328 changes: 50 additions & 278 deletions README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions consensus/consensus.go
Original file line number Diff line number Diff line change
@@ -163,4 +163,5 @@ type PoSA interface {
GetFinalizedHeader(chain ChainHeaderReader, header *types.Header) *types.Header
VerifyVote(chain ChainHeaderReader, vote *types.VoteEnvelope) error
IsActiveValidatorAt(chain ChainHeaderReader, header *types.Header, checkVoteKeyFn func(bLSPublicKey *types.BLSPublicKey) bool) bool
SetValidator(validator common.Address)
}
11 changes: 11 additions & 0 deletions consensus/parlia/parlia.go
Original file line number Diff line number Diff line change
@@ -1897,6 +1897,17 @@ func (p *Parlia) GetFinalizedHeader(chain consensus.ChainHeaderReader, header *t
return chain.GetHeader(snap.Attestation.SourceHash, snap.Attestation.SourceNumber)
}

// SetValidator set the validator of parlia engine
// It is used for builder
func (p *Parlia) SetValidator(val common.Address) {
if val == (common.Address{}) {
return
}
p.lock.Lock()
defer p.lock.Unlock()
p.val = val
}

// =========================== utility function ==========================
func (p *Parlia) backOffTime(snap *Snapshot, header *types.Header, val common.Address) uint64 {
if snap.inturn(val) {
2 changes: 1 addition & 1 deletion core/blockchain.go
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@ import (
mapset "github.com/deckarep/golang-set/v2"
exlru "github.com/hashicorp/golang-lru"
"golang.org/x/crypto/sha3"
"golang.org/x/exp/slices"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/lru"
@@ -56,7 +57,6 @@ import (
"github.com/ethereum/go-ethereum/triedb"
"github.com/ethereum/go-ethereum/triedb/hashdb"
"github.com/ethereum/go-ethereum/triedb/pathdb"
"golang.org/x/exp/slices"
)

var (
Loading

0 comments on commit 7ecb12b

Please sign in to comment.