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

add ddo states #959

Merged
merged 15 commits into from
Dec 16, 2022
Merged

add ddo states #959

merged 15 commits into from
Dec 16, 2022

Conversation

alexcos20
Copy link
Member

@alexcos20 alexcos20 commented Dec 14, 2022

Closes #958

A state object looks like:

obj = {
            "nft": nft_address,
            "did": did,
            "chain_id": chain_id,
            "tx_id": txid,
            "valid": valid,
            "error": error,
        }

Intresting results:

  1. Valid nft/ddo
curl http://172.15.0.5:5000/api/aquarius/state/ddo?did=did:op:9c1235050bcd51c8ec9a7058110102c9595136834911c315b4f739bc9a880b8e
{"chain_id":5,"error":null,"nft":"0x3A695322d631451474090F322eA3d8d2eC8c1562","tx_id":"0x5f4b51adab1971c0c0479e275ed298670eb216d8fd87801c5fc03f34417754b3","valid":true}
  1. Nft not deployed by our factory
curl http://172.15.0.5:5000/api/aquarius/state/ddo?nft=0xC7ED00725AAb7E679fCB46C9620115fE0B6dD94a
{"chain_id":80001,"error":"nft not deployed by our factory","nft":"0xC7ED00725AAb7E679fCB46C9620115fE0B6dD94a","tx_id":"0xcd715efd26226cd5f1545293d4c772e244acb13c6bd71568fb79c4c30adc606e","valid":false}
  1. Unreachable provider
curl http://172.15.0.5:5000/api/aquarius/state/ddo?did=did:op:0d14bbdca68bea8c82f9a7987dbd87e2dc5dd50f7ece97b124c734e4e39583ac
{"chain_id":80001,"error":"Failed to get a response for decrypt DDO with provider=https://provider.dev.dataunion.market, payload={'transactionId': '0x236d27b7e8cfdd74ed6056e26108788f2138dba6f12f9bfa414d0a65028954dd', 'chainId': 80001, 'decrypterAddress': '0xA78deb2Fa79463945C247991075E2a0e98Ba7A09', 'dataNftAddress': '0xE37B76a8bCA614BEDe16dEaF2339C8dC48406807', 'signature': '0xa312e3f48387a5c6bd589c812e3b9eb685d6320bd3e43173a42490cbb5ee168f1a3c107acb3c6fe2e1618a6cdc90bc7fea0ebbe94c72fe0aee9d4f9cd74e0c9c00', 'nonce': '1671045647'}, response=None","nft":"0xE37B76a8bCA614BEDe16dEaF2339C8dC48406807","tx_id":"0x236d27b7e8cfdd74ed6056e26108788f2138dba6f12f9bfa414d0a65028954dd","valid":false}
  1. Decrypter not auth
curl http://172.15.0.5:5000/api/aquarius/state/ddo?did=did:op:ab85ad7b020b37daa6b7b05be6e82d0dcf89a3365274826c5b42c40395380375
{"chain_id":5,"error":"403, response=b'{\"error\":\"Decrypter not authorized\"}\\n'","nft":"0xA61163E975FC6bB82360d67e5EFc9997F9EB7f02","tx_id":"0x38ea775ba91c1de1842169b7c507255dd3cc2d2fbaf85742d89abc9814389ebf","valid":false}

@alexcos20 alexcos20 requested a review from calina-c December 14, 2022 11:49
@alexcos20 alexcos20 self-assigned this Dec 14, 2022
@alexcos20 alexcos20 linked an issue Dec 14, 2022 that may be closed by this pull request
@alexcos20 alexcos20 marked this pull request as draft December 14, 2022 19:52
@alexcos20 alexcos20 marked this pull request as ready for review December 14, 2022 20:25
aquarius/app/es_instance.py Outdated Show resolved Hide resolved
else:
conditions = []
if chain_id:
conditions.append({"term": {"chain_id": chain_id}})
Copy link
Contributor

Choose a reason for hiding this comment

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

how about adding the match one separately, then doing for k in ["chain_id", "did", "conditions"]: if locals[k]: conditions.append("term": {k: locals()[k]}

easier to read

Ref: https://www.programiz.com/python-programming/methods/built-in/locals

Copy link
Member Author

Choose a reason for hiding this comment

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

it will not work. for some, you have "term". for some (as nft), you have "match". so we will end up with bunch of ifs inside loop

aquarius/app/state.py Outdated Show resolved Hide resolved
aquarius/app/state.py Show resolved Hide resolved
aquarius/events/processors.py Outdated Show resolved Hide resolved
aquarius/events/processors.py Outdated Show resolved Hide resolved
@alexcos20 alexcos20 requested a review from calina-c December 15, 2022 13:36
@alexcos20 alexcos20 merged commit 1d7c0aa into bug/refactor_main_loop Dec 16, 2022
@alexcos20 alexcos20 deleted the feature/did_states branch December 16, 2022 08:54
alexcos20 added a commit that referenced this pull request Jan 6, 2023
* refactor main loop

* optimize more

* fix test

* optimize more & better logic for failures

* better comment

* remove log

* use exists to speed up transferOwnership

* force pytest versions

* fix tests

* optimize more

* optimize more

* fix test

* lint

* fix test logic

* fix test logic

* log level change

* add logs

* more logs

* clean up receipt warnings

* add more comments, optimize code

* use es.exists instead of es.read

* revert 607dfb1

* split logs for one block flow

* fix typo

* make function names more descriptive

* new retry queue (#940)

* new retry queue

* Feature/new transfer ownership (#943)

* new nft transfer monitoring

* use custom subgraph version

* fix typo

* fix tests

* remove commented transfer data

* fix non-condition

* fix duplicate code

* fix typo

* remove custom barge

* use ve_allocate_realtime instead of ve_allocate (#939)

* Upgrade to ES 8.5.1 (#944)

* Initial commit for upgrading to ES 8.

* Remove ocurrences of doc_type.

* Black fix.

* Upgrade GH Action to use proper es.

* Fix some tests.

* Fix query endpoint.

* Fix black.

* Fix doc type conflicts.

* Remove config object. (#945)

* Remove config object.

* Black and test fixes.

* Fix multiple issues (#932 , #924 , #933) (#951)

* fix annoying es transport logs

* fix decryptor not auth

* improve logging

* fix logging

* fix blank

* improve graphql error handling

* fix test

* fix #933

* add minLenghts (#952)

* fix es 8.5

* make chunk_size 5k by default

* remove es, since we have it in barge

* use proper schema

* do things in parallel

* customize EVENTS_MONITOR_SLEEP_TIME

* add multiple timers

* update loglevel

* handle non-existant metadatastate changes

* add timers info

* fix test

* fix log statement

* fix search

* fix query

* more es8.5 updates

* fix TokenURIUpdatedProcessor

* lint

* proper use of timeout for requests

* use timeouts for requests

* more logs for error queue

* make sure that did is using checksum addrs

* fix failing code by removing it :)

* fix tests

* fix tests

* Feature/retry queue max hold (#960)

* add retry queue max hold

* add test

* fix code

* fixes

* add ddo states (#959)

* add ddo states

* wait for es when deleting elements

Co-authored-by: Călina Cenan <[email protected]>
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.

DID index state
2 participants