ethereum.forks.london.vm.stackethereum.forks.arrow_glacier.vm.stack

Ethereum Virtual Machine (EVM) Stack.

.. contents:: Table of Contents :backlinks: none :local:

Introduction

Implementation of the stack operators for the EVM.

pop

Pops the top item off of stack.

Parameters

stack : EVM stack.

Returns

value : U256 The top element on the stack.

def pop(​stack: List[U256]​) -> U256:
22
    <snip>
36
    if len(stack) == 0:
37
        raise StackUnderflowError
38
39
    return stack.pop()

push

Pushes value onto stack.

Parameters

stack : EVM stack.

value : Item to be pushed onto stack.

def push(​stack: List[U256], ​​value: U256​) -> None:
43
    <snip>
55
    if len(stack) == 1024:
56
        raise StackOverflowError
57
58
    return stack.append(value)