Skip to content

Further StAnnTx integration #5836

@lehins

Description

@lehins

Follow up work after #5791

This ticket is about actually using memoized PlutusWithContext and using all of memoization for transactions leaving the mempool.

Here is a lay down of steps necessary

  1. First and foremost newtype Validated tx will be deprecated and a different type will be added as its replacement, which will contain StAnnTx, instead of arbitrary tx. Point of this is that we don't even want to leak StAnnTx as a publicly usable type family, it must remain an implementation detail:
data ValidatedTx era = ValidatedTx
  { vtStAnnTx :: !(StAnnTx TopTx era)
  -- ^ State annotated transaction that went through full validation
  , vtProtocolVersion :: !ProtVer
  -- ^ Protocol version in which transaction was fully validated
  , vtSlotNo :: !SlotNo
  -- ^ Slot number in which transaction was fully validated
  }

We want to record the SlotNo for book keeping, as well as for one edge case in Alonzo era, which will be mentioned later below. Protocol version will be needed to properly handle revalidation on the hard fork boundary

  1. applyTxValidation will be responsible for creating StAnnTx and in the end producing ValidatedTx
  2. applyValidatedTx will need to be added into ApplyTx type class. It will accept ValidatedTx era instead of plain old Tx.
  3. applyTx and reapplyTx should have retain their previous type signature and DEPRECATED
  4. applyTxWithFullValidation and applyTxWithReValidation need to be added as their new replacements with same type signatures, except using new ValidatedTx data type
  5. Alonzo era will have to retain previous weird behavior where construction of plutus context actually depends on the SlotNo. Therefore, for AlonzoEra:
  • in applyTxValidation we will pass extended epochInfo:
    mkStAnnTx (unsafeLinearExtendEpochInfo slot ei) sysStart pp utxo tx
  • in applyValidatedTx we will have to guard against revalidation in a different slot number. So if vtSlotNo doesn't equal the supplied slotNo in the MempoolEnv then StAnnTx will have to be reconstructed as above.
  1. Alonzo era will need new definition of LEDGERS rule, which will construct StAnnTx in the same way as in ApplyTx, using unsafeLinearExtendEpochInfo slot ei.
  2. asatProtocolVersion and dsattProtocolVersion can be removed in favor of vtProtocolVersion
  3. in applyTxWithReValidation for all eras, if major protocol version in vtProtocolVersion does not match ppProtocolVersionL . curPParamsGovStateL, then StAnnTx needs to be reconstructed from scratch.
  4. ueUtxo can be removed from UtxosEnv

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions