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] - Simplify switch to different poet services #6116

Closed
wants to merge 31 commits into from

Conversation

ConvallariaMaj
Copy link
Contributor

Motivation

Fix of issue #5563

Description

Implemented:

  • check registrations by node id + poet addresses
  • if round didn't start and new PoETs added, submit missing registrations. Otherwise work with existing.
  • new tests

Test Plan

Tested by unit tests

TODO

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

@ConvallariaMaj ConvallariaMaj marked this pull request as ready for review July 10, 2024 11:14
Copy link

codecov bot commented Jul 10, 2024

Codecov Report

Attention: Patch coverage is 82.32323% with 35 lines in your changes missing coverage. Please review.

Project coverage is 82.1%. Comparing base (83b0499) to head (f9af85a).
Report is 1 commits behind head on develop.

Files Patch % Lines
activation/activation_errors.go 6.6% 14 Missing ⚠️
activation/nipost.go 87.6% 10 Missing and 3 partials ⚠️
activation/poet.go 92.5% 3 Missing and 2 partials ⚠️
activation/e2e/poet_client.go 77.7% 2 Missing ⚠️
node/node.go 0.0% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           develop   #6116   +/-   ##
=======================================
  Coverage     82.0%   82.1%           
=======================================
  Files          309     309           
  Lines        34033   34120   +87     
=======================================
+ Hits         27919   28014   +95     
+ Misses        4329    4324    -5     
+ Partials      1785    1782    -3     

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

@ConvallariaMaj ConvallariaMaj changed the title Fix/issue 5563 Simplify switch to different poet services Jul 10, 2024
activation/nipost.go Outdated Show resolved Hide resolved
sql/localsql/nipost/poet_registration_test.go Outdated Show resolved Hide resolved
activation/nipost_test.go Outdated Show resolved Hide resolved
activation/nipost_test.go Outdated Show resolved Hide resolved
activation/nipost_test.go Outdated Show resolved Hide resolved
activation/nipost_test.go Outdated Show resolved Hide resolved
activation/nipost_test.go Outdated Show resolved Hide resolved
activation/nipost_test.go Outdated Show resolved Hide resolved
activation/nipost.go Outdated Show resolved Hide resolved
activation/nipost.go Outdated Show resolved Hide resolved
activation/nipost.go Outdated Show resolved Hide resolved
- minor issues
- tests

made refactoring
activation/nipost.go Outdated Show resolved Hide resolved
activation/nipost.go Outdated Show resolved Hide resolved
activation/nipost.go Outdated Show resolved Hide resolved
activation/nipost.go Outdated Show resolved Hide resolved
activation/nipost.go Outdated Show resolved Hide resolved
activation/nipost_test.go Show resolved Hide resolved
activation/nipost_test.go Outdated Show resolved Hide resolved
sql/localsql/nipost/poet_registration.go Outdated Show resolved Hide resolved
Copy link
Contributor

@poszu poszu left a comment

Choose a reason for hiding this comment

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

I think the logic below needs to be updated. The idea was that if all registrations failed and it's already too late to submit, then the challenge expires. I think we could simplify the check now. If we have 0 registrations at the end of this function and the registration deadline passed, we expire the challenge.

	allInvalid := true
	for err := range errChan {
		if err == nil {
			allInvalid = false
			continue
		}
		nb.logger.Warn("failed to submit challenge to poet", zap.Error(err), log.ZShortStringer("smesherID", nodeID))
		if !errors.Is(err, ErrInvalidRequest) {
			allInvalid = false
		}
	}
	if allInvalid {
		nb.logger.Warn("all poet submits were too late. ATX challenge expires", log.ZShortStringer("smesherID", nodeID))

activation/nipost.go Outdated Show resolved Hide resolved
activation/nipost.go Outdated Show resolved Hide resolved
activation/nipost.go Outdated Show resolved Hide resolved
activation/nipost.go Outdated Show resolved Hide resolved
activation/nipost.go Outdated Show resolved Hide resolved
activation/nipost.go Outdated Show resolved Hide resolved
activation/nipost.go Outdated Show resolved Hide resolved
activation/nipost_test.go Outdated Show resolved Hide resolved
activation/nipost_test.go Outdated Show resolved Hide resolved
activation/nipost_test.go Outdated Show resolved Hide resolved
activation/nipost_test.go Outdated Show resolved Hide resolved
activation/nipost.go Outdated Show resolved Hide resolved
activation/nipost.go Outdated Show resolved Hide resolved
activation/nipost.go Outdated Show resolved Hide resolved
activation/nipost_test.go Outdated Show resolved Hide resolved
activation/nipost_test.go Show resolved Hide resolved
activation/nipost_test.go Show resolved Hide resolved
activation/nipost_test.go Outdated Show resolved Hide resolved
activation/poet.go Outdated Show resolved Hide resolved
# Conflicts:
#	activation/activation_errors.go
#	activation/nipost_test.go
activation/activation_errors.go Outdated Show resolved Hide resolved
activation/poet.go Outdated Show resolved Hide resolved
activation/nipost.go Outdated Show resolved Hide resolved
activation/nipost.go Outdated Show resolved Hide resolved
activation/nipost_test.go Show resolved Hide resolved
activation/poet.go Show resolved Hide resolved
@fasmat fasmat requested review from fasmat and poszu August 6, 2024 17:48
@fasmat
Copy link
Member

fasmat commented Aug 6, 2024

For me there are now only 2 points left open to merge this PR (see my last 2 comments). @poszu could you also take another look?

@ConvallariaMaj
Copy link
Contributor Author

bors merge

spacemesh-bors bot pushed a commit that referenced this pull request Aug 7, 2024
## Motivation

Fix of issue #5563



Co-authored-by: Matthias <5011972+fasmat@users.noreply.github.com>
@spacemesh-bors
Copy link

spacemesh-bors bot commented Aug 7, 2024

Build failed:

@ConvallariaMaj
Copy link
Contributor Author

bors merge

spacemesh-bors bot pushed a commit that referenced this pull request Aug 7, 2024
## Motivation

Fix of issue #5563



Co-authored-by: Matthias <5011972+fasmat@users.noreply.github.com>
@spacemesh-bors
Copy link

spacemesh-bors bot commented Aug 7, 2024

Pull request successfully merged into develop.

Build succeeded:

@spacemesh-bors spacemesh-bors bot changed the title Simplify switch to different poet services [Merged by Bors] - Simplify switch to different poet services Aug 7, 2024
@spacemesh-bors spacemesh-bors bot closed this Aug 7, 2024
@spacemesh-bors spacemesh-bors bot deleted the fix/issue-5563 branch August 7, 2024 22:05
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.

5 participants