Skip to content

Latest commit

 

History

History
26 lines (16 loc) · 993 Bytes

58.mdx

File metadata and controls

26 lines (16 loc) · 993 Bytes
fork group
Frontier
Stack Memory Storage and Flow Operations

Index 1 is top of the stack. See PUSH.

Notes

The program counter (PC) is a byte offset in the deployed code. It indicates which instruction will be executed next. When an ADD is executed, for example, the PC is incremented by 1, since the instruction is 1 byte. The PUSH instructions are bigger than one byte, and so will increment the counter accordingly.

Not allowed in EOFv1 code, code containing this instruction will fail validation.

Stack output

  1. counter: PC of this instruction in the current program.

Example

See in playground.

Error cases

The state changes done by the current context are reverted in those cases:

  • Not enough gas.
  • Stack overflow.