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

MCOPY spec #522

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

MCOPY spec #522

wants to merge 5 commits into from

Conversation

curryrasul
Copy link
Member

@curryrasul curryrasul commented Apr 9, 2024

Issue Link

Closes #510

@curryrasul curryrasul self-assigned this Apr 9, 2024
@curryrasul curryrasul linked an issue Apr 9, 2024 that may be closed by this pull request
@curryrasul curryrasul added this to the Feature Completeness milestone Apr 9, 2024
@curryrasul
Copy link
Member Author

It's not directly related to MCOPY, but I'm working on this, and looking through RETURNDATACOPY, which we discussed before @ChihChengLiang
It is said, that RETURNDATACOPY copies from memory to memory:

zkevm-specs/specs/tables.md

Lines 276 to 279 in 4f272c2

- Copy from caller/callee memory to callee/caller memory.
- `CALLDATACOPY` (not root call): copy from caller's memory to callee's
- `RETURN` (not create), `REVERT`, `CALLOP` (precompile return): copy from callee's memory to caller's
- `RETURNDATACOPY`, `MCOPY`: copy memory within current context

I read about RETURNDATACOPY, it's said that it copies from so-called return data buffer, that acts like a temporary place, where's the return value from contract-call is stored.
Is it still memory? Or maybe it doesn't belong to memory , stack or storage?

@curryrasul curryrasul marked this pull request as ready for review April 17, 2024 19:40
specs/opcode/94MCOPY.md Outdated Show resolved Hide resolved
@zemse
Copy link
Member

zemse commented Apr 18, 2024

I read about RETURNDATACOPY, it's said that it copies from so-called return data buffer, that acts like a temporary place, where's the return value from contract-call is stored.
Is it still memory? Or maybe it doesn't belong to memory , stack or storage?

I was confused about returndata not present in CopyDataType, but it seems returndatacopy copies from the memory of child call's memory to the current call's memory. So this memory to memory copy of returndatacopy makes sense to me now and mcopy is pretty much similar apart from it is a memory to memory copy for the same call.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Specify MCOPY instruction
3 participants