Skip to content
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

Generate Oura config for an instance of CEM-script #100

Merged

Conversation

Renegatto
Copy link

@Renegatto Renegatto commented Sep 18, 2024

This PR introduces a function, that given a CEM-script instance will generate config for Oura, such that Oura will index all spendings from the CEM-script validator.

API

ouraMonitoringScript ::

ouraMonitoringScript ::
  forall (script :: Type).
  CEMScriptCompiled script =>
  Proxy script ->
  Ledger.Network ->
  SourcePath ->
  SinkPath ->
  Either String Toml.Table -- error or config

The only variable section of the config is filters, the rest can be safely overwritten by the user.

The generated filter have a shape:

{
  "type":"Select",
  "predicate": <cem script payment address bech32>,
  "skip_uncertain": false
}

Testing

The change is tested against the SimpleAuction example.
It feeds Oura with two transactions one of which spends from the validator address, and expect Oura to catch exactly that transaction.

The tests use oura github.com/Renegatto/oura/commit/bfcac25065719f9e3405acbbdf5fe782846ddf32 that can use unix socket in a datagram mode as a source of Txs. This has been made to simplify the testing process and avoid the need of spinning cardano node for it.

Maintenance

If the need to extend this functionality will arise, it can be handy to revert this commit: 7494b28
There was the WIP on making indexer to listen for a particular state transitions.

@Renegatto Renegatto added enhancement New feature or request in-catalyst-milestone Something needed to be done for Catalyst milestones to closed labels Sep 18, 2024
@Renegatto Renegatto self-assigned this Sep 18, 2024
@euonymos euonymos merged commit 481a7a9 into alexey/test-oura-filters Nov 27, 2024
3 of 4 checks passed
@euonymos euonymos deleted the alexey/test-oura-filters-after-refactor branch November 27, 2024 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request in-catalyst-milestone Something needed to be done for Catalyst milestones to closed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants