Skip to content

Commit e1d2e9a

Browse files
committed
Update the wire format
1 parent e8bfb27 commit e1d2e9a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

target_chains/ethereum/contracts/contracts/pyth/PythAccumulator.sol

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,25 @@ abstract contract PythAccumulator is PythGetters, PythSetters, AbstractPyth {
6262
offset += 1;
6363

6464
if (majorVersion != 1) revert PythErrors.InvalidUpdateData();
65+
66+
// never reverts
67+
// uint8 minorVersion = UnsafeBytesLib.toUint16(encoded, index);
68+
offset += 1;
69+
70+
// This check is always false as minorVersion is 0, so it is commented.
71+
// in the future that the minor version increases this will have effect.
72+
// if(minorVersion < 0) revert InvalidUpdateData();
73+
74+
// This field ensure that we can add headers in the future
75+
// without breaking the contract (future compatibility)
76+
uint8 trailingHeaderSize = UnsafeBytesLib.toUint8(
77+
accumulatorUpdate,
78+
offset
79+
);
80+
offset += 1;
81+
82+
// Currently we don't have any trailing header
83+
offset += trailingHeaderSize;
6584
}
6685

6786
// This value is only used as the check below which currently
@@ -130,6 +149,10 @@ abstract contract PythAccumulator is PythGetters, PythSetters, AbstractPyth {
130149
if (updateType != UpdateType.WormholeMerkle)
131150
revert PythErrors.InvalidUpdateData();
132151

152+
// This field is not used
153+
// uint32 storageIndex = UnsafeBytesLib.toUint32(encodedPayload, payloadoffset);
154+
payloadoffset += 4;
155+
133156
digest = bytes20(
134157
UnsafeBytesLib.toAddress(encodedPayload, payloadoffset)
135158
);

0 commit comments

Comments
 (0)