From b88c3b52b2a6a18fc2df8cca05a2c30b58c95261 Mon Sep 17 00:00:00 2001 From: Ayaan Date: Fri, 29 Mar 2024 16:05:28 +0900 Subject: [PATCH] fix(core/types): adjust ecotone params --- core/types/receipt_test.go | 2 +- core/types/rollup_cost.go | 7 ++++--- core/types/rollup_cost_test.go | 3 +++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/types/receipt_test.go b/core/types/receipt_test.go index 307751201..88d60418f 100644 --- a/core/types/receipt_test.go +++ b/core/types/receipt_test.go @@ -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 diff --git a/core/types/rollup_cost.go b/core/types/rollup_cost.go index 1c469b20f..c45fec81d 100644 --- a/core/types/rollup_cost.go +++ b/core/types/rollup_cost.go @@ -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 @@ -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]) diff --git a/core/types/rollup_cost_test.go b/core/types/rollup_cost_test.go index 5d95fc4a1..95a96f74f 100644 --- a/core/types/rollup_cost_test.go +++ b/core/types/rollup_cost_test.go @@ -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 }