Monad 백서

Monad

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 65쪽

ommit states Monad's real-time data stream is emitted directly by the EVM. In Category Labs' implementation of a Monad node, execution and consensus are decoupled, as they are in most Ethereum-compatible blockchain software. That is, consensus and execution are not *just* different algorithms, but completely separate programs that communicate with each other. Consensus is the algorithm (and the daemon) which decides whether or not a potential block will become part of the blockchain. Execution hosts the EVM, and executes blocks on a speculative basis, before it is told the fate of the block by the consensus algorithm. Meanwhile, consensus is in the "driver's seat": it is the primary driver in the creation of new blocks, and execution acts as service that consensus uses. However, only execution produces real-time data and maintains the state database, because it is the only thing that sees the details of every log, every call frame, etc. The exact way that blocks progress from one state to the next is explained below. Note that a block's state is from the perspective of a particular observer -- for example if you receive a [QC](/monad-arch/consensus/monad-bft#quorum-certificate-qc) for a block, then you can move that block to the `Voted` state, but if your friend didn't receive that QC yet, then she would still consider that block to be in the `Proposed` state. The challenge of building a distributed consensus mechanism lies in defining rules that allow nodes to individually update their state machines in response to messages even while assuming the worst, i.e. even while assuming that they might be the only one that received that message. ## First commit state: `Proposed` When a new block is proposed by a leader (a Monad validator node), it is sent from that leader's consensus node to all other consensus nodes to be voted on. From the perspective of each of those nodes (as well as any observers), if the block is valid (i.e., follows all protocol rules), it is in the [`Proposed`](/monad-arch/consensus/block-states#proposed) state. Upon receiving a valid block, each consensus node will send a "yes" vote to the next leader, while also scheduling it for immediate [speculative execution](/monad-arch/consensus/asynchronous-execution#speculative-execution) by its local execution daemon. Shortly after this happens -- even as the "yes" vote is starting to be transmitted over the Internet -- the execution daemon begins executing the proposed block in the EVM. A few milliseconds later, the EVM will begin publishing real-time data for this block. In the current implementation of the software, *all* blockchain data is first observed in the `Proposed` state. A `Proposed` block is a tricky thing. Nearly 100% of proposals that are received do eventually become finalized. In a statistical sense then, seeing a `Proposed` block seems quite good. However, that is because usually the global Monad network is functioning properly: the vast majority of the time, there are no major telecom outages on the Internet and there is no attempted malicious activity going on. You are seeing the block so early, that no one has voted for it except you (if you are a validator), and the leader that proposed it. The first stage vote is occurring in parallel, at roughly the same time that you are watching real-time data from its execution. This is the paradox of a `Proposed` block: the transactions within it are almost certainly going to happen. And yet if you need very high levels of assurance before acting, it would be foolish to assume they definitely will: the blockchain's primary defense against errors, outages, and attacks (its consensus algorithm) has not weighed in yet. Make sure you understand the implications of a block being in the `Proposed` state: it's very early, but has no defense against network problems, software errors, or malicious behavior. Each later stage reduces the likelihood of problems occurring, and the kinds of problems that can occur. ## Second commit state: `Voted` As mentioned above, the consensus algorithm is conducting a first round vote on whether or not that block will be appended to the blockchain. The goal of this referendum is to produce a "quorum (minimum number of required votes for referendum to pass) of "yes" votes. The vote is coordinated by the second-round leader, who gathers a quorum of cryptographically-signed "yes" votes into an aggregate signature called a "quorum certificate" ([QC](/monad-arch/consensus/monad-bft#quorum-certificate-qc)). The second round leader sends out that QC to all consensus nodes. If you have received a QC on a block, that means that you have proof that the block passed the first round of voting. When this happens, you may consider the block to be in the [`Voted`](/monad-arch/consensus/block-states#voted) state. A few things to note about the voted state: ### `Voted` does not mean it's on the blockchain A block *cannot* yet be definitively appended to the blockchain when it reaches the `Voted` state. Monad's consensus algorithm uses two rounds of voting. Possession of a QC (i.e. proof that the first round concluded in most participants voting yes) removes the most common kinds of risks, but some risk of being reverted remains. Possessing a QC removes the risk that a block will be "lost" due to the most common issues such as network outages and latency issues. Even if it turned out that you were the only observer with this QC due to a severe network outage, Monad's consensus algorithm has a fallback mechanism that ensures that the original block will be reproposed and ultimately finalized under almost all conditions. Under what conditions is the existence of a QC not enough? [Several things must have happened](/monad-arch/consensus/monad-bft#the-only-loophole), but the most notable is that the original leader must have *equivocated*, i.e. proposed two different blocks at the same block height, sending each to a different set of nodes. Equivocation is an unlikely thing for a leader to do, since it is an easily attributable fault (proof is just the pair of conflicting blocks signed by the same leader), and since the leader only hurts themselves by invalidating their own proposal. This is why a block that has reached the `Voted` stage is very likely to be finalized. ### A block might never enter the `Voted` state A proposed block might never receive a QC, if its first consensus vote fails. The most common reason that a block does not get voted in is network latency issues. Suppose, for example, that both your node and the leader are in Australia, and there is significant congestion with the cross-continental network traffic. In that case, most of the blockchain nodes may not learn about the proposal before the timeout period expires, and the vote will fail. Note that you will *not* be told that the vote fails. The failure of the vote is *implicit*, but you can tell it happened because of the next property. ### For some block number `N`, *some* proposed block will eventually be voted in If you do not receive a QC for a particular block with block number `N`, then at some other time you will receive a *different* proposed block to become block `N` and that *will* receive a QC. A sequence like the following may occur: * You see all of real-time data for some block `B1`, which is proposed to become block number `N` * You see a *different* block, `B2` (and all of its execution events) also competing to become block `N` * `B2` receives a QC, and this is the only thing that happens. Namely, `B1` does *not* receive an explicit "abandonment" event: it is just never mentioned again, and is implicitly abandoned by the network endorsing another block with the same number ## Third commit state: `Finalized` [`Finalized`](/monad-arch/consensus/block-states#finalized) means the block is now part of the canonical blockchain and cannot be reverted without a hard fork. From this point forward, we no longer need the block id and can refer to a block solely by its block number. When a block number `N` is finalized, it *implicitly* abandons all other proposed blocks with the same block number `N`. Such blocks could be in either the proposed or the voted state. We say the abandonment is implicit because no event will be recorded to explicitly announce the abandonment of previously seen block id. If you are using pipelining programming techniques when you consume real-time data, then you are probably keeping track of some state associated with unfinalized blocks. In our trading example, this would be the pre-prepared buy or sell order transaction message. Every time a block is finalized, you read must check for any blocks (1) with the same block number, but (2) with a different id, and abort your pipelined processing for those blocks. They will never be appended to the blockchain and the associated transactions and their effects -- whose execution events you have already seen -- will never occur. ### Why are there two different stages of voting? This is because the *subject* of the vote -- the thing we are trying to get agreement on -- is different. 1. In the *first* vote, the network wants to verify that a block satisfies all the protocol rules. If a QC is obtained, we know that a majority of the honest nodes agree that the block *should* be added. This first vote is called the "voted" stage since *the block itself* has been voted for. 2. In the *second* vote, we want to get cryptographically secure agreement that *enough of the network has actually seen the result of the first vote*. This second vote is called the "finalized" stage since, now that everyone knows the first vote succeeded, they can also agree that it must be the next block on the blockchain. The second vote is trying to answer the question posed by the old saying "If a tree falls in a forest and no one is around to hear it, does it make a sound?" Consider how the "fan-in, fan-out" [linear communication pattern](/monad-arch/consensus/monad-bft#happy-path) of the BFT protocol works. We talk about nodes "having a QC", but the QC is computed by the leader of the next round -- this leader is the one actually "conducting" the vote. Even if the leader is dishonest, it cannot forge the vote because it cannot forge other nodes' cryptographic signatures. But it *can* fail to successfully tell enough of its peers about the QC, since it must communicate the QC to everyone. Network problems are common, so communication can always fail. Thus we need a second round of voting, for validators to reach distributed agreement about the fact that they've seen the first QC. Now it's safe to assume that everyone (or at least the honest majority) will have the same canonical blockchain. The reason that `Voted` is a very reliable commit state on Monad is that if common problems occur during the *second* stage vote, the algorithm will continue trying to conduct the second stage vote, failing only in some narrow corner cases involving equivocation. ## Fourth commit state: `Verified` The consensus algorithm produces one last state transition for a block, called [`Verified`](/monad-arch/consensus/block-states#verified). The `Verified` state is a consequence of Monad's [asynchronous execution](/monad-arch/consensus/asynchronous-execution). Recall that a consensus node votes on a block *before* its execution is complete. This implies that consensus must be voting on the block's execution inputs, but *not* on the block's execution outputs. Consensus nodes cannot be voting, for example, on the correct value of the state root produced by the execution of the block, because they don't know what it is (remember, it is being computed in parallel with the vote occurring). This means that the `Voted` state does not certify the correctness of any output fields in the Ethereum block header such as `state_root`, `receipts_root`, etc. This is possible because any well-formed Ethereum block will have completely deterministic effects on the blockchain state, when executed by a conforming EVM implementation. Thus, it is safe to append a block onto the blockchain, knowing that everyone will agree on its behavior, even if we don't know exactly what the behavior will be. Clearly though, for the blockchain to be reliable, consensus nodes *must* eventually vote on the correctness of the execution outputs. Suppose they did not, and further suppose that a bug existed in some execution nodes but not in others (perhaps running a different version of the client software). If there were no mechanism to feed the execution outputs back into consensus decisions, the state could become forked without anyone noticing. Consensus proposals *start* by assuming that all execution nodes will compute the correct state, but to prevent bugs and malicious actions from compromising the network, it must check that this happens eventually. Here is how Monad solves this issue: To give execution ample time to finish, execution outputs for block `B` are not incorporated into the consensus protocol until three rounds in the future, alongside the proposal of block `B+3`. When *this* proposal is finalized (ideally two rounds later, during the proposal of block `B+5`), then a supermajority of nodes will have voted for the correct values of the execution outputs. To roughly summarize the difference: * `Finalized` means the block's definition (i.e., its transactions) are definitely part of the blockchain * `Verified` means that a supermajority stake's worth of other nodes have verified that your local node's computation of the state changes of these transactions match the supermajority's To understand more, read [here](/monad-arch/consensus/asynchronous-execution#delayed-merkle-root). Does this imply that verified state is the gold standard for "100%, can never fail" transaction reporting? Also no, if you are trusting a data feed produced by a single node. Who is to say, for example, that the node producing the data in not suffering from a bug, or has been hacked? As always in the blockchain universe, critical transactions that demand *total* peace of mind can only be verified by widespread agreement, *broadly* defined. This includes explicitly checking with other nodes, to ensure no hosts or network intermediaries have been compromised and the software is working properly. In practice, the `Voted` state is usually good enough for most things: it should *very* rarely revert in practice, so it is also used as the `"safe"` block tag in Monad's RPC implementation. # Transaction Lifecycle in Monad Source: https://docs.monad.xyz/monad-arch/transaction-lifecycle ## Transaction Submission The lifecycle of a transaction starts with a user preparing a signed transaction and submitting it to an RPC node. Transactions are typically prepared by an application frontend, then presented to the user's wallet for signing. Most wallets make an `eth_estimateGas` RPC call to populate the gas **limit** for this transaction, although the user can also override this in their wallet. The user is also typically asked to choose a gas **price** for the transaction, which is a number of NativeTokens per unit of gas. After the user approves the signing in their wallet, the signed transaction is submitted to an RPC node using the `eth_sendTransaction` or `eth_sendRawTransaction` API call. ## Mempool Propagation As described in [Local Mempool](/monad-arch/consensus/local-mempool): The RPC node performs validity checks: * signature verification * nonce not too low * gas limit below transaction gas limit before forwarding the pending transaction to the next `N` leaders. Each of those leaders replicate those validity checks before adding the pending transaction to their local mempool. If the transaction isn't included in any of the blocks proposed by those leaders, the RPC node repeats this process, sending to the next `N` leaders. The process is repeated up to `K` times. ## Block Inclusion Pending transactions are included in a block only if further dynamic checks pass: * account balance is sufficient to pay for gas (taking into account the [reserve balance rules](/developer-essentials/reserve-balance)) * nonce is contiguous * pays valid [base fee per gas](/developer-essentials/gas-pricing#eip-1559-compatibility) * there is space in the block and the leader has chosen to include this transaction ## Block Propagation Blocks are propagated through the network as discussed in [MonadBFT](/monad-arch/consensus/monad-bft), using the [RaptorCast](/monad-arch/consensus/raptorcast) messaging protocol for outbound messages from the leader. Under MonadBFT, a block progresses from the Proposed phase to the Voted phase (after 1 block) and then to the Finalized phase (after 2 blocks). Once the block is Finalized, the transaction has officially "occurred" in the history of the blockchain. Since its order is determined, its truth value (i.e., whether it succeeds or fails, and what the outcome is immediately after that execution) is determined. ## Local Execution As soon as a node receives a block, it begins executing the transactions from that block. For efficiency reasons, transactions are executed [optimistically in parallel](/monad-arch/execution/parallel-execution), but it is as if the transactions were executed serially, since results are always committed in the original order. ## Querying the Outcome The user can query the result of the transaction by calling `eth_getTransactionByHash` or `eth_getTransactionReceipt` on any RPC node. The RPC node will return as soon as execution completes locally on the node. # Announcements Source: https://docs.monad.xyz/node-ops/announcements ## Channels Subscribe to the following channels to receive Monad Foundation announcements: | Channel | Link | | - | - | | Email | Delivered to the address associated with your validator registration | | Discord | [#mainnet-validator-announcements](https://discord.gg/monaddev) | | Telegram | [Node Announcements](https://t.me/MonadNodeAnnouncements) | ## Severity System In order to provide a standardized framework for network-related communications, the Monad Foundation uses the following color-coded categories to preface announcements. These categories are directly attributed to level of severity, recommended action, and timeframe. <Info> Ecosystem participants can use this framework to set up alerts (e.g. PagerDuty) for "CODE RED" in email subjects or social channels, further assisting in the dissemination of time-critical information. </Info> Announcements may be reclassified as more information becomes available. In an emergency, the Foundation may use any available communication channel regardless of the classification below. ### Green 🟢 **Subject contains "CODE GREEN"** — informational, no action required. Examples: * Optional upgrades * Validator info updates * Social coordination messaging * Non-critical additions to the operations layer ### Orange 🟠 **Subject contains "CODE ORANGE"** — action recommended within 24–48 hours. Examples: * Upcoming non-emergency upgrades Communication will be shared over email, Discord, and the Telegram Node Announcements channel. ### Red 🔴 **Subject contains "CODE RED"** — action recommended immediately upon receiving communication. Examples: * Critical emergency upgrades * Chain halts * Staking protocol compromises Communication channels depend on the nature of the incident: * **Resetricted rollout** (emergency and sensitive, e.g. security vulnerability) — to minimize the risk of exploitation before a patch is widely deployed, communication may initially be shared **exclusively over email** to known validators. * **Unrestricted rollout** (emergency but not sensitive, e.g. emergency upgrade affecting chain liveness) — communication will generally be shared over email, Discord, and the Telegram Node Announcements channel. # How Full Nodes
프로젝트로 돌아가기