Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
feat: add explanation for MCOPY
Browse files Browse the repository at this point in the history
  • Loading branch information
curryrasul committed Apr 16, 2024
1 parent 453c706 commit deff931
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions specs/opcode/94MCOPY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# MCOPY opcode

## Procedure

The `MCOPY` opcode pops `dest_offset`, `offset` and `size` from the stack.
It then copies `size` bytes in the current environment from memory at an `offset` to the memory at a `dest_offset`. For out-of-bounds scenarios - the memory is extended with respective gas cost applied.

The gas cost of `MCOPY` opcode consists of two parts:

1. A constant gas cost: `3 gas`
2. A dynamic gas cost: cost of memory expansion and copying (variable depending on the `size` copied to memory)

## Constraints

1. OpcodeId check
Expand All @@ -19,5 +29,5 @@

## Exceptions

1.
2.
1. stack underflow: `1022 <= stack_pointer <= 1024`
2. out of gas: remaining gas is not enough

0 comments on commit deff931

Please sign in to comment.