-
Notifications
You must be signed in to change notification settings - Fork 20
feat: event stream trigger NextCommittee #502
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
Conversation
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.
just took an initial pass looks good so far
so i figured out it doesnt like passing in mnemonic, that messes with the parsing. also if you kill a task like you were killing yapper that the will kill the group of processes and fail. |
✅ DONE:
|
Based on the log, the problem is that we are not setting the Fixed in d07f98e. Got a new error: when new decrypt committee started running, there are unknown peer, I probably messed some logic up, will continue tmr morning. Update: problem fixed ✅ Previous problems are:
(Ah, btw, |
cbf1cbd
to
08c8cb1
Compare
08c8cb1
to
d07f98e
Compare
ba3fdd8
to
8c10bda
Compare
#[clap(long)] | ||
parent_url: Option<Url>, | ||
|
||
/// KeyManager contract address on the parent chain |
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 would recommend a rename to key_manager_contract_proxy
so that devs are aware that we're interacting with the key manager contract implementation via a proxy
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 understand the intention, but from the perspective of non-contract dev/ops, they shouldn't care about proxy. They are given an address (by the devops or from the deploy-contract
script) and treat that as the KeyManager contract. Proxy pattern should be hidden from them imo.
in the *-contract
code, I'm fine with being more explicit about _proxy
for clarity tho.
So I will the naming as is here.
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 looks good to me!
timeboost/src/committee.rs
Outdated
let tag = if chain_id == 31337 || chain_id == 1337 { | ||
// local test chain, we start scanning from the genesis | ||
BlockNumberOrTag::Number(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.
Could those test chain configs not directly set the block tag to 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.
yes, they could. but i thought that tag was used for some other purpose? but yah, I will update the test-config instead.
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.
they are used for the delayed inbox, i dont think we should set it to 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.
We could have an additional field in the config, would you like that?
I hope there's an api like block_number_from_timestamp() provided by alloy Provider, but they don't. Otherwise we could set the default starting to effective timestamp of the last committee.
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.
eventually i implemented a binary-search-based get_block_number_from_timestamp()
in 4547bcb so that users don't need to set that extra field in config.
/// Returns the smallest block number whose timestamp is >= `target_ts` through binary search.
/// Useful to determine `from_block` input of `Self::event_stream()` subscription.
pub async fn get_block_number_by_timestamp(
&self,
target_ts: u64,
) -> anyhow::Result<Option<u64>> {
// then later:
let from_block = provider
.get_block_number_by_timestamp(start_ts.into())
.await?
.unwrap_or_default();
let events = provider
.event_stream::<CommitteeCreated>(
config.key_manager_contract,
BlockNumberOrTag::Number(from_block),
)
.await
.map_err(|e| {
error!("Failed to create CommitteeCreated stream: {:?}", e);
e
})?;
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.
update: switch to cleaner contract-assisted approach in c153532, as suggested in #502 (comment)
Co-authored-by: Toralf Wittner <[email protected]>
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.
Thanks @alxiong!
This test is redundant since [PR #502][1] was merged and is often failing on CI. The reason for its failure is a race condition: sometimes not all nodes finish the resharing because of all the DKG requests they send, less than t + 1 are answered because peers are themselves in an incomplete DKG state or they are not in a running state. In any case they are not replying. The test is then ultimately hanging and timing out because it attempts to subsequently collect the inclusion list from all decrypters and some can not provideit. The test would need to be fixed by allowing enough time for the decrypters of committee 1 to have their local DKG state ready before the members of committee 2 send their DKG requests. For production it is assumed that between scheduling the next committee and activating it, sufficient time is given. Rather than fixing the test this PR removes it because -- as mentioned above -- it is redundant with another test. [1]: #502
Closes https://app.asana.com/1/1208976916964769/project/1210099833957576/task/1211291499200146
An alternative approach to #495
This PR:
event CommitteeCreated
, and triggerSequencer.set_next_committee()
upon receiving info about the next committeetest-configs/c1
after thejust test-dyn-comm
test,