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

Refactor(data-requests): pad hashes #127

Merged
merged 1 commit into from
Mar 27, 2024
Merged

Conversation

mennatnaga
Copy link
Contributor

Note

All this work was done by Jameson #116, but we decided to redo it because he forked from a branch that we decided not to merge, so rebasing his PR was very hard.

Motivation

Update the data request hashing function to match the current EVM function.

Explanation of Changes

Used alloy library to pad variable length inputs in hashing function for data request hashes.

Testing

Compared data request hashes to testHash function in EVM contracts' latest commit, which uses identical arguments to produce an identical hash.

Related PRs and Issues

Created in response to this PR for EVM: sedaprotocol/seda-evm-contracts#23

Data result ID hashes are currently not matching tthe EVM contracts, see related issue: #115

@mennatnaga mennatnaga changed the base branch from main to testnet-2 March 24, 2024 20:06
@mennatnaga mennatnaga changed the title Refactor/pad hashes2 Refactor/pad hashes Mar 24, 2024
@mennatnaga mennatnaga changed the title Refactor/pad hashes Refactor(data-requests): pad hashes Mar 24, 2024
@@ -59,7 +59,7 @@ pub fn calculate_dr_id_and_args(
tally_binary_id: tally_binary_id.clone(),
dr_inputs: dr_inputs.clone(),
tally_inputs: tally_inputs.clone(),
memo: memo.clone(),
memo: memo.clone().try_into().unwrap(),
Copy link
Member

Choose a reason for hiding this comment

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

memo should be Bytes and not a Hash.
In that way, we don't need to use that unwrap.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just noticed we already have a Memo type, so I used it.

@mennatnaga mennatnaga force-pushed the refactor/pad-hashes2 branch 2 times, most recently from 5b23f72 to f79fa57 Compare March 25, 2024 13:57
@mennatnaga mennatnaga requested a review from mariocao March 25, 2024 13:57
Copy link
Member

@mariocao mariocao left a comment

Choose a reason for hiding this comment

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

As discussed with @jamesondh , approving for later updating due to the changes to DR specs 😅

@jamesondh jamesondh force-pushed the refactor/pad-hashes2 branch from f79fa57 to 779109a Compare March 27, 2024 16:40
@jamesondh jamesondh merged commit 779109a into testnet-2 Mar 27, 2024
4 checks passed
@jamesondh jamesondh deleted the refactor/pad-hashes2 branch March 27, 2024 16:48
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.

3 participants