Skip to content
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

feat(sidecar): load delegations on startup and send them upon registration #292

Merged
merged 10 commits into from
Oct 15, 2024

Conversation

merklefruit
Copy link
Collaborator

@merklefruit merklefruit commented Oct 14, 2024

Overview

  • Added the ability to parse Opts from a TOML file, loaded optionally if the BOLT_SIDECAR_CONFIG_PATH is defined
  • Added an example toml config validated through a unit test (so it will be easy to keep it updated over time)
  • Added the signing.delegations file path option that will parse SignedDelegations from JSON if present
  • Added logic for checking if a delegated public key is available before signing constraint messages
  • Added call to delegate() during register_validators() so they are done together to signal delegations regularly. We should maybe think of a better strategy as this could be inefficient if done with many delegations (e.g. 10k+ validators).
  • Refactored some primitives (e.g. extracted delegation and transaction types to their own file).

Note: this PR changes the constraints API body type for delegate() and revoke() to take Vec instead of T.
Following PRs in bolt-boost and mev-boost should reflect this change.

Meta

Comment on lines 276 to 288
let delegatees = self.constraints_client.find_delegatees(&validator_pubkey);
let available_pubkeys = self.constraint_signer.available_pubkeys();

// Pick a pubkey to sign constraints with.
//
// Rationale:
// - If there are no delegatee keys, try to use the validator key directly if available.
// - If there are delegatee keys, try to use the first one that is available in the list.
let Some(pubkey) = pick_public_key(validator_pubkey, available_pubkeys, delegatees) else {
error!(%target_slot, "No available public key to sign constraints with");
let _ = response.send(Err(CommitmentError::Internal));
return;
};
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is quite inefficient but the logic should check out. Let me know your thoughts!

@merklefruit merklefruit marked this pull request as ready for review October 15, 2024 07:50
@merklefruit merklefruit self-assigned this Oct 15, 2024
@merklefruit merklefruit added the C: bolt-sidecar Component: bolt-sidecar label Oct 15, 2024
Copy link
Contributor

@thedevbirb thedevbirb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it's great! Some q's

bolt-sidecar/Config.toml Outdated Show resolved Hide resolved
bolt-sidecar/src/config/mod.rs Show resolved Hide resolved
bolt-sidecar/src/config/mod.rs Outdated Show resolved Hide resolved
bolt-sidecar/src/config/signing.rs Show resolved Hide resolved
bolt-sidecar/src/driver.rs Outdated Show resolved Hide resolved
bolt-sidecar/src/driver.rs Outdated Show resolved Hide resolved
bolt-sidecar/src/signer/keystore.rs Outdated Show resolved Hide resolved
@merklefruit merklefruit added this to the v0.3: Holesky 1 milestone Oct 15, 2024
Copy link
Contributor

@mempirate mempirate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, lgtm

@merklefruit merklefruit merged commit 4a25052 into unstable Oct 15, 2024
3 checks passed
@merklefruit merklefruit deleted the nico/feat/sidecar-delegations branch October 15, 2024 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: bolt-sidecar Component: bolt-sidecar
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(sidecar): Create a delegations file format and load it on startup
3 participants