Skip to content

refactor(experimental): WIP modify rpc types for performance #1759

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
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions packages/library/src/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { DEFAULT_RPC_CONFIG } from './rpc-default-config';
import { getRpcSubscriptionsWithSubscriptionCoalescing } from './rpc-subscription-coalescer';

export function createSolanaRpc(config: Omit<Parameters<typeof createJsonRpc>[0], 'api'>): Rpc<SolanaRpcMethods> {
return createJsonRpc({
return createJsonRpc<SolanaRpcMethods>({
...config,
api: createSolanaRpcApi(DEFAULT_RPC_CONFIG),
});
Expand All @@ -27,7 +27,7 @@ export function createSolanaRpcSubscriptions(
config: Omit<Parameters<typeof createJsonSubscriptionRpc>[0], 'api'>
): RpcSubscriptions<SolanaRpcSubscriptions> {
return pipe(
createJsonSubscriptionRpc({
createJsonSubscriptionRpc<SolanaRpcSubscriptions>({
...config,
api: createSolanaRpcSubscriptionsApi(DEFAULT_RPC_CONFIG),
}),
Expand All @@ -42,7 +42,7 @@ export function createSolanaRpcSubscriptions(
export function createSolanaRpcSubscriptions_UNSTABLE(
config: Omit<Parameters<typeof createJsonSubscriptionRpc>[0], 'api'>
): RpcSubscriptions<SolanaRpcSubscriptions & SolanaRpcSubscriptionsUnstable> {
return createJsonSubscriptionRpc({
return createJsonSubscriptionRpc<SolanaRpcSubscriptions & SolanaRpcSubscriptionsUnstable>({
...config,
api: createSolanaRpcSubscriptionsApi_UNSTABLE(DEFAULT_RPC_CONFIG),
});
Expand Down
6 changes: 1 addition & 5 deletions packages/rpc-core/src/rpc-methods/getClusterNodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ type GetClusterNodesApiResponse = readonly GetClusterNodesNode[];
export interface GetClusterNodesApi {
/**
* Returns information about all the nodes participating in the cluster
* Note that the optional NO_CONFIG object is ignored. See https://github.com/solana-labs/solana-web3.js/issues/1389
*/
getClusterNodes(
// FIXME: https://github.com/solana-labs/solana-web3.js/issues/1389
NO_CONFIG?: Record<string, never>
): GetClusterNodesApiResponse;
getClusterNodes(): GetClusterNodesApiResponse;
}
6 changes: 1 addition & 5 deletions packages/rpc-core/src/rpc-methods/getEpochSchedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ type GetEpochScheduleApiResponse = Readonly<{
export interface GetEpochScheduleApi {
/**
* Returns the epoch schedule information from this cluster's genesis config
* Note that the optional NO_CONFIG object is ignored. See https://github.com/solana-labs/solana-web3.js/issues/1389
*/
getEpochSchedule(
// FIXME: https://github.com/solana-labs/solana-web3.js/issues/1389
NO_CONFIG?: Record<string, never>
): GetEpochScheduleApiResponse;
getEpochSchedule(): GetEpochScheduleApiResponse;
}
6 changes: 1 addition & 5 deletions packages/rpc-core/src/rpc-methods/getFirstAvailableBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ type GetFirstAvailableBlockApiResponse = Slot;
export interface GetFirstAvailableBlockApi {
/**
* Returns the slot of the lowest confirmed block that has not been purged from the ledger
* Note that the optional NO_CONFIG object is ignored. See https://github.com/solana-labs/solana-web3.js/issues/1389
*/
getFirstAvailableBlock(
// FIXME: https://github.com/solana-labs/solana-web3.js/issues/1389
NO_CONFIG?: Record<string, never>
): GetFirstAvailableBlockApiResponse;
getFirstAvailableBlock(): GetFirstAvailableBlockApiResponse;
}
5 changes: 1 addition & 4 deletions packages/rpc-core/src/rpc-methods/getGenesisHash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@ export interface GetGenesisHashApi {
/**
* Returns the genesis hash
*/
getGenesisHash(
// FIXME: https://github.com/solana-labs/solana-web3.js/issues/1389
NO_CONFIG?: Record<string, never>
): GetGenesisHashApiResponse;
getGenesisHash(): GetGenesisHashApiResponse;
}
5 changes: 1 addition & 4 deletions packages/rpc-core/src/rpc-methods/getHealth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@ export interface GetHealthApi {
/**
* Returns the health status of the node ("ok" if healthy).
*/
getHealth(
// FIXME: https://github.com/solana-labs/solana-web3.js/issues/1389
NO_CONFIG?: Record<string, never>
): GetHealthApiResponse;
getHealth(): GetHealthApiResponse;
}
5 changes: 1 addition & 4 deletions packages/rpc-core/src/rpc-methods/getHighestSnapshotSlot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,5 @@ export interface GetHighestSnapshotSlotApi {
* incremental snapshot slot based on the full snapshot slot, if there
* is one.
*/
getHighestSnapshotSlot(
// FIXME: https://github.com/solana-labs/solana-web3.js/issues/1389
NO_CONFIG?: Record<string, never>
): GetHighestSnapshotSlotApiResponse;
getHighestSnapshotSlot(): GetHighestSnapshotSlotApiResponse;
}
5 changes: 1 addition & 4 deletions packages/rpc-core/src/rpc-methods/getIdentity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@ export interface GetIdentityApi {
/**
* Returns the identity pubkey for the current node
*/
getIdentity(
// FIXME: https://github.com/solana-labs/solana-web3.js/issues/1389
NO_CONFIG?: Record<string, never>
): GetIdentityApiResponse;
getIdentity(): GetIdentityApiResponse;
}
5 changes: 1 addition & 4 deletions packages/rpc-core/src/rpc-methods/getInflationRate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,5 @@ export interface GetInflationRateApi {
/**
* Returns the current block height of the node
*/
getInflationRate(
// FIXME: https://github.com/solana-labs/solana-web3.js/issues/1389
NO_CONFIG?: Record<string, never>
): GetInflationRateApiResponse;
getInflationRate(): GetInflationRateApiResponse;
}
6 changes: 1 addition & 5 deletions packages/rpc-core/src/rpc-methods/getMaxRetransmitSlot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ type GetMaxRetransmitSlotApiResponse = Slot;
export interface GetMaxRetransmitSlotApi {
/**
* Get the max slot seen from retransmit stage.
* Note that the optional NO_CONFIG object is ignored. See https://github.com/solana-labs/solana-web3.js/issues/1389
*/
getMaxRetransmitSlot(
// FIXME: https://github.com/solana-labs/solana-web3.js/issues/1389
NO_CONFIG?: Record<string, never>
): GetMaxRetransmitSlotApiResponse;
getMaxRetransmitSlot(): GetMaxRetransmitSlotApiResponse;
}
6 changes: 1 addition & 5 deletions packages/rpc-core/src/rpc-methods/getMaxShredInsertSlot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ type GetMaxShredInsertSlotApiResponse = Slot;
export interface GetMaxShredInsertSlotApi {
/**
* Get the max slot seen from after shred insert.
* Note that the optional NO_CONFIG object is ignored. See https://github.com/solana-labs/solana-web3.js/issues/1389
*/
getMaxShredInsertSlot(
// FIXME: https://github.com/solana-labs/solana-web3.js/issues/1389
NO_CONFIG?: Record<string, never>
): GetMaxShredInsertSlotApiResponse;
getMaxShredInsertSlot(): GetMaxShredInsertSlotApiResponse;
}
5 changes: 1 addition & 4 deletions packages/rpc-core/src/rpc-methods/getVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,5 @@ export interface GetVersionApi {
/**
* Returns the current Solana version running on the node
*/
getVersion(
// FIXME: https://github.com/solana-labs/solana-web3.js/issues/1389
NO_CONFIG?: Record<string, never>
): GetVersionApiResponse;
getVersion(): GetVersionApiResponse;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@ export interface RootNotificationsApi {
/**
* Subscribe to receive notification anytime a new root is set by the validator
*/
rootNotifications(
// FIXME: https://github.com/solana-labs/solana-web3.js/issues/1389
NO_CONFIG?: Record<string, never>
): RootNotificationsApiNotification;
rootNotifications(): RootNotificationsApiNotification;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,5 @@ export interface SlotNotificationsApi {
/**
* Subscribe to receive notification anytime a slot is processed by the validator
*/
slotNotifications(
// FIXME: https://github.com/solana-labs/solana-web3.js/issues/1389
NO_CONFIG?: Record<string, never>
): SlotNotificationsApiNotification;
slotNotifications(): SlotNotificationsApiNotification;
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,5 @@ export interface SlotsUpdatesNotificationsApi {
/**
* Subscribe to receive a notification from the validator on a variety of updates on every slot
*/
slotsUpdatesNotifications(
// FIXME: https://github.com/solana-labs/solana-web3.js/issues/1389
NO_CONFIG?: Record<string, never>
): SlotsUpdatesNotificationsApiNotification;
slotsUpdatesNotifications(): SlotsUpdatesNotificationsApiNotification;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,5 @@ export interface VoteNotificationsApi {
/**
* Subscribe to receive a notification from the validator on a variety of updates on every slot
*/
voteNotifications(
// FIXME: https://github.com/solana-labs/solana-web3.js/issues/1389
NO_CONFIG?: Record<string, never>
): VoteNotificationsApiNotification;
voteNotifications(): VoteNotificationsApiNotification;
}
Loading