-
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-718 Rework L1 access from OL STF #469
base: main
Are you sure you want to change the base?
Conversation
/// | ||
/// Includes: | ||
/// * Processes L1 withdrawals that are safe to dispatch to specific deposits. | ||
/// * Reassigns deposits that have passed their deadling to new operators. |
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.
/// * Reassigns deposits that have passed their deadling to new operators. | |
/// * Reassigns deposits that have passed their deadline to new operators. |
deadline? :D
let new_exec_height = cur_block_height as u32 + params.dispatch_assignment_dur; | ||
|
||
// Sequence in which we assign the operators to the deposits. This is kinda | ||
// shitty because it might not account for available funds but it works for |
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.
// shitty because it might not account for available funds but it works for | |
// XXX because it might not account for available funds but it works for |
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.
// shitty because it might not account for available funds but it works for | |
// suboptimal because it might not account for available funds but it works for |
1038b42
to
6d8d186
Compare
pub(crate) l1_state: l1::L1ViewState, | ||
/// Epoch-level state that we only change as of the last block of an epoch. | ||
// TODO this might be reworked to be managed separately | ||
pub(crate) epoch_state: EpochState, | ||
|
||
/// Pending withdrawals that have been initiated but haven't been sent out. | ||
pub(crate) pending_withdraws: StateQueue<bridge_ops::WithdrawalIntent>, | ||
|
||
/// Execution environment state. This is just for the single EE we support | ||
/// right now. | ||
pub(crate) exec_env_state: exec_env::ExecEnvState, |
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.
Curious, can the ExecEnvState
be somehow derived from Chainstate
, or maybe designed to be derived that way? Because I think it would be more transparent and explicit to prepare it before we call EE(s) and also less storage footprint. Something like derive_env_state(Chainstate, Params, ...) -> ExecEnvState
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.
Perhaps, could you expand on what the value of this would be? I'm trying to be as data-oriented as possible here since I anticipate some refactors in the future here when we support async EE consensus.
functional-tests/utils.py
Outdated
cur_ckpt_index = seqrpc.strata_getLatestCheckpointIndex() | ||
return cur_ckpt_idx > first_ckpt_idx | ||
|
||
wait_until_with_value(_f, lambda v: v, "Epoch never finalized", timeout, step) |
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.
The caller doesn't seem to use the returned value, so could be simplified with wait_until
.
wait_until(_f, "Error never vinalizesd", timeout, step)
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.
Oh good point, I didn't realize what I was doing.
let epoch_init_slot = get_epoch_initial_slot(epoch, params); | ||
epoch_init_slot + (params.target_l2_batch_size - 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 simpler?
let epoch_init_slot = get_epoch_initial_slot(epoch, params); | |
epoch_init_slot + (params.target_l2_batch_size - 1) | |
get_epoch_initial_slot(epoch + 1, params) - 1 |
crates/chaintsn/src/epoch.rs
Outdated
for tx in e.deposit_update_txs() { | ||
if let ProtocolOperation::Deposit(deposit_info) = tx.tx().protocol_operation() { |
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.
Asking for deposit_update_txs and then checking if the pattern match and .tx().protocol_operation()
look a bit weird, the interface could be simpler I guess, just getting the deposit infos from payload.
|
||
DepositState::Accepted => { | ||
// If we have an intent to assign, we can dispatch it to this deposit. | ||
if have_ready_intent { |
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.
Can move this to match line to avoid one nesting
|
||
DepositState::Dispatched(dstate) => { | ||
// Check if the deposit is past the threshold. | ||
if cur_block_height >= dstate.exec_deadline() { |
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 for this maybe?
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.
Some nit comments. I think the process_deposit_updates
function can be made better with helper functions.
@bewakes Appreciate the comments. Going to take a while to circle back to most of these since I'm working on the more tricky areas right now for stuff that breaks due to the consensus/bridging refactors. |
…e, deferred processing withdrawals until end of epoch
…t at the end of an epoch
823f492
to
ff4adb3
Compare
Monster rebase. |
Description
The goal of this PR is to change the OL bookkeeping so we're only actually checking in with the L1 at the end of the epoch when we're preparing the epoch checkpoint.
This is incomplete, and may require some storage refactors if we go deep enough. Not sure there yet.
Type of Change
Checklist