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

Add available gas and user args #677

Merged
merged 21 commits into from
Dec 25, 2024

Conversation

MaksymMalicki
Copy link
Contributor

@MaksymMalicki MaksymMalicki commented Dec 13, 2024

This PR introduces the following changes:

  1. Passing the input arguments for the main func and initial gas through the flags
  2. Parsing of user arguments in form of single numeric values and non-nested numeric arrays, i. e. 1 1 [1 2 3] 4 5 [6] 7 [8 9] + tests
  3. Modifications of integration tests pipeline
  4. Writing the args to the memory, using ExternalWriteArgsToMemory hint
  5. Correction in the main function offset calculation (always 0 for cairo1)
  6. Writing gas costs segment to the end of the program segment
  7. Correction in calculation of the offset of the CALL opcode in the entry code (incremented by the offset of the main fuction)
  8. Always writing user args to the AP, instead of AP - len(userArgs)

@MaksymMalicki MaksymMalicki marked this pull request as draft December 13, 2024 14:13
pkg/parsers/starknet/starknet.go Outdated Show resolved Hide resolved
pkg/parsers/starknet/starknet.go Outdated Show resolved Hide resolved
pkg/parsers/starknet/starknet.go Outdated Show resolved Hide resolved
pkg/parsers/starknet/starknet_test.go Outdated Show resolved Hide resolved
pkg/hintrunner/hintrunner.go Outdated Show resolved Hide resolved
pkg/hintrunner/core/hint.go Outdated Show resolved Hide resolved
pkg/hintrunner/core/hint.go Show resolved Hide resolved
@cicr99 cicr99 marked this pull request as ready for review December 20, 2024 13:20
Copy link
Contributor

@cicr99 cicr99 left a comment

Choose a reason for hiding this comment

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

looks great!
The CI is failing though

@MaksymMalicki MaksymMalicki merged commit 5eb27ab into add_code_entry Dec 25, 2024
2 of 3 checks passed
@MaksymMalicki MaksymMalicki deleted the add_available_gas_and_user_args branch December 25, 2024 20:55
MaksymMalicki added a commit that referenced this pull request Jan 10, 2025
* Fixes for the generation of entry code, fixes of hints parsing

* Add modifications to the runner

* Add fixes for the entrycode generation

* Refactor main CLI, offset the hints indexes by entry code size, load arguments and initial gas to the memory

* Add available gas and user args (#677)

* Add parsing logic for input user args

* Add flags for available gas, input user args, writing args to memory

* Fix unit tests for user arguments parsing

* Lint the PR

* Add user args to hint context

* Refactor the code

* Fix unconditional append of ExternalWriteArgsToMemory, bug fixes in integration tests

* Add fixes of the call size calculation and include ExternalWriteArgsToMemory hint when gas present

* Add layouts for integration tests

* Add error handling

* Fixes in entry code generation

* Address changes mentioned in a discussion

* Add comment regarding writing to memory in a hint for the future reference in the integration tests with args

* Changes in calculations of the initial PC offset, CALL opcode offset incremented by mainFuncOffset, writing user args to the AP in the hint

* Turn back VM config to private field

* Add error handling on assign of `userArgs` to the initial scope

* Lint project

* Bump go version from 1.20 -> 1.21 (#678)

* Bump go version from 1.20 -> 1.21

* Update golangci-lint

* Simplify the Makefile

* Correction in the makefile

* Fix the integration tests

* Fixes in the runner

* Fixes in the runner

* Fix the unit tests, uncomment pythonVm execution in integration tests, code cleanups

* Add writing tokens gas cost to memory

* Proper builtins initialization for cairo mode

* Address comments in the PR

* Removed systemtype from builtins
MaksymMalicki added a commit that referenced this pull request Jan 10, 2025
* Fixes for the generation of entry code, fixes of hints parsing

* Add modifications to the runner

* Add fixes for the entrycode generation

* Refactor main CLI, offset the hints indexes by entry code size, load arguments and initial gas to the memory

* Add available gas and user args (#677)

* Add parsing logic for input user args

* Add flags for available gas, input user args, writing args to memory

* Fix unit tests for user arguments parsing

* Lint the PR

* Add user args to hint context

* Refactor the code

* Fix unconditional append of ExternalWriteArgsToMemory, bug fixes in integration tests

* Add fixes of the call size calculation and include ExternalWriteArgsToMemory hint when gas present

* Add layouts for integration tests

* Add error handling

* Fixes in entry code generation

* Address changes mentioned in a discussion

* Add comment regarding writing to memory in a hint for the future reference in the integration tests with args

* Changes in calculations of the initial PC offset, CALL opcode offset incremented by mainFuncOffset, writing user args to the AP in the hint

* Turn back VM config to private field

* Add error handling on assign of `userArgs` to the initial scope

* Lint project

* Bump go version from 1.20 -> 1.21 (#678)

* Bump go version from 1.20 -> 1.21

* Update golangci-lint

* Simplify the Makefile

* Correction in the makefile

* Fix the integration tests

* Fixes in the runner

* Fixes in the runner

* Fix the unit tests, uncomment pythonVm execution in integration tests, code cleanups

* Add writing tokens gas cost to memory

* Proper builtins initialization for cairo mode

* Add fixes for hints, change the order of tokens in gas.go

* Address comments in the PR

* gofmt

* remove systemtype builtin
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.

2 participants