-
Notifications
You must be signed in to change notification settings - Fork 1
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
add support for blob tx #2
add support for blob tx #2
Conversation
core/txpool/validation.go
Outdated
@@ -69,7 +69,7 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types | |||
if tx.Type() == types.DepositTxType { | |||
return core.ErrTxTypeNotSupported | |||
} | |||
if opts.Config.IsOptimism() && tx.Type() == types.BlobTxType { | |||
if false && opts.Config.IsOptimism() && tx.Type() == types.BlobTxType { |
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.
Can be put a flag to enable L2 blob rather than false/true (blow)?
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.
Done, the flag is named enablel2blob
.
0be1126
to
b8ccf69
Compare
4459385
to
687267a
Compare
6062a09
to
0b47f6e
Compare
… otherwise the result will be different when called from state processor 2. l2 blob tx will have two extra fees for L1CostFunc: da fee and da proof fee 3. only check versionedHashes when it's not nil
0b47f6e
to
aec7ec2
Compare
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 feel the description of the PR should be updated.
@@ -378,7 +378,7 @@ func (tx *Transaction) RollupCostData() RollupCostData { | |||
if v := tx.rollupCostData.Load(); v != nil { | |||
return v.(RollupCostData) | |||
} | |||
data, err := tx.MarshalBinary() | |||
data, err := tx.WithoutBlobTxSidecar().MarshalBinary() |
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 think we should add a few comments about why use non BLOB (but with BLOB hash) version of tx.
Another question is in which case the tx will contain the BLOB (as the derivation stage, we cannot derive the BLOB from L1).
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've updated with some comments.
@@ -167,6 +167,8 @@ type Config struct { | |||
|
|||
OverrideOptimismInterop *uint64 `toml:",omitempty"` | |||
|
|||
EnableL2Blob bool |
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 would add a few comments of like "Enable accepting EIP-4844 BLOBs on L2"
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.
Done.
params/protocol_params.go
Outdated
@@ -47,6 +47,9 @@ const ( | |||
LogDataGas uint64 = 8 // Per byte in a LOG* operation's data. | |||
CallStipend uint64 = 2300 // Free gas given at beginning of call. | |||
|
|||
BlobDAFee = 2000 |
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.
Comments are needed here.
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.
Done.
if msg.AccessList != nil { | ||
arg["accessList"] = msg.AccessList | ||
} | ||
if msg.BlobGasFeeCap != nil { |
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.
What is the purpose of this parameter?
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's used here, so that a blob tx will not be included if the specified blob gas fee cap is smaller than BlobBaseFee
of current block.
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.
Geth v1.13.13 supported it on Feb 21, and op-geth has not merged 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.
It seems I mis-understood Qi's question.
Here's more context about this change:ethereum-optimism#299
683d5d5
to
bec7267
Compare
bec7267
to
adf8a3f
Compare
Done. |
core/types/rollup_cost.go
Outdated
@@ -213,6 +214,7 @@ func newL1CostFuncEcotone(l1BaseFee, l1BlobBaseFee, l1BaseFeeScalar, l1BlobBaseF | |||
fee = new(big.Int).Add(calldataCostPerByte, blobCostPerByte) | |||
fee = fee.Mul(fee, calldataGasUsed) | |||
fee = fee.Div(fee, ecotoneDivisor) | |||
fee = fee.Add(fee, big.NewInt(int64(costData.blobs*params.BlobDAFee))) |
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.
Need to deal with integer overflow case?
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.
Good catch, fixed!
params/protocol_params.go
Outdated
@@ -47,6 +47,9 @@ const ( | |||
LogDataGas uint64 = 8 // Per byte in a LOG* operation's data. | |||
CallStipend uint64 = 2300 // Free gas given at beginning of call. | |||
|
|||
BlobDAFee = 2000 // Fee for storing blob to DA provider | |||
BlobDAProofGas = 200 // Gas for storing DA proof to span batch |
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 would add a comment It should be average proof size * TxDataNonZeroGasEIP2028
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.
Added.
@@ -194,6 +194,8 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) { | |||
cfg.Eth.OverrideVerkle = &v | |||
} | |||
|
|||
cfg.Eth.EnableL2Blob = ctx.Bool(utils.EnableL2Blob.Name) |
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.
Do we need to check ctx.IsSet()?
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 think their effects are the same here.
if msg.AccessList != nil { | ||
arg["accessList"] = msg.AccessList | ||
} | ||
if msg.BlobGasFeeCap != nil { |
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.
Geth v1.13.13 supported it on Feb 21, and op-geth has not merged it...
dc717da
to
bfb02ed
Compare
bfb02ed
to
19971ab
Compare
Geth v1.14.7 update code review
Summary of this PR:
enablel2blob
is specified.RollupCostData
, and updatenewL1CostFuncEcotone
accordingly, basically a blob tx will have two extra fees: da fee and da proof fee.Transaction.RollupCostData
so that the result is consistent when called from worker and state processor.