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

[Draft] Onchain Contract Usage Models (App Layer prereqs) #1055

Open
MSilb7 opened this issue Nov 22, 2024 · 0 comments
Open

[Draft] Onchain Contract Usage Models (App Layer prereqs) #1055

MSilb7 opened this issue Nov 22, 2024 · 0 comments

Comments

@MSilb7
Copy link
Contributor

MSilb7 commented Nov 22, 2024

Problem

To accurately evaluate contract usage, we want to look in to all function calls that happen within a transaction. This is the "traces" dataset. Function calls (traces) gives us insight in to the building block contracts (i.e. DEX that calls a token and an oracle) and underlying contracts called by custom contracts (i.e. trading bots). If we only looked at "transaction" level data, we would only be able to see the first contract called, which would cause us to lose this granularity and make incorrect judgements of onchain activity.

It's not controversial to look at traces; however, it introduces infra problems and other nuance:

  1. Traces data tables are much larger than transaction data tables (~20-100x larger); so queries often run long or take up a ton of memory. We need to build a better/smaller data model to support these queries.
  2. There are many possible ways you could attribute usage to each internal contract (i.e. do you split gas, do you count 1 transaction for each contract)
  • Gas: You could: 1. Attrbute all of a transactions' gas to a contract, 2. Get the gas used by each function call, by subtracting sub-traces, 3. equally amortize all gas used across each contract or function call - There are likely cases where each makes sense, so we could store each metric in a model
  1. App-level attribution requires uniqueness - There could be multiple contracts from the same app called in a single transaction; so we need to be careful to not over-count

TODO: What we need to build

Ideas:

  • Enriched transaction table?
  • Hourly/Daily aggregate by contract?

Related Items

  • Migrate High-Frequency Bot Logic (TODO: Make Issue)
  • Migrate Likely Duplicate Address Logic (Sybil Input) (TODO: Make Issue)
  • Any other address segmentation/classification concepts

Prior Work - We'd want to be able to trivially recreate all of these with proper data models

Future Work Ideas/Concepts

  • Common From/To calls
  • Most "composable" contracts - what gets called most often? by the largest variety of contracts?
  • Dependency mapping (network map?) - find the core building block contracts that we need (i.e. how much activity relies on oracles? on a stablecoin?)
@MSilb7 MSilb7 changed the title [Draft] Onchain Contract Usage Models [Draft] Onchain Contract Usage Models (App Layer prereqs) Nov 22, 2024
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

No branches or pull requests

1 participant