-
Notifications
You must be signed in to change notification settings - Fork 0
chore: extract transaction syncer API #2
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
Closed
Closed
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
0eb421b
chore: extract constants into dedicated consts module
thlorenz 014a3cc
chore: add transaction_syncer module with helper functions
thlorenz 7ebf7c8
refactor: integrate transaction_syncer into syncer
thlorenz cdc54d6
chore: public export of transaction syncer module
thlorenz 2f2f756
chore: add transaction syncer process tests
thlorenz 110392e
chore: add CI workflow
thlorenz ae1160b
chore: test that delegation program pubkey representations match
thlorenz 809345c
chore: ensure we don't run the docs as tests
thlorenz 7d94f7a
chore: don't duplicate same transaction slot
thlorenz d1b0d9d
chore: apply code suggestions
thlorenz 4d9dbf8
chore: cleanup build after suggested changes
thlorenz 00d6fec
chore: upgrade to latest rust actions per coderabbit
thlorenz 2264246
chore: fix CI
thlorenz 40aafc9
chore: run ci only while PRing
thlorenz bca4068
chore: adding _real_ undelegation transaction test
thlorenz bb861ef
chore: adjust delegation record account index to make _real_ test pass
thlorenz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| on: | ||
| pull_request: | ||
| types: [opened, reopened, synchronize, ready_for_review] | ||
|
|
||
| name: CI | ||
|
|
||
| jobs: | ||
| ci: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Rust stable | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| components: rustfmt, clippy | ||
|
|
||
| - name: Setup Rust nightly for formatting | ||
| uses: dtolnay/rust-toolchain@nightly | ||
| with: | ||
| components: rustfmt, clippy | ||
|
|
||
| - name: Cache cargo registry | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.cargo/registry | ||
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | ||
|
|
||
| - name: Cache cargo index | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.cargo/git | ||
| key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} | ||
|
|
||
| - name: Cache cargo build | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: target | ||
| key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} | ||
|
thlorenz marked this conversation as resolved.
|
||
|
|
||
| - name: Run tests | ||
| run: cargo test | ||
|
|
||
| - name: Check formatting | ||
| run: cargo +nightly fmt --check | ||
|
|
||
| - name: Run clippy | ||
| run: cargo clippy --all-targets -- -D warnings | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| //! Constants used throughout the DLP synchronization service. | ||
|
|
||
| use crate::types::Pubkey; | ||
|
|
||
| /// Size of a Solana public key in bytes. | ||
| pub(crate) const PUBKEY_LEN: usize = 32; | ||
|
|
||
| /// Delegation program address. | ||
| pub(crate) const DELEGATION_PROGRAM: &str = "DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh"; | ||
|
|
||
| /// Delegation program pubkey in bytes. | ||
| pub(crate) const DELEGATION_PROGRAM_PUBKEY: Pubkey = | ||
| bs58::decode(DELEGATION_PROGRAM.as_bytes()).into_array_const_unwrap(); | ||
|
|
||
| /// Size of a delegation record account in bytes. | ||
| pub(crate) const DELEGATION_RECORD_SIZE: u64 = 96; | ||
|
|
||
| /// Instruction discriminator for undelegate operations. | ||
| pub(crate) const UNDELEGATE_DISCRIMINATOR: u8 = 3; | ||
|
|
||
| /// Length of an instruction discriminator (Anchor programs). | ||
| pub(crate) const DISCRIMINATOR_LEN: usize = 8; | ||
|
|
||
| /// Index of the delegation record account in undelegate instruction accounts. | ||
| pub(crate) const DELEGATION_RECORD_ACCOUNT_INDEX: usize = 7; | ||
|
|
||
| /// Maximum pending subscription/unsubscription requests. | ||
| pub(crate) const MAX_PENDING_REQUESTS: usize = 256; | ||
|
|
||
| /// Maximum pending account/transaction updates. | ||
| pub(crate) const MAX_PENDING_UPDATES: usize = 8192; | ||
|
|
||
| /// Maximum reconnection attempts to the Laserstream. | ||
| pub(crate) const MAX_RECONNECT_ATTEMPTS: u32 = 16; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.