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

fix: wait for confirmed status before fetch tx in test #821

Merged
merged 1 commit into from
Aug 14, 2024
Merged
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
18 changes: 10 additions & 8 deletions contracts/tests/ocr2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,12 @@ describe("ocr2", () => {
schema: borsh.Schema,
classType: any
): Promise<any> => {
let tx = await workspace.Store.rpc.query(scope, {
accounts: { feed },
options: { commitment: "confirmed" },
});
let tx = await workspace.Store.methods
.query(scope)
.accounts({ feed })
.rpc();

await provider.connection.confirmTransaction(tx, "confirmed")
let t = await provider.connection.getTransaction(tx, {
commitment: "confirmed",
});
Expand Down Expand Up @@ -901,7 +903,7 @@ describe("ocr2", () => {
for (let i = 2; i <= rounds; i++) {
let transmitTx = await transmit(feed.publicKey, i, i, new BN(i));

await provider.connection.confirmTransaction(transmitTx);
await provider.connection.confirmTransaction(transmitTx, "confirmed");
let t = await provider.connection.getTransaction(transmitTx, {
commitment: "confirmed",
});
Expand Down Expand Up @@ -1011,7 +1013,7 @@ describe("ocr2", () => {
computePriceMicroLamports,
juelsPerLamport,
);
await provider.connection.confirmTransaction(tx);
await provider.connection.confirmTransaction(tx, "confirmed");
let t = await provider.connection.getTransaction(tx, { commitment: "confirmed" });
console.log(t.meta.logMessages); // 195_785/195_997
account = await program.account.state.fetch(state.publicKey, 'confirmed');
Expand Down Expand Up @@ -1155,7 +1157,7 @@ describe("ocr2", () => {
]
});
// Print out program log so we can see total units consumed
await provider.connection.confirmTransaction(tx);
await provider.connection.confirmTransaction(tx, "confirmed");
let t = await provider.connection.getTransaction(tx, {
commitment: "confirmed",
});
Expand Down Expand Up @@ -1280,7 +1282,7 @@ describe("ocr2", () => {

// submit, then read from the feed to ensure it works fine
let transmitTx = await transmit(feed.publicKey, 1, 1, new BN(100));
await provider.connection.confirmTransaction(transmitTx);
await provider.connection.confirmTransaction(transmitTx, "confirmed");
let t = await provider.connection.getTransaction(transmitTx, {
commitment: "confirmed",
});
Expand Down
Loading
Loading