aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/stack_table.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/vm/stack_table.go')
-rw-r--r--core/vm/stack_table.go32
1 files changed, 15 insertions, 17 deletions
diff --git a/core/vm/stack_table.go b/core/vm/stack_table.go
index a4b1cfcd8..10c12901a 100644
--- a/core/vm/stack_table.go
+++ b/core/vm/stack_table.go
@@ -17,28 +17,26 @@
package vm
import (
- "fmt"
-
"github.com/ethereum/go-ethereum/params"
)
-func makeStackFunc(pop, push int) stackValidationFunc {
- return func(stack *Stack) error {
- if err := stack.require(pop); err != nil {
- return err
- }
-
- if stack.len()+push-pop > int(params.StackLimit) {
- return fmt.Errorf("stack limit reached %d (%d)", stack.len(), params.StackLimit)
- }
- return nil
- }
+func minSwapStack(n int) int {
+ return minStack(n, n)
+}
+func maxSwapStack(n int) int {
+ return maxStack(n, n)
}
-func makeDupStackFunc(n int) stackValidationFunc {
- return makeStackFunc(n, n+1)
+func minDupStack(n int) int {
+ return minStack(n, n+1)
+}
+func maxDupStack(n int) int {
+ return maxStack(n, n+1)
}
-func makeSwapStackFunc(n int) stackValidationFunc {
- return makeStackFunc(n, n)
+func maxStack(pop, push int) int {
+ return int(params.StackLimit) + pop - push
+}
+func minStack(pops, push int) int {
+ return pops
}