-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
EIP-1559 Transaction Support #1610
Comments
We are definitely eagerly awaiting this at MyCrypto to start playing around with it. Let me know if you need any help at all! |
hi from web3.py! following along too as we'll be starting down this path either this or next week. 👀 |
So, one problems that has come up is the default choices for maxFeeGas and maxPriorityFeePerGas. It makes total sense that
This has the following consequence. On Calaveras, right now the
And Option 1:
Option 2:
Options 3
Both options will likely massively overpay (100's of millions times more to the miner than the burn) on a network with a low base fee. Ideas? |
What if we have default In pre-EIP1559 system, there has been an option to set a minimum gas price for eth clients, and mostly it has been However, post-EIP1559, this minimim gas price is in the form of Edit: since we are setting |
If you set a maxPriorityFee of 0 though, you will 100% never get mined though. Miners will not mine a transaction that does not cover their costs for uncle risk. We need priority fees to prevent mining empty blocks. Micah suggested we go with Option 2, and the discussions on discord have convinced me. :) I've made those changes to the eip-1559 branch, if anyone wants to check it out. :) One nice thing of EIP-1559 is we will no longer require any gas oracle. And it looks like any oracle data we might need to make better decisions in the future may be included in the Geth JSON-RPC, such as a histogram of priority fees paid. Then we can add some nice logic to ethers to "just work" for anyone doing normal things and overriding will only be necessary for developers doing more advanced things. :) |
In this case, what we would end up with is:
I was originally concerned, because I was thinking of priority fee like a tip, and I would never tip $500 million on a $3 coffee. But Micah pointed out that we shouldn't think of it like a tip. The |
I don't get why this is assumed, because there is a block reward. I thought the tip is really just to be mined quickly when there is congestion to give the miners an way to prioritize. And the mechanism is supposed to make ether more valuable. |
@marceljay
Sorry, I don’t know what I was thinking when I wrote that. I need to revise my answer as that last one is entirely incorrect. :s The block subsidy reward only rewards the miner for the resources used to mine a block, but there must be an incentive to include each transaction, otherwise it would be easier to just mine empty blocks, and no reason to bother including anything else. Each transaction also requires some additional time to process, and increases the processing time of each other node to verify a successful block before that block gets accepted and propagated. As a result, including additional transactions has an extra cost; each transaction increases the odds that a block will get uncled (or worse orphaned), so the priority fee is required to offset the cost of that risk. |
@marceljay Sorry. My previous answer was wrong. I updated it and am tagging you to make sure you see it. Sorry about that. |
This has been published in 5.4.0. Try it out and let me know how it works for you! :) |
@ricmoo Do these updates for EIP-1559 break any compat with old txs (i.e. can 5.4.0+ be used on Mainnet still)? |
@jmrossy Everything is 100% backwards compatible. It has to be this way to continue supporting other networks (e.g. matic, xDai, etc). The new |
Thank you for your comments, sir! And for all job you do :) |
Thanks for your patience with my typos. ;) |
I disagree with the general statement:
I am working with one specific function where MetaMask is, for some reason, setting max priority fee to 185 and max fee to 185. (Today gas prices are about priority = 2 and base = 180). Here I am working on a function that I will be calling my self many times. (Manually dropping Su Square NFTs, FML). So I would like a way here to specify that no, I do not want a crazy high priority fee. |
@ricmoo Xdai now implemented EIP-1559, should you add compatibility from your side? |
@rperez89 The ethers provider will automatically detect if a network supports EIP-1559 and use it if it does, so there shouldn't be any need to do anything as long as Xdai correctly adds a |
ohh i see thanks! |
@ricmoo Does this support wallet.signTransaction(transaction) ?
I am getting this error during signing. "invalid object key - maxFeePerGas (argument="transaction:maxFeePerGas" |
@mohammed-shameem Yes, it should work fine. What version are you using? What signer? |
@ricmoo
Ah is the error because of InfuraProvider ? |
Getting this too |
Managed to workaround it: put type 2 transaction var transaction = {
to: address,
data: transactionData,
nonce: txCount,
maxFeePerGas,
maxPriorityFeePerGas,
type: 2,
gasLimit: 7000000,
chainId
}; @ricmoo problem lies at signTransaction(transaction: TransactionRequest): Promise<string> {
return resolveProperties(transaction).then((tx) => {
if (tx.from != null) {
if (getAddress(tx.from) !== this.address) {
logger.throwArgumentError("transaction from address mismatch", "transaction.from", transaction.from);
}
delete tx.from;
}
if(tx.type == null && (tx.maxFeePerGas || tx.maxPriorityFeePerGas)) tx.type = 2
const signature = this._signingKey().signDigest(keccak256(serialize(<UnsignedTransaction>tx)));
return serialize(<UnsignedTransaction>tx, signature);
});
} |
What will happen if I only define a |
@akwodkiewicz Along with |
@zemse, thanks for the reply. I knew about the |
Is there a programmable way of checking EIP1559 support other than parsing a potential error after a failed EIP1559 transaction? |
If you have a provider connected to a network, you can use |
It may need to be clarified that the maxFeePerGas property will always be returned but will be null in case of no eip-1559 support |
is there a way to force type 2 transactions on all transactions? using ethers through hardhat-ethers to send a lot of transactions for some tests on filecoin s evm compatible jsonrpc (https://wallaby.node.glif.io/rpc/v0) and it always fails to send the transaction with i can force it one by one to use type 2 through overrides but that s quite tedious for loads of deploys and txs. thank you very much for everything |
The Signer class that you are using (Wallet or JsonRpcSigner), you can override it’s But if you are getting the signer from somewhere and if it’s challange to have your new class being used over there, you may try this hacky solution: const sendTransactionOld = contract.signer.sendTransaction;
contract.signer.sendTransaction = async(tx) => {
if(tx.type === undefined) {
tx.type = 2;
}
return sendTransactionOld.bind(contract.signer)(tx);
} |
i am sending tx s through hardhat-ethers and the contract interface it provides so i end up doing something like
thanks @zemse will give it a try and see if i manage something |
This has already been started locally, but I'm throwing together a quick issue to help track it (in commits) and to include relevant literature.
For those unfamiliar with EIP-1559, it uses a new fee structure to provide more stable gas fees across block, improving the user experience and attempting to minimize economic inefficiencies which lead to many users overpaying for their transactions.
It's goal is not necessarily to make transactions cheaper, but will make it easier to know how much to pay for a reasonable inclusion duration, and cause fees paid for transactions to more accurately reflect fair-market value.
More links: (this will be updated as I find more resources):
Old Links:
The text was updated successfully, but these errors were encountered: