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

Fix DDO: Stats and Prices for exchanges/dispensers #774

Merged
merged 133 commits into from
Mar 6, 2025

Conversation

mariacarmina
Copy link
Member

@mariacarmina mariacarmina commented Dec 4, 2024

Fixes #525 .

Changes proposed in this PR:

  • Create type for IndexedMetadata
  • Delete key when validating DDO & compose metadata hash
  • Update logic for MetadataCreated, MetadataUpdated, OrderStarted, OrderReused
  • Created new monitoring logic for ExchangeCreated, ExchangeActivated, ExchangeRateChanged, ExchangeDeactivated, DispenserActivated, DispenserDeactivated
  • Fixed hardcoded service[0].datatokenAddress when inserting the DDO in the DB -> you can have multiple datatokens attached to the same NFT with different services
  • Add new util function to return service id based on datatoken address
  • Create util function which returns the ddo updated with according stats
  • Fix bug in getEventData -> when decoding the event, by default it is retrieved first log's topics, logs[0].topics, if the tx receipt contains multiple events, those are not captured automatically -> fix: check for each log if topic[0] matches one value from EVENTS_HASHES.
  • Add tests w bundled txs for indexedMetadata stats

@mariacarmina mariacarmina self-assigned this Dec 4, 2024
@mariacarmina
Copy link
Member Author

For the moment only ocean-cli test regarding getDDO fails:
To be more precise at this check https://github.com/oceanprotocol/ocean-cli/blob/main/test/consumeFlow.test.ts#L144

Ocean CLI Publishing
    ✔ should publish a dataset using 'npm run cli publish' (3446ms)
    ✔ should publish a compute dataset using 'npm run cli publish' (3099ms)
    ✔ should publish a js Algorithm using 'npm run cli publishAlgo' (3025ms)
    ✔ should publish a python Algorithm using 'npm run cli publishAlgo' (3042ms)
    1) should get DDO using 'npm run cli getDDO' for download dataset


  4 passing (3m)
  1 failing

  1) Ocean CLI Publishing
       should get DDO using 'npm run cli getDDO' for download dataset:
     Uncaught AssertionError: expected '\n> ocean-cli@2.0.0 cli\n> TS_NODE_PR…' to include 'https://w3id.org/did/v1'
      at /home/runner/work/ocean-node/ocean-node/ocean-cli/test/consumeFlow.test.ts:144:31
      at ChildProcess.exithandler (node:child_process:414:7)
      at ChildProcess.emit (node:events:5[19](https://github.com/oceanprotocol/ocean-node/actions/runs/12207966655/job/34060344250#step:20:20):28)
      at ChildProcess.emit (node:domain:488:12)
      at maybeClose (node:internal/child_process:1105:16)
      at Process.ChildProcess._handle.onexit (node:internal/child_process:305:5)

I'll put this in review to see if for Metadata events and Order events, I implemented as expected on the specs.
Still FixedRateExchange and Dispenser events needs to be monitored (WIP) along with tests for fixed rate exchange & dispenser pricing schemas.

@mariacarmina mariacarmina marked this pull request as ready for review December 7, 2024 00:28
@mariacarmina mariacarmina force-pushed the feature/new-ddo-structure branch from cb9b17c to 2cb06f4 Compare March 4, 2025 12:33
Copy link
Contributor

@paulo-ocean paulo-ocean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm
but don't forget to update the ci.yml
after merging oceanprotocol/ocean-cli#87

with:
          repository: 'oceanprotocol/ocean-cli'
          path: 'ocean-cli'
          ref: 'fix-tests-for-new-ddo'

put back ref: 'main'

Copy link
Member

@jamiehewitt15 jamiehewitt15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@mariacarmina
Copy link
Member Author

lgtm but don't forget to update the ci.yml after merging oceanprotocol/ocean-cli#87

with:
          repository: 'oceanprotocol/ocean-cli'
          path: 'ocean-cli'
          ref: 'fix-tests-for-new-ddo'

put back ref: 'main'

yep, done, merged the PR in ocean-cli, now it's updated

@mariacarmina mariacarmina merged commit fdee534 into main Mar 6, 2025
13 checks passed
@mariacarmina mariacarmina deleted the feature/new-ddo-structure branch March 6, 2025 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DDO: Stats and Prices for exchanges/dispensers
4 participants