-
Notifications
You must be signed in to change notification settings - Fork 13
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
Memcpy hints #230
Merged
Merged
Memcpy hints #230
Changes from 15 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
0baa5b4
add is_positive felt method
toni-calvin c746374
implement memcpy_continue_copying hint
toni-calvin 5a8bd09
fix test
toni-calvin 737eee6
fix hint
toni-calvin 53bc048
add failing test
toni-calvin 3ccf363
Merge branch 'main' of github.com:lambdaclass/cairo-vm.go into memcpy…
toni-calvin 364470d
add hint
toni-calvin e3c6546
add test to memcpy_continue_copying hint
toni-calvin 7f083b9
improve imports in hints
toni-calvin 8b08918
abstract error
toni-calvin 3ceeae8
add aux utils methods
toni-calvin a1c1990
change from MaybeRelocatable to Felt when returning n identifier
toni-calvin 5d9c089
add tests
toni-calvin 853ee4c
Merge branch 'main' of github.com:lambdaclass/cairo-vm.go into memcpy…
toni-calvin 65b8ce6
add continue loop hint
toni-calvin 88ae47a
use utils method for adding segments
toni-calvin 4889d53
fix memcpy_continue_coding hint code
toni-calvin 556cf70
improve returned value in memset_step_loop method
toni-calvin 9efe91f
delete GetRef method fromexecScopes
toni-calvin ad0c563
Revert "delete GetRef method fromexecScopes"
toni-calvin a4d467c
Revert "Revert "delete GetRef method fromexecScopes""
toni-calvin b4cdeca
improve error message
toni-calvin 3611a38
improve tests
toni-calvin 52a7a44
add integration tests
toni-calvin 522ffaf
Merge branch 'main' of github.com:lambdaclass/cairo-vm.go into me…
toni-calvin 545c929
Merge branch 'main' of github.com:lambdaclass/cairo-vm.go into memcpy…
toni-calvin 8416087
Merge branch 'main' of github.com:lambdaclass/cairo-vm.go into memcpy…
toni-calvin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package hints | ||
|
||
const MEMSET_ENTER_SCOPE = "vm_enter_scope({'n': ids.n})" | ||
const MEMSET_CONTINUE_LOOP = "n -= 1 ids.continue_loop = 1 if n > 0 else 0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package hints | ||
|
||
import ( | ||
. "github.com/lambdaclass/cairo-vm.go/pkg/hints/hint_utils" | ||
. "github.com/lambdaclass/cairo-vm.go/pkg/types" | ||
. "github.com/lambdaclass/cairo-vm.go/pkg/vm" | ||
) | ||
|
||
// Implements hint: | ||
// %{ vm_enter_scope({'n': ids.n}) %} | ||
func memset_enter_scope(ids IdsManager, vm *VirtualMachine, execScopes *ExecutionScopes) error { | ||
n, err := ids.GetFelt("n", vm) | ||
if err != nil { | ||
return err | ||
} | ||
execScopes.EnterScope(map[string]interface{}{"n": n}) | ||
return nil | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I do this? The main reason is to check the error from tests and to "abstract" them a little bit, but I feel I am adding noise to the code and maybe it is not worth it.
If you feel the same i can revert the commit and not implementing it in future prs 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's good!
Although it might be a good idea to open an issue to make sure we use these error functions on other hints