Skip to content

Commit

Permalink
chore: Reduce resource usage of assertion in ReadFramedMessageBody (#665
Browse files Browse the repository at this point in the history
)

Co-authored-by: Remy Willems <[email protected]>
  • Loading branch information
robin-aws and keyboardDrummer authored Jun 12, 2024
1 parent 2bbab7d commit c49af85
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion AwsEncryptionSDK/dafny/AwsEncryptionSdk/src/MessageBody.dfy
Original file line number Diff line number Diff line change
Expand Up @@ -1031,8 +1031,17 @@ module MessageBody {
//# (../framework/algorithm-suites.md#encryption-algorithm) specified by
//# the algorithm suite (../framework/algorithm-suites.md), with the
//# following inputs:
assert CorrectlyRead(buffer, Success(SuccessfulRead(nextRegularFrames, regularFrame.tail)), WriteMessageRegularFrames) by {
var res := Success(SuccessfulRead(nextRegularFrames, regularFrame.tail));
assert CorrectlyRead(buffer, res, WriteMessageRegularFrames) by {
reveal CorrectlyReadRange();

var tail := res.value.tail;
var readRange := WriteMessageRegularFrames(res.value.data);
assert buffer.bytes == tail.bytes;
assert buffer.start <= tail.start <= |buffer.bytes|;
assert buffer.bytes[buffer.start..] == tail.bytes[buffer.start..];
assert readRange <= buffer.bytes[buffer.start..];
assert tail.start == buffer.start + |readRange|;
}

ReadFramedMessageBody(
Expand Down

0 comments on commit c49af85

Please sign in to comment.