[#471] Add DUP n
Description
Problem: A new DUP n
has been added with the edo
procotol (008)! This MR introduces the new DUP n
instruction which, provided a stack with at least n
items, duplicates the one-indexed n
-th item and pushes it to the top of the stack.
Solution: Implement this new instruction in untyped and typed form, support it in the type-checker, interpreter, packer and unpacker, and Lorentz. Replace various existing usages of DIP DUP ; SWAP
with DUP 2
and DIP n DUP ; DUG n
with DUP n
.
This MR also moves various contracts back to 008
, which were causing tests to fail.
Related issue(s)
Resolves #471 (closed)
✅ Checklist for your Merge Request
Related changes (conditional)
-
Tests (see short guidelines)
-
If I added new functionality, I added tests covering it. -
If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
-
-
Documentation
Stylistic guide (mandatory)
-
My commits comply with the following policy. -
My code complies with the style guide.