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: make more structs serializable #1723

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

feat: make more structs serializable #1723

wants to merge 1 commit into from

Conversation

haraldh
Copy link
Collaborator

@haraldh haraldh commented Apr 18, 2024

What ❔

Make more structs serializable.

Why ❔

Needed for the TEE verifier as input. These structs will be serialized for intercloud data exchange.

Checklist

  • PR title corresponds to the body of PR (we generate changelog entries from PRs).
  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • Code has been formatted via zk fmt and zk lint.
  • Spellcheck has been run via zk spellcheck.
  • Linkcheck has been run via zk linkcheck.

@haraldh
Copy link
Collaborator Author

haraldh commented Apr 18, 2024

Failed linkcheck action fixed with #1720

@mm-zk
Copy link
Collaborator

mm-zk commented Apr 18, 2024

is there any reason for this?
Every struct that is serializable, makes it harder to do breaking changes to (for example, if I'm adding or removing the field, now i have to look to make sure that I didn't break the serialization)

@haraldh
Copy link
Collaborator Author

haraldh commented Apr 18, 2024

is there any reason for this? Every struct that is serializable, makes it harder to do breaking changes to (for example, if I'm adding or removing the field, now i have to look to make sure that I didn't break the serialization)

@mm-zk while I agree with you, it will be needed for an external running (SGX) verifier ... do you have any other suggestion on how to solve this? Either we will have to have a public constructor for those structs, or do it via serde.

@haraldh
Copy link
Collaborator Author

haraldh commented Apr 18, 2024

Or we can state, that the serialization user is aware of struct changes and can cope with those by making sure the consumer is in lockstep with the producer.

@mm-zk
Copy link
Collaborator

mm-zk commented Apr 19, 2024

@haraldh - what do you mean by 'public constructor'? AFAIK in rust as long as all the fields are pub, you have implicit public constructor (Struct{field1: xx, field2: yy} )

@haraldh
Copy link
Collaborator Author

haraldh commented Apr 19, 2024

@haraldh - what do you mean by 'public constructor'? AFAIK in rust as long as all the fields are pub, you have implicit public constructor (Struct{field1: xx, field2: yy} )

True, in this case all the fields of the touched structs are public. So, we will have to make shadow structs for all of them instead, if this PR is not gonna make it.

Needed for the TEE verifier as input. These structs will be
serialized for intercloud data exchange.

Signed-off-by: Harald Hoyer <harald@matterlabs.dev>
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.

None yet

2 participants