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 PoW implementation to include peerID in data #27

Merged
merged 2 commits into from
Feb 27, 2025
Merged

Conversation

thang14
Copy link
Contributor

@thang14 thang14 commented Feb 26, 2025

This pull request introduces changes to the Proof of Work (PoW) implementation in the core/apps/verifier/pow.go file to include the peerID in the PoW process. This ensures that the PoW is tied to a specific peer, enhancing security and traceability. Additionally, corresponding updates are made to the test cases in the core/apps/verifier/pow_test.go file.

Key changes include:

Proof of Work Enhancements:

  • Modified performPoW to include peerID as a parameter, updating the input format to include the peerID in the hash calculation. (core/apps/verifier/pow.go, [1] [2]
  • Updated verifyPoW to include peerID as a parameter, ensuring the verification process checks the hash with the peerID. (core/apps/verifier/pow.go, core/apps/verifier/pow.goL121-R122)

PoW Request and Response Handling:

  • Adjusted OnPoWRequest and OnPoWResponse methods to pass peerID when calling performPoW and verifyPoW. (core/apps/verifier/pow.go, [1] [2]

Test Case Updates:

  • Updated test cases in pow_test.go to include peerID in both performPoW and verifyPoW calls, ensuring tests validate the new behavior. (core/apps/verifier/pow_test.go, core/apps/verifier/pow_test.goL12-R37)

- Update `performPoW` and `verifyPoW` functions to include `peerID` in the data to prevent misuse by verifiers.
- Adjust unit tests to accommodate the changes in `performPoW` and `verifyPoW` functions.
@thang14 thang14 merged commit ad605cc into main Feb 27, 2025
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.

1 participant