-
Notifications
You must be signed in to change notification settings - Fork 159
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
refactor: simplify ChainIndex
, hoist out checkpoints
#3220
Conversation
…psets are resolved
This needs to be reviewed first: #3216 |
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.
Generally happy with these changes, only serious comment is #3220 (comment)
# This file maps epochs to block headers for calibnet and mainnet. Forest use | ||
# this mapping to quickly identify the origin network of a tipset. | ||
# | ||
# Block headers can be inspected on filfox: | ||
# - https://filfox.info/en/block/bafy2bzacebnfm6dvxo7sm5thcxnv3kttoamb53uxycnvtdxgk5mh7d73qlly2 | ||
# - https://calibration.filfox.info/en/block/bafy2bzacedhkkz76zdekpexha55b42eop42e24ajmajm26wws4nbvtq7louvu | ||
# | ||
# This file was generated with `forest-cli archive checkpoints` |
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.
new issue:
I'd like to remove the serialization for this, and turn it into rust code, probably using something like databake, but that's a little heavyweight - we could then just
struct KnownBlocks<'a> {
calibnet: &'a [(i64, Cid)],
mainnet: &'a [(i64, Cid)],
}
const KNOWN_BLOCKS: KnownBlocks<'static> = todo!();
Unfortunately, multihash and cid aren't there yet:
multiformats/rust-cid#138
multiformats/rust-multihash#330
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.
Why should it be Rust code?
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.
It's less work, and makes an error state impossible.
Consider this:
use std::net::Ipv4Addr;
const MEH: &str = "127.0.0.1";
const NICE: Ipv4Addr = Ipv4Addr::new(127, 0, 0, 1);
fn meh() -> Ipv4Addr {
MEH.parse().unwrap()
}
fn nice() -> Ipv4Addr {
NICE
}
Why should meh()
need to unwrap
, when it can be NICE
?
NICE
also facilitates inlining, and all that other good stuff :)
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.
Even the simple case can't be const-evaluated by the compiler: https://godbolt.org/z/ooqGrhdxE
Co-authored-by: Aatif Syed <38045910+aatifsyed@users.noreply.github.com>
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.
rock-solid
Summary of changes
Changes introduced in this pull request:
tipset_by_height
fromChainStore
toChainIndex
.forest-cli archive checkpoints
command for generating new checkpoints.Reference issue to close (if applicable)
Closes
Other information and links
Change checklist