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 0x58 - PC #73

Closed
Eikix opened this issue Oct 20, 2022 · 1 comment
Closed

feat: implement 0x58 - PC #73

Eikix opened this issue Oct 20, 2022 · 1 comment
Assignees
Labels
cairo cairo Context: isolated no previous knowledge of the codebase required Type: feature a new feature to implement

Comments

@Eikix
Copy link
Member

Eikix commented Oct 20, 2022

Since

Frontier

Group

Stack, Memory, Storage and Flow Operations

Description

0x58 - PC

Notes
The program counter (PC) is a byte offset in the deployed code. It indicates which instruction will be executed next. When an ADD is executed, for example, the PC is incremented by 1, since the instruction is 1 byte. The PUSH instructions are bigger than one byte, and so will increment the counter accordingly.

Stack output
counter: PC of this instruction in the current program.
Example
See in playground.

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

Not enough gas.
Stack overflow.

@Eikix Eikix added Context: isolated no previous knowledge of the codebase required Difficulty: intermediate cairo cairo Type: feature a new feature to implement labels Oct 20, 2022
@etashhh
Copy link
Contributor

etashhh commented Oct 20, 2022

I can take this one

@etashhh etashhh mentioned this issue Oct 21, 2022
7 tasks
etashhh added a commit that referenced this issue Oct 21, 2022
<!--- Please provide a general summary of your changes in the title
above -->

## Pull request type

<!-- Please try to limit your pull request to one type, submit multiple
pull requests if needed. -->

Please check the type of change your PR introduces:

- [ ] Bugfix
- [x] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] Documentation content changes
- [ ] Other (please describe):

## What is the current behavior?

<!-- Please describe the current behavior that you are modifying, or
link to a relevant issue. -->

Issue Number: #73 

## What is the new behavior?

<!-- Please describe the behavior or changes that are being added by
this PR. -->

- The program counter (PC) indicates which instruction will be executed
next.
- The stack output is the PC of this instruction in the current program

## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
@etashhh etashhh closed this as completed Oct 21, 2022
@matthieuauger matthieuauger added this to the Full OPCODE implementation milestone Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cairo cairo Context: isolated no previous knowledge of the codebase required Type: feature a new feature to implement
Projects
Archived in project
Development

No branches or pull requests

3 participants