@@ -414,7 +414,6 @@ module DynamoToStruct {
414
414
&& ListAttrToBytes (a.L, depth). Success?
415
415
&& ret. value[PREFIX_LEN.. ] == ListAttrToBytes (a.L, depth). value
416
416
&& ListAttrToBytes (a.L, depth). value[.. LENGTH_LEN] == U32ToBigEndian (|a.L|). value
417
- // && ret.value[PREFIX_LEN..PREFIX_LEN+LENGTH_LEN] == U32ToBigEndian(|a.L|).value
418
417
&& (|a. L| == 0 ==> |ret. value| == PREFIX_LEN + LENGTH_LEN)
419
418
420
419
// = specification/dynamodb-encryption-client/ddb-attribute-serialization.md#map-attribute
@@ -737,10 +736,6 @@ module DynamoToStruct {
737
736
}
738
737
739
738
// Can't be {:tailrecursion} because it calls AttrToBytes which might again call CollectList
740
- // However, we really need this to loop and not recurse.
741
- // This verifies without the `by method`, but Dafny is too broken to let it verify by method
742
- // for example, a call to CollectList somehow does not satisfy the decreases clause
743
- // hence the {:verify false}
744
739
function {:opaque} CollectList (
745
740
listToSerialize : ListAttributeValue ,
746
741
depth : uint64 ,
@@ -758,7 +753,8 @@ module DynamoToStruct {
758
753
reveal CollectList ();
759
754
reveal CollectListGhost ();
760
755
var result := serialized;
761
- for i := 0 to |listToSerialize|
756
+ MemoryMath. ValueIsSafeBecauseItIsInMemory (|listToSerialize|);
757
+ for i : uint64 := 0 to |listToSerialize| as uint64
762
758
{
763
759
var val := AttrToBytes (listToSerialize[i], true, depth+1);
764
760
if val. Failure? {
@@ -1033,10 +1029,6 @@ module DynamoToStruct {
1033
1029
1034
1030
// Bytes to List
1035
1031
// Can't be {:tailrecursion} because it calls BytesToAttr which might again call DeserializeList
1036
- // However, we really need this to loop and not recurse.
1037
- // This verifies without the `by method`, but Dafny is too broken to let it verify by method
1038
- // for example, a call to DeserializeListEntry somehow does not satisfy the decreases clause
1039
- // hence the {:verify false}
1040
1032
function {:vcs_split_on_every_assert} {:opaque} DeserializeList (
1041
1033
serialized : seq <uint8 >,
1042
1034
pos : uint64 ,
@@ -1063,7 +1055,7 @@ module DynamoToStruct {
1063
1055
reveal DeserializeList ();
1064
1056
var npos : uint64 := pos;
1065
1057
var newResultList := resultList;
1066
- for i := 0 to remainingCount
1058
+ for i : uint64 : = 0 to remainingCount
1067
1059
invariant serialized == old (serialized)
1068
1060
invariant newResultList. val. L?
1069
1061
invariant npos as int <= |serialized|
@@ -1163,10 +1155,6 @@ module DynamoToStruct {
1163
1155
1164
1156
// Bytes to Map
1165
1157
// Can't be {:tailrecursion} because it calls BytesToAttr which might again call DeserializeMap
1166
- // However, we really need this to loop and not recurse.
1167
- // This verifies without the `by method`, but Dafny is too broken to let it verify by method
1168
- // for example, a call to DeserializeMapEntry somehow does not satisfy the decreases clause
1169
- // hence the {:verify false}
1170
1158
function {:vcs_split_on_every_assert} {:opaque} DeserializeMap (
1171
1159
serialized : seq <uint8 >,
1172
1160
pos : uint64 ,
@@ -1192,7 +1180,7 @@ module DynamoToStruct {
1192
1180
reveal DeserializeMap ();
1193
1181
var npos : uint64 := pos;
1194
1182
var newResultMap := resultMap;
1195
- for i := 0 to remainingCount
1183
+ for i : uint64 : = 0 to remainingCount
1196
1184
invariant serialized == old (serialized)
1197
1185
invariant newResultMap. val. M?
1198
1186
invariant npos as int <= |serialized|
0 commit comments