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

feat: add contract ID from PanicReceipts #583

Merged
merged 3 commits into from
Nov 11, 2022
Merged

feat: add contract ID from PanicReceipts #583

merged 3 commits into from
Nov 11, 2022

Conversation

QuinnLee
Copy link
Contributor

@QuinnLee QuinnLee commented Nov 7, 2022

TLDR

Add missing contractId's from panic receipts

Follow-up

Figure out if the underlying transactionRequest on the scope should be updated too

@QuinnLee QuinnLee changed the title feat: add contract ID feat: add contract ID from PanicReceipts Nov 7, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2022

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements
90.23% (-0% 🔻)
3656/4052
🟡 Branches
71.54% (+0.01% 🔼)
704/984
🟢 Functions
86.72% (-0.07% 🔻)
725/836
🟢 Lines
90.26% (-0% 🔻)
3503/3881
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟡
... / provider.ts
74.43% (+0.78% 🔼)
62.5%
72.09% (-1.72% 🔻)
73.21% (+0.89% 🔼)
🟢
... / util.ts
97.5% (-2.5% 🔻)
86.67% (-4.24% 🔻)
100%
97.06% (-2.94% 🔻)

Test suite run success

545 tests passing in 49 suites.

Report generated by 🧪jest coverage report action from 3cc7746

@QuinnLee QuinnLee force-pushed the ql/462 branch 7 times, most recently from 45d7e2f to 6c47543 Compare November 8, 2022 22:28
{ type: 1, inputIndex: 0 },
{ type: 1, inputIndex: 1 },
]);
const scope = contract.functions.call_external_foo(1336, otherContract.id);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is sufficient for tests following the pattern here.

The only issue is that the underlying transaction request doesn't get mutated if there are updates on to it so the getContract assertion is no longer needed. I'm going to create follow-up issue to see if we should update the scope.transactionRequest

@QuinnLee QuinnLee requested review from LuizAsFight, luizstacio, camsjams and a team and removed request for LuizAsFight, luizstacio and camsjams November 8, 2022 22:41
@QuinnLee QuinnLee marked this pull request as ready for review November 8, 2022 22:42
): receipt is ReceiptPanic =>
receipt.type === ReceiptType.Panic &&
receipt.contractId !== '0x0000000000000000000000000000000000000000000000000000000000000000';

Copy link
Member

@arboleya arboleya Nov 10, 2022

Choose a reason for hiding this comment

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

Nice use of type helpers. ⚡

Since getReceiptsWithMissingOutputVariables and getReceiptsWithMissingContractIds don't actually get a list of receipts, I suggest renaming them using question-like nomenclature.

One literal example would be:

  • doesReceiptHaveMissingOutputVariables
  • doesReceiptHaveMissingContractId

Copy link
Contributor Author

Choose a reason for hiding this comment

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

got it! this makes sense. Will update!

transactionRequest.addContract(Address.fromString(contractId))
);
tries += 1;
} while (tries < MAX_RETRIES);
Copy link
Member

Choose a reason for hiding this comment

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

What is the reasoning behind MAX_RETRIES, and why is it 10 and not 20 or 30 or other value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TBH, I just used the same number as the Rust SDK set. Not sure what the motivation for it is too. cc @digorithm - should we set a max retry to a different number

@QuinnLee QuinnLee requested a review from a team November 11, 2022 04:21
@QuinnLee QuinnLee self-assigned this Nov 11, 2022
@QuinnLee QuinnLee linked an issue Nov 11, 2022 that may be closed by this pull request
@QuinnLee QuinnLee merged commit 897888e into master Nov 11, 2022
@QuinnLee QuinnLee deleted the ql/462 branch November 11, 2022 18:04
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.

Add contract inputs automatically by simulate tx
3 participants