-
Notifications
You must be signed in to change notification settings - Fork 439
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
[SDK] Feature: Add support for forcing legacy transactions in chain configuration #6180
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
size-limit report 📦
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6180 +/- ##
==========================================
- Coverage 56.93% 56.92% -0.01%
==========================================
Files 1155 1155
Lines 63923 63931 +8
Branches 5193 5199 +6
==========================================
+ Hits 36392 36394 +2
- Misses 26803 26808 +5
- Partials 728 729 +1
*This pull request uses carry forward flags. Click here to find out more.
|
/** | ||
* Whether to force legacy transactions (pre EIP-1559) for this chain | ||
*/ | ||
forceLegacyTransactions?: boolean; |
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.
Don't like the boolean because its inflexible, a type: "legacy"
might be better (and matches viem/ox APIs)
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.
Might also want this on the transaction level if the user is providing it
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.
agreed on both counts. So something like feeType: "legacy" | "eip1559"
?
@@ -26,6 +28,7 @@ export type ChainOptions = { | |||
increaseZeroByteCount?: boolean; | |||
}; | |||
faucets?: Array<string>; | |||
feeType?: FeeType; |
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.
who will fill in this value though?
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.
when a user defines chain, it's good to be able to globally specify only to use legacy transaction
(this is the reason this came on my radar to begin with lol, I need a way to do this in engine)
resolvePromisedValue(transaction.maxFeePerGas), | ||
resolvePromisedValue(transaction.maxPriorityFeePerGas), | ||
resolvePromisedValue(transaction.gasPrice), | ||
resolvePromisedValue(transaction.feeType), |
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.
so we have it on the chain, on the tx AND in the function itself? seems a bit much no?
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.
It should come from the chains DB if possible but the user override only on the transaction. User override takes precedence
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.
for context, I felt this need on engine where I need to expose configuration that allows users to force legacy transactions on a chain. Especially important when engine sends nonce cancellation transactions which are not user triggered. (I could manage this in engine too, but felt like it could be a more general thing so the SDK would benefit from it)
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.
yeah chain level makes sense to me
resolvePromisedValue(transaction.maxFeePerGas), | ||
resolvePromisedValue(transaction.maxPriorityFeePerGas), | ||
resolvePromisedValue(transaction.gasPrice), | ||
resolvePromisedValue(transaction.feeType), |
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.
yeah chain level makes sense to me
// if chain is configured to force legacy transactions or is in the legacy chain list | ||
if ( | ||
resolvedFeeType === "legacy" || | ||
FORCE_GAS_PRICE_CHAIN_IDS.includes(chain.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.
while you're at it can you add the chain in question to the FORCE_GAS_PRICE_CHAIN_IDS list please?
@@ -40,6 +43,7 @@ const FORCE_GAS_PRICE_CHAIN_IDS = [ | |||
1942999413, // Humanity Testnet | |||
1952959480, // Lumia Testnet | |||
994873017, // Lumia Mainnet | |||
1942999413, // Humanity Mainnet |
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.
The chain ID 1942999413
appears twice in FORCE_GAS_PRICE_CHAIN_IDS
- once for Humanity Testnet and again for Humanity Mainnet. This appears to be a duplicate entry. If these networks truly have the same chain ID, one entry should be removed. If they are meant to be different networks, one of the chain IDs needs to be corrected.
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
@@ -17,6 +17,7 @@ export type StaticPrepareTransactionOptions = { | |||
maxFeePerGas?: bigint | undefined; | |||
maxPriorityFeePerGas?: bigint | undefined; | |||
maxFeePerBlobGas?: bigint | undefined; | |||
feeType?: FeeType | undefined; |
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.
actually lets not add this, lets just do the chain one.
this prop is too similar the tx.type one which also indicates if its a legacy or 1559 tx
PR-Codex overview
This PR introduces a new
feeType
option in various transaction-related types and functions, allowing for better handling of transaction fee structures (legacy
oreip1559
). It modifies existing functions to accommodate this new parameter for improved gas fee management.Detailed summary
feeType
property toChainOptions
type.feeType
inStaticPrepareTransactionOptions
type.FeeType
type with values"legacy"
and"eip1559"
.getGasOverridesForTransaction
function to handlefeeType
.getDefaultGasOverrides
to prioritizefeeType
over chain defaults.feeType
.