Skip to content

Commit

Permalink
fix(core/types): adjust ecotone params
Browse files Browse the repository at this point in the history
  • Loading branch information
kangsorang committed Mar 29, 2024
1 parent 6ef0267 commit b88c3b5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/types/receipt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ func TestDeriveOptimismBedrockTxReceipts(t *testing.T) {

func TestDeriveOptimismEcotoneTxReceipts(t *testing.T) {
// Ecotone style l1 attributes with baseFeeScalar=2, blobBaseFeeScalar=3, baseFee=1000*1e6, blobBaseFee=10*1e6
payload := common.Hex2Bytes("440a5e20000000020000000300000000000004d200000000000004d200000000000004d2000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000000000000000000000000000000000000098968000000000000000000000000000000000000000000000000000000000000004d200000000000000000000000000000000000000000000000000000000000004d2")
payload := common.Hex2Bytes("440a5e20000000020000000300000000000004d200000000000004d200000000000004d2000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000000000000000000000000000000000000098968000000000000000000000000000000000000000000000000000000000000004d200000000000000000000000000000000000000000000000000000000000004d20000000000000000000000000000000000000000000000000000000000000000")
// the parameters we use below are defined in rollup_test.go
l1GasPrice := baseFee
l1GasUsed := ecotoneGas
Expand Down
7 changes: 4 additions & 3 deletions core/types/rollup_cost.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ func extractL1GasParams(config *params.ChainConfig, time uint64, data []byte) (l
// extractEcotoneL1GasParams extracts the gas parameters necessary to compute gas from L1 attribute
// info calldata after the Ecotone upgrade, but not for the very first Ecotone block.
func extractL1GasParamsEcotone(data []byte) (l1BaseFee *big.Int, costFunc l1CostFunc, err error) {
if len(data) != 164 {
return nil, nil, fmt.Errorf("expected 164 L1 info bytes, got %d", len(data))
if len(data) != 196 {
return nil, nil, fmt.Errorf("expected 196 L1 info bytes, got %d", len(data))
}
// data layout assumed for Ecotone:
// offset type varname
Expand All @@ -260,8 +260,9 @@ func extractL1GasParamsEcotone(data []byte) (l1BaseFee *big.Int, costFunc l1Cost
// 28 uint64 _l1BlockNumber
// 36 uint256 _basefee,
// 68 uint256 _blobBaseFee,
// 100 bytes32 _hash,
// 100 bytes32 _hash,
// 132 bytes32 _batcherHash,
// 164 uint256 _validatorRewardScalar
l1BaseFee = new(big.Int).SetBytes(data[36:68])
l1BlobBaseFee := new(big.Int).SetBytes(data[68:100])
l1BaseFeeScalar := new(big.Int).SetBytes(data[4:8])
Expand Down
3 changes: 3 additions & 0 deletions core/types/rollup_cost_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ func getEcotoneL1Attributes(baseFee, blobBaseFee, baseFeeScalar, blobBaseFeeScal
data = append(data, blobBaseFee.FillBytes(uint256)...)
data = append(data, ignored.FillBytes(uint256)...)
data = append(data, ignored.FillBytes(uint256)...)
// [Kroma: START]
data = append(data, baseFee.FillBytes(uint256)...)
// [Kroma: END]
return data
}

Expand Down

0 comments on commit b88c3b5

Please sign in to comment.