Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

builder: implement BEP322 builder-api #7

Merged
merged 6 commits into from
Mar 13, 2024
Merged

builder: implement BEP322 builder-api #7

merged 6 commits into from
Mar 13, 2024

Conversation

Pythonberg1997
Copy link
Collaborator

@Pythonberg1997 Pythonberg1997 commented Jan 22, 2024

Description

This pr is to implement the BEP322 builder-api.

This project represents a minimal implementation of the protocol and is provided as is. We make no guarantees regarding its functionality or security.

See also: bnb-chain/BEPs#322

Rationale

tell us why we need these changes...

Example

add an example CLI or API response...

Changes

Notable changes:

  • implement BEP322 builder-api

consensus/consensus.go Outdated Show resolved Hide resolved
core/types/bid.go Outdated Show resolved Hide resolved
eth/api_backend.go Outdated Show resolved Hide resolved
miner/bidder.go Outdated Show resolved Hide resolved
miner/worker.go Outdated Show resolved Hide resolved
miner/worker.go Outdated Show resolved Hide resolved
miner/worker_builder.go Outdated Show resolved Hide resolved
miner/worker_builder.go Outdated Show resolved Hide resolved
miner/bidder.go Outdated Show resolved Hide resolved
miner/bidder.go Outdated Show resolved Hide resolved
eth/handler.go Outdated
@@ -84,10 +83,16 @@ type txPool interface {
// Add should add the given transactions to the pool.
Add(txs []*txpool.Transaction, local bool, sync bool) []error

// AddBundle should add the given bundle to the pool.
AddBundle(bundle *types.Bundle) error

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, the two interface here seems useless

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

func (b *EthAPIBackend) SendBundle(ctx context.Context, bundle *types.Bundle) error {
	return b.eth.txPool.AddBundle(bundle)
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems useless, the caller does not from interface, I'll remove it

miner/bidder.go Outdated Show resolved Hide resolved
core/types/bid.go Outdated Show resolved Hide resolved
miner/bidder.go Outdated Show resolved Hide resolved
miner/bidder.go Outdated Show resolved Hide resolved
miner/bidder.go Outdated Show resolved Hide resolved
miner/bidder.go Outdated Show resolved Hide resolved
return e.Code
}

func (s *IssueAPI) ReportIssue(ctx context.Context, args IssueArgs) error {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In most case, issue is bid about, tx error or gas error whatever. If mev is not runnig, sendBid would directly return err

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so I'll delete this API

miner/bidder.go Outdated
case work := <-b.newBidCh:
if work.header.Number.Int64() > currentHeight {
bidNum = 0
bidUntil = time.Unix(int64(work.header.Time+b.chain.Config().Parlia.Period-b.config.DelayLeftOver), 0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

worker.header.Time has already added period

* 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
@irrun irrun merged commit 884dad6 into develop Mar 13, 2024
6 checks passed
@irrun irrun deleted the BEP-322 branch March 13, 2024 09:06
irrun added a commit that referenced this pull request Apr 1, 2024
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants