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

Adding Epoch Snapshot #7

Merged
merged 31 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2a135ce
starting epoch snapshot
coachchucksol Nov 8, 2024
5b024f2
Merge branch 'master' of https://github.com/jito-foundation/jito-mev-…
coachchucksol Nov 8, 2024
cf4c10d
more thoughts
coachchucksol Nov 8, 2024
4d58ac5
getting closer
coachchucksol Nov 11, 2024
ed04d05
one more function maybe
coachchucksol Nov 11, 2024
b1dd01e
good work
coachchucksol Nov 12, 2024
bd7e3b1
working
coachchucksol Nov 12, 2024
b5d77e0
updated clients
coachchucksol Nov 12, 2024
200fca4
tip router client up to date
coachchucksol Nov 12, 2024
a4f17b6
testing setup closer
coachchucksol Nov 12, 2024
7c2d632
going to merge in Evans work
coachchucksol Nov 13, 2024
5a671a6
need to make testing framework
coachchucksol Nov 13, 2024
38f98b5
getting closer
coachchucksol Nov 13, 2024
40e9381
added in vaultOperatorDelegationVotes
coachchucksol Nov 14, 2024
84d9252
working
coachchucksol Nov 14, 2024
27a164a
took out the account
coachchucksol Nov 14, 2024
1b52c14
tests getting closer
coachchucksol Nov 14, 2024
a3f78b2
on the right track
coachchucksol Nov 14, 2024
32faa6c
working
coachchucksol Nov 15, 2024
d64418a
serde problem
coachchucksol Nov 15, 2024
9df99c3
working
coachchucksol Nov 15, 2024
919c96a
test made
coachchucksol Nov 15, 2024
ab9015e
test are intermittent
coachchucksol Nov 15, 2024
a748cb1
looking better
coachchucksol Nov 19, 2024
7fb0e4d
TODOs added
coachchucksol Nov 19, 2024
9d9b415
fixed dead code
coachchucksol Nov 19, 2024
2e6a419
Force new blockhash on airdrop
ebatsell Nov 19, 2024
d8f975e
Rm prints
ebatsell Nov 19, 2024
c642cfe
Last fixes
ebatsell Nov 19, 2024
a3c5d76
fixed tests
coachchucksol Nov 19, 2024
e723047
fixed tests
coachchucksol Nov 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[profile.default]
retries = { backoff = "exponential", count = 5, delay = "1s", jitter = true, max-delay = "10s" }
test-threads = "num-cpus"
threads-required = 1
fail-fast = false
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

176 changes: 176 additions & 0 deletions clients/js/jito_tip_router/accounts/epochSnapshot.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
/**
* This code was AUTOGENERATED using the kinobi library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun kinobi to update it.
*
* @see https://github.com/kinobi-so/kinobi
*/

import {
assertAccountExists,
assertAccountsExist,
combineCodec,
decodeAccount,
fetchEncodedAccount,
fetchEncodedAccounts,
getAddressDecoder,
getAddressEncoder,
getArrayDecoder,
getArrayEncoder,
getStructDecoder,
getStructEncoder,
getU128Decoder,
getU128Encoder,
getU64Decoder,
getU64Encoder,
getU8Decoder,
getU8Encoder,
type Account,
type Address,
type Codec,
type Decoder,
type EncodedAccount,
type Encoder,
type FetchAccountConfig,
type FetchAccountsConfig,
type MaybeAccount,
type MaybeEncodedAccount,
} from '@solana/web3.js';
import {
getFeesDecoder,
getFeesEncoder,
type Fees,
type FeesArgs,
} from '../types';

export type EpochSnapshot = {
discriminator: bigint;
ncn: Address;
ncnEpoch: bigint;
bump: number;
slotCreated: bigint;
slotFinalized: bigint;
ncnFees: Fees;
operatorCount: bigint;
vaultCount: bigint;
operatorsRegistered: bigint;
validOperatorVaultDelegations: bigint;
stakeWeight: bigint;
reserved: Array<number>;
};

export type EpochSnapshotArgs = {
discriminator: number | bigint;
ncn: Address;
ncnEpoch: number | bigint;
bump: number;
slotCreated: number | bigint;
slotFinalized: number | bigint;
ncnFees: FeesArgs;
operatorCount: number | bigint;
vaultCount: number | bigint;
operatorsRegistered: number | bigint;
validOperatorVaultDelegations: number | bigint;
stakeWeight: number | bigint;
reserved: Array<number>;
};

export function getEpochSnapshotEncoder(): Encoder<EpochSnapshotArgs> {
return getStructEncoder([
['discriminator', getU64Encoder()],
['ncn', getAddressEncoder()],
['ncnEpoch', getU64Encoder()],
['bump', getU8Encoder()],
['slotCreated', getU64Encoder()],
['slotFinalized', getU64Encoder()],
['ncnFees', getFeesEncoder()],
['operatorCount', getU64Encoder()],
['vaultCount', getU64Encoder()],
['operatorsRegistered', getU64Encoder()],
['validOperatorVaultDelegations', getU64Encoder()],
['stakeWeight', getU128Encoder()],
['reserved', getArrayEncoder(getU8Encoder(), { size: 128 })],
]);
}

export function getEpochSnapshotDecoder(): Decoder<EpochSnapshot> {
return getStructDecoder([
['discriminator', getU64Decoder()],
['ncn', getAddressDecoder()],
['ncnEpoch', getU64Decoder()],
['bump', getU8Decoder()],
['slotCreated', getU64Decoder()],
['slotFinalized', getU64Decoder()],
['ncnFees', getFeesDecoder()],
['operatorCount', getU64Decoder()],
['vaultCount', getU64Decoder()],
['operatorsRegistered', getU64Decoder()],
['validOperatorVaultDelegations', getU64Decoder()],
['stakeWeight', getU128Decoder()],
['reserved', getArrayDecoder(getU8Decoder(), { size: 128 })],
]);
}

export function getEpochSnapshotCodec(): Codec<
EpochSnapshotArgs,
EpochSnapshot
> {
return combineCodec(getEpochSnapshotEncoder(), getEpochSnapshotDecoder());
}

export function decodeEpochSnapshot<TAddress extends string = string>(
encodedAccount: EncodedAccount<TAddress>
): Account<EpochSnapshot, TAddress>;
export function decodeEpochSnapshot<TAddress extends string = string>(
encodedAccount: MaybeEncodedAccount<TAddress>
): MaybeAccount<EpochSnapshot, TAddress>;
export function decodeEpochSnapshot<TAddress extends string = string>(
encodedAccount: EncodedAccount<TAddress> | MaybeEncodedAccount<TAddress>
): Account<EpochSnapshot, TAddress> | MaybeAccount<EpochSnapshot, TAddress> {
return decodeAccount(
encodedAccount as MaybeEncodedAccount<TAddress>,
getEpochSnapshotDecoder()
);
}

export async function fetchEpochSnapshot<TAddress extends string = string>(
rpc: Parameters<typeof fetchEncodedAccount>[0],
address: Address<TAddress>,
config?: FetchAccountConfig
): Promise<Account<EpochSnapshot, TAddress>> {
const maybeAccount = await fetchMaybeEpochSnapshot(rpc, address, config);
assertAccountExists(maybeAccount);
return maybeAccount;
}

export async function fetchMaybeEpochSnapshot<TAddress extends string = string>(
rpc: Parameters<typeof fetchEncodedAccount>[0],
address: Address<TAddress>,
config?: FetchAccountConfig
): Promise<MaybeAccount<EpochSnapshot, TAddress>> {
const maybeAccount = await fetchEncodedAccount(rpc, address, config);
return decodeEpochSnapshot(maybeAccount);
}

export async function fetchAllEpochSnapshot(
rpc: Parameters<typeof fetchEncodedAccounts>[0],
addresses: Array<Address>,
config?: FetchAccountsConfig
): Promise<Account<EpochSnapshot>[]> {
const maybeAccounts = await fetchAllMaybeEpochSnapshot(
rpc,
addresses,
config
);
assertAccountsExist(maybeAccounts);
return maybeAccounts;
}

export async function fetchAllMaybeEpochSnapshot(
rpc: Parameters<typeof fetchEncodedAccounts>[0],
addresses: Array<Address>,
config?: FetchAccountsConfig
): Promise<MaybeAccount<EpochSnapshot>[]> {
const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
return maybeAccounts.map((maybeAccount) => decodeEpochSnapshot(maybeAccount));
}
2 changes: 2 additions & 0 deletions clients/js/jito_tip_router/accounts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* @see https://github.com/kinobi-so/kinobi
*/

export * from './epochSnapshot';
export * from './ncnConfig';
export * from './operatorSnapshot';
export * from './trackedMints';
export * from './weightTable';
Loading
Loading