core/types, params: add InclusionList type

This commit is contained in:
Jihoon Song 2025-07-28 22:15:02 +09:00
parent e03d97a420
commit 1dab670156
2 changed files with 50 additions and 0 deletions

View file

@ -0,0 +1,48 @@
// Copyright 2025 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package types
import (
"encoding/json"
"github.com/ethereum/go-ethereum/common/hexutil"
)
// InclusionList is a list of transactions that should be included in a payload.
type InclusionList [][]byte
func (inclusionList InclusionList) MarshalJSON() ([]byte, error) {
inclusionListHex := make([]hexutil.Bytes, len(inclusionList))
for i, tx := range inclusionList {
inclusionListHex[i] = tx
}
return json.Marshal(inclusionListHex)
}
func (inclusionList *InclusionList) UnmarshalJSON(input []byte) error {
var inclusionListHex []hexutil.Bytes
if err := json.Unmarshal(input, &inclusionListHex); err != nil {
return err
}
*inclusionList = make([][]byte, len(inclusionListHex))
for i, tx := range inclusionListHex {
(*inclusionList)[i] = tx
}
return nil
}

View file

@ -137,6 +137,8 @@ const (
MaxCodeSize = 24576 // Maximum bytecode to permit for a contract MaxCodeSize = 24576 // Maximum bytecode to permit for a contract
MaxInitCodeSize = 2 * MaxCodeSize // Maximum initcode to permit in a creation transaction and create instructions MaxInitCodeSize = 2 * MaxCodeSize // Maximum initcode to permit in a creation transaction and create instructions
MaxBytesPerInclusionList uint64 = 8192 // Maximum size in bytes allowed for each inclusion list.
// Precompiled contract gas prices // Precompiled contract gas prices
EcrecoverGas uint64 = 3000 // Elliptic curve sender recovery gas price EcrecoverGas uint64 = 3000 // Elliptic curve sender recovery gas price