Skip to content

Commit

Permalink
fix(sidecar): don't treat transaction list as bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
mempirate committed Oct 2, 2024
1 parent 9a5759f commit 685544c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
30 changes: 16 additions & 14 deletions bolt-sidecar/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,21 +220,23 @@ impl<C: StateFetcher, BLS: SignerBLS, ECDSA: SignerECDSA> SidecarDriver<C, BLS,

// parse the request into constraints and sign them
let slot = inclusion_request.slot;
let message = ConstraintsMessage::build(validator_pubkey, inclusion_request);
let signed_constraints = match self.constraint_signer.sign(&message.digest()).await {
Ok(signature) => SignedConstraints { message, signature },
Err(err) => {
error!(?err, "Failed to sign constraints");
let _ = response.send(Err(CommitmentError::Internal));
return;
}
};

// Track the number of transactions preconfirmed considering their type
signed_constraints.message.transactions.iter().for_each(|full_tx| {
ApiMetrics::increment_transactions_preconfirmed(full_tx.tx_type());
});
self.execution.add_constraint(slot, signed_constraints);
for tx in inclusion_request.txs {
let tx_type = tx.tx_type();
let message = ConstraintsMessage::from_transaction(validator_pubkey.clone(), slot, tx);

let signed_constraints = match self.constraint_signer.sign(&message.digest()).await {
Ok(signature) => SignedConstraints { message, signature },
Err(err) => {
error!(?err, "Failed to sign constraints");
let _ = response.send(Err(CommitmentError::Internal));
return;
}
};

ApiMetrics::increment_transactions_preconfirmed(tx_type);
self.execution.add_constraint(slot, signed_constraints);
}

// Create a commitment by signing the request
match request.commit_and_sign(&self.commitment_signer).await {
Expand Down
5 changes: 5 additions & 0 deletions bolt-sidecar/src/primitives/constraint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ impl ConstraintsMessage {

Self { pubkey, slot: request.slot, top: false, transactions }
}

/// Builds a constraints message from a single transaction.
pub fn from_transaction(pubkey: BlsPublicKey, slot: u64, transaction: FullTransaction) -> Self {
Self { pubkey, slot, top: false, transactions: vec![transaction] }
}
}

impl SignableBLS for ConstraintsMessage {
Expand Down

0 comments on commit 685544c

Please sign in to comment.