1
- use std:: collections:: HashSet ;
1
+ use std:: collections:: { BTreeSet , HashSet } ;
2
2
use std:: fs:: { self , File , OpenOptions } ;
3
3
use std:: io:: { Read , Write } ;
4
4
use std:: marker:: PhantomData ;
@@ -122,9 +122,9 @@ pub struct AnalysisReport {
122
122
/// This does not guarantee they are functional or even have the correct signatures.
123
123
pub has_ibc_entry_points : bool ,
124
124
/// A set of all entrypoints that are exported by the contract.
125
- pub entrypoints : HashSet < Entrypoint > ,
125
+ pub entrypoints : BTreeSet < Entrypoint > ,
126
126
/// The set of capabilities the contract requires.
127
- pub required_capabilities : HashSet < String > ,
127
+ pub required_capabilities : BTreeSet < String > ,
128
128
}
129
129
130
130
impl < A , S , Q > Cache < A , S , Q >
@@ -292,7 +292,9 @@ where
292
292
. iter ( )
293
293
. all ( |required| exports. contains ( required. as_ref ( ) ) ) ,
294
294
entrypoints,
295
- required_capabilities : required_capabilities_from_module ( & module) ,
295
+ required_capabilities : required_capabilities_from_module ( & module)
296
+ . into_iter ( )
297
+ . collect ( ) ,
296
298
} )
297
299
}
298
300
@@ -1307,28 +1309,28 @@ mod tests {
1307
1309
report1,
1308
1310
AnalysisReport {
1309
1311
has_ibc_entry_points: false ,
1310
- entrypoints: HashSet :: from( [
1312
+ entrypoints: BTreeSet :: from( [
1311
1313
E :: Instantiate ,
1312
1314
E :: Migrate ,
1313
1315
E :: Sudo ,
1314
1316
E :: Execute ,
1315
1317
E :: Query
1316
1318
] ) ,
1317
- required_capabilities: HashSet :: new( ) ,
1319
+ required_capabilities: BTreeSet :: new( ) ,
1318
1320
}
1319
1321
) ;
1320
1322
1321
1323
let checksum2 = cache. save_wasm ( IBC_CONTRACT ) . unwrap ( ) ;
1322
1324
let report2 = cache. analyze ( & checksum2) . unwrap ( ) ;
1323
1325
let mut ibc_contract_entrypoints =
1324
- HashSet :: from ( [ E :: Instantiate , E :: Migrate , E :: Reply , E :: Query ] ) ;
1326
+ BTreeSet :: from ( [ E :: Instantiate , E :: Migrate , E :: Reply , E :: Query ] ) ;
1325
1327
ibc_contract_entrypoints. extend ( REQUIRED_IBC_EXPORTS ) ;
1326
1328
assert_eq ! (
1327
1329
report2,
1328
1330
AnalysisReport {
1329
1331
has_ibc_entry_points: true ,
1330
1332
entrypoints: ibc_contract_entrypoints,
1331
- required_capabilities: HashSet :: from_iter( [
1333
+ required_capabilities: BTreeSet :: from_iter( [
1332
1334
"iterator" . to_string( ) ,
1333
1335
"stargate" . to_string( )
1334
1336
] ) ,
@@ -1341,8 +1343,8 @@ mod tests {
1341
1343
report3,
1342
1344
AnalysisReport {
1343
1345
has_ibc_entry_points: false ,
1344
- entrypoints: HashSet :: new( ) ,
1345
- required_capabilities: HashSet :: from( [ "iterator" . to_string( ) ] ) ,
1346
+ entrypoints: BTreeSet :: new( ) ,
1347
+ required_capabilities: BTreeSet :: from( [ "iterator" . to_string( ) ] ) ,
1346
1348
}
1347
1349
) ;
1348
1350
}
0 commit comments