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

[follower] Remove transaction from batch, and verify the digests received. #1431

Merged

Conversation

gdanezis
Copy link
Collaborator

This is a patch to refactor_stream_client that removes the list of transactions from the batch, and uses the transactions received to verify the batches and ensure they are signed.

@gdanezis gdanezis changed the title [quick fix] Remove transaction from batch, and verify the digests received. [follower] Remove transaction from batch, and verify the digests received. Apr 18, 2022

let x = match &batch_info_item {
Ok(BatchInfoResponseItem(UpdateItem::Batch(signed_batch))) => {
println!("batch {:?}", signed_batch.batch);
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be a log debug line?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh no, forgot my debug prints :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed now

if let Err(err) = client.check_update_item_batch_response(
req_clone,
&signed_batch,
&txs_and_last_batch,
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to be populated with the transactions from the batch first? I think this is what confused me before, that we don't store the digests of each transaction in the batch. If we use all the digests to create the batch, but then we don't pass in all the digests to reconstruct the batch, is it still possible we get the same batch after reconstruction?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As you can see for the first batch, I just check the signature, and only check the second batch for its actual strucure. Maybe there are some gaps, but indeed without the transactions before it makes no sense to check very much.

);
Ok(BatchInfoResponseItem(UpdateItem::Transaction((seq, digest)))) => {
// A stream always starts with a batch, so the previous should have initialized it.
// And here we insert the tuple into the batch.
Copy link
Contributor

Choose a reason for hiding this comment

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

In one of the batch tests, I saw that there were a few individual transactions sent before a batch was sent, also is it not ever expected that we would have individual transactions sent only like how we see in the benchmark with the default parameters set?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hm, right now we indeed have a gap in testing. We test only against a mock server. It would be nice to test against a real authority to make sure we catch something like this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As I remembered the follower server side should be sending batch --> (trasnactions+ -> batch) + , so all transactions are fully enclosed by batches. We should test to see if there is any issue with this?

@gdanezis gdanezis merged commit a9fa162 into laura/refactor_stream_client_without_info Apr 18, 2022
@gdanezis gdanezis deleted the no-transaction-in-batch branch April 18, 2022 17:24
gdanezis added a commit that referenced this pull request Apr 18, 2022
gdanezis added a commit that referenced this pull request Apr 18, 2022
@gdanezis gdanezis restored the no-transaction-in-batch branch April 18, 2022 17:27
@gdanezis gdanezis deleted the no-transaction-in-batch branch April 18, 2022 17:29
lanvidr pushed a commit that referenced this pull request Apr 18, 2022
…ived. (#1431)

* Remove trasnaction from batch, and verify the digests received.

Co-authored-by: George Danezis <george@danez.is>
lanvidr pushed a commit that referenced this pull request Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants