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

chore: use L1 Tx Utils #10759

Merged
merged 14 commits into from
Jan 10, 2025
Merged

chore: use L1 Tx Utils #10759

merged 14 commits into from
Jan 10, 2025

Conversation

spypsy
Copy link
Member

@spypsy spypsy commented Dec 16, 2024

Fixes #10464

@spypsy spypsy marked this pull request as ready for review December 16, 2024 13:38
Comment on lines 266 to 281
const args = [to.toString(), amount, claimSecretHash.toString()] as const;
const { request } = await this.portal.simulate.depositToAztecPublic(args);

const txReceipt = await this.l1TxUtils.sendAndMonitorTransaction(
{
to: request.address!,
data: encodeFunctionData({
abi: this.portal.abi,
functionName: 'depositToAztecPublic',
args,
}),
},
{
fixedGas: request.gas,
},
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to call simulate here if the tx utils already call estimateGas under the hood, which should throw (emphasis on should, we need to verify that) if the tx would revert? Also, note that simulate does not seem to perform a gas estimation as it's just mapped to call, and the gas returned seems to be whatever was originally set and not the actual gas used (see here).

Comment on lines 411 to 412
// Call function on L1 contract to consume the message
const { request } = await this.portal.simulate.withdraw(withdrawArgs);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above

Comment on lines 94 to 104
// Send transactions first
const [mintTxRes, approveTxRes] = await Promise.all([
l1TxUtils.sendTransaction(mintRequest),
l1TxUtils.sendTransaction(approveRequest),
]);

// Monitor transactions in parallel
await Promise.all([
l1TxUtils.monitorTransaction(mintRequest, mintTxRes.txHash, { gasLimit: mintTxRes.gasLimit }),
l1TxUtils.monitorTransaction(approveRequest, approveTxRes.txHash, { gasLimit: approveTxRes.gasLimit }),
]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Curious: why not a single Promise.all with sendAndMonitor?

Copy link
Member Author

Choose a reason for hiding this comment

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

I feel like I had a reason and now realizing that it was probably invalid since we're sending these 2 at the same time anyway

Copy link
Contributor

github-actions bot commented Jan 8, 2025

Changes to circuit sizes

Generated at commit: cc46e498e42381ec18d1ba467f17da7fd5a8e8fb, compared to commit: b5d51ebe8c1c9b0f4104f8f04995018bea2b701a

🧾 Summary (100% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
rollup_base_private +60,705 ❌ +10.90% +132,875 ❌ +5.98%
private_kernel_tail +225 ❌ +4.39% +225 ❌ +0.82%
private_kernel_empty +177 ❌ +22.41% +177 ❌ +0.02%
rollup_base_public +71 ❌ +0.01% +57 ❌ +0.00%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
rollup_base_private 617,798 (+60,705) +10.90% 2,355,616 (+132,875) +5.98%
private_kernel_tail 5,348 (+225) +4.39% 27,501 (+225) +0.82%
private_kernel_empty 967 (+177) +22.41% 865,308 (+177) +0.02%
rollup_base_public 849,484 (+71) +0.01% 3,749,059 (+57) +0.00%

@spypsy spypsy merged commit ccf28f5 into master Jan 10, 2025
48 checks passed
@spypsy spypsy deleted the spy/use-l1-tx-utils branch January 10, 2025 17:03
spypsy added a commit that referenced this pull request Jan 10, 2025
ludamad pushed a commit that referenced this pull request Jan 10, 2025
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.

Use L1TxUtils in all L1 contract interactions
3 participants