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] - atx: verify syntactic correctness before fetching deps #4814

Closed

Conversation

countvonzero
Copy link
Contributor

@countvonzero countvonzero commented Aug 10, 2023

Motivation

part of #4632

Changes

break syntactic checks into 3 steps:

  • do all the syntactically correctness checks on the current atx without its dependencies
  • fetching atx dependencies, including poet proof, prev/positioning/commitment atxs
  • do the syntactic checks based on the referenced atxs.

@countvonzero
Copy link
Contributor Author

bors try

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

bors bot commented Aug 10, 2023

try

Build failed:

@codecov
Copy link

codecov bot commented Aug 10, 2023

Codecov Report

Merging #4814 (43d5ba3) into develop (900f5b5) will decrease coverage by 0.1%.
Report is 1 commits behind head on develop.
The diff coverage is 75.2%.

@@            Coverage Diff            @@
##           develop   #4814     +/-   ##
=========================================
- Coverage     77.1%   77.1%   -0.1%     
=========================================
  Files          254     254             
  Lines        30281   30281             
=========================================
- Hits         23367   23354     -13     
- Misses        5399    5411     +12     
- Partials      1515    1516      +1     
Files Changed Coverage Δ
activation/nipost.go 81.0% <ø> (-0.1%) ⬇️
node/node.go 63.0% <ø> (-0.1%) ⬇️
activation/handler.go 78.3% <75.0%> (+1.7%) ⬆️
activation/validation.go 86.9% <75.0%> (-4.6%) ⬇️
activation/activation.go 75.7% <100.0%> (ø)

... and 3 files with indirect coverage changes

@countvonzero
Copy link
Contributor Author

bors try

bors bot added a commit that referenced this pull request Sep 5, 2023
@bors
Copy link

bors bot commented Sep 5, 2023

try

Build failed:

@countvonzero
Copy link
Contributor Author

bors try

bors bot added a commit that referenced this pull request Sep 5, 2023
@bors
Copy link

bors bot commented Sep 5, 2023

try

Build failed:

activation/handler.go Outdated Show resolved Hide resolved
activation/handler.go Outdated Show resolved Hide resolved
if atx.NIPost == nil {
return fmt.Errorf("nil nipst in gossip for atx %s", atx.ShortString())
if err := h.SyntacticallyValidate(ctx, &atx); err != nil {
return err
Copy link
Contributor

Choose a reason for hiding this comment

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

How about adding little context like for ...ValidateDeps()?

Suggested change
return err
return fmt.Errorf("atx %v syntactically invalid: %w", atx.ShortString(), err)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

honestly i cannot think of a good context to add to the name. suggestions?

activation/handler.go Outdated Show resolved Hide resolved
activation/nipost_test.go Show resolved Hide resolved
activation/validation.go Outdated Show resolved Hide resolved
if challenge.CommitmentATX == nil {
return fmt.Errorf("no prevATX declared, but commitmentATX is missing")
v.log.Panic("commitment atx is nil")
Copy link
Contributor

Choose a reason for hiding this comment

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

Why panic here? It opens a door to crash the node with a malicious ATX.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

to check programming error. it's already verified that in SyntacticallyValidate() that this cannot be nil. but anyway. changed to return error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the idea was that all the nil were checked in the first stage of syntactic check. here it's doing checks on the deps. but not a big deal.

if *id == types.EmptyATXID {
return fmt.Errorf("empty positioning atx")
v.log.Panic("empty positioning atx")
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto.

Btw, if id cannot be nil, then perhaps it should be passed by value to avoid the possibility of dereferencing a nil at all? The compiler should be able to optimize the copy away anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed. thanks

@countvonzero
Copy link
Contributor Author

bors try

bors bot added a commit that referenced this pull request Sep 7, 2023
@bors
Copy link

bors bot commented Sep 7, 2023

try

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@countvonzero
Copy link
Contributor Author

bors merge

bors bot pushed a commit that referenced this pull request Sep 8, 2023
## Motivation
part of #4632

## Changes
break syntactic checks into 3 steps:
- do all the syntactically correctness checks on the current atx without its dependencies
- fetching atx dependencies, including poet proof, prev/positioning/commitment atxs
- do the syntactic checks based on the referenced atxs.
@bors
Copy link

bors bot commented Sep 9, 2023

Build failed:

@countvonzero
Copy link
Contributor Author

bors merge

bors bot pushed a commit that referenced this pull request Sep 9, 2023
## Motivation
part of #4632

## Changes
break syntactic checks into 3 steps:
- do all the syntactically correctness checks on the current atx without its dependencies
- fetching atx dependencies, including poet proof, prev/positioning/commitment atxs
- do the syntactic checks based on the referenced atxs.
@bors
Copy link

bors bot commented Sep 9, 2023

Pull request successfully merged into develop.

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot changed the title atx: verify syntactic correctness before fetching deps [Merged by Bors] - atx: verify syntactic correctness before fetching deps Sep 9, 2023
@bors bors bot closed this Sep 9, 2023
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.

None yet

2 participants