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/verifier #19

Merged
merged 28 commits into from
Feb 24, 2025
Merged

Feat/verifier #19

merged 28 commits into from
Feb 24, 2025

Conversation

thang14
Copy link
Contributor

@thang14 thang14 commented Feb 24, 2025

This pull request includes several significant changes to the subnet-node project, focusing on logging improvements, configuration updates, and refactoring of the AccountService and AppService components. The most important changes are summarized below:

Logging Improvements:

  • Added a new logging package github.com/ipfs/go-log/v2 and set all loggers to LevelDebug when the debug flag is enabled in cmd/subnet/main.go. [1] [2]

Configuration Updates:

  • Updated default addresses for DefaultSubnetAppStoreAddr, DefaultSubnetProviderAddr, and added DefaultSubnetVerifier in config/default_config.go.

Refactoring AccountService:

  • Removed unused import crypto/rand and added signer package in core/account/service.go. [1] [2]
  • Removed subnetProvierUptime related fields and methods from AccountService. [1] [2] [3] [4] [5]
  • Simplified the Sign method and added a new SignTypedData method for signing typed data.

Refactoring AppService:

  • Refactored UpdateAppConfig, GetApps, and RunApp methods to use new atypes package in core/apps. [1] [2] [3] [4]
  • Added new methods for handling app details, removal, reporting, and restarting containers in core/apps. [1] [2] [3] [4]

These changes enhance the project's logging capabilities, update default configurations, and improve the structure and functionality of AccountService and AppService components.

- Added logic to mark nodes as fraudulent only after 5 failed verifications.
- Reset failure count upon successful verification.
- Added Pow struct to handle PoW operations.
- Implemented PerformPoW method to find a nonce that satisfies the difficulty using multiple CPUs.
- Implemented VerifyPoW method to verify the PoW by checking the hash and nonce.
- Moved PoW-related methods from verifier.go to a new file pow.go.
- Added `RequestPoWFromPeers` method in `Pow` to request PoW from a list of peers using multiple workers.
- Updated `Verifier` to filter logs by qualified peers in `processUsageReports`.
- Refactored `saveAndSendSignedUsages` to use multiple workers for sending signed usages.
- Added `Clear` method in `Pow` to clear requests and qualified peers.
- Added unit tests for `performPoW` and `verifyPoW` methods in `pow_test.go`.
- Added a new channel `signatureResponseChan` to the `Service` struct for handling SignatureResponse messages sequentially.
- Modified the `onSignatureReceive` function to send the SignatureResponse to the `signatureResponseChan`.
- Added a new function `handleSignatureResponses` to process the SignatureResponse messages from the channel sequentially.
- Updated the `Start` and `Stop` methods to handle the new channel.
@thang14 thang14 merged commit e63a9d6 into main Feb 24, 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