惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - Franky
有赞技术团队
有赞技术团队
宝玉的分享
宝玉的分享
雷峰网
雷峰网
Hugging Face - Blog
Hugging Face - Blog
V
V2EX
大猫的无限游戏
大猫的无限游戏
博客园 - 司徒正美
D
Docker
T
The Blog of Author Tim Ferriss
罗磊的独立博客
博客园 - 叶小钗
酷 壳 – CoolShell
酷 壳 – CoolShell
Blog — PlanetScale
Blog — PlanetScale
月光博客
月光博客
J
Java Code Geeks
Jina AI
Jina AI
博客园 - 【当耐特】
C
Check Point Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
腾讯CDC
Last Week in AI
Last Week in AI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Visual Studio Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
The Bug Behind the Bug: Why Protocol Failures Rarely Live...
Dinesh · 2026-06-28 · via DEV Community

Blockchain incidents are often explained too simply: “consensus stopped,” “the VM produced the wrong state,” or “a malformed transaction crashed validators.”

In production protocols, the real failure usually emerges between components. A bug may begin in transaction decoding, become dangerous during execution, and finally halt the network when consensus repeatedly proposes the same invalid payload.

A Protocol Is a Chain of Deterministic Assumptions

Every validator must transform the same input into the same result:

previous state + ordered transactions
              -> deterministic execution
              -> identical state root

Each step hides assumptions. Are transactions decoded identically? Is iteration deterministic? Is gas accounting equal across architectures? Can recovery expose partial state? Does consensus distinguish an invalid proposal from a local execution failure?

Any unclear answer represents consensus risk.

Deterministic Invalidity Can Kill Liveness

Non-deterministic execution is dangerous because validators may calculate different state roots. Deterministic invalidity is less obvious but can be equally destructive.

Suppose a transaction triggers an execution bug. Every honest validator rejects the proposed block. Safety is preserved because no conflicting state is committed.

But the failed transaction remains in the mempool. The next leader selects it again and creates another invalid block. Leadership rotates, yet proposers keep rebuilding candidates from the same poisoned transaction set.

The chain does not fork. It freezes.

“All validators agreed” does not prove the protocol behaved correctly. Consensus can agree indefinitely on rejecting progress.

Consensus Needs Typed Execution Errors

A common mistake is treating execution as binary:

match execute_block(block) {
    Ok(result) => vote(result),
    Err(_) => reject(block),
}

This destroys important information. Failures should be classified as permanently invalid, state-dependent, temporarily unverifiable, or local infrastructure failures.

Each category requires a different response. A permanently invalid transaction should be removed from proposal paths. Missing data may trigger recovery. A local database error must not be broadcast as proof that the block is invalid.

Without typed errors, operational faults can become consensus decisions.

State Commit Must Be Atomic

A validator should never expose partially committed state.

execute in isolated state
-> verify state root
-> atomically commit state and metadata
-> publish the result

If account updates are stored before receipts or block metadata, a crash can leave the node with state that belongs to no committed block. After restart, it may calculate a different result from healthy peers even when execution code is correct.

Write-ahead logs, versioned state, idempotent recovery, and atomic batches are protocol-safety mechanisms, not merely database optimizations.

Test Recovery, Not Only Success

A serious test suite should cover repeated invalid proposals, failure between execution and commit, validator restart during persistence, inconsistent error classification, stale mempool recovery, and upgrades that change serialization, gas, or state-root behavior.

Run these scenarios in multi-node environments with process kills, disk faults, delayed messages, duplicated proposals, and mixed versions.

Unit tests prove local behavior. Fault-injection tests reveal whether local failures can coordinate into a global outage.

The Senior Protocol Engineering Principle

The most important review question is not:

Can this function fail?

It is:

What will every other subsystem do after it fails?

A resilient blockchain must reject invalid transitions, remove poison from proposer pipelines, distinguish protocol invalidity from local failure, commit state atomically, and recover without changing deterministic behavior.

The deepest protocol bugs live at boundaries. Consensus engineers must understand execution. VM engineers must understand storage. Storage engineers must understand replay. Networking engineers must understand retry behavior.

A protocol remains reliable only when every layer agrees not just on valid state, but also on how failure is classified, contained, and recovered.