updated jumptable

This commit is contained in:
lmittmann 2024-07-31 23:18:09 +02:00
parent c20fa8a700
commit fd591ef042
2 changed files with 16 additions and 26 deletions

View file

@ -1003,13 +1003,3 @@ func makeDup(size int64) executionFunc {
return nil, nil return nil, nil
} }
} }
// make swap instruction function
func makeSwap(size int64) executionFunc {
// switch n + 1 otherwise n would be swapped with n
size++
return func(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) {
scope.Stack.swap(int(size))
return nil, nil
}
}

View file

@ -892,97 +892,97 @@ func newFrontierInstructionSet() JumpTable {
maxStack: maxDupStack(16), maxStack: maxDupStack(16),
}, },
SWAP1: { SWAP1: {
execute: makeSwap(1), execute: opSwap1,
constantGas: GasFastestStep, constantGas: GasFastestStep,
minStack: minSwapStack(2), minStack: minSwapStack(2),
maxStack: maxSwapStack(2), maxStack: maxSwapStack(2),
}, },
SWAP2: { SWAP2: {
execute: makeSwap(2), execute: opSwap2,
constantGas: GasFastestStep, constantGas: GasFastestStep,
minStack: minSwapStack(3), minStack: minSwapStack(3),
maxStack: maxSwapStack(3), maxStack: maxSwapStack(3),
}, },
SWAP3: { SWAP3: {
execute: makeSwap(3), execute: opSwap3,
constantGas: GasFastestStep, constantGas: GasFastestStep,
minStack: minSwapStack(4), minStack: minSwapStack(4),
maxStack: maxSwapStack(4), maxStack: maxSwapStack(4),
}, },
SWAP4: { SWAP4: {
execute: makeSwap(4), execute: opSwap4,
constantGas: GasFastestStep, constantGas: GasFastestStep,
minStack: minSwapStack(5), minStack: minSwapStack(5),
maxStack: maxSwapStack(5), maxStack: maxSwapStack(5),
}, },
SWAP5: { SWAP5: {
execute: makeSwap(5), execute: opSwap5,
constantGas: GasFastestStep, constantGas: GasFastestStep,
minStack: minSwapStack(6), minStack: minSwapStack(6),
maxStack: maxSwapStack(6), maxStack: maxSwapStack(6),
}, },
SWAP6: { SWAP6: {
execute: makeSwap(6), execute: opSwap6,
constantGas: GasFastestStep, constantGas: GasFastestStep,
minStack: minSwapStack(7), minStack: minSwapStack(7),
maxStack: maxSwapStack(7), maxStack: maxSwapStack(7),
}, },
SWAP7: { SWAP7: {
execute: makeSwap(7), execute: opSwap7,
constantGas: GasFastestStep, constantGas: GasFastestStep,
minStack: minSwapStack(8), minStack: minSwapStack(8),
maxStack: maxSwapStack(8), maxStack: maxSwapStack(8),
}, },
SWAP8: { SWAP8: {
execute: makeSwap(8), execute: opSwap8,
constantGas: GasFastestStep, constantGas: GasFastestStep,
minStack: minSwapStack(9), minStack: minSwapStack(9),
maxStack: maxSwapStack(9), maxStack: maxSwapStack(9),
}, },
SWAP9: { SWAP9: {
execute: makeSwap(9), execute: opSwap9,
constantGas: GasFastestStep, constantGas: GasFastestStep,
minStack: minSwapStack(10), minStack: minSwapStack(10),
maxStack: maxSwapStack(10), maxStack: maxSwapStack(10),
}, },
SWAP10: { SWAP10: {
execute: makeSwap(10), execute: opSwap10,
constantGas: GasFastestStep, constantGas: GasFastestStep,
minStack: minSwapStack(11), minStack: minSwapStack(11),
maxStack: maxSwapStack(11), maxStack: maxSwapStack(11),
}, },
SWAP11: { SWAP11: {
execute: makeSwap(11), execute: opSwap11,
constantGas: GasFastestStep, constantGas: GasFastestStep,
minStack: minSwapStack(12), minStack: minSwapStack(12),
maxStack: maxSwapStack(12), maxStack: maxSwapStack(12),
}, },
SWAP12: { SWAP12: {
execute: makeSwap(12), execute: opSwap12,
constantGas: GasFastestStep, constantGas: GasFastestStep,
minStack: minSwapStack(13), minStack: minSwapStack(13),
maxStack: maxSwapStack(13), maxStack: maxSwapStack(13),
}, },
SWAP13: { SWAP13: {
execute: makeSwap(13), execute: opSwap13,
constantGas: GasFastestStep, constantGas: GasFastestStep,
minStack: minSwapStack(14), minStack: minSwapStack(14),
maxStack: maxSwapStack(14), maxStack: maxSwapStack(14),
}, },
SWAP14: { SWAP14: {
execute: makeSwap(14), execute: opSwap14,
constantGas: GasFastestStep, constantGas: GasFastestStep,
minStack: minSwapStack(15), minStack: minSwapStack(15),
maxStack: maxSwapStack(15), maxStack: maxSwapStack(15),
}, },
SWAP15: { SWAP15: {
execute: makeSwap(15), execute: opSwap15,
constantGas: GasFastestStep, constantGas: GasFastestStep,
minStack: minSwapStack(16), minStack: minSwapStack(16),
maxStack: maxSwapStack(16), maxStack: maxSwapStack(16),
}, },
SWAP16: { SWAP16: {
execute: makeSwap(16), execute: opSwap16,
constantGas: GasFastestStep, constantGas: GasFastestStep,
minStack: minSwapStack(17), minStack: minSwapStack(17),
maxStack: maxSwapStack(17), maxStack: maxSwapStack(17),