-
Notifications
You must be signed in to change notification settings - Fork 146
Conversation
cc @pipermerriam for some context on beam sync |
@@ -148,7 +155,7 @@ def load_mining_chain(db): | |||
|
|||
return build( | |||
FakeAsyncChain, | |||
byzantium_at(0), | |||
petersburg_at(0), |
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.
side note
Might be nice to have a latest_mainnet_fork_at
that keeps us from having to propagate these updates through the codebase.
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.
😎
May be irrelevant depending on how you're refactoring but I ran into this last night. |
Maybe you weren't using the branch of py-evm from ethereum/py-evm#1783 ? |
Yup, wrong py-evm branch. I clearely didn't look at that stack trace very closely because when I posted I thought it was trinity code... |
trinity/sync/beam/chain.py
Outdated
self._transaction_completed[block.hash] = {} | ||
for txn_idx in range(len(block.transactions)): | ||
self._transaction_completed[block.hash][txn_idx] = asyncio.Event() | ||
self._state_downloader.run_task(self._speculate_transaction(txn_idx, block)) |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Whelp, cut the PR down from +2.?k lines to +1.4k. -4 lines, lol Currently failing the beam sync tests because I haven't updated to the new request server and peer pool approach in I know it's huge. Sorry. Open to more ideas on how to break this up. |
@pipermerriam okay, everything's passing. No major updates on functionality since the last run-through, just been working on getting it merge-ready. Can you take a look? The biggest flaw right now is the uncle validation handling. It dies if you try syncing to a block with an uncle right now. It's fixable, but I think the fix belongs in its own PR, since this one is already huge. |
Okay, this one is really, actually passing this time. (Well it was before, but stochastically) |
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.
Frankly, this is large enough that I'm good moving it forward however you see fit and we can address any architectural issues iteratively. It's kind of in that "too big" range where I'm mostly inclined to trust you under the premise that I'll grow to understand it over time and we'll probably end up re-writing every piece of this iteratively both as it evolves and as we migrate to trio
.
Ok, cool. Totally understood. I'll see if I can pair review with @lithp for a bit for a second look. The good news is that everything is behind an opt-in sync-mode flag, so it's pretty low risk, even going into a release as-is. |
Also from pair review with Brian:
|
Beam sync will fail if any of the first 6 blocks have uncles. A solution for that is in progress and will be posted shortly.
HUZZAH! |
What was wrong?
It takes too long to sync. Beam sync is an experiment to see if we can direct fast sync to choose the nodes we need in order to execute the latest blocks in the chain. If we can download the needed state fast enough, then we can keep up with the tip of the chain as soon as we find the right header tip. (Right now, we still have to commit all headers before starting beam sync, which would become the new longest part of sync).
How was it fixed?
Depends on ethereum/py-evm#1783
A lot of hacked stuff. This is never intended to be merged as is, except for a few pieces that I'll split off to independent PRs. It's got some horrendous code, that was just built for prototyping. The reason for publishing the PR is to provide some context to where Beam Sync is headed.
There is a beam sync test added, with a custom database. That should likely make it into a final Beam Sync PR.
Next steps are to re-implement in a different approach: Subclass VM, catch exceptions while getting state, pause execution until the state is added to the DB, then resume. That should provide some speed benefits, plus require less custom stuff in py-evm (like
MidBlockState
).Ripping pieces out, into:
TODO
verify_uncles=False
flagBeamSyncService
needs theevent_bus
Probably later, at least write up an issue:
move beam syncrun_in_executor
to its own process instead of thread? (not critical, because only one block imported at a time right now)Cute Animal Picture