Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement 0x9B - SWAP12 Opcode #313

Closed
Eikix opened this issue Sep 7, 2023 · 1 comment
Closed

feat: implement 0x9B - SWAP12 Opcode #313

Eikix opened this issue Sep 7, 2023 · 1 comment
Labels
enhancement New feature or request opcode Implementation of an opcode

Comments

@Eikix
Copy link
Member

Eikix commented Sep 7, 2023

Kakarot v0 implementation: https://github.com/kkrt-labs/kakarot/blob/main/src/kakarot/instructions/exchange_operations.cairo
Kakarot v0 tests: https://github.com/kkrt-labs/kakarot/blob/44dabfcab05a87f85bcfe0a457809059d11d83fb/tests/src/kakarot/instructions/test_exchange_operations.cairo#L107

EELS Implementation: https://github.com/ethereum/execution-specs/blob/fade6e95726c9c0b47b779fd8873b5737fbea3b3/src/ethereum/paris/vm/instructions/stack.py#L108

SinceGroup
FrontierExchange Operations

Index 1 is top of the stack. See PUSH.

Stack input

  1. a: value to swap.
  2. ignored value.
  3. ignored value.
  4. ignored value.
  5. ignored value.
  6. ignored value.
  7. ignored value.
  8. ignored value.
  9. ignored value.
  10. ignored value.
  11. ignored value.
  12. ignored value.
  13. b: value to swap.

Stack output

  1. b: swapped value.
  2. ignored value.
  3. ignored value.
  4. ignored value.
  5. ignored value.
  6. ignored value.
  7. ignored value.
  8. ignored value.
  9. ignored value.
  10. ignored value.
  11. ignored value.
  12. ignored value.
  13. a: swapped value.

Example

InputOutput
112
200
300
400
500
600
700
800
900
1000
1100
1200
1321

Reproduce in playground.

Error cases

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

  • Not enough gas.
  • Not enough values on the stack.
@Eikix Eikix added enhancement New feature or request opcode Implementation of an opcode labels Sep 7, 2023
@github-project-automation github-project-automation bot moved this to 🆕 Backlog in Kakarot on Starknet Sep 7, 2023
@Eikix
Copy link
Member Author

Eikix commented Sep 8, 2023

Important update: we are gathering some bugs in the Kakarot v0 codebase, we need to make sure each issue and each PR in Kakarot-ssj is aware of the lists of known bugs. Look at this tracking issue everytime you take an issue and check your issue isn't targeted by a known bug.

@enitrat enitrat closed this as completed Sep 17, 2023
@github-project-automation github-project-automation bot moved this from 🆕 Backlog to ✅ Done in Kakarot on Starknet Sep 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request opcode Implementation of an opcode
Projects
No open projects
Archived in project
Development

No branches or pull requests

2 participants