@@ -394,10 +394,10 @@ ensures acc(sl.Bytes(ub, 0, length), R55)
394394ensures s.ValidHeaderOffset(ub, len(ub))
395395decreases
396396func (s *SCION) ValidHeaderOffsetFromSubSliceLemma(ub []byte, length int) {
397- reveal s.ValidHeaderOffset(ub, len(ub) )
397+ reveal s.ValidHeaderOffset(ub, length )
398398 unfold acc(sl.Bytes(ub, 0, len(ub)), R56)
399399 unfold acc(sl.Bytes(ub, 0, length), R56)
400- assert reveal s.ValidHeaderOffset(ub, length )
400+ assert reveal s.ValidHeaderOffset(ub, len(ub) )
401401 fold acc(sl.Bytes(ub, 0, len(ub)), R56)
402402 fold acc(sl.Bytes(ub, 0, length), R56)
403403}
@@ -532,6 +532,12 @@ decreases
532532func IsSupportedPktSubslice(raw []byte, idx int) {
533533 unfold acc(sl.Bytes(raw, 0, len(raw)), R56)
534534 unfold acc(sl.Bytes(raw[:idx], 0, idx), R56)
535+ // The two calls of IsSupportedPkt read the next header and the path type
536+ // through different sl.Bytes predicates. Reading both locations through
537+ // both slices while the predicates are unfolded is what makes their
538+ // snapshots agree on them.
539+ assert raw[:idx][4] == raw[4]
540+ assert raw[:idx][8] == raw[8]
535541 reveal IsSupportedPkt(raw)
536542 reveal IsSupportedPkt(raw[:idx])
537543 fold acc(sl.Bytes(raw, 0, len(raw)), R56)
@@ -547,6 +553,9 @@ decreases
547553func GetPathTypeSubslice(raw []byte, idx int) {
548554 unfold acc(sl.Bytes(raw, 0, len(raw)), R56)
549555 unfold acc(sl.Bytes(raw[:idx], 0, idx), R56)
556+ // Relates the two sl.Bytes snapshots on the byte holding the path type,
557+ // which is the only one the two calls of GetPathType read.
558+ assert raw[:idx][8] == raw[8]
550559 fold acc(sl.Bytes(raw, 0, len(raw)), R56)
551560 fold acc(sl.Bytes(raw[:idx], 0, idx), R56)
552561}
0 commit comments