-
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
feat: Trusted auctioneer: Maintain a separate optimistic block fork #3
feat: Trusted auctioneer: Maintain a separate optimistic block fork #3
Conversation
grpc/execution/server.go
Outdated
@@ -231,6 +235,89 @@ func protoU128ToBigInt(u128 *primitivev1.Uint128) *big.Int { | |||
return lo.Add(lo, hi) | |||
} | |||
|
|||
func (s *ExecutionServiceServerV1Alpha2) ExecuteOptimisticBlock(ctx context.Context, req *optimsticPb.BaseBlock) (*astriaPb.Block, error) { |
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.
This will be used in the streamExecuteOptimisticBlock
grpc and we will move it out to its own package when we implement the grpc method.
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 |
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.
We can use this instead of maintaining a separate currentOptimisticBlock
grpc/execution/server.go
Outdated
} | ||
|
||
// Build a payload to add to the chain | ||
payloadAttributes := &miner.BuildPayloadArgs{ |
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.
we would want to validate the transactions before executing them. It might be cheaper than executing the transaction on a VM.
267d68a
to
e786668
Compare
eb28e72
to
c925895
Compare
c85c783
to
fe03e69
Compare
fe03e69
to
9f7886f
Compare
chore: Trusted Auctioneer: update the protos
feat: Trusted Auctioneer: Add initial set of metrics for auctioneer
feat: Trusted Auctioneer: Code cleanups
…-block feat: Trusted Auctioneer: Add API to query the current optimistic block
feat: Trusted Auctioneer: Support unmarshalling signed allocations and placing it at the TOB
feat: Trusted Auctioneer: Add a cmd line flag to run a Flame node in auctioneer mode
refactor: Trusted Auctioneer: Separate execution api service and optimistic execution api service
feat: Trusted Auctioneer: Implement bundle streaming
…ecution feat: Trusted Auctioneer: implement stream execute optimistic block
feat: Trusted Auctioneer: add event which is triggered when the mempool is cleared
feat: Trusted Auctioneer: Clear mempool when mempool state is reset
feat: Trusted auctioneer: use optimistic head event in txpool's maintanance loop
…k-event feat: Trusted auctioneer: Add an event for optimistic head creation
For the trusted auctioneer, we want to maintain two separate forks of the Flame chain:
StreamOptimisticBlock
grpc method.This PR adds support for maintaining an optimistic fork given a
BaseBlock
struct which will be received by the Flame trusted auctioneer via theStreamOptimisticBlock
stream.The following changes have been made:
ExecuteOptimisticBlock
which takes in aBaseBlock
struct and creates an optimistic block which is inserted into the chain.currentOptimisticBlock
pointer incore.Blockchain
which stores a pointer to the header of the current optimistic block. This pointer is updated after an optimistic block is successfully executed inExecuteOptimisticBlock
BuildPayloadArgs
takes an extra parameter calledoverrideTransactions
which is a list of transactions which will be executed overAstriaOrdered
. This will be simpler rather than maintaining a separate mempool list likeAstriaOrdered
for optimistic block transactions. When we are executing the optimistic block we override theoverrideTransactions
list with the list of transactions in our optimistic block. It does not matter to us if the transactions do not execute as they will be removed from the mempool as this block is eventually executed by conductor.IsOptimisticExecution
flag during payload building. If this flag is true, reverting transactions are not removed from the mempool.ExecuteOptimisticBlock
Note: If there are transactions which revert during optimistic execution, we do not care about removing them since they would eventually be removed during the actual block execution which would be done by conductor.