Skip to content

fix(erpc:PLA-1610): harden consensus and HyperEVM filtering#93

Open
0x666c6f wants to merge 9 commits into
morpho-mainfrom
feature/pla-1610-harden-erpc-consensus-and-evm-cache-correctness
Open

fix(erpc:PLA-1610): harden consensus and HyperEVM filtering#93
0x666c6f wants to merge 9 commits into
morpho-mainfrom
feature/pla-1610-harden-erpc-consensus-and-evm-cache-correctness

Conversation

@0x666c6f

@0x666c6f 0x666c6f commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fail closed when consensus wait caps fire before enough valid participants respond.
  • Enforce required participant tag quotas against final valid consensus responses.
  • Tighten HyperEVM system-transaction filtering while validating original upstream blocks first.

Changes

  • Add wait-cap, required-participant, and slow-required-participant regression coverage in consensus tests.
  • Require HyperEVM filtered transactions to match multiple zero-value system fields, not just zero gas price.
  • Validate HyperEVM blocks before post-processing filters remove system transactions, with all-system transactionsRoot regression coverage.
  • Update consensus docs and existing hedge tests for explicit non-wait-cap timing.

Linear


Open in Devin Review

Copilot AI review requested due to automatic review settings June 24, 2026 10:41
@0x666c6f 0x666c6f self-assigned this Jun 24, 2026
Comment thread consensus/rules.go Outdated
Action: func(a *consensusAnalysis) *slotResult {
return &slotResult{
Error: common.NewErrConsensusLowParticipants(
"not enough required consensus participants: "+strings.Join(a.missingRequiredParticipants(), ", "),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

missingRequiredParticipants() is invoked twice; call it once, store the result, and reuse it for length check and join to avoid redundant computation

Details

✨ AI Reasoning
​The Action builds an error string by calling missingRequiredParticipants() twice (once to test length and again to produce the joined string). This re-computes the same slice twice. Capture the slice once and reuse it to avoid redundant work and make intent clearer.

🔧 How do I fix it?
Rewrite the snippet in the simpler, behavior-equivalent form: return a boolean expression directly instead of if cond return true else return false, avoid using lists when they are guaranteed to contain one element, etc.

Reply @AikidoSec feedback: [FEEDBACK] to get better review comments in the future.
Reply @AikidoSec ignore: [REASON] to ignore this issue.
More info

aikido-pr-checks[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Hardens eRPC’s consensus behavior under wait caps and required-participant quotas, and tightens HyperEVM system-transaction filtering to prevent invalid/undesired transactions from affecting block handling.

Changes:

  • Consensus: fail closed when wait caps fire before reaching agreementThreshold, and enforce requiredParticipants quotas against valid responses.
  • HyperEVM: strengthen system-transaction identification (multiple zero-ish fields) and run filtering before block validation.
  • Tests/docs: add/adjust regression coverage and update consensus documentation to reflect the new rule ordering/semantics.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
erpc/networks_hedge_cancel_test.go Makes hedge/consensus tests explicit about wait-cap timing to avoid ambiguous behavior.
docs/pages/config/failsafe/consensus.mdx Updates docs to reflect fail-closed wait-cap semantics and strict required-participant enforcement (26 rules).
consensus/wait_cap_test.go Adds regression tests for fail-closed behavior below threshold and updates existing wait-cap expectations.
consensus/rules.go Introduces new top-priority rules for wait-capped low participants and missing required-participant quotas.
consensus/quota.go Updates quota semantics comments to match strict enforcement in analysis.
consensus/quota_test.go Adds unit coverage ensuring required participant quotas can reject an otherwise “winning” result.
consensus/executor.go Propagates wait-cap state into analysis to support fail-closed rule evaluation.
consensus/analysis.go Adds waitCapped to analysis and implements required-participant quota checking over valid responses.
common/config.go Updates ConsensusPolicyConfig.RequiredParticipants comment to reflect fail-closed semantics.
architecture/evm/eth_getBlockByNumber.go Moves HyperEVM filtering before validation and tightens system-tx detection fields.
architecture/evm/eth_getBlockByNumber_test.go Updates fixtures/assertions to ensure only true system txs are filtered on HyperEVM.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread consensus/executor.go Outdated
Comment on lines +555 to +559
if analysis == nil {
analysis = newConsensusAnalysis(e.logger, ctx, e.config, responses)
analysis = newConsensusAnalysisWithOptions(e.logger, ctx, e.config, responses, waitCapped)
winner = e.determineWinner(lg, analysis)
} else if waitCapped {
analysis = newConsensusAnalysisWithOptions(e.logger, ctx, e.config, responses, true)
Copilot AI review requested due to automatic review settings June 24, 2026 10:48

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 1 additional finding in Devin Review.

Open in Devin Review

Comment thread architecture/evm/eth_getBlockByNumber.go

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Comment thread consensus/wait_cap_test.go
Copilot AI review requested due to automatic review settings June 24, 2026 10:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Comment thread consensus/wait_cap_test.go Outdated
Copilot AI review requested due to automatic review settings June 24, 2026 11:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Comment thread consensus/rules.go
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.

2 participants