Skip to content

Sample Test Results

Arnaud Bailly edited this page Oct 10, 2022 · 1 revision

Hydra.SnapshotStrategy

New Snapshot Decision

  • sends ReqSn given is leader and no snapshot in flight and there's a seen tx
  • always ReqSn given head has 1 member and there's a seen tx
  • there's always a leader for every snapsnot number
  • do not send ReqSn when we aren't leader
  • do not send ReqSn when there is a snapshot in flight
  • do not send ReqSn when there's no seen transactions

Snapshot Emission

  • update seenSnapshot state when sending ReqSn

Hydra.Party

Ord

  • is transitive

  • is reflexive

  • is antisymmetric

  • implements Eq and Ord correspondingly

JSON encoding of Party

  • allows to encode values with aeson and read them back
  • produces the same JSON as is found in golden/Party.json

Hydra.Options

Hydra Node RunOptions

  • has defaults
  • parses --host option given valid IPv4 and IPv6 addresses
  • parses --port option given valid port number
  • parses --peer : option
  • does parse --peer given ipv6 addresses
  • parses --monitoring-port option given valid port number
  • parses --version flag as a parse error
  • parses --hydra-verification-key option as a filepath
  • parses --hydra-signing-key option as a filepath
  • parses --network-id option as a number
  • parses --mainnet flag
  • parses --node-socket as a filepath
  • parses --cardano-signing-key option as a filepath
  • parses --cardano-verification-key option as a filepath
  • parses --ledger-genesis-file as a filepath
  • parses --ledger-protocol-parameters-file as a filepath
  • parses --start-chain-from as a pair of slot number and block header hash
  • parses --hydra-scripts-tx-id as a tx id
  • roundtrip options

publish-scripts sub-command

  • does not parse without any options
  • does not parse with some missing option (1)
  • does not parse with some missing option (2)
  • does not parse with some missing option (3)
  • should parse with all options

Hydra.Node

  • emits a single ReqSn and AckSn as leader, even after multiple ReqTxs
  • rotates snapshot leaders
  • processes out-of-order AckSn
  • notifies client when postTx throws PostTxError

Hydra.Network.Heartbeat

Heartbeat

  • sends a heartbeat message with local host after 500 ms
  • sends Connected when Ping received from other peer
  • sends Connected when any message received from other party
  • do not send Connected on subsequent messages from already Connected party
  • sends Disconnected given no messages has been received from known party within twice heartbeat delay
  • stop sending heartbeat message given action sends a message
  • restart sending heartbeat messages given last message sent is older than heartbeat delay

Hydra.Network

Networking layer

Serialisation

  • can roundtrip CBOR encoding/decoding of Hydra Message

JSON encoding of (Message SimpleTx)

  • allows to encode values with aeson and read them back
  • produces the same JSON as is found in golden/Message SimpleTx.json

Ouroboros Network

  • broadcasts messages to single connected peer
  • broadcasts messages between 3 connected peers

Hydra.Model

  • model generates consistent traces
  • implementation respects model
  • check conflict-free liveness

Hydra.Logging.Monitoring

  • provides prometheus metrics from traces

Hydra.Logging

  • dumps logs to stdout in JSON with timestamp
  • HydraLog

Hydra.Ledger.Simple

Simple Ledger

  • validates only correctly built transactions

Hydra.Ledger.Cardano

JSON encoding of (Tx BabbageEra)

  • allows to encode values with aeson and read them back
  • produces the same JSON as is found in golden/Tx BabbageEra.json

JSON encoding of (UTxO' (TxOut CtxUTxO BabbageEra))

  • allows to encode values with aeson and read them back
  • produces the same JSON as is found in golden/UTxO' (TxOut CtxUTxO BabbageEra).json

JSON encoding of AssetName

  • allows to encode values with aeson and read them back

  • produces the same JSON as is found in golden/AssetName.json

  • Same TxId before/after JSON encoding

  • Roundtrip to and from Ledger

  • CBOR encoding of Tx

  • applies valid transaction

  • applies valid transaction serialised from JSON

  • should parse a Cardano.UTxO

  • should parse a Tx

Evaluate helpers

  • slotNoFromUTCTime . slotNoToUTCTime === id

Generators

  • arbitrary @TxIn is reasonably collision resistant
  • arbitrary @TxId is reasonably collision resistant
  • arbitrary @(VerificationKey PaymentKey) is reasonably collision resistant
  • arbitrary @(Hash PaymentKey) is reasonably collision resistant
  • genUTxOAlonzo does not generate collapsing values
  • genUTxOAdaOnlyOfSize does not generate collapsing values
  • genUTxOFor is reasonably collision resistant
  • genOneUTxOFor is reasonably collision resistant

Hydra.HeadLogic

Coordinated Head Protocol

  • rejects if a requested tx is expired
  • waits if a requested tx is not (yet) applicable
  • confirms snapshot given it receives AckSn from all parties
  • does not confirm snapshot when given a non-matching signature produced from a different message
  • does not confirm snapshot when given a non-matching signature produced from a different key
  • waits if we receive a snapshot with not-yet-seen transactions
  • waits if we receive an AckSn for an unseen snapshot
  • waits if we receive a future snapshot
  • waits if we receive a future snapshot while collecting signatures
  • acks signed snapshot from the constant leader
  • does not ack snapshots from non-leaders
  • rejects too-old snapshots
  • rejects too-old snapshots when collecting signatures
  • wait given too new snapshots from the leader
  • rejects overlapping snapshot requests from the leader
  • ignores in-flight ReqTx when closed
  • notifies client when it receives a ping
  • cannot observe abort after collect com
  • cannot observe collect com after abort
  • notify user on head closing and when passing the contestation deadline
  • notify user on rollback
  • contests when detecting close with old snapshot
  • re-contests when detecting contest with old snapshot

Types

JSON encoding of (HeadState SimpleTx)

  • allows to encode values with aeson and read them back
  • produces the same JSON as is found in golden/HeadState SimpleTx.json

JSON encoding of (Event SimpleTx)

  • allows to encode values with aeson and read them back
  • produces the same JSON as is found in golden/Event SimpleTx.json

Hydra.FireForget

Fire-Forget Ouroboros Protocol

  • client can send 'Hail Hydra!' to server

Hydra.Crypto

MultiSignature

  • is sensitive to order

Signature

  • show includes escaped hex
  • can sign arbitrary messages
  • sign/verify roundtrip

VerificationKey

  • show includes escaped hex

JSON encoding of (VerificationKey HydraKey)

  • allows to encode values with aeson and read them back
  • produces the same JSON as is found in golden/VerificationKey HydraKey.json

SigningKey

  • show includes escaped hex
  • can be generated when seed exceeds the max seed size for algorithm
  • can be generated

Hydra.Chain.Direct.Wallet

newTinyWallet

  • initialises wallet by querying UTxO
  • re-queries UTxO from the reset point

coverFee

  • balances transaction with fees

applyBlock

  • only reduces the UTXO set when no address is ours
  • Seen inputs are consumed and not in the resulting UTXO

genBlock / genUTxO

  • are well-suited for testing

Hydra.Chain.Direct.Tx

abortTx

  • validates
  • cover fee correctly handles redeemers

collectComTx

  • validates

Hydra.Chain.Direct.TimeHandle

  • can roundtrip currentPointInTime
  • should convert slot within latest/current era

Hydra.Chain.Direct.State

fanout

  • transaction size is below 16kB
  • validates within maxTxExecutionUnits

contest

  • transaction size is below 16kB
  • validates within maxTxExecutionUnits

close

  • transaction size is below 16kB
  • validates within maxTxExecutionUnits

collectCom

  • transaction size is below 16kB
  • validates within maxTxExecutionUnits

abort

  • transaction size is below 16kB
  • validates within maxTxExecutionUnits
  • ignore aborts of other heads

commit

  • transaction size is below 16kB
  • consumes all inputs that are committed
  • can only be applied / observed once
  • reject Commits of Byron outputs

init

  • transaction size is below 16kB
  • is not observed if not invited

observeTx

  • All valid transitions for all possible states can be observed.

Hydra.Chain.Direct.ScriptRegistry

  • newScriptRegistry (registryUTxO r) === Just r

Hydra.Chain.Direct.Handlers

  • roll forward results in Tick events
  • roll forward fails with outdated TimeHandle
  • yields observed transactions rolling forward
  • can replay chain on (benign) rollback

Hydra.Chain.Direct.Contract

Fanout

  • is healthy
  • does not survive random adversarial mutations

Contest

  • is healthy
  • does not survive random adversarial mutations

Close

  • is healthy
  • does not survive random adversarial mutations

CollectCom

  • is healthy
  • does not survive random adversarial mutations

Commit

  • is healthy
  • does not survive random adversarial mutations

Abort

  • is healthy
  • does not survive random adversarial mutations

Init

  • is healthy
  • does not survive random adversarial mutations (on-chain)
  • does not survive random adversarial mutations (off-chain)

Serializing commits

  • deserializeCommit . serializeCommit === id

TxOut hashing

  • OffChain.hashUTxO == OnChain.hashTxOuts (on sorted tx outs)
  • OnChain.hashPreSerializedCommits == OnChain.hashTxOuts (on sorted tx outs)

Signature validator

  • verifies single signature produced off-chain
  • verifies snapshot multi-signature for list of parties and signatures

Hydra.Behavior

rolling back

  • resets head to just after init
  • resets head to just after collect-com

Behavior of one ore more hydra nodes

Hydra Node Logging

  • traces processing of events
  • traces handling of effects

JSON encoding of (HydraNodeLog SimpleTx)

  • allows to encode values with aeson and read them back
  • produces the same JSON as is found in golden/HydraNodeLog SimpleTx.json

in an open head

  • sees the head closed by other nodes
  • valid new transactions are seen by all parties
  • sending two conflicting transactions should lead one being confirmed and one expired
  • valid new transactions get snapshotted
  • reports transactions as seen only when they validate (against the confirmed ledger)
  • multiple transactions get snapshotted
  • outputs utxo from confirmed snapshot when client requests it
  • can be finalized by all parties after contestation period
  • contest automatically when detecting closing with old snapshot

Two participant Head

  • only opens the head after all nodes committed
  • can abort and re-open a head when one party has not committed
  • cannot abort head when commits have been collected
  • cannot commit twice
  • outputs committed utxo when client requests it

Single participant Head

  • accepts Init command
  • accepts Commit after successful Init
  • not accepts commits when the head is open
  • can close an open head
  • does not fanout automatically
  • does finalize head after contestation period upon command

Sanity tests of test suite

  • does not delay for real

Hydra.API.ServerOutput

JSON encoding of (ReasonablySized (ServerOutput (Tx BabbageEra)))

  • allows to encode values with aeson and read them back
  • produces the same JSON as is found in golden/ReasonablySized (ServerOutput (Tx BabbageEra)).json

JSON encoding of (ReasonablySized (ServerOutput SimpleTx))

  • allows to encode values with aeson and read them back
  • produces the same JSON as is found in golden/ReasonablySized (ServerOutput SimpleTx).json

Hydra.API.Server

  • greets
  • sends sendOutput to all connected clients
  • echoes history (past outputs) to client upon reconnection
  • sends an error when input cannot be decoded

Hydra.API.ClientInput

FromJSON (ValidatedTx era)

  • accepts transactions produced via cardano-cli
  • accepts raw CBOR-base16-encoded transactions

JSON encoding of (ReasonablySized (ClientInput (Tx BabbageEra)))

  • allows to encode values with aeson and read them back
  • produces the same JSON as is found in golden/ReasonablySized (ClientInput (Tx BabbageEra)).json

JSON encoding of (ReasonablySized (ClientInput SimpleTx))

  • allows to encode values with aeson and read them back
  • produces the same JSON as is found in golden/ReasonablySized (ClientInput SimpleTx).json
Clone this wiki locally