-
Notifications
You must be signed in to change notification settings - Fork 0
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
Changes from all commits
2c091a2
14ecb93
9ffc153
d4ed621
3946bba
4745feb
0130470
12f933c
9f7886f
a7b1404
21416ea
721ee82
a800a16
0fac052
c62b0bd
e09cfde
878c5c0
f2fdd0f
6a8e446
01be512
2051f8a
864138e
f7bb86f
9a352f1
7dc78f5
f311e0a
b0ec901
56dc5cd
98edfc9
c929957
a1152d7
17a333c
f1356b2
e37bba3
db067e1
c529b84
bea3622
35f3a6c
4b612d6
5acc678
e57148b
e4cf569
f795b75
0c02e8c
a5fb8a5
a114f0d
edfddc9
12e3ab2
14c097e
2f6e1eb
df7504f
128be57
99560fa
a62047e
e5065e5
0af0e92
258c8e2
54381f4
f28ac18
12eec4d
651a6ca
9bf573a
6abc0f4
e48458f
591e827
7444772
61af0ec
c4662a7
64758bb
6985314
3661b01
9e0e612
f4bc725
2992b5b
a82a00e
9809d0c
e6f1345
2561dc3
df8ead5
7aed2a0
634e962
e5d90d2
9e7abe7
f7d5584
1457ce3
b6e5401
1cd5701
b555cc9
3284998
17dbebd
1c1a935
5b99a85
d5628b5
e49d7f4
98e817c
2b9a863
e384e18
9a7f5ad
43fdcea
9496cb9
41fb511
11cebfd
19f8867
2e26e91
0e1b4a1
211b66d
805e73c
ff39ee3
68ef31c
d9af4a0
bb12dfa
eff4025
cf81f29
950959b
c83e52d
eb499c6
6d906bf
af08e5b
9fdd7a1
defc35b
89b70aa
c969f99
23a2bd7
eface0f
4352912
1bcfa46
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" | ||
|
@@ -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", | ||
|
@@ -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) | ||
} | ||
|
@@ -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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The At some point it might make sense to have a struct for the servers/services that we add to instead of growing param list. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes |
||
if err := node.NewGRPCServerHandler(stack, execServ, optimisticExecutionServ, auctionServiceServer, cfg); err != nil { | ||
Fatalf("Failed to register the gRPC service: %v", err) | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
|
||
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do you need to add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we update the There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
||
|
@@ -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 | ||
|
@@ -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())) | ||
} | ||
} | ||
|
@@ -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 ( | ||
|
There was a problem hiding this comment.
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?There was a problem hiding this comment.
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.