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: multi-call contract operations in tx summary #3710

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

danielbate
Copy link
Member

@danielbate danielbate commented Feb 14, 2025

Release notes

In this release, we:

  • Populated transaction summaries with all contract operations

Summary

Builds on the work in #3704 but makes correct usage of the param1 and param2 contract call receipt properties by using them in conjunction with a calculated script data size, enabling multi-call contract operations.

Checklist

  • All changes are covered by tests (or not applicable)
  • All changes are documented (or not applicable)
  • I reviewed the entire PR myself (preferably, on GH UI)
  • I described all Breaking Changes (or there's none)

@danielbate danielbate added the bug Issue is a bug label Feb 14, 2025
@danielbate danielbate self-assigned this Feb 14, 2025
Copy link

vercel bot commented Feb 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fuels-template ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 17, 2025 0:10am
ts-docs 🛑 Canceled (Inspect) Feb 17, 2025 0:10am
ts-docs-api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 17, 2025 0:10am

@danielbate danielbate marked this pull request as ready for review February 17, 2025 11:59
Copy link
Contributor

Coverage Report:

Lines Branches Functions Statements
77.1%(-0.05%) 70.79%(+0.1%) 75.3%(+0%) 77.1%(-0.05%)
Changed Files:
Ok File (✨=New File) Lines Branches Functions Statements
🔴 ✨ packages/abi-coder/src/utils/scriptData.ts 0%
(+0%)
0%
(+0%)
0%
(+0%)
0%
(+0%)
🔴 packages/account/src/providers/provider.ts 67.53%
(+0.58%)
59.8%
(+2.73%)
68.04%
(+0%)
67.29%
(+0.56%)
🔴 packages/account/src/providers/transaction-summary/call.ts 4.34%
(-1.91%)
0%
(+0%)
0%
(+0%)
4.34%
(-1.91%)
🔴 packages/account/src/providers/transaction-summary/operations.ts 94.44%
(+0.18%)
70.83%
(+0%)
94%
(+0.25%)
93.42%
(+0.35%)
🔴 packages/errors/src/test-utils/expect-to-throw-fuel-error.ts 91.66%
(-0.34%)
88.88%
(+0%)
100%
(+0%)
91.66%
(-0.34%)

const callScriptBaseOffset =
SCRIPT_FIXED_SIZE +
calculateScriptVariableSize(callReceiptsForContract) +
calculateVmTxMemory({ maxInputs: maxInputs.toNumber() });
Copy link
Member

@arboleya arboleya Feb 19, 2025

Choose a reason for hiding this comment

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

IIUC, judging by the answers to your questions, we can't rely on max inputs, can't we?

Copy link
Member Author

@danielbate danielbate Feb 19, 2025

Choose a reason for hiding this comment

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

No we can't. But I think there is value as for a tx summary created from a tx response, where it is likely that the max inputs is the same, we will get a more complete summary. It is also failing gracefully (empty array for operations) should the offset be incorrect.

For legacy transactions where it is possible that submitted max inputs != current max inputs, I've got an idea whereby we could query the block header that the tx was included in, and get the consensus param version and check that against the one we want to use for the calculation. This would need another request though. Or we ask them to include that in the transaction status that we have already, that gives us the block ID.

Additionally, there is the tracer but that will also require an additional request.

Going to dump these thoughts on a follow-up issue.

Copy link
Member

Choose a reason for hiding this comment

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

Should we postpone this feature until it is 100% reliable (via the tracer or similar)?

IIRC, one of the use cases for this was to show stuff on the Explorer, correct?

Which, given the circumstances, will not happen anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

Max inputs has not changed since we launched main-net. Right now, if we merged this feature, the explorer could display all contract operations for all transactions without making any additional requests.

Right now, we don't have any call operations in the tx summary. If max inputs changes, this feature mirrors that outcome for legacy txs. So IMO there is little downside vs where we are right now.

I'll leave it at that, I think there's value, but I'll leave it to you and the team if there isn't agreement and I'll convert to draft 👍🏻

Copy link
Member

Choose a reason for hiding this comment

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

My point is that there's no guarantee it won't change, right? This is the same caveat from @Torres-ssf's presentation on why we can't hardcode the maxInputs value and save one extra request. The same rationale was applied to the RPC Consistency pull request, accounting for variations and "what if it changes" cases.

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no guarantee.

I'll get an issue written up to investigate/introduce tracing as that'll likely be the most robust, and will close this PR with that issue.

@danielbate danielbate marked this pull request as draft February 19, 2025 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assembling a transaction summary using multicall incorrectly sets contract operations
3 participants