From edf95ec610e7cd3c5bd5f649fdbb427d7bbf6e08 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Thu, 15 Jun 2017 14:13:23 +0200 Subject: [PATCH] core/vm: added metropolis instructions --- core/vm/jump_table.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/core/vm/jump_table.go b/core/vm/jump_table.go index 130532c5c8..e1f69433f0 100644 --- a/core/vm/jump_table.go +++ b/core/vm/jump_table.go @@ -58,8 +58,44 @@ type operation struct { var ( frontierInstructionSet = NewFrontierInstructionSet() homesteadInstructionSet = NewHomesteadInstructionSet() + metropolisInstructionSet = NewMetropolisInstructionSet() ) +// NewMetropolisInstructionSet returns the frontier, homestead and +// metropolis instructions. +func NewMetropolisInstructionSet() [256]operation { + // instructions that can be executed during the homestead phase. + instructionSet := NewHomesteadInstructionSet() + instructionSet[STATIC_CALL] = operation{ + execute: opStaticCall, + gasCost: gasStaticCall, + validateStack: makeStackFunc(6, 1), + memorySize: memoryStaticCall, + valid: true, + } + instructionSet[REVERT] = operation{ + execute: opRevert, + gasCost: constGasFunc(GasFastestStep), + validateStack: makeStackFunc(2, 0), + valid: true, + reverts: true, + } + instructionSet[RETURNDATASIZE] = operation{ + execute: opReturnDataSize, + gasCost: constGasFunc(0), // TODO + validateStack: makeStackFunc(0, 1), + valid: true, + } + instructionSet[RETURNDATACOPY] = operation{ + execute: opReturnDataCopy, + gasCost: gasReturnDataCopy, + validateStack: makeStackFunc(3, 0), + memorySize: memoryReturnDataCopy, + valid: true, + } + return instructionSet +} + // NewHomesteadInstructionSet returns the frontier and homestead // instructions that can be executed during the homestead phase. func NewHomesteadInstructionSet() [256]operation {