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: Gas Utils for L1 operations #9834

Merged
merged 56 commits into from
Dec 4, 2024
Merged
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
7dca6df
feat: Gas Utils for L1 operations
spypsy Nov 8, 2024
8a0edaa
undo irrelevant change
spypsy Nov 8, 2024
fdfc143
update some logging
spypsy Nov 8, 2024
df22c32
Merge branch 'master' into spy/gas-utils
spypsy Nov 8, 2024
347d750
add e2e test
spypsy Nov 11, 2024
d01a316
add to E2E test config
spypsy Nov 11, 2024
78f8fb2
Merge branch 'master' into spy/gas-utils
spypsy Nov 11, 2024
427c836
rm old import
spypsy Nov 11, 2024
1adc20e
small fixes
spypsy Nov 13, 2024
b481eb2
rm pk logging
spypsy Nov 13, 2024
13d731a
formatting & test issues
spypsy Nov 13, 2024
e688b8d
formatting
spypsy Nov 13, 2024
b280ed4
don't fail script when ADDRESS & pk are unset
spypsy Nov 13, 2024
58bcc71
remove logs
spypsy Nov 13, 2024
2261352
update default private_key assignment in validator.sh
spypsy Nov 13, 2024
7092327
use const for WEI
spypsy Nov 13, 2024
1b4c8c3
skip PRIVATE_KEY assignment
spypsy Nov 13, 2024
31449f7
WIP: PR fixes
spypsy Nov 14, 2024
9af92ea
Merge branch 'master' into spy/gas-utils
spypsy Nov 14, 2024
d066d51
refactor GasUtils
spypsy Nov 18, 2024
f96b1d8
simplify acc & wallets
spypsy Nov 18, 2024
e18c4f9
bump priorityFee on retries
spypsy Nov 18, 2024
f853f21
configs
spypsy Nov 18, 2024
569bf2d
Merge branch 'master' into spy/gas-utils
spypsy Nov 19, 2024
b3223d7
rename to L1TxUtils
spypsy Nov 19, 2024
47f15a4
don't use 0x
spypsy Nov 19, 2024
03fbf79
send contract deployments to null
spypsy Nov 19, 2024
280c9a7
fix publisher tests
spypsy Nov 19, 2024
0b45fe6
fix getNodeInfo test
spypsy Nov 19, 2024
bb5505b
Merge branch 'master' into spy/gas-utils
spypsy Nov 19, 2024
653a083
split sendTx & monitorTx for separate use
spypsy Nov 19, 2024
c15d6b1
calc nonce in monitor function
spypsy Nov 19, 2024
9508cb7
fix null-check
spypsy Nov 19, 2024
81c03e7
Merge branch 'master' into spy/gas-utils
spypsy Nov 20, 2024
d80ece6
remove from e2e config
spypsy Nov 20, 2024
47edcd8
temp fix integration publisher test
spypsy Nov 20, 2024
d1fa404
temp fix integration publisher test
spypsy Nov 20, 2024
09339a4
some PR fixes
spypsy Nov 21, 2024
a331d9e
use default-defined value
spypsy Nov 21, 2024
1b169b4
more PR fixes
spypsy Nov 21, 2024
8818d1f
10% min fee bump, ensure test sends replacement tx
spypsy Nov 22, 2024
60afdea
merge conflicts
spypsy Nov 22, 2024
2c4858d
Merge branch 'master' into spy/gas-utils
spypsy Nov 25, 2024
c2338d0
Merge branch 'master' into spy/gas-utils
spypsy Nov 26, 2024
34170d1
undo submodule changes
spypsy Nov 26, 2024
3d46d87
fix get-node-info opts
spypsy Nov 27, 2024
af2d3e6
requesting info from node, not pxe
spypsy Nov 27, 2024
4ab1d4b
Merge branch 'master' into spy/gas-utils
spypsy Nov 29, 2024
0834d50
More PR fixes
spypsy Nov 29, 2024
0c20390
fix await
spypsy Nov 29, 2024
5fd231b
add cheat codes
spypsy Dec 2, 2024
a17a0ae
expect two error calls
spypsy Dec 2, 2024
0c84a64
update l1-publisher tests
spypsy Dec 2, 2024
de03935
add priorityFee to maxFeePerGas calculation, retry fetching l1 tx
spypsy Dec 3, 2024
e62ba9c
fix priorityFee addition, add gas calculationt ests
spypsy Dec 4, 2024
e4cc25f
Merge branch 'master' into spy/gas-utils
spypsy Dec 4, 2024
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
14 changes: 12 additions & 2 deletions yarn-project/ethereum/src/l1_tx_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export class L1TxUtils {
// Retry a few times, in case the tx is not yet propagated.
const tx = await retry<GetTransactionReturnType>(
() => this.publicClient.getTransaction({ hash: initialTxHash }),
`Getting L1 transaction ${initialTxHash} nonce`,
`Getting L1 transaction ${initialTxHash}`,
makeBackoff([1, 2, 3]),
this.logger,
true,
Expand Down Expand Up @@ -244,7 +244,14 @@ export class L1TxUtils {
}
}

const tx = await this.publicClient.getTransaction({ hash: currentTxHash });
// Retry a few times, in case the tx is not yet propagated.
const tx = await retry<GetTransactionReturnType>(
() => this.publicClient.getTransaction({ hash: currentTxHash }),
`Getting L1 transaction ${currentTxHash}`,
makeBackoff([1, 2, 3]),
this.logger,
true,
);
const timePassed = Date.now() - lastAttemptSent;

if (tx && timePassed < gasConfig.stallTimeMs!) {
Expand Down Expand Up @@ -359,6 +366,9 @@ export class L1TxUtils {
priorityFee = (priorityFee * (100n + (gasConfig.priorityFeeBumpPercentage || 0n))) / 100n;
}

// Add priority fee to maxFeePerGas
maxFeePerGas += priorityFee;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should happen before the maxFeePerGas = maxFeePerGas > minMaxFee ? maxFeePerGas : minMaxFee, since the minMaxFee already has the priority fee component accounted for.

Otherwise, if maxFeePerGas gets set to minMaxFee and then we add priorityFee on top of it, we'd be accounting for the priorityFee twice.

Copy link
Member Author

Choose a reason for hiding this comment

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

right ofc 🤦


// Ensure we don't exceed maxGwei
const maxGweiInWei = gasConfig.maxGwei! * WEI_CONST;
maxFeePerGas = maxFeePerGas > maxGweiInWei ? maxGweiInWei : maxFeePerGas;
Expand Down
Loading