-
Notifications
You must be signed in to change notification settings - Fork 2
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-799: Upgrade CL guest code to prove range of N blocks #563
base: main
Are you sure you want to change the base?
Conversation
befae62
to
5509e46
Compare
5509e46
to
871160f
Compare
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.
Looks good, main issue is that error handling should be a little more deliberate instead of panicking if things seem wrong. I know a lot of this was written with .expect
in places but since we're in here making changes to related code we have good reason to clean it up a bit more.
871160f
to
f75932e
Compare
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.
Still not really happy with the name "operators" it kinda doesn't make sense and it's sorta an overloaded term. A term like "controller" or "dispatcher" or even maybe just "adaptor" makes a lot more sense to me.
f842bf3
to
391f71c
Compare
391f71c
to
1a74eaa
Compare
1a74eaa
to
ad3a19b
Compare
/// Retrieves the [`L2BlockId`] for the given `block_num` | ||
pub async fn get_l2id(&self, block_num: u64) -> Result<L2BlockId, ProvingTaskError> { | ||
let l2_headers = self | ||
.cl_client | ||
.get_headers_at_idx(block_num) | ||
.await | ||
.inspect_err(|_| error!(%block_num, "Failed to fetch l2_headers")) | ||
.map_err(|e| ProvingTaskError::RpcError(e.to_string()))?; | ||
|
||
let headers = l2_headers.ok_or_else(|| { | ||
error!(%block_num, "Failed to fetch L2 block"); | ||
ProvingTaskError::InvalidWitness(format!("Invalid L2 block height {}", block_num)) | ||
})?; | ||
|
||
let first_header: Buf32 = headers | ||
.first() | ||
.ok_or_else(|| { | ||
ProvingTaskError::InvalidWitness(format!("Invalid L2 block height {}", block_num)) | ||
})? | ||
.block_id | ||
.into(); | ||
|
||
Ok(first_header.into()) | ||
} | ||
|
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 should be part of CL Operator.
.context(); | ||
|
||
// Doing the manual block idx to id transformation. Will be removed once checkpoint_info | ||
// include the range interms of block_id. |
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.
typo: interms in terms
/// Maximum number of blocks allowed in a proving range. | ||
/// | ||
/// This constant serves as a safety limit to prevent proving tasks from processing | ||
/// an excessively large number of blocks. If the number of blocks to prove exceeds | ||
/// this limit, the task will be aborted early. | ||
pub const MAX_PROVING_BLOCK_RANGE: u64 = 1024; |
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.
Does it make sense it to be passed as an argument? I don't have a strong opinion on this. Also let's add a rationale for using 1024
instead of other number.
None => return Ok(None), | ||
}; | ||
|
||
async fn get_cl_block_witness_raw(&self, blkid: L2BlockId) -> RpcResult<Option<Vec<u8>>> { |
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 think this should not return an option. It might make sense to return Error when the information is not found.
async fn get_exec_update_by_id(&self, block_id: L2BlockId) -> RpcResult<Option<RpcExecUpdate>>; | ||
|
||
#[method(name = "getCLBlockWitness")] | ||
async fn get_cl_block_witness_raw(&self, index: u64) -> RpcResult<Option<Vec<u8>>>; | ||
async fn get_cl_block_witness_raw(&self, block_id: L2BlockId) -> RpcResult<Option<Vec<u8>>>; |
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.
Same as above. I think this should return error if not found instead of None.
strata-primitives = { workspace = true } | ||
strata-rpc-types = { workspace = true } |
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.
Use
.workspace = true
@@ -52,7 +52,7 @@ impl<H: ZkVmHost> ProofGenerator for CheckpointProofGenerator<H> { | |||
|
|||
let l2_batch_proof = self | |||
.l2_batch_prover | |||
.get_proof(&(l2_start_height, l2_end_height)) | |||
.get_proof(&vec![(l2_start_height, l2_end_height)]) |
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.
If we are passing reference, we might not need vec.
Description
Type of Change
Notes to Reviewers
Checklist
Related Issues