Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@honourfish
Copy link
Contributor

@honourfish honourfish commented Jan 22, 2025

Overview

  • add IKWID (I know what i'm doing) command to veracity to find trie entries based on given trie keys

Testing

help text:

NAME:
   veracity find-trie-entries - finds the matching trie entries for the given trie key.

                                    By default returns all mmr Indexes of matching trie entries.

                                    The trieKey is HASH(DOMAIN | LOGID | APPID)

                                    NOTE: ignores the global --tenant option, please use --log-tenant command option.


USAGE:
   veracity find-trie-entries [command options] [arguments...]

OPTIONS:
   --log-tenant value    the tenant of the log to search in. Required or can be derived from log-id.
   --log-id value        the hexadecimal representation of the log ID. Required or can be derived from log-tenant.
   --app-id value        the app ID. For eventsv1 or assetsv2 this is the event id.
   --domain value        the domain used to derive the trie key. (default: 0)
   --as-leafindexes      if true, returns a list of matching leaf indexes instead of mmr indexes. (default: false)
   --massif-start value  if set, start the search for matching trie entries at the massif at this given massif index. if omitted will start search at massif 0. (default: 0)
   --massif-end value    if set, end the search for matching trie entries at the massif at this given massif index. if omitted will end search at the last massif. (default: -1)
   --help, -h            show help

manually tested with an eventsv1 event and an assetsv2 event:

eventsv1 event:

./veracity --loglevel DEBUG --data-url https://app.dev-jgough-0.dev.datatrails.ai/verifiabledata find-trie-entries --log-tenant tenant/7e4a511f-d4ae-425c-b915-9c4ac09ca929 --app-id events/01948dd3-4346-7b59-9825-fabb55989b39
trieKey version 0: ca80d222d44ffa7de854373235c907dad892ff120abd60ce30e433443693a8d2
trieKey version 1: 41311e0881e7c0f40fc91eb71015ae113d2fc09660353788f22d546c85ded333
checking 8192 trie entries in massif 0 for matches
checking 8192 trie entries in massif 1 for matches
checking 8192 trie entries in massif 2 for matches
checking 8192 trie entries in massif 3 for matches
checking 8192 trie entries in massif 4 for matches
checking 8192 trie entries in massif 5 for matches
checking 8192 trie entries in massif 6 for matches
checking 8192 trie entries in massif 7 for matches
checking 3038 trie entries in massif 8 for matches
entries considered: 68574
matches: [137135]

as leaf indexes:

./veracity --loglevel DEBUG --data-url https://app.dev-jgough-0.dev.datatrails.ai/verifiabledata find-trie-entries --log-tenant tenant/7e4a511f-d4ae-425c-b915-9c4ac09ca929 --app-id events/01948dd3-4346-7b59-9825-fabb55989b39 --as-leafindexes
trieKey version 0: ca80d222d44ffa7de854373235c907dad892ff120abd60ce30e433443693a8d2
trieKey version 1: 41311e0881e7c0f40fc91eb71015ae113d2fc09660353788f22d546c85ded333
checking 8192 trie entries in massif 0 for matches
checking 8192 trie entries in massif 1 for matches
checking 8192 trie entries in massif 2 for matches
checking 8192 trie entries in massif 3 for matches
checking 8192 trie entries in massif 4 for matches
checking 8192 trie entries in massif 5 for matches
checking 8192 trie entries in massif 6 for matches
checking 8192 trie entries in massif 7 for matches
checking 3038 trie entries in massif 8 for matches
entries considered: 68574
matches: [68572]

assetsv2 event considering all massifs:

./veracity --loglevel DEBUG --data-url https://app.dev-jgough-0.dev.datatrails.ai/verifiabledata find-trie-entries --log-tenant tenant/7e4a511f-d4ae-425c-b915-9c4ac09ca929 --app-id assets/ea596dcc-8f38-4af6-8c3f-8c8dd69da6d0/events/60ee85f8-6f10-4f6e-9dd8-fa54294acd7d
trieKey version 0: fad5a0dcfad9083c86bfd49dab6eb49ae511453939d6be2c36dee9a633705ac6
trieKey version 1: 1fe4fcd29b1783fa438dcb5933ef33b9016fef9d59eb9c435789c3e1132cb3b4
checking 8192 trie entries in massif 0 for matches
checking 8192 trie entries in massif 1 for matches
checking 8192 trie entries in massif 2 for matches
checking 8192 trie entries in massif 3 for matches
checking 8192 trie entries in massif 4 for matches
checking 8192 trie entries in massif 5 for matches
checking 8192 trie entries in massif 6 for matches
checking 8192 trie entries in massif 7 for matches
checking 3038 trie entries in massif 8 for matches
entries considered: 68574
matches: [137136]

assetsv2 event with massif range:

./veracity --loglevel DEBUG --data-url https://app.dev-jgough-0.dev.datatrails.ai/verifiabledata find-trie-entries --log-tenant tenant/7e4a511f-d4ae-425c-b915-9c4ac09ca929 --app-id assets/ea596dcc-8f38-4af6-8c3f-8c8dd69da6d0/events/60ee85f8-6f10-4f6e-9dd8-fa54294acd7d --massif-start 7 --massif-end 8
trieKey version 0: fad5a0dcfad9083c86bfd49dab6eb49ae511453939d6be2c36dee9a633705ac6
trieKey version 1: 1fe4fcd29b1783fa438dcb5933ef33b9016fef9d59eb9c435789c3e1132cb3b4
checking 8192 trie entries in massif 7 for matches
checking 3038 trie entries in massif 8 for matches
entries considered: 11230
matches: [137136]

assetsv2 event with massif range of 1 massif:

./veracity --loglevel DEBUG --data-url https://app.dev-jgough-0.dev.datatrails.ai/verifiabledata find-trie-entries --log-tenant tenant/7e4a511f-d4ae-425c-b915-9c4ac09ca929 --app-id assets/ea596dcc-8f38-4af6-8c3f-8c8dd69da6d0/events/60ee85f8-6f10-4f6e-9dd8-fa54294acd7d --massif-start 8 --massif-end 8
trieKey version 0: fad5a0dcfad9083c86bfd49dab6eb49ae511453939d6be2c36dee9a633705ac6
trieKey version 1: 1fe4fcd29b1783fa438dcb5933ef33b9016fef9d59eb9c435789c3e1132cb3b4
checking 3038 trie entries in massif 8 for matches
entries considered: 3038
matches: [137136]

assetsv2 event with massif range outside of the massif the event is in:

./veracity --loglevel DEBUG --data-url https://app.dev-jgough-0.dev.datatrails.ai/verifiabledata find-trie-entries --log-tenant tenant/7e4a511f-d4ae-425c-b915-9c4ac09ca929 --app-id assets/ea596dcc-8f38-4af6-8c3f-8c8dd69da6d0/events/60ee85f8-6f10-4f6e-9dd8-fa54294acd7d --massif-start 3 --massif-end 5
trieKey version 0: fad5a0dcfad9083c86bfd49dab6eb49ae511453939d6be2c36dee9a633705ac6
trieKey version 1: 1fe4fcd29b1783fa438dcb5933ef33b9016fef9d59eb9c435789c3e1132cb3b4
checking 8192 trie entries in massif 3 for matches
checking 8192 trie entries in massif 4 for matches
checking 8192 trie entries in massif 5 for matches
entries considered: 24576
matches: []

@honourfish honourfish requested a review from robinbryce January 22, 2025 13:12
@honourfish honourfish requested a review from robinbryce January 22, 2025 13:38
Copy link
Contributor

@robinbryce robinbryce left a comment

Choose a reason for hiding this comment

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

LGTM. Great stuff thanks!

@honourfish honourfish merged commit 9f417dd into main Jan 22, 2025
3 checks passed
@honourfish honourfish deleted the dev/jgough/find-trie-entries branch January 22, 2025 13:45
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.

3 participants