-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Conversation
Coverage report
Show files with reduced coverage 🔻
Test suite run success545 tests passing in 49 suites. Report generated by 🧪jest coverage report action from 3cc7746 |
45d7e2f
to
6c47543
Compare
{ type: 1, inputIndex: 0 }, | ||
{ type: 1, inputIndex: 1 }, | ||
]); | ||
const scope = contract.functions.call_external_foo(1336, otherContract.id); |
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 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
): receipt is ReceiptPanic => | ||
receipt.type === ReceiptType.Panic && | ||
receipt.contractId !== '0x0000000000000000000000000000000000000000000000000000000000000000'; | ||
|
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 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
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.
got it! this makes sense. Will update!
transactionRequest.addContract(Address.fromString(contractId)) | ||
); | ||
tries += 1; | ||
} while (tries < MAX_RETRIES); |
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.
What is the reasoning behind MAX_RETRIES
, and why is it 10
and not 20
or 30
or other value?
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.
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
TLDR
Add missing contractId's from panic receipts
Follow-up
Figure out if the underlying transactionRequest on the scope should be updated too