Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

feat: implement 0x9F - SWAP16 Opcode #317

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

feat: implement 0x9F - SWAP16 Opcode #317

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. ignored value.
  14. ignored value.
  15. ignored value.
  16. ignored value.
  17. 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. ignored value.
  14. ignored value.
  15. ignored value.
  16. ignored value.
  17. a: swapped value.

Example

InputOutput
112
200
300
400
500
600
700
800
900
1000
1100
1200
1300
1400
1500
1600
1721

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
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