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

[Merged by Bors] - Support poet certificates #5221

Closed
wants to merge 71 commits into from

Conversation

poszu
Copy link
Contributor

@poszu poszu commented Nov 3, 2023

Motivation

Closes #5204

Changes

Added support for registering in the poet services using a certificate instead of PoW. It still supports both ways and will fallback to the PoW if:

  • certificate is not available (couldn't certify)
  • the poet service doesn't support certificates

There is a new interface in activation package certifierService that provides a generic way to obtain a certificate for a given poet. It abstracts away the fact that a POST proof is used - it is hidden in certifierServiceClient, which could in future have different implementations for other poet services.

Changed the initial_post table to post as it now holds the latest POST proof. Relying solely on initial post proof OR an existing ATX could not work in case of a checkpoint (in fact this way it failed systests).

Test Plan

  • added UTs
  • added system tests

@poszu
Copy link
Contributor Author

poszu commented Nov 3, 2023

bors try

bors bot added a commit that referenced this pull request Nov 3, 2023
Copy link

bors bot commented Nov 3, 2023

try

Build failed:

Copy link

codecov bot commented Nov 6, 2023

Codecov Report

Attention: Patch coverage is 79.16667% with 80 lines in your changes are missing coverage. Please review.

Project coverage is 80.7%. Comparing base (166e015) to head (7f83cab).
Report is 4 commits behind head on develop.

Files Patch % Lines
activation/certifier.go 71.2% 29 Missing and 17 partials ⚠️
activation/poet.go 82.3% 8 Missing and 7 partials ⚠️
sql/localsql/nipost/post.go 79.5% 9 Missing and 1 partial ⚠️
sql/localsql/certifier/db.go 87.8% 3 Missing and 1 partial ⚠️
activation/activation.go 90.0% 2 Missing ⚠️
node/node.go 91.6% 1 Missing and 1 partial ⚠️
activation/nipost.go 88.8% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           develop   #5221     +/-   ##
=========================================
- Coverage     80.8%   80.7%   -0.1%     
=========================================
  Files          287     290      +3     
  Lines        29905   30525    +620     
=========================================
+ Hits         24182   24659    +477     
- Misses        4140    4234     +94     
- Partials      1583    1632     +49     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@poszu
Copy link
Contributor Author

poszu commented Nov 6, 2023

bors try

@poszu
Copy link
Contributor Author

poszu commented Nov 10, 2023

bors try

spacemesh-bors bot added a commit that referenced this pull request Nov 10, 2023
@spacemesh-bors
Copy link

try

Build failed:

@poszu
Copy link
Contributor Author

poszu commented Nov 10, 2023

bors try

spacemesh-bors bot added a commit that referenced this pull request Nov 10, 2023
@spacemesh-bors
Copy link

try

Build failed:

@poszu
Copy link
Contributor Author

poszu commented Nov 13, 2023

bors try

spacemesh-bors bot added a commit that referenced this pull request Nov 13, 2023
sql/atxs/atxs.go Outdated Show resolved Hide resolved
activation/validation.go Outdated Show resolved Hide resolved
@poszu poszu requested a review from fasmat April 26, 2024 07:25
activation/interface.go Outdated Show resolved Hide resolved
activation/interface.go Outdated Show resolved Hide resolved
sql/localsql/certifier/db.go Show resolved Hide resolved
@fasmat fasmat self-requested a review May 22, 2024 14:43
@poszu
Copy link
Contributor Author

poszu commented May 22, 2024

Bors try

spacemesh-bors bot added a commit that referenced this pull request May 22, 2024
activation/certifier.go Outdated Show resolved Hide resolved
log.ZShortStringer("smesherID", nodeID),
)
challenge []byte,
logger *zap.Logger,
Copy link
Member

Choose a reason for hiding this comment

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

Why is this logger passed as argument? poetClient has a logger field?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because it gets a logger already enriched with additional fields like context and smesher ID.

Copy link
Member

@fasmat fasmat May 23, 2024

Choose a reason for hiding this comment

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

Not part of this PR, but it doesn't make sense how we handle loggers and contexts to me at the moment. Ideally we would have a situation like this:

ctx = log.WithFields(ctx, log.ZShortStringer("smesherID", nodeID) // probably already in node.go and passed to component
// ... some code to determine which poet to use
ctx = log.WithFields(ctx, zap.String("poet", client.Address())
// ... only pass ctx to child functions
// within child function
logger := c.log.WithOptions(log.ZContext(ctx))
logger.Info("some message") // prints message + smesherID field + poet address field

Right now we are passing both the logger and the context around and store information that should be added to logs in both the context and local loggers...

Wdyt?

@spacemesh-bors
Copy link

try

Build succeeded:

@poszu
Copy link
Contributor Author

poszu commented May 23, 2024

bors merge

spacemesh-bors bot pushed a commit that referenced this pull request May 23, 2024
## Motivation
Closes #5204 

## Changes
Added support for registering in the poet services using a certificate instead of PoW. It still supports both ways and will fallback to the PoW if:
- certificate is not available (couldn't certify)
- the poet service doesn't support certificates

There is a new interface in `activation` package `certifierService` that provides a generic way to obtain a certificate for a given poet. It abstracts away the fact that a POST proof is used - it is hidden in `certifierServiceClient`, which could in future have different implementations for other poet services.

Changed the `initial_post` table to `post` as it now holds the latest POST proof. Relying solely on initial post proof OR an existing ATX could not work in case of a checkpoint (in fact this way it failed systests).

## Test Plan
- added UTs
- added system tests
@spacemesh-bors
Copy link

Build failed:

@poszu
Copy link
Contributor Author

poszu commented May 23, 2024

bors merge

spacemesh-bors bot pushed a commit that referenced this pull request May 23, 2024
## Motivation
Closes #5204 

## Changes
Added support for registering in the poet services using a certificate instead of PoW. It still supports both ways and will fallback to the PoW if:
- certificate is not available (couldn't certify)
- the poet service doesn't support certificates

There is a new interface in `activation` package `certifierService` that provides a generic way to obtain a certificate for a given poet. It abstracts away the fact that a POST proof is used - it is hidden in `certifierServiceClient`, which could in future have different implementations for other poet services.

Changed the `initial_post` table to `post` as it now holds the latest POST proof. Relying solely on initial post proof OR an existing ATX could not work in case of a checkpoint (in fact this way it failed systests).

## Test Plan
- added UTs
- added system tests
@spacemesh-bors
Copy link

Pull request successfully merged into develop.

Build succeeded:

@spacemesh-bors spacemesh-bors bot changed the title Support poet certificates [Merged by Bors] - Support poet certificates May 23, 2024
@spacemesh-bors spacemesh-bors bot closed this May 23, 2024
@spacemesh-bors spacemesh-bors bot deleted the support-poet-certificates branch May 23, 2024 13:49
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.

support for certifier service and registering in poet with certificates
2 participants