mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-10 14:03:46 +00:00
core/vm: added metropolis instructions
This commit is contained in:
parent
4ba89772ac
commit
edf95ec610
1 changed files with 36 additions and 0 deletions
|
|
@ -58,8 +58,44 @@ type operation struct {
|
||||||
var (
|
var (
|
||||||
frontierInstructionSet = NewFrontierInstructionSet()
|
frontierInstructionSet = NewFrontierInstructionSet()
|
||||||
homesteadInstructionSet = NewHomesteadInstructionSet()
|
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
|
// NewHomesteadInstructionSet returns the frontier and homestead
|
||||||
// instructions that can be executed during the homestead phase.
|
// instructions that can be executed during the homestead phase.
|
||||||
func NewHomesteadInstructionSet() [256]operation {
|
func NewHomesteadInstructionSet() [256]operation {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue