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

Trusted auctioneer #30

Merged
merged 126 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
2c091a2
implement optimistic block execution with tests
bharath-123 Oct 29, 2024
14ecb93
use commitmentUpdateLock when accessing the safe block
bharath-123 Oct 29, 2024
9ffc153
fix test
bharath-123 Oct 29, 2024
d4ed621
add a flag to check if the payload is being built optimistically
bharath-123 Sep 30, 2024
3946bba
add tx validaton to optimistic block execution
bharath-123 Oct 24, 2024
4745feb
take the block execution lock when accessing nextFeeRecipient
bharath-123 Oct 24, 2024
0130470
use v1 protos
bharath-123 Oct 29, 2024
12f933c
acquire fee recipient lock after getting the softblock
bharath-123 Nov 12, 2024
9f7886f
avoid taking block commitment lock when fetching softblock pointer
bharath-123 Nov 20, 2024
a7b1404
add event for optimistic head
bharath-123 Sep 27, 2024
21416ea
add optimistic head subscription method to mempool Blockchain interface
bharath-123 Sep 24, 2024
721ee82
test fixes
bharath-123 Sep 27, 2024
a800a16
use optimistic head event in txpool's maintanance loop
bharath-123 Sep 24, 2024
0fac052
fix tests
bharath-123 Oct 24, 2024
c62b0bd
add logic to clear mempool
bharath-123 Sep 26, 2024
e09cfde
remove invalids
bharath-123 Sep 26, 2024
878c5c0
add comments
bharath-123 Sep 26, 2024
f2fdd0f
remove mempool conditionals
bharath-123 Oct 16, 2024
6a8e446
split out reset logic and head only reset logc
bharath-123 Oct 24, 2024
01be512
ensure that unreserved addresses are removed
bharath-123 Nov 10, 2024
2051f8a
add event for mempool clearance
bharath-123 Nov 10, 2024
864138e
update subscription interfaces
bharath-123 Sep 27, 2024
f7bb86f
fix potential panic while subscribing to mempool clearance
bharath-123 Nov 4, 2024
9a352f1
dont send mempool clearing event while holding mempool lock
bharath-123 Nov 10, 2024
7dc78f5
implement stream execute optimistic block
bharath-123 Oct 29, 2024
f311e0a
unit tests
bharath-123 Nov 4, 2024
b0ec901
use generics to implement mock bi directional stream
bharath-123 Oct 1, 2024
56dc5cd
wip
bharath-123 Oct 16, 2024
98edfc9
use an atomic pointer for sequencer block hash
bharath-123 Oct 29, 2024
c929957
reduce mempool clearing timeout
bharath-123 Oct 24, 2024
a1152d7
fix imports
bharath-123 Oct 29, 2024
17a333c
update grpc method names
bharath-123 Nov 5, 2024
f1356b2
only allow 1 client to be connected to the execute optimistic block s…
bharath-123 Nov 12, 2024
e37bba3
rename executeBlockStreamConnected to executeOptimisticBlockStreamCon…
bharath-123 Nov 12, 2024
db067e1
remove restrictions to allow just one client to connect to the optimi…
bharath-123 Dec 2, 2024
c529b84
implement bundle streaming
bharath-123 Nov 5, 2024
bea3622
update unit tests
bharath-123 Nov 5, 2024
35f3a6c
only send the effective tip as part of the fee
bharath-123 Oct 1, 2024
4b612d6
minor test updates
bharath-123 Oct 16, 2024
5acc678
rename grpc methods
bharath-123 Nov 5, 2024
e57148b
close the bundle stream when client closes the connection
bharath-123 Nov 11, 2024
e4cf569
allow only 1 client to connect to the bundle stream
bharath-123 Dec 2, 2024
f795b75
fix minor error
bharath-123 Dec 2, 2024
0c02e8c
fetch the next fee recipient under the block execution lock
bharath-123 Oct 11, 2024
a5fb8a5
validate txs before optimistically executing them
bharath-123 Oct 16, 2024
a114f0d
support uds endpoints for auctioneer
bharath-123 Oct 16, 2024
edfddc9
remove duplicate code
bharath-123 Oct 24, 2024
12e3ab2
add uds flag to options
bharath-123 Nov 4, 2024
14c097e
separate out execution api services and optimistic execution api serv…
bharath-123 Dec 2, 2024
2f6e1eb
minor updates
bharath-123 Oct 17, 2024
df7504f
minor nits
bharath-123 Oct 17, 2024
128be57
make tests more robust
bharath-123 Oct 17, 2024
99560fa
move BigIntoToProtoU128 to shared test utils
bharath-123 Oct 24, 2024
a62047e
minor updates
bharath-123 Oct 29, 2024
e5065e5
update grpc methods
bharath-123 Nov 5, 2024
0af0e92
close the bundle stream when client closes the connection
bharath-123 Nov 11, 2024
258c8e2
remove UDS references
bharath-123 Nov 12, 2024
54381f4
rename a wrongly renamed word
bharath-123 Nov 12, 2024
f28ac18
re add single client connection checks
bharath-123 Nov 12, 2024
12eec4d
maintain only 1 server instance
bharath-123 Nov 12, 2024
651a6ca
renaming
bharath-123 Nov 20, 2024
9bf573a
remove atomic bools to restrict client connections to 1
bharath-123 Dec 3, 2024
6abc0f4
feature flag auctioneer
bharath-123 Nov 12, 2024
e48458f
add flags
bharath-123 Oct 29, 2024
591e827
save
bharath-123 Nov 12, 2024
7444772
maintain a copy of legacy pool tests to test the cases when auctionee…
bharath-123 Nov 12, 2024
61af0ec
unmarshall auction result
bharath-123 Nov 13, 2024
c4662a7
add signature verification
bharath-123 Nov 13, 2024
64758bb
set the trusted builder public key in genesis
bharath-123 Nov 17, 2024
6985314
add some tests for the auction results
bharath-123 Nov 17, 2024
3661b01
dilineate trusted builder public keys by block number
bharath-123 Nov 19, 2024
9e0e612
renaming
bharath-123 Nov 20, 2024
f4bc725
update protos
bharath-123 Nov 20, 2024
2992b5b
change trusted builder instances to auctioneer
bharath-123 Nov 21, 2024
a82a00e
fix typo
bharath-123 Nov 21, 2024
9809d0c
add an api to query the optimistic block
bharath-123 Nov 20, 2024
e6f1345
support querying optimistic block using the optimistic string
bharath-123 Nov 21, 2024
2561dc3
close the stream when we get the done signal
bharath-123 Nov 27, 2024
df8ead5
add debug logs for when the stream rpcs are called
bharath-123 Dec 3, 2024
7aed2a0
add some logs
bharath-123 Nov 27, 2024
634e962
add some logs
bharath-123 Dec 3, 2024
e5d90d2
use atomic pointer for fee recipient
bharath-123 Dec 3, 2024
9e7abe7
remove unecessary lock
bharath-123 Dec 3, 2024
f7d5584
wrap errors
bharath-123 Dec 3, 2024
1457ce3
buffer the reserved addresses and remove them at once
bharath-123 Jan 3, 2025
b6e5401
avoid cleaning up duplicate addresses
bharath-123 Jan 6, 2025
1cd5701
add metrics
bharath-123 Jan 3, 2025
b555cc9
update depot token
bharath-123 Jan 9, 2025
3284998
add a few debug logs
bharath-123 Jan 10, 2025
17dbebd
update to use new protos
bharath-123 Jan 13, 2025
1c1a935
update protobufs
bharath-123 Jan 13, 2025
5b99a85
Merge pull request #28 from astriaorg/bharath/update-protos
bharath-123 Jan 13, 2025
d5628b5
Merge pull request #25 from astriaorg/bharath/add-auctioneer-metrics
bharath-123 Jan 13, 2025
e49d7f4
Merge pull request #24 from astriaorg/bharath/code-cleanups
bharath-123 Jan 13, 2025
98e817c
Merge pull request #22 from astriaorg/bharath/api-to-query-optimistic…
bharath-123 Jan 13, 2025
2b9a863
Merge pull request #21 from astriaorg/bharath/auction-result
bharath-123 Jan 13, 2025
e384e18
Merge pull request #17 from astriaorg/bharath/feature-flag-auctioneer
bharath-123 Jan 13, 2025
9a7f5ad
Merge pull request #16 from astriaorg/bharath/refactor-services
bharath-123 Jan 13, 2025
43fdcea
Merge pull request #12 from astriaorg/bharath/implement-bundle-streaming
bharath-123 Jan 13, 2025
9496cb9
Merge pull request #11 from astriaorg/bharath/implement-optimistic-ex…
bharath-123 Jan 13, 2025
41fb511
Merge pull request #9 from astriaorg/bharath/add-mempool-clearing-event
bharath-123 Jan 13, 2025
11cebfd
Merge pull request #8 from astriaorg/bharath/clear-mempool
bharath-123 Jan 13, 2025
19f8867
Merge pull request #7 from astriaorg/bharath/use-optimistic-fork-event
bharath-123 Jan 13, 2025
2e26e91
Merge pull request #4 from astriaorg/bharath/implement-optimistic-for…
bharath-123 Jan 13, 2025
0e1b4a1
Merge pull request #3 from astriaorg/bharath/implement-optimistic-for…
bharath-123 Jan 13, 2025
211b66d
add auctioneer start height
bharath-123 Jan 14, 2025
805e73c
pick the auctioneer start height to be the height at which the first …
bharath-123 Jan 14, 2025
ff39ee3
Merge pull request #34 from astriaorg/bharath/ignore-allocation-befor…
bharath-123 Jan 14, 2025
68ef31c
multiply effective tip with gas used
bharath-123 Jan 14, 2025
d9af4a0
address review comment
bharath-123 Jan 15, 2025
bb12dfa
Merge pull request #36 from astriaorg/bharath/fix-tip-fee-calc
bharath-123 Jan 15, 2025
eff4025
send metadata on bid stream initialization
bharath-123 Jan 16, 2025
cf81f29
Merge pull request #37 from astriaorg/bharath/send-metadata-on-bidstr…
bharath-123 Jan 16, 2025
950959b
update logs
bharath-123 Jan 16, 2025
c83e52d
remove sending init msg
bharath-123 Jan 16, 2025
eb499c6
some code cleanups
bharath-123 Jan 17, 2025
6d906bf
add comment
bharath-123 Jan 17, 2025
af08e5b
minor refactoring
bharath-123 Jan 17, 2025
9fdd7a1
minor updates
bharath-123 Jan 18, 2025
defc35b
address review comments
bharath-123 Feb 3, 2025
89b70aa
add a debug log while streaming bid
bharath-123 Feb 4, 2025
c969f99
address review comments 2
bharath-123 Feb 5, 2025
23a2bd7
address review comments
bharath-123 Feb 10, 2025
eface0f
handle error when sending execute optimistic block stream response
bharath-123 Feb 10, 2025
4352912
fix linting errors
bharath-123 Feb 10, 2025
1bcfa46
add some logging
bharath-123 Feb 10, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/astria-build-and-publish-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ jobs:
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
project: w2d6w0spqz
project: w2d6w0spqz
2 changes: 2 additions & 0 deletions cmd/devp2p/internal/ethtest/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func TestEthSuite(t *testing.T) {
if err != nil {
t.Fatalf("could not create new test suite: %v", err)
}

for _, test := range suite.EthTests() {
t.Run(test.Name, func(t *testing.T) {
if test.Slow && testing.Short() {
Expand Down Expand Up @@ -149,5 +150,6 @@ func setupGeth(stack *node.Node, dir string) error {
return fmt.Errorf("failed to register catalyst service: %v", err)
}
_, err = backend.BlockChain().InsertChain(chain.blocks[1:])
backend.BlockChain().SetOptimistic(chain.blocks[len(chain.blocks)-1])
return err
}
13 changes: 10 additions & 3 deletions cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (
"errors"
"fmt"
"github.com/ethereum/go-ethereum/eth/catalyst"
"github.com/ethereum/go-ethereum/grpc/optimistic"
"github.com/ethereum/go-ethereum/grpc/shared"
"os"
"reflect"
"runtime"
Expand Down Expand Up @@ -206,11 +208,16 @@ func makeFullNode(ctx *cli.Context) *node.Node {

// Configure gRPC if requested.
if ctx.IsSet(utils.GRPCEnabledFlag.Name) {
serviceV1, err := execution.NewExecutionServiceServerV1(eth)
sharedService, err := shared.NewSharedServiceContainer(eth)
if err != nil {
utils.Fatalf("failed to create execution service: %v", err)
utils.Fatalf("failed to create shared service container: %v", err)
}
utils.RegisterGRPCExecutionService(stack, serviceV1, &cfg.Node)

serviceV1a2 := execution.NewExecutionServiceServerV1(sharedService)

auctionServiceV1Alpha1 := optimistic.NewAuctionServiceV1Alpha1(sharedService)

utils.RegisterGRPCServices(stack, serviceV1a2, auctionServiceV1Alpha1, auctionServiceV1Alpha1, &cfg.Node)
Copy link
Member

Choose a reason for hiding this comment

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

Why does this take the auctionServiceV1Alpha1 twice?

Should we make this one parameter into RegisterGRPCServices OR split these up into independent services?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah so it takes in the optimistic execution service and also the auction service both of which have been implemented by the AuctionServiceV1Alpha1. I don't think we should make them one parameter but we should in the future split them into independent services. I didn't split them now because their functionality didnt seem big enough to warrant separate services. but a good idea to keep this in mind going forward.

}

// Add the Ethereum Stats daemon if requested.
Expand Down
1 change: 1 addition & 0 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ var (
utils.MinerRecommitIntervalFlag,
utils.MinerPendingFeeRecipientFlag,
utils.MinerNewPayloadTimeoutFlag, // deprecated
utils.AuctioneerEnabledFlag,
utils.NATFlag,
utils.NoDiscoverFlag,
utils.DiscoveryV4Flag,
Expand Down
18 changes: 15 additions & 3 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"strings"
"time"

auctionGrpc "buf.build/gen/go/astria/execution-apis/grpc/go/astria/auction/v1alpha1/auctionv1alpha1grpc"
astriaGrpc "buf.build/gen/go/astria/execution-apis/grpc/go/astria/execution/v1/executionv1grpc"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/accounts/keystore"
Expand Down Expand Up @@ -769,6 +770,13 @@ var (
Category: flags.APICategory,
}

// auctioneer
AuctioneerEnabledFlag = &cli.BoolFlag{
Name: "auctioneer",
Usage: "Enable the auctioneer server",
Category: flags.MinerCategory,
}

// Network Settings
MaxPeersFlag = &cli.IntFlag{
Name: "maxpeers",
Expand Down Expand Up @@ -1438,6 +1446,10 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
SetDataDir(ctx, cfg)
setSmartCard(ctx, cfg)

if ctx.IsSet(AuctioneerEnabledFlag.Name) {
cfg.EnableAuctioneer = ctx.Bool(AuctioneerEnabledFlag.Name)
}

if ctx.IsSet(JWTSecretFlag.Name) {
cfg.JWTSecret = ctx.String(JWTSecretFlag.Name)
}
Expand Down Expand Up @@ -1987,10 +1999,10 @@ func RegisterGraphQLService(stack *node.Node, backend ethapi.Backend, filterSyst
}
}

// RegisterGRPCExecutionService adds the gRPC API to the node.
// RegisterGRPCServices adds the gRPC API to the node.
// It was done this way so that our grpc execution server can access the ethapi.Backend
func RegisterGRPCExecutionService(stack *node.Node, execServ astriaGrpc.ExecutionServiceServer, cfg *node.Config) {
if err := node.NewGRPCServerHandler(stack, execServ, cfg); err != nil {
func RegisterGRPCServices(stack *node.Node, execServ astriaGrpc.ExecutionServiceServer, optimisticExecutionServ auctionGrpc.OptimisticExecutionServiceServer, auctionServiceServer auctionGrpc.AuctionServiceServer, cfg *node.Config) {
Copy link
Member

Choose a reason for hiding this comment

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

The optimisticExecutionServ and auctionServiceServer are always the same object here, couple other notes in here but preference for keeping the params to minimum needed?

At some point it might make sense to have a struct for the servers/services that we add to instead of growing param list.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes RegisterGRPCServices should take in a struct. we should add these to the list of refactoring things we can do on flame. We should also understand the future scope of auctioneer and the changes we want to make to flame and refactor accordingly.

if err := node.NewGRPCServerHandler(stack, execServ, optimisticExecutionServ, auctionServiceServer, cfg); err != nil {
Fatalf("Failed to register the gRPC service: %v", err)
}
}
Expand Down
54 changes: 36 additions & 18 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@ import (
)

var (
headBlockGauge = metrics.NewRegisteredGauge("chain/head/block", nil)
headHeaderGauge = metrics.NewRegisteredGauge("chain/head/header", nil)
headFastBlockGauge = metrics.NewRegisteredGauge("chain/head/receipt", nil)
headFinalizedBlockGauge = metrics.NewRegisteredGauge("chain/head/finalized", nil)
headSafeBlockGauge = metrics.NewRegisteredGauge("chain/head/safe", nil)
headBlockGauge = metrics.NewRegisteredGauge("chain/head/block", nil)
headHeaderGauge = metrics.NewRegisteredGauge("chain/head/header", nil)
headFastBlockGauge = metrics.NewRegisteredGauge("chain/head/receipt", nil)
headFinalizedBlockGauge = metrics.NewRegisteredGauge("chain/head/finalized", nil)
headSafeBlockGauge = metrics.NewRegisteredGauge("chain/head/safe", nil)
headOptimisticBlockGauge = metrics.NewRegisteredGauge("chain/head/optimistic", nil)

chainInfoGauge = metrics.NewRegisteredGaugeInfo("chain/info", nil)

Expand Down Expand Up @@ -219,24 +220,26 @@ type BlockChain struct {
stateCache state.Database // State database to reuse between imports (contains state cache)
txIndexer *txIndexer // Transaction indexer, might be nil if not enabled

hc *HeaderChain
rmLogsFeed event.Feed
chainFeed event.Feed
chainSideFeed event.Feed
chainHeadFeed event.Feed
logsFeed event.Feed
blockProcFeed event.Feed
scope event.SubscriptionScope
genesisBlock *types.Block
hc *HeaderChain
rmLogsFeed event.Feed
chainFeed event.Feed
chainSideFeed event.Feed
chainHeadFeed event.Feed
chainOptimisticHeadFeed event.Feed
logsFeed event.Feed
blockProcFeed event.Feed
scope event.SubscriptionScope
genesisBlock *types.Block

// This mutex synchronizes chain write operations.
// Readers don't need to take it, they can just read the database.
chainmu *syncx.ClosableMutex

currentBlock atomic.Pointer[types.Header] // Current head of the chain
currentSnapBlock atomic.Pointer[types.Header] // Current head of snap-sync
currentFinalBlock atomic.Pointer[types.Header] // Latest (consensus) finalized block
currentSafeBlock atomic.Pointer[types.Header] // Latest (consensus) safe block
currentBlock atomic.Pointer[types.Header] // Current head of the chain
currentSnapBlock atomic.Pointer[types.Header] // Current head of snap-sync
currentFinalBlock atomic.Pointer[types.Header] // Latest (consensus) finalized block
currentSafeBlock atomic.Pointer[types.Header] // Latest (consensus) safe block
currentOptimisticBlock atomic.Pointer[types.Header] // Latest optimistic block
Comment on lines +238 to +242
Copy link
Contributor

Choose a reason for hiding this comment

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

why do you need to add currentOptimisticBlock over just setting the optimistic block as the head? the existing structures is able to handle forks, in the case the head block changes to a different block. astria only really uses safe/final anyways, so it seems easier to just use head for optimistic

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we update the currentBlock and currentSnapBlock during SetCanonical when we call UpdateCommitmentState. And each time we update the head, we update the blockchain state on top of which the legacy mempool validates it txs.
For the auctioneer flame node, we want to ensure that the legacy mempool validates its txs on the state of the given optimistic block at any given time. This means that when we execute an optimistic block, we need to update the blockchain state referenced in the legacy mempool.
I believe if we set it as head, we end up updating the legacy mempool state twice, once when the optimistic block is executed and twice when the update commitment state is called.
Plus i think we wouldn't be able to distinguish in code whether the head was updated due to an optimistic block execution or an update commitment state and that might be needed in some cases going forward?

Copy link
Member

Choose a reason for hiding this comment

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

I think this ties back to how having conductor do this could simplify, basically if conductor ran here, the head would always be the most recent block, however because they are seperate services executing against the same box we need this seperate tracker?


currentBaseCelestiaHeight atomic.Uint64 // Latest finalized block height on Celestia

Expand Down Expand Up @@ -325,6 +328,7 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis
bc.currentBlock.Store(bc.genesisBlock.Header())
bc.currentFinalBlock.Store(bc.genesisBlock.Header())
bc.currentSafeBlock.Store(bc.genesisBlock.Header())
bc.currentOptimisticBlock.Store(bc.genesisBlock.Header())
bc.currentBaseCelestiaHeight.Store(bc.Config().AstriaCelestiaInitialHeight)

// Update chain info data metrics
Expand Down Expand Up @@ -532,6 +536,7 @@ func (bc *BlockChain) loadLastState() error {
bc.currentFinalBlock.Store(block.Header())
headFinalizedBlockGauge.Update(int64(block.NumberU64()))
bc.currentSafeBlock.Store(block.Header())
bc.currentOptimisticBlock.Store(block.Header())
headSafeBlockGauge.Update(int64(block.NumberU64()))
}
}
Expand Down Expand Up @@ -639,6 +644,19 @@ func (bc *BlockChain) SetSafe(header *types.Header) {
}
}

// SetOptimistic sets the optimistic block.
func (bc *BlockChain) SetOptimistic(block *types.Block) {
header := block.Header()
bc.currentOptimisticBlock.Store(header)
if header != nil {
headOptimisticBlockGauge.Update(int64(header.Number.Uint64()))
} else {
headOptimisticBlockGauge.Update(0)
}

bc.chainOptimisticHeadFeed.Send(ChainOptimisticHeadEvent{Block: block})
}

// rewindHashHead implements the logic of rewindHead in the context of hash scheme.
func (bc *BlockChain) rewindHashHead(head *types.Header, root common.Hash) (*types.Header, uint64) {
var (
Expand Down
11 changes: 11 additions & 0 deletions core/blockchain_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ func (bc *BlockChain) CurrentSafeBlock() *types.Header {
return bc.currentSafeBlock.Load()
}

// CurrentOptimisticBlock retrieves the current optimistic block of the canonical
// chain. The block is retrieved from the blockchain's internal cache.
func (bc *BlockChain) CurrentOptimisticBlock() *types.Header {
return bc.currentOptimisticBlock.Load()
}

// CurrentBaseCelestiaHeight retrieves the current base celestia height of the
// canonical chain. The height is retrieved from the blockchain's internal cache.
func (bc *BlockChain) CurrentBaseCelestiaHeight() uint64 {
Expand Down Expand Up @@ -439,6 +445,11 @@ func (bc *BlockChain) SubscribeChainHeadEvent(ch chan<- ChainHeadEvent) event.Su
return bc.scope.Track(bc.chainHeadFeed.Subscribe(ch))
}

// SubscribeChainOptimisticHeadEvent registers a subscription of ChainOptimisticHeadEvent.
func (bc *BlockChain) SubscribeChainOptimisticHeadEvent(ch chan<- ChainOptimisticHeadEvent) event.Subscription {
return bc.scope.Track(bc.chainOptimisticHeadFeed.Subscribe(ch))
}

// SubscribeChainSideEvent registers a subscription of ChainSideEvent.
func (bc *BlockChain) SubscribeChainSideEvent(ch chan<- ChainSideEvent) event.Subscription {
return bc.scope.Track(bc.chainSideFeed.Subscribe(ch))
Expand Down
10 changes: 10 additions & 0 deletions core/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ import (
// NewTxsEvent is posted when a batch of transactions enter the transaction pool.
type NewTxsEvent struct{ Txs []*types.Transaction }

// NewMempoolClearedEvent is posted when the mempool is cleared after a head reset for trusted auctioneer
type NewMempoolCleared struct {
// the new head to which the mempool state was reset to before clearing the mempool
NewHead *types.Header
}

// NewMinedBlockEvent is posted when a block has been imported.
type NewMinedBlockEvent struct{ Block *types.Block }

Expand All @@ -41,3 +47,7 @@ type ChainSideEvent struct {
}

type ChainHeadEvent struct{ Block *types.Block }

type ChainOptimisticHeadEvent struct {
Block *types.Block
}
5 changes: 5 additions & 0 deletions core/txpool/blobpool/blobpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ func (p *BlobPool) ClearAstriaOrdered() {}
func (p *BlobPool) AddToAstriaExcludedFromBlock(*types.Transaction) {}
func (p *BlobPool) AstriaExcludedFromBlock() *types.Transactions { return &types.Transactions{} }
func (p *BlobPool) AstriaOrdered() *types.Transactions { return &types.Transactions{} }
func (p *BlobPool) ValidateTx(tx *types.Transaction) error { return nil }

// Filter returns whether the given transaction can be consumed by the blob pool.
func (p *BlobPool) Filter(tx *types.Transaction) bool {
Expand Down Expand Up @@ -1601,6 +1602,10 @@ func (p *BlobPool) SubscribeTransactions(ch chan<- core.NewTxsEvent, reorgs bool
}
}

func (p *BlobPool) SubscribeMempoolClearance(ch chan<- core.NewMempoolCleared) event.Subscription {
return nil
}

// Nonce returns the next nonce of an account, with all transactions executable
// by the pool already applied on top.
func (p *BlobPool) Nonce(addr common.Address) uint64 {
Expand Down
Loading