Skip to content

Add std/opcodes#405

Merged
rodrigogribeiro merged 5 commits into
argotorg:mainfrom
axic:opcodes
Jun 9, 2026
Merged

Add std/opcodes#405
rodrigogribeiro merged 5 commits into
argotorg:mainfrom
axic:opcodes

Conversation

@axic

@axic axic commented May 22, 2026

Copy link
Copy Markdown
Contributor

The goal here is to reduce ad-hoc helpers. The std/opcodes.solc file could be auto-generated, following fixed templates.

Comment thread std/opcodes.solc
return res;
}

function revert(a: word, b: word) -> () {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will likely conflict with special handling for revert(string literal).

@axic axic force-pushed the opcodes branch 4 times, most recently from 67c581b to 68715bf Compare May 22, 2026 15:53
Comment thread std/std.solc
}

return tail;
function encodeIntoFromBytesLike(srcPtr:word, basePtr:word, offset:word, tail:word) -> word {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an example using the opcode helpers assembly blocks can be rewritten line-by-line, and after that it is easy to simplify it too.

@axic axic force-pushed the opcodes branch 7 times, most recently from d021af3 to b4b79f2 Compare June 3, 2026 13:13
@axic axic force-pushed the opcodes branch 2 times, most recently from 255f6c9 to 6096b30 Compare June 8, 2026 16:31
@axic

axic commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

Will split this into two parts:

  1. This PR adding the script and std/opcodes.solc.
  2. A follow up PR using the helpers from it.

@axic axic force-pushed the opcodes branch 2 times, most recently from 47fa1b8 to 3fb17a4 Compare June 9, 2026 12:03
@axic axic marked this pull request as ready for review June 9, 2026 12:22
claude and others added 4 commits June 9, 2026 14:23
Introduces a small Python generator that builds std/opcodes.solc from a
declarative opcode list (name, inputs, output).

Co-authored-by: Alex Beregszaszi <alex@rtfs.hu>
The `return` mnemonic clashes with solcore's `return` statement keyword,
so the generated wrapper for the EVM `return` opcode now uses the name
`return_`. The inner assembly call still emits the real `return` opcode.

Co-authored-by: Alex Beregszaszi <alex@rtfs.hu>
Exercises each of the four wrapper shape categories with two opcodes
each: stop/invalid (no input, no return), address/timestamp (no input,
returns word), pop/mstore (input, no return), add/mload (input, returns
word). Also regenerates std/opcodes.solc from gen-std-opcodes.py so the
`return` wrapper rename to `return_` is reflected on disk (the script
was already updated, but the generated file was stale and unparseable
because `return` is a reserved word).

Co-authored-by: Alex Beregszaszi <alex@rtfs.hu>
@axic

axic commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

@rodrigogribeiro this should be ready. Moved the usage to #449 (blocked by #435)

@rodrigogribeiro rodrigogribeiro merged commit d54f69b into argotorg:main Jun 9, 2026
4 checks passed
@axic axic deleted the opcodes branch June 9, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants