blob: eed8805f23662338dde148155232fbd9a09fc4b6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package vm
import (
"fmt"
"github.com/ethereum/go-ethereum/params"
)
func makeStackFunc(pop, diff int) stackValidationFunc {
return func(stack *Stack) error {
if err := stack.require(pop); err != nil {
return err
}
if int64(stack.len()+diff) > params.StackLimit.Int64() {
return fmt.Errorf("stack limit reached %d (%d)", stack.len(), params.StackLimit)
}
return nil
}
}
func makeDupStackFunc(n int) stackValidationFunc {
return makeStackFunc(n, 1)
}
func makeSwapStackFunc(n int) stackValidationFunc {
return makeStackFunc(n, 0)
}
|