core/vm: implement metropolis static call opcode

This commit is contained in:
Jeffrey Wilcke
2017-08-15 11:23:23 +03:00
committed by Péter Szilágyi
parent 9facf6423d
commit 3d123bcde6
7 changed files with 153 additions and 3 deletions

View File

@ -56,10 +56,26 @@ type operation struct {
}
var (
frontierInstructionSet = NewFrontierInstructionSet()
homesteadInstructionSet = NewHomesteadInstructionSet()
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[STATICCALL] = operation{
execute: opStaticCall,
gasCost: gasStaticCall,
validateStack: makeStackFunc(6, 1),
memorySize: memoryStaticCall,
valid: true,
}
return instructionSet
}
// NewHomesteadInstructionSet returns the frontier and homestead
// instructions that can be executed during the homestead phase.
func NewHomesteadInstructionSet() [256]operation {
@ -810,6 +826,7 @@ func NewFrontierInstructionSet() [256]operation {
validateStack: makeStackFunc(2, 0),
memorySize: memoryLog,
valid: true,
writes: true,
},
LOG1: {
execute: makeLog(1),
@ -817,6 +834,7 @@ func NewFrontierInstructionSet() [256]operation {
validateStack: makeStackFunc(3, 0),
memorySize: memoryLog,
valid: true,
writes: true,
},
LOG2: {
execute: makeLog(2),
@ -824,6 +842,7 @@ func NewFrontierInstructionSet() [256]operation {
validateStack: makeStackFunc(4, 0),
memorySize: memoryLog,
valid: true,
writes: true,
},
LOG3: {
execute: makeLog(3),
@ -831,6 +850,7 @@ func NewFrontierInstructionSet() [256]operation {
validateStack: makeStackFunc(5, 0),
memorySize: memoryLog,
valid: true,
writes: true,
},
LOG4: {
execute: makeLog(4),
@ -838,6 +858,7 @@ func NewFrontierInstructionSet() [256]operation {
validateStack: makeStackFunc(6, 0),
memorySize: memoryLog,
valid: true,
writes: true,
},
CREATE: {
execute: opCreate,