Merge pull request #786 from input-output-hk/everyone-collects
Everyone collects after observing the last commit
Everyone collects after observing the last commit
- `hydra-node` detects misconfiguration and exits with the log item and
exception if the provided arguments are not inline with persisted state.
- All participants' `hydra-node` try to collect once seeing the last `commitTx`.
## [0.9.0] - 2023-03-02
:dragon_face: Renamed the repository from `hydra-poc` to [`hydra`](https://github.com/input-output-hk/hydra)!
-- __Transition__: 'InitialState' → 'InitialState'
onInitialChainCommitTx ::
Monoid (UTxOType tx) =>
Environment ->
InitialState tx ->
-- | New chain state
ChainStateType tx ->
-- | Committed UTxO
UTxOType tx ->
Outcome tx
onInitialChainCommitTx env st newChainState pt utxo =
onInitialChainCommitTx st newChainState pt utxo =
NewState newState $
notifyClient :
[postCollectCom | canCollectCom]
, postChainTx = CollectComTx $ fold newCommitted
}
canCollectCom = null remainingParties && pt == us
canCollectCom = null remainingParties
remainingParties = Set.delete pt pendingCommits
InitialState{parameters, pendingCommits, committed, headId} = st
Environment{party = us} = env
-- | Client request to abort the head. This leads to an abort transaction on
-- chain, reimbursing already committed UTxOs.
--
(Initial idleState, ClientEvent clientInput@(Commit _)) ->
onInitialClientCommit env idleState clientInput
(Initial initialState, OnChainEvent Observation{observedTx = OnCommitTx{party = pt, committed = utxo}, newChainState}) ->
onInitialChainCommitTx env initialState newChainState pt utxo
onInitialChainCommitTx initialState newChainState pt utxo
(Initial initialState, ClientEvent Abort) ->
onInitialClientAbort initialState
(Initial initialState, OnChainEvent Observation{observedTx = OnCollectComTx{}, newChainState}) ->
HeadParameters (..),
IsChainState,
OnChainTx (..),
PostChainTx (ContestTx),
PostChainTx (CollectComTx, ContestTx),
)
import Hydra.Crypto (aggregate, generateSigningKey, sign)
import Hydra.HeadLogic (
update bobEnv ledger (inOpenState threeParties ledger) (NetworkEvent defaultTTL $ Connected nodeId)
`hasEffect` ClientEffect (PeerConnected nodeId)
it "everyone does collect on last commit after collect com" $ do
let s0 = inInitialState threeParties
aliceCommit = OnCommitTx alice (utxoRef 1)
bobCommit = OnCommitTx bob (utxoRef 2)
carolCommit = OnCommitTx carol (utxoRef 3)
s1 <- assertNewState $ update bobEnv ledger s0 (observeEventAtSlot 1 aliceCommit)
s2 <- assertNewState $ update bobEnv ledger s1 (observeEventAtSlot 2 bobCommit)
-- Bob is not the last party, but still does post a collect
update bobEnv ledger s2 (observeEventAtSlot 3 carolCommit) `hasEffectSatisfying` \case
OnChainEffect{postChainTx = CollectComTx{}} -> True
_ -> False
it "cannot observe abort after collect com" $ do
let s0 = inInitialState threeParties
s1 <- assertNewState $ update bobEnv ledger s0 (observationEvent OnCollectComTx)
, chainState = SimpleChainState{slot = ChainSlot 0}
}
observeEventAtSlot :: Natural -> OnChainTx SimpleTx -> Event SimpleTx
observeEventAtSlot slot observedTx =
OnChainEvent
{ chainEvent =
Observation
{ observedTx
, newChainState = SimpleChainState{slot = ChainSlot slot}
}
}
-- | Create an observation event with fixed chain state and slot.
observationEvent :: OnChainTx SimpleTx -> Event SimpleTx
observationEvent observedTx =
Bumps [log](https://github.com/rust-lang/log) from 0.4.17 to 0.4.18. - [Release notes](https://github.com/rust-lang/log/releases) - [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-lang/log/compare/0.4.17...0.4.18) --- updated-dependencies: - dependency-name: log dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.28.1 to 1.28.2. - [Release notes](https://github.com/tokio-rs/tokio/releases) - [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.28.1...tokio-1.28.2) --- updated-dependencies: - dependency-name: tokio dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
PLT-5901 Implemented checks for valid network addresses.
fix: tuple clause must preserve previous clause properties state
fix: rearrange clauses and fill in gaps now handles nested patterns in a uniform way fix: discards in records was being sorted incorrectly leading to type issues chore: remove some filter maps in cases where None is impossible anyway chore: some refactoring on a couple functions to clean up
fix: tuple clause must preserve previous clause properties state
feat: disable openapi
closes #569 * added new methods to Definitions it doesn't use expect * lookup was failing for the special map/pair case when resolving list generics Co-authored-by: Pi <[email protected]>
defaulting to ghc 9.2.8, also building for 8.10.7. Fix #20.