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

No deploy nullptrs #427

Closed
wants to merge 6 commits into from
Closed

No deploy nullptrs #427

wants to merge 6 commits into from

Conversation

notlesh
Copy link
Collaborator

@notlesh notlesh commented Nov 7, 2024

This PR removes the retdata hacks (as done in #419) but also makes a small change to cairo-lang to avoid cast(0, felt*) during deploys.

The changes to the OS are effectively:

diff --git a/src/starkware/starknet/core/os/execution/deprecated_execute_entry_point.cairo b/src/starkware/starknet/core/os/execution/deprecated_execute_entry_point.cairo
index d147c23f7b..e329f5855d 100644
--- a/src/starkware/starknet/core/os/execution/deprecated_execute_entry_point.cairo
+++ b/src/starkware/starknet/core/os/execution/deprecated_execute_entry_point.cairo
@@ -128,7 +128,7 @@ func deprecated_execute_entry_point{
         // Assert that there is no call data in the case of NOP entry point.
         assert execution_context.calldata_size = 0;
         %{ execution_helper.skip_call() %}
-        return (retdata_size=0, retdata=cast(0, felt*));
+        return (retdata_size=0, retdata=cast(nondet %{ segments.add() %}, felt*));
     }

     local range_check_ptr = range_check_ptr;
diff --git a/src/starkware/starknet/core/os/execution/deprecated_execute_syscalls.cairo b/src/starkware/starknet/core/os/execution/deprecated_execute_syscalls.cairo
index a3d2f922ec..da1c5219ea 100644
--- a/src/starkware/starknet/core/os/execution/deprecated_execute_syscalls.cairo
+++ b/src/starkware/starknet/core/os/execution/deprecated_execute_syscalls.cairo
@@ -248,7 +248,7 @@ func execute_deploy_syscall{
     assert syscall_ptr.response = DeployResponse(
         contract_address=contract_address,
         constructor_retdata_size=0,
-        constructor_retdata=cast(0, felt*),
+        constructor_retdata=cast(nondet %{ segments.add() %}, felt*),
     );

     tempvar constructor_execution_context = new ExecutionContext(
diff --git a/src/starkware/starknet/core/os/execution/execute_entry_point.cairo b/src/starkware/starknet/core/os/execution/execute_entry_point.cairo
index ef2ca40441..7b32e759af 100644
--- a/src/starkware/starknet/core/os/execution/execute_entry_point.cairo
+++ b/src/starkware/starknet/core/os/execution/execute_entry_point.cairo
@@ -171,7 +171,7 @@ func execute_entry_point{
         // Assert that there is no call data in the case of NOP entry point.
         assert execution_context.calldata_size = 0;
         %{ execution_helper.skip_call() %}
-        return (retdata_size=0, retdata=cast(0, felt*));
+        return (retdata_size=0, retdata=cast(nondet %{ segments.add() %}, felt*));
     }

     let entry_point_offset = compiled_class_entry_point.offset;

Note that this PR seems to fail because of the second part of this change, as can be seen in CI in both our integration tests and the Sepolia integration tests. Specifically, this second change that breaks things is:

@@ -248,7 +248,7 @@ func execute_deploy_syscall{

-        constructor_retdata=cast(0, felt*),
+        constructor_retdata=cast(nondet %{ segments.add() %}, felt*),

@notlesh
Copy link
Collaborator Author

notlesh commented Dec 9, 2024

Closing as this issue was addressed in cairo-vm

@notlesh notlesh closed this Dec 9, 2024
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.

1 participant