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 report structs #29

Merged
merged 2 commits into from
Aug 5, 2024
Merged

Add report structs #29

merged 2 commits into from
Aug 5, 2024

Conversation

bamzedev
Copy link
Contributor

@bamzedev bamzedev commented Aug 1, 2024

This PR adds the EG extrinsic, aka Reports.

@bamzedev bamzedev force-pushed the add-report-structs branch from 263c1cc to f8d859e Compare August 1, 2024 15:03
@bamzedev bamzedev requested a review from a team August 1, 2024 15:04
@carlos-romano
Copy link
Contributor

carlos-romano commented Aug 5, 2024

I think it looks good so far. We are just missing adding the EG to the extrinsic right?

@bamzedev
Copy link
Contributor Author

bamzedev commented Aug 5, 2024

I think it looks good so far. We are just missing adding the EG to the extrinsic right?

yes

pantrif
pantrif previously approved these changes Aug 5, 2024
@carlos-romano
Copy link
Contributor

@bamzedev if you could add the guarantees to the extrinsic, I think I would have everything I need 👍

@bamzedev bamzedev merged commit 358d76f into main Aug 5, 2024
2 checks passed
@bamzedev bamzedev deleted the add-report-structs branch August 5, 2024 11:56
@bamzedev bamzedev mentioned this pull request Aug 5, 2024
6 tasks

// Guarantee represents a single guarantee within the E_G extrinsic
type Guarantee struct {
CoreIndex uint32 // Index of the core this guarantee is for
Copy link
Member

Choose a reason for hiding this comment

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

From my understanding of the paper the core index is taken from the WorkReport.CoreIndex so defining it here is redundant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The paper defines it that way. Not sure about the reason for this redundancy, maybe somewhere we will take this index without the need to deserialize the work report. Gavin knows for sure.

Copy link
Member

Choose a reason for hiding this comment

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

in the paper the EG is defined as a tuple of 3 items, core index is not one of them
image


// GuaranteesExtrinsic represents the E_G extrinsic
type GuaranteesExtrinsic struct {
Guarantees []Guarantee
Copy link
Member

Choose a reason for hiding this comment

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

	Guarantees [NrOfCores]Guarantee

Where:

const NrOfCores = 341

?

Copy link
Member

Choose a reason for hiding this comment

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

The same question as with Credential, do we need this intermediary struct GuaranteesExtrinsic or can we use []Guarantees directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is variable length, so we can't represent it and array with length 341.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do we need this intermediary struct

I think so. I initially started the ticket with just a slice, but seems wrong and I have a PR fixing that. We will probably have functions specific for extrinsics, i.e. validate etc. So it makes sense.


// Credential represents the credential a in the document
type Credential struct {
Signatures []CredentialSignature
Copy link
Member

Choose a reason for hiding this comment

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

Not trying to nitpick, but should we use []CredentialSignature directly in the Guarantee struct and rename CredentialSignature to Signature? we do we need to create this intermediary struct Credential?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think Signatures is correct, because you get them from a Credential struct, so: Credential.Signatures, instead of Credential.CredentialSignatures.

Copy link
Member

Choose a reason for hiding this comment

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

My question is not as much regarding the naming, as if we need this Credential struct at all and if we should use the sequence of signatures in the parent struct directly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, sorry didn't read correctly. Yeah, doesn't make sense. I'll update it, thanks!

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.

4 participants