-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
State diff on root mismatch option #738
Merged
Merged
Changes from 16 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
c4581a1
State diff on root mismatch option
austinabell 34a15b5
Fix resolution to ignore non hash link Cids
austinabell 956d79b
Update colored output dep
austinabell 0a19c2e
headers
austinabell 00abc00
Update cid codec checks
austinabell 66d87de
Try to resolve actor states before defaulting to base Ipld resolve
austinabell 7040df3
Update error message
austinabell 496d3af
Support extracted vectors by ignoring links that don't exist in store
austinabell 489a128
remove unnecessary skip
austinabell a0f0960
Fix incorrect test case
austinabell 93a8da6
Fix error type on feature
austinabell 129cbb9
merge and resolve
austinabell 0be224e
trigger CI
austinabell f3301d7
basefee conversion from float for now
austinabell 37c1176
Change to unwrap
austinabell 34e58d2
Merge branch 'main' of github.com:ChainSafe/forest into austin/statediff
austinabell 6b93ea3
clean up resolve logic
austinabell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright 2020 ChainSafe Systems | ||
// SPDX-License-Identifier: Apache-2.0, MIT | ||
|
||
use super::BlockStore; | ||
use cid::{Cid, Codec}; | ||
use forest_ipld::Ipld; | ||
use std::error::Error as StdError; | ||
|
||
/// Resolves link to recursively resolved Ipld with no hash links. | ||
pub fn resolve_cids_recursive<BS>(bs: &BS, cid: &Cid) -> Result<Ipld, Box<dyn StdError>> | ||
where | ||
BS: BlockStore, | ||
{ | ||
let mut ipld = bs | ||
.get(cid)? | ||
.ok_or_else(|| "Cid does not exist in blockstore")?; | ||
|
||
resolve_ipld(bs, &mut ipld)?; | ||
|
||
Ok(ipld) | ||
} | ||
|
||
/// Resolves Ipld links recursively, building an Ipld structure with no hash links. | ||
pub fn resolve_ipld<BS>(bs: &BS, ipld: &mut Ipld) -> Result<(), Box<dyn StdError>> | ||
where | ||
BS: BlockStore, | ||
{ | ||
match ipld { | ||
Ipld::Map(m) => { | ||
for (_, v) in m.iter_mut() { | ||
resolve_ipld(bs, v)?; | ||
} | ||
} | ||
Ipld::List(list) => { | ||
for v in list.iter_mut() { | ||
resolve_ipld(bs, v)?; | ||
} | ||
} | ||
link @ Ipld::Link(_) => { | ||
let resolved: Option<Ipld> = if let Ipld::Link(cid) = link { | ||
if cid.codec != Codec::DagCBOR { | ||
return Ok(()); | ||
} | ||
bs.get(cid)? | ||
} else { | ||
unreachable!() | ||
}; | ||
|
||
if let Some(ipld) = resolved { | ||
*link = ipld; | ||
} | ||
} | ||
_ => (), | ||
} | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah ya oops, for some reason I thought ipld would not be able to be overwritten while cid was bound in the match