-
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
Str 304 migrate prover guest code #339
Draft
prajwolrg
wants to merge
18
commits into
main
Choose a base branch
from
STR-304-migrate-prover-guest-code
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
045c043
feat: sync with cl guest code
MdTeach 7901583
--amend
MdTeach 5dcc926
Add get_last_checkpoint to checkpoint manager
2601881
functional test sh update
MdTeach 4d159b2
Merge branch 'STR-304-migrate-prover-guest-code' of github.com:alpenl…
MdTeach c1df259
functional test env eval done
MdTeach f8345a7
prover manager cl deps tracking done
MdTeach 7bf30a9
refactor prover client proof -> proofwithvkey
MdTeach 1f06aed
prover client works for the cl block
MdTeach b394c89
prover manager cl batch refactor
MdTeach f7d731f
prover manager l1 block dispatch
MdTeach ea700c2
prover client l1 agg scheduler
MdTeach b4e3de2
prover client agg proof scheduler
MdTeach ab310db
prover manager el->cl->cl_agg works on sp1
MdTeach 629dd33
prover manager l1 blocks proof
MdTeach bb921d7
prover manager l1 blocks -> l1 batch sp1
MdTeach f97f7fe
lint fix
MdTeach feae6b4
prover manager task logging
MdTeach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,5 @@ | ||
// Number of prover workers to spawn | ||
pub const NUM_PROVER_WORKER: usize = 10; | ||
pub const NUM_PROVER_WORKERS: usize = 5; | ||
|
||
// Wait time in seconds for the prover manager loop, in seconds | ||
pub const PROVER_MANAGER_WAIT_TIME: u64 = 5; | ||
|
||
// Interval between dispatching block proving tasks, in seconds | ||
pub const BLOCK_PROVING_TASK_DISPATCH_INTERVAL: u64 = 1; | ||
|
||
// Starting block height for EL block proving tasks | ||
pub const EL_START_BLOCK_HEIGHT: u64 = 1; | ||
// Wait time in seconds for the prover manager loop | ||
pub const PROVER_MANAGER_INTERVAL: u64 = 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
use std::{fmt::Debug, sync::Arc}; | ||
|
||
use tracing::info; | ||
use uuid::Uuid; | ||
|
||
use crate::{errors::ProvingTaskError, proving_ops::ops::ProvingOperations, task::TaskTracker}; | ||
|
||
/// Generic dispatcher for block proving tasks. | ||
#[derive(Debug, Clone)] | ||
pub struct TaskDispatcher<O> | ||
where | ||
O: ProvingOperations, | ||
{ | ||
operations: O, | ||
task_tracker: Arc<TaskTracker>, | ||
} | ||
|
||
impl<O> TaskDispatcher<O> | ||
where | ||
O: ProvingOperations + Clone + Send + Sync + 'static, | ||
O::Params: Debug + Clone, | ||
{ | ||
/// Creates a new task dispatcher. | ||
pub fn new(operations: O, task_tracker: Arc<TaskTracker>) -> Self { | ||
Self { | ||
operations, | ||
task_tracker, | ||
} | ||
} | ||
|
||
/// Creates a proving task for the given params. | ||
pub async fn create_task(&self, param: O::Params) -> Result<Uuid, ProvingTaskError> { | ||
info!( | ||
"Creating proving task for block {:?} {:?}", | ||
param, | ||
self.operations.block_type() | ||
); | ||
let input = self | ||
.operations | ||
.fetch_input(param.clone()) | ||
.await | ||
.map_err(|e| ProvingTaskError::FetchInput { | ||
param: format!("{:?}", param), | ||
task_type: self.operations.block_type(), | ||
source: e, | ||
})?; | ||
self.operations | ||
.append_task(self.task_tracker.clone(), input) | ||
.await | ||
} | ||
|
||
pub fn task_tracker(&self) -> Arc<TaskTracker> { | ||
self.task_tracker.clone() | ||
} | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm not sure if I'm reading how this is used correctly but this seems like a bit of a red flag on how this type is designed. It looks like simultaneously it's trying to be both a handle for dispatching tasks and also a OO-style worker type that you run. This is a red flag because
.start()
is being called on the same (cloned) instances that are being called with.create_task
in theRpcContext
type. So what's actually the data flow supposed to look like here?As it seems, there's sorta spooky action at a distance. In
.start()
, we loop and try to spontaneously start new jobs at what happens to be the same rate as blocks are being produced. This should work, but if something breaks elsewhere then we break ourselves. We should only try to start generating the proofs when we know that we're probably going to do it successfully. Just trying to do it at a fixed interval is not robust because there's inevitably going to be some clock skew that happens and would cause spurious errors (because the data wasn't ready when we tried to star the work) or adds latency (because our clock phase shifted).Should split out the
.start()
function to be a toplevel function that takes the dispatcher state and the input as separate arguments. Then we could have a builder that launches the dispatcher in the background and returns the handle used to communicate with the worker. Then that handle is what would actually be used to submit work items to the dispatcher, from something else that's more closely following what we're waiting on to produce proofs.Did I make sense there?