Skip to content

Commit ee587fa

Browse files
committed
block validation
1 parent acbb52b commit ee587fa

4 files changed

Lines changed: 17 additions & 0 deletions

File tree

core/block_validator.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ func NewBlockValidator(config *params.ChainConfig, blockchain *BlockChain, engin
5050
// header's transaction and uncle roots. The headers are assumed to be already
5151
// validated at this point.
5252
func (v *BlockValidator) ValidateBody(block *types.Block) error {
53+
// check EIP 7934 RLP-encoded block size cap
54+
if v.config.IsOsaka(block.Number(), block.Time()) && block.Size() > params.MaxBlockSize {
55+
return ErrBlockOversized
56+
}
5357
// Check whether the block's known, and if not, that it's linkable
5458
if v.bc.HasBlockAndState(block.Hash(), block.NumberU64()) {
5559
return ErrKnownBlock

core/error.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,8 @@ var (
7070
ErrInsufficientFundsForTransfer = errors.New("insufficient funds for transfer")
7171

7272
ErrGasLimitTooHigh = errors.New("transaction gas limit too high")
73+
74+
// ErrBlockOversized is returned if the size of the RLP-encoded block
75+
// exceeds the cap established by EIP 7934
76+
ErrBlockOversized = errors.New("block RLP-encoded size exceeds maximum")
7377
)

core/vm/jump_table.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ func validate(jt JumpTable) JumpTable {
7070

7171
func newOsakaInstructionSet() JumpTable {
7272
instructionSet := newMergeInstructionSet()
73+
//enable3860(&instructionSet) // Limit and meter initcode
74+
//enable4844(&instructionSet) // EIP-4844 (BLOBHASH opcode)
75+
//enable7516(&instructionSet) // EIP-7516 (BLOBBASEFEE opcode)
76+
//enable1153(&instructionSet) // EIP-1153 "Transient Storage"
77+
//enable6780(&instructionSet) // EIP-6780 SELFDESTRUCT only in same transaction
78+
//enable7702(&instructionSet) // EIP-7702 Setcode transaction type
79+
//enable4762(&instructionSet)
7380
enable7939(&instructionSet) // EIP-7939 (CLZ opcode)
7481
return validate(instructionSet)
7582
}

params/protocol_params.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ const (
178178

179179
BlobTxTargetBlobGasPerBlock = 3 * BlobTxBlobGasPerBlob // Target consumable blob gas for data blobs per block (for 1559-like pricing)
180180
MaxBlobGasPerBlock = 6 * BlobTxBlobGasPerBlob // Maximum consumable blob gas for data blobs per block
181+
182+
MaxBlockSize = 8_388_608 // maximum size of an RLP-encoded block
181183
)
182184

183185
// Bls12381G1MultiExpDiscountTable is the gas discount table for BLS12-381 G1 multi exponentiation operation

0 commit comments

Comments
 (0)