Skip to content

Commit

Permalink
Add forgotted return for invalid prposal signatures.
Browse files Browse the repository at this point in the history
Some cleanup and TODO updates.
  • Loading branch information
ancazamfir committed May 30, 2024
1 parent ad109ca commit 75896d6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions code/actors/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,7 @@ where
return Ok(());
};

// TODO - proposals with invalid signatures should be dropped.
// For well signed we should validate the proposal against the block parts (if all received).
// Add `valid()` to Context.
// TODO - verify that the proposal was signed by the proposer for the height and round, drop otherwise.
let proposal = &signed_proposal.proposal;
let proposal_height = proposal.height();
let proposal_round = proposal.round();
Expand All @@ -231,7 +229,8 @@ where
proposal_height,
proposal_round,
proposal.value()
)
);
return Ok(());
}
assert!(proposal_height == state.driver.height());

Expand Down Expand Up @@ -277,6 +276,7 @@ where
return Ok(());
}

// TODO - verify that the proposal was signed by the proposer for the height and round, drop otherwise.
self.proposal_builder.cast(ProposalBuilderMsg::BlockPart {
block_part: signed_block_part.block_part,
reply_to: myself.clone(),
Expand Down
6 changes: 6 additions & 0 deletions code/actors/src/util/value_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@ pub mod test {
}
}

// This is a temporary store implementation for block parts
// TODO-s:
// - make it context generic
// - add Address to key
// - not sure if this is required as consensus should verify that only the parts signed by the proposer for
// the height and round should be forwarded here (see the TODOs in consensus)
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct PartStore {
pub map: BTreeMap<(Height, Round, u64), BlockPart>,
Expand Down

0 comments on commit 75896d6

Please sign in to comment.