Skip to content

Commit b38e1b7

Browse files
committed
core/vm: implement BLOBBASEFEE opcode 0x4a ethereum#28098
1 parent af10d14 commit b38e1b7

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

core/vm/eips.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,23 @@ func opMcopy(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]by
256256
return nil, nil
257257
}
258258

259+
// opBlobBaseFee implements BLOBBASEFEE opcode
260+
func opBlobBaseFee(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) {
261+
blobBaseFee := new(uint256.Int)
262+
scope.Stack.push(blobBaseFee)
263+
return nil, nil
264+
}
265+
266+
// enable7516 applies EIP-7516 (BLOBBASEFEE opcode)
267+
func enable7516(jt *JumpTable) {
268+
jt[BLOBBASEFEE] = &operation{
269+
execute: opBlobBaseFee,
270+
constantGas: GasQuickStep,
271+
minStack: minStack(0, 1),
272+
maxStack: maxStack(0, 1),
273+
}
274+
}
275+
259276
// enable6780 applies EIP-6780 (deactivate SELFDESTRUCT)
260277
func enable6780(jt *JumpTable) {
261278
jt[SELFDESTRUCT] = &operation{

core/vm/jump_table.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ type JumpTable [256]*operation
6363

6464
func newCancunInstructionSet() JumpTable {
6565
instructionSet := newEip1559InstructionSet()
66+
enable7516(&instructionSet) // EIP-7516 (BLOBBASEFEE opcode)
6667
enable1153(&instructionSet) // EIP-1153 "Transient Storage"
6768
enable5656(&instructionSet) // EIP-5656 (MCOPY opcode)
6869
enable6780(&instructionSet) // EIP-6780 SELFDESTRUCT only in same transaction

core/vm/opcodes.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ const (
100100
CHAINID OpCode = 0x46
101101
SELFBALANCE OpCode = 0x47
102102
BASEFEE OpCode = 0x48
103+
BLOBBASEFEE OpCode = 0x4a
103104
)
104105

105106
// 0x50 range - 'storage' and execution.
@@ -284,6 +285,7 @@ var opCodeToString = [256]string{
284285
CHAINID: "CHAINID",
285286
SELFBALANCE: "SELFBALANCE",
286287
BASEFEE: "BASEFEE",
288+
BLOBBASEFEE: "BLOBBASEFEE",
287289

288290
// 0x50 range - 'storage' and execution.
289291
POP: "POP",
@@ -457,6 +459,7 @@ var stringToOp = map[string]OpCode{
457459
"GASLIMIT": GASLIMIT,
458460
"SELFBALANCE": SELFBALANCE,
459461
"BASEFEE": BASEFEE,
462+
"BLOBBASEFEE": BLOBBASEFEE,
460463
"POP": POP,
461464
"MLOAD": MLOAD,
462465
"MSTORE": MSTORE,

0 commit comments

Comments
 (0)