Skip to content

Commit 3d077b8

Browse files
committed
m
1 parent 72a95b6 commit 3d077b8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

DynamoDbEncryption/dafny/DynamoDbEncryption/src/CompoundBeacon.dfy

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -522,12 +522,13 @@ module CompoundBeacon {
522522
}
523523

524524
// OkPrefixPair, but return Result with error message
525-
function method CheckOnePrefixPart(pos1 : uint64, pos2 : uint64) : (ret : Result<bool, Error>)
526-
requires pos1 as nat < |parts|
527-
requires pos2 as nat < |parts|
528-
ensures ret.Success? ==> OkPrefixPair(pos1, pos2)
525+
function method CheckOnePrefixPart(pos1 : nat, pos2 : nat) : (ret : Result<bool, Error>)
526+
requires pos1 < |parts|
527+
requires pos2 < |parts|
528+
ensures ret.Success? ==> HasUint64Len(parts) && OkPrefixPair(pos1 as uint64, pos2 as uint64)
529529
{
530-
if !OkPrefixPair(pos1, pos2) then
530+
SequenceIsSafeBecauseItIsInMemory(parts);
531+
if !OkPrefixPair(pos1 as uint64, pos2 as uint64) then
531532
Failure(E("Compound beacon " + base.name + " defines part " + parts[pos1].getName() + " with prefix " + parts[pos1].prefix
532533
+ " which is incompatible with part " + parts[pos2].getName() + " which has a prefix of " + parts[pos2].prefix + "."))
533534
else
@@ -538,9 +539,8 @@ module CompoundBeacon {
538539
function method CheckOnePrefix(pos : nat) : (ret : Result<bool, Error>)
539540
requires pos < |parts|
540541
{
541-
SequenceIsSafeBecauseItIsInMemory(parts);
542542
var partNumbers : seq<nat> := seq(|parts|, (i : nat) => i as nat);
543-
var _ :- Sequence.MapWithResult((p : int) requires 0 <= p < |parts| => CheckOnePrefixPart(pos as uint64, p as uint64), seq(|parts|, i => i));
543+
var _ :- Sequence.MapWithResult((p : int) requires 0 <= p < |parts| => CheckOnePrefixPart(pos, p), seq(|parts|, i => i));
544544
Success(true)
545545
}
546546

0 commit comments

Comments
 (0)