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

Draft
wants to merge 77 commits into
base: main
Choose a base branch
from

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
  • 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.

@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> [email protected] 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
@jamiehewitt15
Copy link
Member

Have you looked into why the tests are failing?

@mariacarmina
Copy link
Member Author

mariacarmina commented Jan 11, 2025

Have you looked into why the tests are failing?

Yes, of course I looked into the failure. They fail because on ExchangeCreate event decodedData of the event is null and I cannot retrieve the exchange id -> the event name is wrong

@mariacarmina
Copy link
Member Author

Have you looked into why the tests are failing?

Yes, of course I looked into the failure. They fail because on ExchangeCreate event decodedData of the event is null and I cannot retrieve the exchange id -> the event name is wrong

I see the root cause is that in getEventData, we hardcode to retrieve the first log from tx receipt, when we call a bundled function (for e.g. deploying an nft, a erc20 and a fre), threre are multiple events within that tx and by default it retrives the first log which is not correct, I have added a workaround to check topics[0] from logs[i] to match the event hash that we are looking for.

@mariacarmina mariacarmina marked this pull request as draft January 20, 2025 06:58
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
2 participants