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

Change CairoPie serialization #1443

Closed
pefontana opened this issue Sep 13, 2023 · 0 comments
Closed

Change CairoPie serialization #1443

pefontana opened this issue Sep 13, 2023 · 0 comments
Assignees

Comments

@pefontana
Copy link
Collaborator

pefontana commented Sep 13, 2023

We need to make some changes in the deserialization of the CairoPie struct, to make it equal to the Python VM one:

  • Change the CairoPie.program.data
// python program data
        "data": [
            4613515612218425344,
            100,
            5188850460319907840,
            4613515612218425344,
            200,
            5188850464614875136,
            4613515612218425344,
            300,
            5188850468909842432,
            5198983563776458752,
            3,
            2345108766317314046
        ],
// rust program data
"data": [
      {
        "Int": {
          "value": {
            "val": [
              2147450880,
              1074167809
            ]
          }
        }
      },
      {
        "Int": {
          "value": {
            "val": [
              100
            ]
          }
        }
      },
      {

I think we can change this by adding a serialize implementation to the data field

pub struct StrippedProgram {
    #[serde(serialize_with = "X")]
    pub data: Vec<MaybeRelocatable>,
    pub builtins: Vec<BuiltinName>,
    pub main: usize,
}

Also, i think it would be more clean to move the definition of the StrippedProgram struct to the vm/src/vm/runners/cairo_pie.rs module.

  • Change CairoPie.additional_data serialization
// python additional data
{
    "output_builtin": {
        "pages": {},
        "attributes": {}
    }
}
// rust additional data
{
  "output_builtin": {
    "Output": {
      "pages": {},
      "attributes": {}
    }
  }
}
  • The CairoPie.metadata.program serialization should include the prime field

Image

Remainder: Dont forget to implement this changes also with the lambdaworks feature

@pefontana pefontana moved this to Todo in Starknet Sep 13, 2023
@azteca1998 azteca1998 moved this from Todo to In Progress in Starknet Sep 14, 2023
@azteca1998 azteca1998 moved this from In Progress to In Review in Starknet Sep 14, 2023
@github-project-automation github-project-automation bot moved this from In Review to Done in Starknet Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants