Skip to content
Snippets Groups Projects
Select Git revision
  • 3645-nil-pointer-errors-are-occasionally-thrown
  • main default protected
  • release-1.4 protected
  • partial-merkle-tree
  • 3616-migrate-block-ledger
  • 3623-backport
  • hashed-time-locks
  • 3626-expose-simulator
  • 3640-mining-support
  • 3621-csv2yaml
  • eip712-mask
  • 3565-eip712-ethan
  • 3617-instrumentation-followup
  • database
  • database-benchmark-index
  • database-no-mutex
  • 3588-blockchain-specific-key-value-database
  • 3570-generalize-pki-types
  • 3600-fee-schedule-consistency
  • 3589-code-intelligence
  • v1.4.1-snapshot
  • v1.4.1
  • v1.4.0
  • v1.4.0-alpha.1
  • v1.3.0
  • v1.3.0-rc.3
  • v1.2.13
  • v1.2.12
  • mexc-v1.2.11
  • v1.3.0-rc.2
  • v1.2.11
  • v1.2.10
  • v1.2.10-rc.8
  • v1.2.10-rc.7
  • v1.2.10-rc.6
  • v1.2.10-rc.5
  • v1.2.10-rc.4
  • v1.2.10-rc.3
  • v1.2.10-rc.2
  • mexc-v1.2.10-rc.2
40 results

chain

  • Clone with SSH
  • Clone with HTTPS
  • Ethan Reesor's avatar
    Ethan Reesor authored
    Closes AC-1298. Moves the block executor to its own package to clearly separate block execution from transaction execution. Also so we don't have so many `executor_this.go` and `executor_that.go` files.
    93a3b788
    History

    Chain Validator Design

    Chain validators are organized by transaction type. The executor handles mundane tasks that are common to all chain validators, such as authentication and authorization.

    In general, every transaction requires an origin record. Thus, the executor validates and loads the origin before delegating to the chain validator. However, certain transaction types, specifically synthetic transactions that create records, may not need an extant origin. The executor has a specific clause for these special cases.

    Chain Validator Implementation

    Chain validators must satisfy the TxExecutor interface:

    type TxExecutor interface {
    	Type() protocol.TransactionType
    	Validate(*StateManager, *protocol.Envelope) error
    }

    All state manipulation (mutating and loading) must go through the state manager. There are three methods that can be used to modify records and/or create synthetic transactions:

    • Implementing a user transaction executor
      • Update(record) - Update one or more existing records. Cannot be used to create records.
      • Create(record) - Create one or more new records. Produces a synthetic chain create transaction.
      • Submit(url, body) - Submit a synthetic transaction.
    • Implementing a synthetic transaction executor
      • Update(record) - Create or update one or more existing records.
      • Create(record) - Cannot be used by synthetic transactions.
      • Submit(url, body) - Cannot be used by synthetic transactions.