Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Added new gas mechanics design. #1411
base: main
Are you sure you want to change the base?
Added new gas mechanics design. #1411
Changes from all commits
dae7cac
dd2eda4
987e375
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Has not been discussed (just in case it was missed :) )
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.
shouldn't the l2 gas component implemnet the eip 1559 as well? To regulate the congestion on the L2?
If batches are 50% full, the l2 base fee increases, etc
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.
As per the discord conversation, we need to address what it means to have batches full which is currently not a concept. I'll update the design with this.
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.
how can we find out? Is it based on the chainId?
Maybe we can ask them?
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.
Bhav will get in touch to get the requirements from their dev team
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.
This isn't 100% correct, and makes things confusing.
Gas estimation is how much processing power it takes to execute the transaction.
Which is used for network congestion throttling.
Since :
I don't believe there is a point in changing how the gas estimation for a given transaction is done. The binary search tree done in geth should be enough, and I don't see the need to add the L1 calldata cost.
My suggestion would be to leave the gas estimation as geth and move additional payout to the gas price.
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.
Gas estimation needs to reflect what the user will actually pay.
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.
Why
deduct the layer 1 costs for the transaction from the sender's balance
?What if the gas price was bumped for a given transaction? Such that :
gas_price = l2_current_gasPrice + projected_number_txs_in_a_rollup / l1_projected_gasPrice
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.
This calculation makes it so transactions that spend more gas on the L2 to pay for more L1 fees, while value transfers will pay little in L1 fees. It's not really a competitive solution with other rollups. We'd have some users subsidizing others.
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.
I might be missing somthing, can you explain a bit more about how is one user subsidizing others?
The lowest possible transaction is a value transfer, which has a fixed L2 gas cos, which will potentially be a fixed L1 Rollup cost, so it should pay a smaller L1 fee than a contract creation or other transactions right ?
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.
Value transfer should pay less for L1 cost than transactions with encoded calldata, correct. But it should still pay its full L1 gas price. If I do a transaction to say a smart contract that has a fallback (so no calldata) and in this contract you have a for loop er whatever, the calldata is pretty much the same as it would be for a value transfer, yet because L1 fees are factored in the gas price each iteration of the loop would be subsidizing L1 costs that are completely irrelevant to the computation.
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.
No, because the gas limit of that said transaction is higher than the value transfer.
So let's say there's a Quirky Tx that does a call on a contract which does a for loop (spins a while).
gasPrice: ( L2Gasprice + L1Gasprice)
Tx A: Value transfer - tx rollup size 10 - gas limit 21 000 - Final gas cost 21 000 * gasPrice
Tx B: Deploy Contract - tx rollup size 3000 - gas limit 120 000 - Final gas cost 120 000 * gasPrice
Tx C: Quirky Tx - tx rollup size 40 - gas limit 500 000 - Final gas cost 500 000 * gasPrice
The rollup size does not matter for the gas price nor for the final gas paid by the user.
Saying that tx A and C are subsidizing Tx B doesn't make a lot of sense because they are paying network congestion on the L2.
That being said, if you want to figure out a way that you can adjust the
L1GasPrice
component based on the potential tx rollup size, I think that's a good idea, but perhaps not needed for a first iteration imo.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.
Let's say we have a mechanism to estimate the L1 eth gas cost.
The following happens:
a. Check that the user has enough balance to pay for size(Tx1) * estimated_publishing cost. If yes, deduct that amount. Also, record this amount, in case it needs to be payed back if the tx is not included.
b. Check the user has the minium gas required for Obscuro. Deduct that
c. Start executing, until the tx finishes, or the user runs out of gas.
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.
This is the initial approach I was thinking about as it is most intuitive to implement, but the problem with it is that transactions will result in spending more ETH than authorised when signed. When a user signs there is an agreement over the total gas cost that can be deducted from the balance + the total value being sent in the transaction; Deducting externally of the gas will result in higher than authorized "total" gas spend.
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.
but why do you have to deduct more than authorised?
Obscuro user submits TX1 (size=1kb) and the L2 execution cost is 1Million gas.
Tx1 enters the enclave which will do the following:
a. Check that the user has enough balance to pay for size(Tx1) * estimated_publishing cost. Also if the tx is authorised to spend that. If yes, deduct that amount. Also, record this amount, in case it needs to be payed back if the tx is not included.
b. Check the user has the minium gas required for Obscuro. Deduct that
c. Start executing, until the tx finishes, or the user runs out of gas.
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.
this is the key element of the design.
Needs to be elaborated on a bit more