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

Solana staking improvements #6496

Merged
merged 33 commits into from
Aug 6, 2024
Merged

Solana staking improvements #6496

merged 33 commits into from
Aug 6, 2024

Conversation

andrewhong5297
Copy link
Collaborator

@andrewhong5297 andrewhong5297 commented Aug 4, 2024

Adding a few solana improvement tables.

"solana_utils.epochs": this is a simple table that I'm creating for easier query UX around epochs on Solana

"staking_solana.stake_account_delegations": vote delegations of accounts on solana are non-trivial to pull because of merge/split/withdraw accounts. This is an intermediary table to pull all historical validators delegated by a stake account

"staking_solana.validator_stake_account_epochs": this is a table that combines the prior two to get all stake accounts delegated to a validator BEFORE an epoch began. This then allows us to more accurately calculate active stake and stake rewards in in-app queries, which has been heavily requested by solflare, steakhouse, helius, and other teams.

@andrewhong5297 andrewhong5297 added the WIP work in progress label Aug 4, 2024
@jeff-dude jeff-dude self-assigned this Aug 5, 2024
@jeff-dude jeff-dude added the ready-for-review this PR development is complete, please review label Aug 5, 2024
@andrewhong5297
Copy link
Collaborator Author

hmm this used to run in 37 minutes but idk why it is suddenly now timing out. maybe we can bump the cluster for this one, it really shouldn't be that compute expensive

@andrewhong5297 andrewhong5297 removed the WIP work in progress label Aug 6, 2024
@andrewhong5297
Copy link
Collaborator Author

oh it ran @jeff-dude , data looks good to me

@jeff-dude jeff-dude added in review Assignee is currently reviewing the PR and removed ready-for-review this PR development is complete, please review labels Aug 6, 2024
, materialized = 'incremental'
, file_format = 'delta'
, incremental_strategy = 'merge'
, unique_key = ['block_time', 'block_slot', 'stake_account', 'vote_account']
Copy link
Member

Choose a reason for hiding this comment

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

looks like this model is failing the unique test, but only after incremental run. that usually means incorrect keys. i noticed this model has 4 total columns, 4 keys, meaning nothing to update when match found. can we simplify the keys to less columns?

then the other thing to consider is null values in a key, which would fail the lookup. can any be null?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

none of the keys can be full. and yes this would only ever append, and not update. I put this unique key here so that we just don't end up with duplicates for overlapping incremental runs. we can't remove any of them because stake accounts could move delegations between vote accounts (and vice versa) any time.

Copy link
Member

Choose a reason for hiding this comment

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

okay, only other option should be the target filter. i've removed to try again.

@jeff-dude jeff-dude added the WIP work in progress label Aug 6, 2024
Copy link
Member

@jeff-dude jeff-dude left a comment

Choose a reason for hiding this comment

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

okay, looks better now

@jeff-dude jeff-dude added ready-for-merging and removed WIP work in progress in review Assignee is currently reviewing the PR labels Aug 6, 2024
@jeff-dude jeff-dude merged commit 25ffd7d into main Aug 6, 2024
2 checks passed
@jeff-dude jeff-dude deleted the stake-new branch August 6, 2024 19:21
@github-actions github-actions bot locked and limited conversation to collaborators Aug 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants