Skip to content

Commit b1ed850

Browse files
authored
fix: pesky deprecation warning (#1342)
1 parent 1230c1c commit b1ed850

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

contracts/test/helpers/SelectorLibrary.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ library SelectorLibrary {
4848
if (keccak256(abi.encodePacked(facetName)) == keccak256(abi.encodePacked("CheckpointingFacet"))) {
4949
return
5050
abi.decode(
51-
hex"0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000453b4e7bf000000000000000000000000000000000000000000000000000000009db11d8c000000000000000000000000000000000000000000000000000000006326379f00000000000000000000000000000000000000000000000000000000ac81837900000000000000000000000000000000000000000000000000000000",
51+
hex"0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000353b4e7bf000000000000000000000000000000000000000000000000000000009db11d8c000000000000000000000000000000000000000000000000000000006326379f00000000000000000000000000000000000000000000000000000000",
5252
(bytes4[])
5353
);
5454
}

fendermint/actors/chainmetadata/src/actor.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright 2021-2023 Protocol Labs
22
// SPDX-License-Identifier: Apache-2.0, MIT
33

4+
use anyhow::Error;
45
use fil_actors_runtime::actor_dispatch;
56
use fil_actors_runtime::actor_error;
67
use fil_actors_runtime::builtin::singletons::SYSTEM_ACTOR_ADDR;
@@ -50,13 +51,16 @@ impl Actor {
5051
// remove the oldest block if the AMT is full (note that this assume the
5152
// for_each_while iterates in order, which it seems to do)
5253
if blockhashes.count() > st.lookback_len {
53-
let mut first_idx = 0;
54-
blockhashes
55-
.for_each_while(|i, _: &BlockHash| {
56-
first_idx = i;
57-
Ok(false)
54+
let first_idx = blockhashes
55+
.iter()
56+
.map(|res| {
57+
let (i, _blockhash) = res?;
58+
Ok::<u64, Error>(i)
5859
})
59-
.unwrap();
60+
.next()
61+
.expect("Blockhashes is not empty")
62+
.expect("Blockhashes does not contain an error variant result");
63+
6064
blockhashes.delete(first_idx).unwrap();
6165
}
6266

0 commit comments

Comments
 (0)