Skip to content

feat: create svm spoke _update #976

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

Open
wants to merge 8 commits into
base: epic/svm-client
Choose a base branch
from

Conversation

james-a-morris
Copy link
Member

WIP (not working atm)

@james-a-morris james-a-morris force-pushed the james/upstream-slot-resolution branch from 2fb3b1a to 75a9749 Compare April 14, 2025 16:40
@james-a-morris james-a-morris changed the base branch from james/upstream-slot-resolution to epic/svm-client April 14, 2025 20:22
@james-a-morris james-a-morris force-pushed the james/_update-svm-client branch from 8e9649e to 0858448 Compare April 14, 2025 20:26
Signed-off-by: james-a-morris <[email protected]>
Signed-off-by: james-a-morris <[email protected]>
@@ -58,15 +59,21 @@ export abstract class BaseAbstractClient {
* @provider Ethers RPC provider instance.
* @returns An EventSearchConfig instance if valid, otherwise an UpdateFailureReason.
*/
public async updateSearchConfig(provider: providers.Provider): Promise<EventSearchConfig | UpdateFailureReason> {
public async updateSearchConfig(
provider: providers.Provider | Rpc<SolanaRpcApiFromTransport<RpcTransport>>
Copy link
Contributor

Choose a reason for hiding this comment

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

Something that we can do later is to use a helper type whenever we refer to a Solana provider. We already have one (here) but I think we should rename it and maybe relocate it too since it's not just a spoke util.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah we can relocate it to arch/svm/types.ts for example.

Copy link
Member Author

Choose a reason for hiding this comment

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

const errMsg = BigNumber.isBigNumber(currentTime)
? `currentTime: ${currentTime} < ${toBN(this.currentTime)}`
: `currentTime is not a BigNumber: ${JSON.stringify(currentTime)}`;
throw new Error(`SpokePoolClient::update: ${errMsg}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we specify that this was thrown by SvmSpokePoolClient?

Copy link
Member Author

Choose a reason for hiding this comment

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

if (provider instanceof providers.Provider) {
toBlock = await provider.getBlockNumber();
} else {
toBlock = Number(await provider.getBlockHeight({ commitment: "confirmed" }).send());
Copy link
Contributor

Choose a reason for hiding this comment

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

@james-a-morris Did you check on the time delta for confirmed vs processed? I think the equivalent behaviour on EVM is processed since we typically don't want to impose any finality overheads on the data ingested here.

Copy link
Member Author

Choose a reason for hiding this comment

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

This delta is usually 0-2 blocks in practice. The reason for choosing confirmed over processed is that our events use confirmed slots

@amateima amateima self-requested a review April 16, 2025 13:28
…Address types to strings; update SvmSpokePoolClient to utilize this function; include tests for unwrapEventData functionality
@james-a-morris james-a-morris marked this pull request as ready for review April 16, 2025 19:58
Copy link
Contributor

@melisaguevara melisaguevara left a comment

Choose a reason for hiding this comment

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

Left two comments sharing some errors I had when testing locally.

);
return Promise.all(
events.map(async (event): Promise<SortableEvent> => {
const block = await this.rpc.getBlock(event.slot).send();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we have to add {maxSupportedTransactionVersion: 0} as config for this call. This was failing locally for me with:

SolanaError: Transaction version (0) is not supported by the requesting client.
Please try the request again with the following configuration parameter: "maxSupportedTransactionVersion": 0

if (!BigNumber.isBigNumber(currentTime) || currentTime.lt(this.currentTime)) {
const errMsg = BigNumber.isBigNumber(currentTime)
? `currentTime: ${currentTime} < ${toBN(this.currentTime)}`
: `currentTime is not a BigNumber: ${JSON.stringify(currentTime)}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm also getting an error here: TypeError: Do not know how to serialize a BigInt.

…res; add isUint8Array utility function; update SvmSpokePoolClient for improved transaction hash handling; include new tests for FillUtils
Signed-off-by: james-a-morris <[email protected]>
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

Successfully merging this pull request may close these issues.

3 participants