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

[R4R]-[fee]feat: fee collection with tokenRatio #6

Merged
merged 14 commits into from
Nov 29, 2023

Conversation

Tri-stone
Copy link

@Tri-stone Tri-stone commented Nov 6, 2023

Core changes:

  • get tokenRatio from GasPriceOracle
  • when estimateGas and executing a tx, it will involve tokenRatio to calculate L1 Rollup Fee & L2 Execution Fee
    • L2 Execution Fee = L2 gasPrice * L2 gasUsed * tokenRatio
    • L1 Rollup Fee = (rollupDataGas + overhead) * L1BaseFee * scalar
      • L1BaseFee = L1 gasPrice * tokenRatio
    • L2 gasUsed' = (L2 Execution Fee + L1 Rollup Fee) / L2 gasPrice
      • L2 gasUsed' will be the final gasLimit

Releated PR:

@Tri-stone Tri-stone changed the title [R4R]-[fee]feat: add tokenRatio(ETH/MNT) in L1BlockInfo [R4R]-[fee]feat: fee collection with tokenRatio Nov 6, 2023
core/blockchain.go Outdated Show resolved Hide resolved
core/genesis.go Outdated Show resolved Hide resolved
byteflyfunny
byteflyfunny previously approved these changes Nov 21, 2023
byteflyfunny
byteflyfunny previously approved these changes Nov 22, 2023
@@ -74,7 +74,9 @@ func setDefaults(cfg *Config) {
cfg.Difficulty = new(big.Int)
}
if cfg.GasLimit == 0 {
cfg.GasLimit = math.MaxUint64
// todo: leo
// cfg.GasLimit = math.MaxUint64

Choose a reason for hiding this comment

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

Please resolve todo

Copy link
Author

@Tri-stone Tri-stone Nov 28, 2023

Choose a reason for hiding this comment

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

resolved, delete the todo directly.

type RunMode uint8

const (
CommitMode RunMode = iota

Choose a reason for hiding this comment

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

Please assign CommitMode to RunMode in function TransactionToMessage. Not a bug. It is strange that CommitMode is never used.

Copy link
Author

Choose a reason for hiding this comment

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

fixed, set default RunMode as CommitMode

@@ -499,7 +531,7 @@ func (rs Receipts) DeriveFields(config *params.ChainConfig, hash common.Hash, nu
// Deriving the signer is expensive, only do if it's actually needed
from, _ := Sender(signer, txs[i])
nonce := txs[i].Nonce()
if rs[i].DepositNonce != nil {
if txs[i].IsDepositTx() && rs[i].DepositNonce != nil {

Choose a reason for hiding this comment

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

txs[i].IsDepositTx() seems to be not necessary.

Copy link
Author

Choose a reason for hiding this comment

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

We changes the way to store DepositNonce, so the DepositNonce will not be nil and the default value will be 0 for non-depositTxs, so add txs[i].IsDepositTx() to determine the tx type.

@abelliumnt
Copy link

No other comment

@Tri-stone Tri-stone merged commit fc472cf into develop Nov 29, 2023
0 of 2 checks passed
@Tri-stone Tri-stone deleted the leo/fee_collection branch April 28, 2024 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants