Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Verify that previous ATX points to correct ATX when handling incoming ATXs #27

Merged
merged 28 commits into from
May 7, 2024

Conversation

fasmat
Copy link
Member

@fasmat fasmat commented Apr 29, 2024

Motivation

Fixes GHSA-jcqq-g64v-gcm7

Related: spacemeshos/api-cve-fix#2

Description

  • The Previous ATX is now verified to be from the same NodeID
    • if it is a syntactic invalidity, the ATX is discarded and the peer that broadcasted the ATX will be dropped
  • The activation.Handler now marks a NodeID as malicious if it produces two ATXs pointing to the same previous ATX
  • A new malfeasance proof type was added that proofs that two different ATXs by the same smesher point to the same previous ATX
    • The scan for malicious ATXs can be triggered via a command line parameter during the start of the node: --scan-malfeasant-atxs=true and should take less than 5 minutes on a machine with a fast hard drive.

Test Plan

  • tests were added for the new behaviour
  • existing tests where updated where needed

TODO

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

malfeasance/wire/malfeasance.go Outdated Show resolved Hide resolved
malfeasance/wire/malfeasance.go Outdated Show resolved Hide resolved
activation/handler.go Outdated Show resolved Hide resolved
activation/handler.go Outdated Show resolved Hide resolved
malfeasance/wire/malfeasance.go Show resolved Hide resolved
activation/handler.go Outdated Show resolved Hide resolved
@fasmat
Copy link
Member Author

fasmat commented May 2, 2024

bors try

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

spacemesh-bors bot commented May 2, 2024

try

Build failed:

@fasmat
Copy link
Member Author

fasmat commented May 2, 2024

bors try

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

spacemesh-bors bot commented May 2, 2024

try

Build failed:

@fasmat fasmat changed the title WiP: Verify that previous ATX points to correct ATX when handling incoming ATXs Verify that previous ATX points to correct ATX when handling incoming ATXs May 2, 2024
@fasmat
Copy link
Member Author

fasmat commented May 2, 2024

bors try

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

spacemesh-bors bot commented May 2, 2024

try

Build failed:

@fasmat
Copy link
Member Author

fasmat commented May 2, 2024

bors try

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

spacemesh-bors bot commented May 2, 2024

try

Build failed:

@fasmat
Copy link
Member Author

fasmat commented May 2, 2024

Flaky test

bors try

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

spacemesh-bors bot commented May 2, 2024

try

Build failed:

@fasmat
Copy link
Member Author

fasmat commented May 2, 2024

flaky TestPostMalfeasanceProof

bors try

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

spacemesh-bors bot commented May 2, 2024

try

Build succeeded:

malfeasance/wire/malfeasance_test.go Outdated Show resolved Hide resolved
malfeasance/wire/malfeasance_test.go Outdated Show resolved Hide resolved
sql/atxs/atxs.go Show resolved Hide resolved
@fasmat fasmat requested review from ivan4th, poszu and pigmej May 6, 2024 07:46
activation/handler.go Outdated Show resolved Hide resolved
activation/handler.go Outdated Show resolved Hide resolved
@fasmat fasmat merged commit 60aa607 into v1.5 May 7, 2024
18 checks passed
@spacemesh-bors spacemesh-bors bot deleted the fix-prev-atx branch May 7, 2024 12:46
fasmat added a commit that referenced this pull request May 7, 2024
fasmat added a commit that referenced this pull request May 7, 2024
fasmat added a commit that referenced this pull request May 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants