-
Notifications
You must be signed in to change notification settings - Fork 54
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
fix: address LUT issues on tests #811
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Chris Maree <[email protected]>
// Avoids invalid ALT index as ALT might not be active yet on the following tx. | ||
await new Promise((resolve) => setTimeout(resolve, 1000)); | ||
// Wait for slot to advance. LUTs only active after slot advance. | ||
const initialSlot = await connection.getSlot(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice finding!
Suggestion: Could we use something like this connection.onSlotChange to subscribe to slot changes? Not sure how reliable onSlotChange is though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this and this was better. not sure if onSlotChange was delayed or returned early but it did to result in the tests always working as expected, like this implementation does.
src/svm/transactionUtils.ts
Outdated
await web3.sendAndConfirmTransaction(connection, new web3.Transaction().add(extendInstruction), [sender], { | ||
skipPreflight: true, // Avoids recent slot mismatch in simulation. | ||
}); | ||
await web3.sendAndConfirmTransaction(connection, new web3.Transaction().add(extendInstruction), [sender]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we also set this to "confirmed", otherwise might default to "max"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure & done.
Signed-off-by: Chris Maree <[email protected]>
addresses an issue we were seeing with unit tests after an anchor update. Now, all tests work.
reason this was needed is as follows: