Skip to content

Commit 1169bc8

Browse files
authored
fix: SetToSequence should be a method, not a function (#1035)
* fix: SetToSequence should be a method, not a function
1 parent 21ad206 commit 1169bc8

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

AwsCryptographicMaterialProviders/runtimes/rust/src/storm_tracker.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub mod internal_StormTrackingCMC {
7070
)});
7171
}
7272
EmptyWait {} => {
73-
if (crate::Time::_default::CurrentRelativeTimeMilli() <= max_in_flight) {
73+
if crate::Time::_default::CurrentRelativeTimeMilli() <= max_in_flight {
7474
std::thread::sleep(sleep_time);
7575
} else {
7676
return std::rc::Rc::new(crate::_Wrappers_Compile::Result::Failure{error :

StandardLibrary/src/Sets.dfy

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ module {:extern "SortedSets"} SortedSets {
2525
ensures forall k <- s :: k in res
2626
ensures |res| == |s|
2727

28-
function method {:extern "SetToSequence"} ComputeSetToSequence<T(==, !new)>(
28+
// This must be a method, not a function, because the results are not deterministic
29+
// It might even return different results for the same input
30+
method {:extern "SetToSequence"} ComputeSetToSequence<T(==, !new)>(
2931
s: set<T>
3032
)
31-
: (res: seq<T>)
33+
returns (res: seq<T>)
3234
ensures Seq.HasNoDuplicates(res)
3335
ensures forall k <- res :: k in s
3436
ensures forall k <- s :: k in res

TestVectorsAwsCryptographicMaterialProviders/dafny/TestVectorsAwsCryptographicMaterialProviders/src/WriteJsonManifests.dfy

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module {:options "-functionSyntax:4"} WriteJsonManifests {
3939
function EncryptionContextToJson(key: string, m: Types.EncryptionContext)
4040
: Result<seq<(string, JSON)>, string>
4141
{
42-
var keys := SortedSets.ComputeSetToSequence(m.Keys);
42+
var keys := SortedSets.ComputeSetToOrderedSequence2(m.Keys, (a, b) => a < b);
4343
var pairsBytes
4444
:- Seq.MapWithResult(
4545
k requires k in m.Keys =>

0 commit comments

Comments
 (0)