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

idl: Fix idl write overwrites from retries #2964

Merged
merged 3 commits into from
May 27, 2024

Conversation

andreihrs
Copy link
Contributor

@andreihrs andreihrs commented May 13, 2024

Retries caused unnecessary idl writes, even if the tx was succesful. This ended up corrupting the idl, ending up with a wrong IDL/corrupt deflated stream when trying to fetch it.

I moved the blockhash retrieval outside the retry loop, to resend the same tx in case there is a retry, up to the point the blockhash expires. From that point, we refetch the blockhash and resend the tx with a different blockhash

Copy link

vercel bot commented May 13, 2024

@andreihrs is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

@acheroncrypto acheroncrypto added cli fix Bug fix PR labels May 13, 2024
Copy link
Collaborator

@acheroncrypto acheroncrypto left a comment

Choose a reason for hiding this comment

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

Retries caused unnecessary idl writes, even if the tx was succesful. This ended up corrupting the idl, ending up with a wrong IDL/corrupt deflated stream when trying to fetch it.

I moved the blockhash retrieval outside the retry loop, to resend the same tx in case there is a retry, up to the point the blockhash expires. From that point, we refetch the blockhash and resend the tx with a different blockhash

The code looks better, however, how does it fix the problem you're describing? My understanding is that the IDL would only get corrupted if the chunks we get from the loop get corrupted e.g. if we skip one or more.

Similar to program buffers, rewriting the same bytes at the same index to the IDL buffer would not change anything other than wasting a transaction. Thus, it's likely the corruption happened due to one or more transactions not confirming rather than unnecessary writes.

@andreihrs
Copy link
Contributor Author

I tracked the number of writes that were displayed to happen and it fit how many steps I was expecting the idl buffer write to take.

however, once I did this change, the idl write worked afterwards

Copy link
Collaborator

@acheroncrypto acheroncrypto left a comment

Choose a reason for hiding this comment

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

Looks good in any case. Could you note this fix in the CHANGELOG then?

Copy link
Collaborator

@acheroncrypto acheroncrypto left a comment

Choose a reason for hiding this comment

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

Thanks!

@acheroncrypto acheroncrypto merged commit bcf3862 into coral-xyz:master May 27, 2024
47 of 49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli fix Bug fix PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants