-
Notifications
You must be signed in to change notification settings - Fork 184
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
implement sequencing #2332
base: main
Are you sure you want to change the base?
implement sequencing #2332
Conversation
e9ccfc0
to
f91febd
Compare
44e8796
to
be21143
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2332 +/- ##
==========================================
- Coverage 74.41% 70.53% -3.88%
==========================================
Files 109 116 +7
Lines 11493 13280 +1787
==========================================
+ Hits 8552 9367 +815
- Misses 2277 3091 +814
- Partials 664 822 +158 ☔ View full report in Codecov by Sentry. |
8706311
to
8f5f4b6
Compare
@@ -6,6 +6,7 @@ build/ | |||
coverage/* | |||
config/ | |||
.envrc | |||
.python-version |
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.
what is .python-version
?
func New(poolDB db.DB) *Pool { | ||
return &Pool{ | ||
db: poolDB, | ||
validator: func(_ *BroadcastedTransaction) error { return nil }, | ||
txPushed: make(chan struct{}, 1), | ||
} | ||
} |
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 is an example of what we talked in the daily regarding escape analysis. When returning a reference to Pool
you are allocating it into the the heap, if you change the result to Pool
it will be stored in the stack.
You can see the escape analysis made by the compiler using this command
go build -gcflags="-m" ./mempool/mempool.go
Which will show a line like this in the output:
...
... some compiler analysis
...
mempool/mempool.go:39:9: &Pool{...} escapes to heap
...
... other variables that escape or not
...
This PR can be broken down as follows:
mempool
pkg: this pkg is responsible for storing incoming transactions in a persistent (so users don't have to resubmit their txns if there's a crash) linked list. Transactions come into themempool
from theAddTransaction
rpc handler, and leave whenbuilder
callsPop
on the mempool.genesis
pkg: this pkg is essentially responsible for constructing a state-diff that can be used to bootstrap the network at block 0. For example, users can specify the set of classes they want to be declared (eg accounts / tokens), to deploy instances of those classes, and then to invoke contract functions (eg transfer funds) defined in the deployed contracts. We also allow users to specify transactions to be executed when building this state-diff. Currently,genesis_prefund_accounts.json
will declare & deploy a token contract, pre-funded account contracts and the universal-deplorer contract. This allows the Juno sequencer to be used as a devnet.builder
pkg: this is where all the sequencing magic happens. The main entry point is Run. There are two modes of operation, "sequencer" and "shadow" mode. The normal "sequencer" mode just continuously pops transactions from the mempool (if they are present), executes them, and builds the block from the resulting traces. Every N seconds, the builder will stop executing transactions, and Finalise the block. The purpose of the "shadow" mode is to verify that the Juno sequencer can replicate the Sepolia network via re-execution. It pulls Sepolia blocks from the feeder-gateway, re-executes them, builds the traces, and verifies that there is an exact match between the sequenced block and the Sepolia block before adding the block to the chain. Note that shadowing is very sensitive to the block version, andblockifier
version, and was only tested on 0.12.3 blocks.This PR will be broken down as follows: