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

Emerald: tokens analyzer #284

Merged
merged 4 commits into from
Feb 2, 2023
Merged

Emerald: tokens analyzer #284

merged 4 commits into from
Feb 2, 2023

Conversation

pro-wh
Copy link
Collaborator

@pro-wh pro-wh commented Jan 13, 2023

here's a new tokens analyzer. notes from the demo:

~70% speedup in block scanning

before

image

after

image


image


image

@pro-wh
Copy link
Collaborator Author

pro-wh commented Jan 13, 2023

current state:

  • trying this thing where instead of a dedicated tokens-to-query table, I'm adding a "discovery state" column to the tokens table. we can come up with a state machine like (row nonexistent) -> discovered -> info populated <-> need total supply update etc

@pro-wh pro-wh changed the title (unfinished) tokens analyzer Emerald: tokens analyzer Jan 20, 2023
@pro-wh pro-wh marked this pull request as ready for review January 20, 2023 00:54
@pro-wh
Copy link
Collaborator Author

pro-wh commented Jan 20, 2023

readying this for review, there are some issues with this though

Copy link
Contributor

@mitjat mitjat left a comment

Choose a reason for hiding this comment

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

Nice! It's a good amount of boilerplate to figure out; thank you!

I think this is overall good; I have a few small style/docs suggestions, and one higher-level one about focusing the analyzer on the EVM module, not Emerald.

analyzer/queries.go Outdated Show resolved Hide resolved
storage/migrations/02_oasis_3_emerald.up.sql Outdated Show resolved Hide resolved
storage/migrations/02_oasis_3_emerald.up.sql Outdated Show resolved Hide resolved
analyzer/emeraldtokens/emerald_tokens.go Outdated Show resolved Hide resolved
analyzer/emeraldtokens/emerald_tokens.go Outdated Show resolved Hide resolved
@pro-wh
Copy link
Collaborator Author

pro-wh commented Jan 24, 2023

designing new table to use three columns: first seen, last round when mutable info changed, last round when we analyzed it. diagram of the latter two columns:

image

source
digraph {
    start [shape=none]
    node [shape=box]
    start -> no_row
    no_row [peripheries=2]
    null_round [peripheries=2]
    round_round [peripheries=2]
    // block analyzer
    edge [color=blue]
    no_row -> null_null [label="see transfer"]
    no_row -> round_null [label="see mint"]
    null_null -> round_null [label="see mint"]
    null_round -> high_low [label="see mint"]
    round_round -> high_low [label="see mint"]
    // evm token analyzer
    edge [color=green]
    null_null -> null_round [label="download"]
    null_null -> high_low [label="stale download"]
    round_null -> high_low [label="stale download"]
    round_null -> round_round [label="download"]
    high_low -> round_round [label="download mutable"]
}

blue is what happens in the block analyzer. green is what happens in the evm token analyzer. self edges omitted.

double boxes are consistent states. following only green edges should allow the system to settle into one of these states.

"stale download" is what happens when the evm token analyzer reads one "last round when mutable info changed" into its goroutine, then the block analyzer detects something that would further change the mutable info while the evm token analyzer is downloading info for an out of date round, then the evm token analyzer saves that out of date info.

@pro-wh pro-wh marked this pull request as draft January 25, 2023 01:24
@pro-wh pro-wh force-pushed the pro-wh/feature/holders7 branch 3 times, most recently from c03bc31 to 9274d15 Compare January 27, 2023 23:40
analyzer/queries.go Outdated Show resolved Hide resolved
@pro-wh pro-wh marked this pull request as ready for review January 31, 2023 01:11
@pro-wh
Copy link
Collaborator Author

pro-wh commented Jan 31, 2023

description updated. re-opening for review

@pro-wh pro-wh requested a review from mitjat January 31, 2023 01:11
Copy link
Contributor

@mitjat mitjat left a comment

Choose a reason for hiding this comment

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

Looking good!
Consider this pretty much approved from my end, I'm just holding off because I'm not sure if we are on the same page re/ dead reckoning for mints and burns.

analyzer/modules/evm.go Outdated Show resolved Hide resolved
analyzer/modules/evm.go Outdated Show resolved Hide resolved
storage/migrations/02_oasis_3_emerald.up.sql Show resolved Hide resolved
storage/migrations/02_oasis_3_emerald.up.sql Show resolved Hide resolved
analyzer/emerald/incoming.go Show resolved Hide resolved
analyzer/modules/evm.go Outdated Show resolved Hide resolved
analyzer/modules/evm.go Show resolved Hide resolved
analyzer/queries.go Outdated Show resolved Hide resolved
analyzer/emerald/incoming.go Show resolved Hide resolved
analyzer/evmtokens/evm_tokens.go Show resolved Hide resolved
analyzer/evmtokens/evm_tokens.go Outdated Show resolved Hide resolved
@pro-wh pro-wh force-pushed the pro-wh/feature/holders7 branch 2 times, most recently from 3128c33 to db9a5d8 Compare February 1, 2023 01:21
@mitjat mitjat mentioned this pull request Feb 1, 2023
4 tasks
Copy link
Contributor

@mitjat mitjat left a comment

Choose a reason for hiding this comment

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

🐑 it!

@pro-wh pro-wh merged commit 8203fa7 into main Feb 2, 2023
@pro-wh pro-wh deleted the pro-wh/feature/holders7 branch February 2, 2023 00:10
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.

None yet

2 participants