stack_table.go 418 B

1234567891011121314151617181920
  1. package vm
  2. import (
  3. "fmt"
  4. "github.com/ethereum/go-ethereum/params"
  5. )
  6. func makeStackFunc(pop, push int) stackValidationFunc {
  7. return func(stack *Stack) error {
  8. if err := stack.require(pop); err != nil {
  9. return err
  10. }
  11. if push > 0 && int64(stack.len()-pop+push) > params.StackLimit.Int64() {
  12. return fmt.Errorf("stack limit reached %d (%d)", stack.len(), params.StackLimit.Int64())
  13. }
  14. return nil
  15. }
  16. }