Skip to content

ci: Fix BLS integration of e2e-nightly.yml - #30

Closed
xdustinface wants to merge 1 commit into
dashpay:masterfrom
xdustinface:pr-github-fix-e2e-nightly
Closed

xdustinface wants to merge 1 commit into
dashpay:masterfrom
xdustinface:pr-github-fix-e2e-nightly

Conversation

@xdustinface

Copy link
Copy Markdown
Contributor

This PR only makes sure e2e-nightly test are running through, they don't without this because of missing BLS integration. However, some of the generated testnet configurations still don't pass with this PR and need to be fixed.

Also this PR drops the slack notification feature for failing e2e-nightly tests. Im fine reverting this change and create a web-hook for slack notification but i guess its not really needed, thoughts?

Comment thread .github/workflows/e2e-nightly.yml Resolved

@shumkov shumkov left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍

@xdustinface xdustinface changed the title ci: Fix BLS integration of e2e-nightly.yml, drop slack notifications ci: Fix BLS integration of e2e-nightly.yml Dec 16, 2020
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions Bot added the Stale label Oct 15, 2021
@github-actions github-actions Bot closed this Oct 19, 2021
shumkov added a commit that referenced this pull request Aug 17, 2026
* fix(consensus): prevent remote crash/brick via unknown vote-extension type

An unprivileged peer could send a Commit (or precommit) carrying a
vote-extension whose proto enum Type is undefined. proto3 enums are open, so
gogoproto accepts any varint; VoteExtensionFromProto's default arm then
panicked, terminating the consensus goroutine (which is designed to re-panic).
Because the message is written to the WAL before it is processed, the node
re-read it on restart and crash-looped — a one-packet, network-wide kill of
every validator and full node, not recoverable by restart.

Fix (defense-in-depth):
- VoteExtensionFromProto no longer panics on an unknown type; it returns a
  non-threshold-recoverable extension so construction cannot crash on any path.
- MakeQuorumSigns — the shared chokepoint of VerifyCommit (commits) and
  VerifyExtensionSign (precommit votes) — rejects unknown extension types, so a
  message carrying one fails closed instead of being silently excluded from the
  sign items (which on the precommit path would otherwise still reach the ABCI
  VerifyVoteExtension call).

The rejection is deliberately NOT placed in Commit.ValidateBasic: that runs on
the WAL decode path, where a rejection becomes a DataCorruptionError that aborts
replay and would re-brick already-attacked nodes. On the verification path the
error is swallowed by loggingMiddleware on both live and replay, so poisoned
nodes restart cleanly.

Tests (red→green verified for each):
- types/commit_extension_regression_test.go — construction does not panic;
  VerifyCommit, MakeQuorumSigns and the precommit VerifyExtensionSign reject
  the unknown type. The vote-path test fails if the MakeQuorumSigns check is
  removed, pinning the silent-ignore regression.
- internal/consensus/commit_extension_unbrick_test.go — writes a poison commit
  to a real WAL, confirms it still DECODES (a ValidateBasic rejection would
  abort replay), and that verifying the replayed commit returns an error
  without panicking. This is the restart-recovery (un-brick) property.

Green across types, privval, light, and internal/consensus vote/commit/WAL/
replay tests. Independently validated: crash removed, un-brick preserved, no
false-accept, no legitimate traffic rejected.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* fix(types): return an error for unknown vote-extension types

VoteExtensionFromProto returned a fabricated GenericVoteExtension for a type
outside the defined enum values. proto3 enums are open, so a peer can put any
varint on the wire, and vote extensions feed the sign-hash through
MakeQuorumSigns: substituting a default silently changes the digest, so at best
verification fails with a misleading error and at worst two nodes derive
different canonical votes for the same commit. Nothing on a path feeding a
signature may be fabricated.

The conversion now returns an error, propagated through VoteExtensions.Add,
VoteExtensionsFromProto, NewVoteExtensionsFromABCIExtended and
Commit.GetCanonicalVote, and out through the callers that already return an
error. A poisoned message is rejected by the existing caller instead of
terminating the consensus goroutine.

A poison commit still decodes from the WAL — CommitFromProto keeps extensions in
wire form and Commit.ValidateBasic is unchanged — and is rejected later at
VerifyCommit, so an already-attacked node still restarts. A poison precommit now
dies at MsgFromProto -> VoteFromProto in the reactor; it could never reach the
WAL, because on every prior version that same conversion panicked there.

NewVoteExtensionsFromABCIExtended propagates the error and ExtendVote panics on
it: that input is our own application, not a peer, so an undefined type is a
local bug and must fail loudly, consistent with the panics ExtendVote already
raises on ABCI misbehaviour.

Drops the defensive loop MakeQuorumSigns used to carry: both paths it guarded
funnel through the same VoteExtensionsFromProto call, which now rejects the type
before Filter can silently exclude it.

Out of scope by instruction: peer punishment, Commit.ValidateBasic validation,
WAL write ordering, and recover()/panic-handling middleware.

Co-Authored-By: Claude Opus 5 <[email protected]>

* docs: remove commit-extension-panic exploit spec

The spec documented an unpatched vulnerability (exact packet size,
ungated reactor branch, exploit cost) under docs/, a VuePress-built
site with no exclude rule for this path — publishable before the fix
ships, contradicting the doc's own §8 guidance not to push it early.

Flagged HIGH by security review; removing rather than gating, since
no exclude mechanism exists in the current VuePress config.

* fix(types): add a sentinel error and reject nil vote extensions

VoteExtensionsFromProto dereferenced every slice element without a nil check,
contradicting the fail-closed contract VoteExtensionFromProto documents: the
conversion is reachable from untrusted network input and must neither panic nor
fabricate a value. A nil element now yields an error naming its index.

The unknown-type rejection gains an exported sentinel, ErrUnknownVoteExtensionType,
so callers can match it with errors.Is. A future peer-punishment change needs to
distinguish "this peer sent an undefined enum value" from any other conversion
failure, which a bare fmt.Errorf cannot express. The message text is unchanged.

Add, VoteExtensionsFromProto and NewVoteExtensionsFromABCIExtended became fallible
without their godoc saying so; each now documents its error contract. Callers of
VoteExtensions.Add are the one signature change the compiler cannot enforce - a
stale .Add(ve) call still compiles and silently swallows the rejection - so the
error is now part of the documented API surface.

Tests assert the specific sentinel via errors.Is rather than "some error".
VerifyCommit's case previously passed even with the rejection fully removed,
because its fake zero signature failed verification first; it now builds a commit
that genuinely verifies, asserts that positive control, and only then flips one
extension type to an undefined value. Restores direct coverage of
Vote.VerifyExtensionSign, which the peer-path test does not exercise: its vote is
built as a struct literal, reaching a path no converter can guard.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test: share one vote-extension helper and drop review IDs from comments

Making VoteExtensionsFromProto fallible spread the same three-line convert-and-
require dance across two packages and a dozen call sites, as two near-identical
private helpers whose signatures had already diverged (testing.TB vs *testing.T).
Export MustVoteExtensionsFromProto from types/test_util.go instead, following the
existing convention of a non-test file importing testing (internal/state/test/
factory), and use it everywhere a *testing.T is in scope.

The two production helpers that convert extensions, types.makeCommit and the
state test factory, keep returning an error: they have no t to fail.

Also drops ephemeral review-finding IDs from test comments in the two files this
change touches. Those IDs are reassigned on every review run and go dead after
merge, so each is replaced by the invariant it stood for.

Co-Authored-By: Claude Opus 5 <[email protected]>

* fix(kvstore): return errors from the sign-item helpers

makeVoteExtensionSignItems panicked on the newly fail-closed conversion of
peer-forwarded wire data, and makeBlockSignItem panicked on its own marshalling
failures. STYLE_GUIDE.md reserves panic for a broken internal invariant; neither
qualifies, since both derive from a FinalizeBlock request. Both now return an
error, propagated by FinalizeBlock the same way as its other failure paths.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test: cover the light-client and ExtendVote extension-type paths

The unknown-type rejection has four propagation destinations; the light client
and the ABCI-facing ExtendVote had no test. verifyBlockSignatureWithDashCore
builds a canonical vote from a provider-supplied commit, so a malicious provider
could otherwise panic the light client; its Dash Core client is left nil in the
test because the rejection must happen before any RPC round-trip.

ExtendVote's panic is asserted rather than removed. That response comes from our
own application, so a type outside the enum is a local app/tenderdash mismatch,
not a network fault, and failing loudly is the intended behaviour there. The test
pins that contract so it cannot be softened by accident.

Co-Authored-By: Claude Opus 5 <[email protected]>

* docs: correct two comments on the vote-extension paths

MakeQuorumSigns claimed a causal dependency that does not hold for the traced
input; the real reason to convert first is that MakeBlockSignItem panics rather
than returning an error, so fallible work belongs ahead of it.

Marks the ExtendVote panic as a reviewed, deliberate choice: ABCI hardening is
out of scope here, and panicking on an ABCI-supplied undefined type is the
intended strongest signal, not an oversight to be fixed later.

Co-Authored-By: Claude Opus 5 <[email protected]>

---------

Co-authored-by: Ivan Shumkov <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
shumkov added a commit that referenced this pull request Aug 17, 2026
* fix(consensus): prevent remote crash/brick via unknown vote-extension type

An unprivileged peer could send a Commit (or precommit) carrying a
vote-extension whose proto enum Type is undefined. proto3 enums are open, so
gogoproto accepts any varint; VoteExtensionFromProto's default arm then
panicked, terminating the consensus goroutine (which is designed to re-panic).
Because the message is written to the WAL before it is processed, the node
re-read it on restart and crash-looped — a one-packet, network-wide kill of
every validator and full node, not recoverable by restart.

Fix (defense-in-depth):
- VoteExtensionFromProto no longer panics on an unknown type; it returns a
  non-threshold-recoverable extension so construction cannot crash on any path.
- MakeQuorumSigns — the shared chokepoint of VerifyCommit (commits) and
  VerifyExtensionSign (precommit votes) — rejects unknown extension types, so a
  message carrying one fails closed instead of being silently excluded from the
  sign items (which on the precommit path would otherwise still reach the ABCI
  VerifyVoteExtension call).

The rejection is deliberately NOT placed in Commit.ValidateBasic: that runs on
the WAL decode path, where a rejection becomes a DataCorruptionError that aborts
replay and would re-brick already-attacked nodes. On the verification path the
error is swallowed by loggingMiddleware on both live and replay, so poisoned
nodes restart cleanly.

Tests (red→green verified for each):
- types/commit_extension_regression_test.go — construction does not panic;
  VerifyCommit, MakeQuorumSigns and the precommit VerifyExtensionSign reject
  the unknown type. The vote-path test fails if the MakeQuorumSigns check is
  removed, pinning the silent-ignore regression.
- internal/consensus/commit_extension_unbrick_test.go — writes a poison commit
  to a real WAL, confirms it still DECODES (a ValidateBasic rejection would
  abort replay), and that verifying the replayed commit returns an error
  without panicking. This is the restart-recovery (un-brick) property.

Green across types, privval, light, and internal/consensus vote/commit/WAL/
replay tests. Independently validated: crash removed, un-brick preserved, no
false-accept, no legitimate traffic rejected.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* fix(types): return an error for unknown vote-extension types

VoteExtensionFromProto returned a fabricated GenericVoteExtension for a type
outside the defined enum values. proto3 enums are open, so a peer can put any
varint on the wire, and vote extensions feed the sign-hash through
MakeQuorumSigns: substituting a default silently changes the digest, so at best
verification fails with a misleading error and at worst two nodes derive
different canonical votes for the same commit. Nothing on a path feeding a
signature may be fabricated.

The conversion now returns an error, propagated through VoteExtensions.Add,
VoteExtensionsFromProto, NewVoteExtensionsFromABCIExtended and
Commit.GetCanonicalVote, and out through the callers that already return an
error. A poisoned message is rejected by the existing caller instead of
terminating the consensus goroutine.

A poison commit still decodes from the WAL — CommitFromProto keeps extensions in
wire form and Commit.ValidateBasic is unchanged — and is rejected later at
VerifyCommit, so an already-attacked node still restarts. A poison precommit now
dies at MsgFromProto -> VoteFromProto in the reactor; it could never reach the
WAL, because on every prior version that same conversion panicked there.

NewVoteExtensionsFromABCIExtended propagates the error and ExtendVote panics on
it: that input is our own application, not a peer, so an undefined type is a
local bug and must fail loudly, consistent with the panics ExtendVote already
raises on ABCI misbehaviour.

Drops the defensive loop MakeQuorumSigns used to carry: both paths it guarded
funnel through the same VoteExtensionsFromProto call, which now rejects the type
before Filter can silently exclude it.

Out of scope by instruction: peer punishment, Commit.ValidateBasic validation,
WAL write ordering, and recover()/panic-handling middleware.

Co-Authored-By: Claude Opus 5 <[email protected]>

* docs: remove commit-extension-panic exploit spec

The spec documented an unpatched vulnerability (exact packet size,
ungated reactor branch, exploit cost) under docs/, a VuePress-built
site with no exclude rule for this path — publishable before the fix
ships, contradicting the doc's own §8 guidance not to push it early.

Flagged HIGH by security review; removing rather than gating, since
no exclude mechanism exists in the current VuePress config.

* fix(types): add a sentinel error and reject nil vote extensions

VoteExtensionsFromProto dereferenced every slice element without a nil check,
contradicting the fail-closed contract VoteExtensionFromProto documents: the
conversion is reachable from untrusted network input and must neither panic nor
fabricate a value. A nil element now yields an error naming its index.

The unknown-type rejection gains an exported sentinel, ErrUnknownVoteExtensionType,
so callers can match it with errors.Is. A future peer-punishment change needs to
distinguish "this peer sent an undefined enum value" from any other conversion
failure, which a bare fmt.Errorf cannot express. The message text is unchanged.

Add, VoteExtensionsFromProto and NewVoteExtensionsFromABCIExtended became fallible
without their godoc saying so; each now documents its error contract. Callers of
VoteExtensions.Add are the one signature change the compiler cannot enforce - a
stale .Add(ve) call still compiles and silently swallows the rejection - so the
error is now part of the documented API surface.

Tests assert the specific sentinel via errors.Is rather than "some error".
VerifyCommit's case previously passed even with the rejection fully removed,
because its fake zero signature failed verification first; it now builds a commit
that genuinely verifies, asserts that positive control, and only then flips one
extension type to an undefined value. Restores direct coverage of
Vote.VerifyExtensionSign, which the peer-path test does not exercise: its vote is
built as a struct literal, reaching a path no converter can guard.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test: share one vote-extension helper and drop review IDs from comments

Making VoteExtensionsFromProto fallible spread the same three-line convert-and-
require dance across two packages and a dozen call sites, as two near-identical
private helpers whose signatures had already diverged (testing.TB vs *testing.T).
Export MustVoteExtensionsFromProto from types/test_util.go instead, following the
existing convention of a non-test file importing testing (internal/state/test/
factory), and use it everywhere a *testing.T is in scope.

The two production helpers that convert extensions, types.makeCommit and the
state test factory, keep returning an error: they have no t to fail.

Also drops ephemeral review-finding IDs from test comments in the two files this
change touches. Those IDs are reassigned on every review run and go dead after
merge, so each is replaced by the invariant it stood for.

Co-Authored-By: Claude Opus 5 <[email protected]>

* fix(kvstore): return errors from the sign-item helpers

makeVoteExtensionSignItems panicked on the newly fail-closed conversion of
peer-forwarded wire data, and makeBlockSignItem panicked on its own marshalling
failures. STYLE_GUIDE.md reserves panic for a broken internal invariant; neither
qualifies, since both derive from a FinalizeBlock request. Both now return an
error, propagated by FinalizeBlock the same way as its other failure paths.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test: cover the light-client and ExtendVote extension-type paths

The unknown-type rejection has four propagation destinations; the light client
and the ABCI-facing ExtendVote had no test. verifyBlockSignatureWithDashCore
builds a canonical vote from a provider-supplied commit, so a malicious provider
could otherwise panic the light client; its Dash Core client is left nil in the
test because the rejection must happen before any RPC round-trip.

ExtendVote's panic is asserted rather than removed. That response comes from our
own application, so a type outside the enum is a local app/tenderdash mismatch,
not a network fault, and failing loudly is the intended behaviour there. The test
pins that contract so it cannot be softened by accident.

Co-Authored-By: Claude Opus 5 <[email protected]>

* docs: correct two comments on the vote-extension paths

MakeQuorumSigns claimed a causal dependency that does not hold for the traced
input; the real reason to convert first is that MakeBlockSignItem panics rather
than returning an error, so fallible work belongs ahead of it.

Marks the ExtendVote panic as a reviewed, deliberate choice: ABCI hardening is
out of scope here, and panicking on an ABCI-supplied undefined type is the
intended strongest signal, not an oversight to be fixed later.

Co-Authored-By: Claude Opus 5 <[email protected]>

---------

Co-authored-by: Ivan Shumkov <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants