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(tenderdash-abci): deterministic request_id #38

Closed
wants to merge 2 commits into from

Conversation

lklimek
Copy link
Collaborator

@lklimek lklimek commented Oct 3, 2023

Issue being fixed or feature implemented

When analyzing logs, it would be useful if request ID on different nodes is the same.
Even if it means that request IDs are not unique.

What was done?

Request ID is derived from md5(request) instead of random.

How Has This Been Tested?

cargo test

Breaking Changes

Request ID is not unique.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

@lklimek lklimek requested a review from shumkov October 3, 2023 13:55
let value = request.into();
let value = request.value.as_ref().expect("request value is missing");

// we use md5 as we need 16-byte request id for uuid, and it doesn't have to be
Copy link
Member

Choose a reason for hiding this comment

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

This approach has downsides, especially if we want to filter by specific requests in elastic. There are endpoints like info, query, etc. where we don't have much difference so they will have the same ID.
We could have both: unique request ID and md5 so we will benefit from both depending on what we need.

That would be great if we could use the same request ID with tenderdash so we can easily filter related events.


// we use md5 as we need 16-byte request id for uuid, and it doesn't have to be
// cryptographically secure
let mut md5 = lhash::Md5::new();
Copy link
Member

Choose a reason for hiding this comment

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

I think it's pretty expensive, especially for the process and prepare proposal that contain state transitions. Should we do that only if a specific logging level is enabled?

// we use md5 as we need 16-byte request id for uuid, and it doesn't have to be
// cryptographically secure
let mut md5 = lhash::Md5::new();
md5.update(&request.encode_to_vec());
Copy link
Member

Choose a reason for hiding this comment

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

BTW, BLAKE3 much faster than md5 (which is not using in crypto world at all)

@lklimek
Copy link
Collaborator Author

lklimek commented Jan 31, 2024

we decided it's not needed

@lklimek lklimek closed this Jan 31, 2024
@lklimek lklimek deleted the logs-deterministic-request-id branch March 8, 2024 09:07
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