You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// ID returns the unique identifier for the concrete view, which is the ID of
// the chunk the view is for.
func (c*ChunkDataPack) ID() Identifier {
returnc.ChunkID
}
This approach assumes that ChunkID is sufficient to uniquely identify a ChunkDataPack. While this method is straightforward, it introduces potential malleability concerns because it does not consider the integrity of the other fields within ChunkDataPack.
Specifically, fields like:
StartState,
Proof,
Collection,
ExecutionDataRoot,
are excluded from the identifier computation. This omission means that two ChunkDataPack instances with the same ChunkID but differing values for these fields would produce the same ID, which is incorrect.
Proposed Solution
Key Changes
Update ID() :
To address these concerns, the ID() method will be updated to compute the identifier based on the entire ChunkDataPack struct using the MakeID() function:
By encoding all fields, this approach guarantees that the resulting ID is malleability-resistant. Changes to any field of ChunkDataPack will produce a different Identifier.
All fields will be encoded in a way that guarantees consistency:
Primitive and byte array fields: fields like ChunkID, StartState, and Proof are encoded directly as raw bytes using RLP.
Custom structs: Collection -ID() for Collection struct needs to be updated first in [Malleability] Collection #6721. Recursive ExecutionDataRoot struct will be encoded as RLP lists of their public fields, capturing the entire structure consistently (encoding rlp rules).
Remove unused function:
During the revision process, it was identified that the function FromChunkID is unused and redundant. This function will be removed.
Also Checksum() function will be removed.
Definition of Done
The ChunkDataPack.ID() method has been updated using MakeID.
The identifier computation has been verified to use RLP encoding or Fingerprint for all fields.
The unused FromChunkID and Checksum() functions has been removed.
Unit tests have been updated to validate the new behavior, ensuring identifiers change as expected when data is modified.
Documentation and comments have been updated to reflect the changes and clarify the purpose of the ID() method.
The text was updated successfully, but these errors were encountered:
ChunkDataPack Malleability
flow-go/model/flow/chunk.go
Lines 94 to 104 in 22daf5c
The current
ChunkDataPack
implementation uses theID()
method to return theChunkID
field as the unique identifier:flow-go/model/flow/chunk.go
Lines 123 to 127 in 22daf5c
This approach assumes that
ChunkID
is sufficient to uniquely identify aChunkDataPack
. While this method is straightforward, it introduces potential malleability concerns because it does not consider the integrity of the other fields withinChunkDataPack
.Specifically, fields like:
StartState
,Proof
,Collection
,ExecutionDataRoot
,are excluded from the identifier computation. This omission means that two
ChunkDataPack
instances with the sameChunkID
but differing values for these fields would produce the sameID
, which is incorrect.Proposed Solution
Key Changes
ID()
:To address these concerns, the
ID
() method will be updated to compute the identifier based on the entireChunkDataPack
struct using theMakeID
() function:By encoding all fields, this approach guarantees that the resulting
ID
is malleability-resistant. Changes to any field ofChunkDataPack
will produce a differentIdentifier
.All fields will be encoded in a way that guarantees consistency:
ChunkID
,StartState
, andProof
are encoded directly as raw bytes usingRLP
.Collection
-ID()
forCollection
struct needs to be updated first in [Malleability] Collection #6721. RecursiveExecutionDataRoot
struct will be encoded asRLP
lists of their public fields, capturing the entire structure consistently (encoding rlp rules).During the revision process, it was identified that the function
FromChunkID
is unused and redundant. This function will be removed.Also
Checksum()
function will be removed.Definition of Done
ChunkDataPack.ID()
method has been updated usingMakeID
.The identifier computation has been verified to use
RLP encoding
orFingerprint
for all fields.FromChunkID
andChecksum()
functions has been removed.ID()
method.The text was updated successfully, but these errors were encountered: