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] - Move node key to config directory and enable loading of multiple identities #5592

Closed
wants to merge 40 commits into from

Conversation

fasmat
Copy link
Member

@fasmat fasmat commented Feb 21, 2024

Motivation

This completes the implementation of multi-smeshing support.

Related: spacemeshos/post#270

Description

Part of #5089

  • The key is now migrated at the first start from the Post Data Directory to the Node's DataDir (the directory containing e.g. the *.sql databases)
    • The key will be named identity.key and contains the same data as the key.bin file contains - the private key encoded in hex
    • To add more identities the user just has to add more private keys to this folder by storing them hex encoded in *.key files
    • Keys are checked to not contain duplicates to avoid accidental equivocations by running the same identity twice.
  • If fewer or more than 1 identity is found StartSmeshing is disabled via config and GRPC
    • only when exactly 1 identity is available supervised smeshing is possible, to preserve backwards compatibility
    • If more or fewer than 1 identity are configured, setting StartSmeshing to true in the config file will cause the node to fail during startup. Additionally calling the GRPC StartSmeshing endpoint will also return an error if more or fewer than 1 identity are configured.
  • Checkpoint was extended to support multiple identities
    • it was missing support before so I added it as part of this PR
    • tests were added to ensure that a) all identities are check-pointed and b) overlapping ATX chains are de-duplicated

Closes #4653

  • LoadIdentities and Cleanup methods of app have been improved to not require handling of private fields in tests any more.

Test Plan

  • A new test was added that checks if AdminEvents on a supervised node work with multiple identities
  • New tests for Checkpoint were added to verify functionality in a supervised setup
  • System tests have been updated to work with remote setups
    • System tests with multi-smeshing setups will be added in a future PR

TODO

  • Explain motivation or link existing issue(s)
  • Test changes and document test plan
  • Update documentation as needed
  • Update changelog as needed

@fasmat fasmat self-assigned this Feb 21, 2024
Copy link

codecov bot commented Feb 22, 2024

Codecov Report

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

Project coverage is 79.7%. Comparing base (c3f3793) to head (aaf6d26).

Files Patch % Lines
node/node_identities.go 53.7% 49 Missing and 6 partials ⚠️
node/node.go 61.5% 17 Missing and 3 partials ⚠️
activation/activation.go 70.7% 10 Missing and 2 partials ⚠️
checkpoint/recovery.go 92.7% 3 Missing and 3 partials ⚠️
beacon/beacon.go 60.0% 1 Missing and 1 partial ⚠️
blocks/certifier.go 60.0% 1 Missing and 1 partial ⚠️
activation/handler.go 50.0% 1 Missing ⚠️
activation/post.go 90.9% 1 Missing ⚠️
api/grpcserver/smesher_service.go 75.0% 0 Missing and 1 partial ⚠️
checkpoint/util.go 80.0% 0 Missing and 1 partial ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff            @@
##           develop   #5592     +/-   ##
=========================================
- Coverage     79.8%   79.7%   -0.2%     
=========================================
  Files          273     274      +1     
  Lines        27654   27802    +148     
=========================================
+ Hits         22085   22160     +75     
- Misses        4031    4100     +69     
- Partials      1538    1542      +4     

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

@fasmat
Copy link
Member Author

fasmat commented Feb 22, 2024

bors try

spacemesh-bors bot added a commit that referenced this pull request Feb 22, 2024
@spacemesh-bors
Copy link

try

Build failed:

@fasmat fasmat force-pushed the 5089-move-key-to-config branch from 82fcacf to 3edce6a Compare February 23, 2024 15:16
@fasmat fasmat marked this pull request as ready for review February 24, 2024 03:27
@dshulyak
Copy link
Contributor

would it be possible to submit separate pr for changes that can be separated, such as changes in mocks? i wanted to review, but the sheer number of changed lines makes it very easy to miss details

@fasmat fasmat force-pushed the 5089-move-key-to-config branch from 32a1c90 to 1bdf71b Compare February 26, 2024 16:47
@fasmat
Copy link
Member Author

fasmat commented Feb 26, 2024

I created #5604 and rebased the changes of this PR on top of that.

@fasmat fasmat force-pushed the 5089-move-key-to-config branch from 1bdf71b to c8524fd Compare February 26, 2024 18:24
@fasmat fasmat changed the base branch from develop to update-mockgen February 26, 2024 18:24
@fasmat
Copy link
Member Author

fasmat commented Feb 26, 2024

bors try

spacemesh-bors bot added a commit that referenced this pull request Feb 26, 2024
@fasmat fasmat force-pushed the 5089-move-key-to-config branch from 7b8c00a to 2d33410 Compare February 26, 2024 21:03
@fasmat
Copy link
Member Author

fasmat commented Feb 26, 2024

bors cancel

@spacemesh-bors
Copy link

try

Build failed:

@spacemesh-bors spacemesh-bors bot changed the base branch from update-mockgen to develop February 26, 2024 21:56
@fasmat fasmat force-pushed the 5089-move-key-to-config branch from 2d33410 to be94b15 Compare February 26, 2024 21:57
@fasmat
Copy link
Member Author

fasmat commented Feb 26, 2024

bors try

spacemesh-bors bot added a commit that referenced this pull request Feb 26, 2024
@spacemesh-bors
Copy link

try

Build succeeded:

@fasmat fasmat force-pushed the 5089-move-key-to-config branch from c33e9c8 to 949095c Compare March 1, 2024 13:12
@fasmat fasmat force-pushed the 5089-move-key-to-config branch from 72a985c to c2f9543 Compare March 1, 2024 18:26
@fasmat
Copy link
Member Author

fasmat commented Mar 4, 2024

bors merge

spacemesh-bors bot pushed a commit that referenced this pull request Mar 4, 2024
…tities (#5592)

## Motivation

This completes the implementation of multi-smeshing support.

Related: spacemeshos/post#270
@spacemesh-bors
Copy link

spacemesh-bors bot commented Mar 4, 2024

Pull request successfully merged into develop.

Build succeeded:

@spacemesh-bors spacemesh-bors bot changed the title Move node key to config directory and enable loading of multiple identities [Merged by Bors] - Move node key to config directory and enable loading of multiple identities Mar 4, 2024
@spacemesh-bors spacemesh-bors bot closed this Mar 4, 2024
@spacemesh-bors spacemesh-bors bot deleted the 5089-move-key-to-config branch March 4, 2024 15:45
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.

node: improve node state and lifecycle management
3 participants