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

[Malleability] Collection #6721

Open
Tracked by #6647
UlyanaAndrukhiv opened this issue Nov 14, 2024 · 0 comments
Open
Tracked by #6647

[Malleability] Collection #6721

UlyanaAndrukhiv opened this issue Nov 14, 2024 · 0 comments

Comments

@UlyanaAndrukhiv
Copy link
Contributor

UlyanaAndrukhiv commented Nov 14, 2024

Collection Malleability

// Collection is set of transactions.
type Collection struct {
Transactions []*TransactionBody
}

The current Collection implementation uses the ID() method to compute the identifier for a collection by delegating the call to the ID() method of the corresponding LightCollection. This approach introduces potential malleability concerns. Specifically, it relies on LightCollection, which only references the TransactionIDs and excludes important details about the transactions themselves. This could result in identifiers that do not fully represent the entire Collection and its underlying data.

func (c Collection) ID() Identifier {
return c.Light().ID()
}

Proposed Solution

  1. Update ID():
    To address these concerns, the ID() method will be updated to compute the identifier based on the entire Collection instead of relying on c.Light().ID(). This ensures that the identifier includes all the information encapsulated within the Collection, not just the light references to transaction IDs.

It is safe to use MakeID() for this purpose because the Fingerprint() method is already implemented for Collection. This guarantees that MakeID will generate a unique and malleability-resistant identifier by considering all relevant fields within the Collection.

func (c *Collection) ID() Identifier {
    return MakeID(c)
}
  1. Remove unused function: Checksum() function will be removed.

Definition of Done

  1. The Collection.ID() method has been updated using MakeID.
  2. All references to Light().ID() in the context of Collection.ID() have been removed, the unused Checksum() function has been removed.
  3. Unit tests and usages have been updated to verify that ID() considers the entire Collection for identifier computation.
  4. Documentation and comments have been updated to reflect the change, explaining the importance of this update in preventing malleability.
@UlyanaAndrukhiv UlyanaAndrukhiv changed the title [Malleability C] Collection [Malleability] Collection Nov 18, 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

No branches or pull requests

1 participant