-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement a simple stateless observation executable #1158
Conversation
This asserts the initialization of a Hydra head is also seen by the (not yet existing) hydra-chain-observer executable
We might want to implement that strategy as an observeRawCollectTx first and see whether that aligns with the "full" observation.
272f149
to
4dbfa12
Compare
1eba0a4
to
c8c9a7c
Compare
This avoids passing the "too big" type into the HydraClient
This package is released with all other hydra-* packages and shares a changelog
90f3532
to
22a9456
Compare
This makes it clear that the hydra-node still only "cares" about commit transactions about the head it knows in the chain layer.
|
||
prop "Does not updates UTxO state given transactions outside of Head lifecycle" $ | ||
forAll genSequenceOfSimplePaymentTransactions $ \(utxo, txs) -> | ||
fst (observeAll testNetworkId utxo txs) === utxo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abailly-iohk Do we need this? It's no harm if the UTxO is always updated, even when nothing is observed. I think it would simplify the implementation a bit if we remove this constraint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an optimization. That is, we do not accumulate memory on unrelated transactions.
let initials = fst3 <$> initialInitials | ||
observation <- observeCommitTx networkId initials tx | ||
let utxo = getKnownUTxO st | ||
observation <- observeCommitTx networkId utxo tx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SB: Shouldn't we make sure we only process commits of "our head" now?
Yes. This is implicit here (as only UTxO of our head are resolvable), but could be improved by an explicit guard $ headId == commitHeadId
or so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work guys!
Tested this manually against cabal run hydra-chain-observer -- --node-socket testnets/preprod/node.socket --testnet-magic 1 --start-chain-from "43251332.9ea784cd95687e3c90a17b6f3633b5554f25a3ceba82f860c2e4d3cb57a0b236" | jq 'select(.message.tag == "HeadInitTx")' Will output: {
"timestamp": "2023-11-13T14:17:57.570680734Z",
"threadId": 6,
"namespace": "hydra-chain-observer",
"message": {
"headId": "1185347034540e3a9c60c69a73185ebdcd3b06cd243047aea289e6b6",
"tag": "HeadInitTx"
}
} |
📋 Created a
hydra-chain-observer
executable, which prints a few basic observations of the head life-cycle.📋 The chain observer does connect directly to a
cardano-node
just the same as a ydra-node` would.📋 Refactored low-level observation functions to only take
UTxO
andTx
(especially theobserveCommitTx
).CHANGELOG updated or not needed
Documentation updated or not needed
Haddocks updated or not needed
No new TODOs introduced or explained herafter
State.hs
about a stateful generator - this will be removed once we get rid of stateful observation anyways