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

WiP: Add invalid prev ATX proof #6310

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft

Conversation

fasmat
Copy link
Member

@fasmat fasmat commented Aug 29, 2024

Motivation

Closes #6309

Description

In the sql/identities package activation/wire is imported which would cause a cyclic dependency when the identities package is used in the activation/wire package. Since the only function that requires activation/wire is identities. GetMalfeasanceProof and that function was used primarily in tests I deleted it and replaced its usage with identities.LoadMalfeasanceBlob.

identities.LoadMalfeasaneBlob also had a bug where it would not return sql.ErrNotFound when an equivocation set is stored but that set hasn't been marked as malicious yet, instead it would return []byte{}, nil - which would cause broadcasting of empty proofs.

Test Plan

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 Aug 29, 2024
Copy link

codecov bot commented Aug 29, 2024

Codecov Report

Attention: Patch coverage is 58.08383% with 70 lines in your changes missing coverage. Please review.

Project coverage is 81.6%. Comparing base (062d40c) to head (5bb525e).

Files with missing lines Patch % Lines
activation/wire/malfeasance_invalid_prev_atx.go 52.1% 32 Missing and 13 partials ⚠️
activation/handler_v2.go 51.2% 17 Missing and 3 partials ⚠️
activation/wire/malfeasance_double_marry.go 0.0% 2 Missing ⚠️
activation/wire/wire_v2.go 88.2% 1 Missing and 1 partial ⚠️
sql/atxs/atxs.go 92.3% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           develop   #6310     +/-   ##
=========================================
- Coverage     81.7%   81.6%   -0.2%     
=========================================
  Files          312     313      +1     
  Lines        34637   34752    +115     
=========================================
+ Hits         28327   28376     +49     
- Misses        4479    4528     +49     
- Partials      1831    1848     +17     

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

@fasmat fasmat force-pushed the add-invalid-prev-atx-proof branch 2 times, most recently from a968426 to de6c8a8 Compare September 13, 2024 14:11
@fasmat fasmat changed the base branch from develop to no-wire-dependency September 13, 2024 14:11
@spacemesh-bors spacemesh-bors bot changed the base branch from no-wire-dependency to develop September 13, 2024 15:24
@@ -1813,64 +1810,6 @@ func Test_MarryingMalicious(t *testing.T) {
}
}

func TestContextualValidation_DoublePost(t *testing.T) {
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 keeping the test to make sure this kind of malfeasance is detected?

Comment on lines +25 to +27
// 4. Both marriage certificates have valid signatures.
//
// HINT: this works if the identity that publishes the marriage ATX marries themselves.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's needed and enough to prove that the signers of the two ATXs are married.

Suggested change
// 4. Both marriage certificates have valid signatures.
//
// HINT: this works if the identity that publishes the marriage ATX marries themselves.
// 4. Signers of bots ATXs are married

Comment on lines +18 to +19
// ProofInvalidPrevAtxV2 is a proof that two ATXs published by an identity reference the same previous ATX for an
// identity.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// ProofInvalidPrevAtxV2 is a proof that two ATXs published by an identity reference the same previous ATX for an
// identity.
// ProofInvalidPrevAtxV2 is a proof that two distinct ATXs reference the same previous ATX for one
// of the included identities.

PreviousATXsRoot: types.Hash32(atx.PreviousATXs.Root()),
PreviousATXsRootProof: prevATXsRootProof,

PrevATXIndex: marriageIndex,
Copy link
Contributor

Choose a reason for hiding this comment

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

The previous ATX and marriage indexes mean different things and they are not usually equal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Malfeasance V2: Invalid Previous ATX
2 participants