github.com/ava-labs/avalanchego@v1.11.11/vms/platformvm/block/executor/README.md (about)

     1  # Package `executor`
     2  
     3  This package deals with state management for P-Chain blocks.
     4  
     5  ## `*Block`
     6  
     7  The `*Block` type implements the `snowman.Block` interface.
     8  This is the type that the `platformvm` deals with when it uses `snowman.Block`s.
     9  `*Block` wraps a `blocks.Block` and a `manager`.
    10  The `*Block` itself doesn't have any state.
    11  The state is all held by the `manager`, and the `*Block` acts upon the `manager` to get/set the state.
    12  Therefore, we don't need to worry about deduplicating `*Block` instances.
    13  
    14  The `platformvm` uses the `manager` to create blocks and query block state because
    15  the `manager.GetBlock` returns a _stateful_ block (`*Block`), whereas `state.State`'s `GetStatelessBlock` returns a `blocks.Block`.
    16  
    17  ## Visitors
    18  
    19  This package contains three implementations of `blocks.Visitor`: `verifier`, `acceptor` and `rejector`.
    20  These implement the logic for verifying, accepting and rejecting blocks.
    21  Each implementation has a reference to a shared `*backend`, which maintains state, etc.
    22  (The `manager` has a reference to the shared `*backend` as well.)