Skip to content
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

Remove cardano net and remove unecessary network settings #65

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

ecioppettini
Copy link
Contributor

This PR replaces the cardano-net crate por pallas-network.

There are 2 reasons for this:

  1. One is to be able to have the newer protocol versions, since cardano-net is unmaintained.
  2. Pallas-network exposes the full chainsync api, which allows us to remove the hacky genesis and genesis_parent settings. These were added as a workaround to the fact that it's not possible to pass Point::Origin to the blockfetch protocol, so we needed to know the first block (and the fact that we wanted the first block). But now this is replaced by using the RequestNext message, which gives us the first block. This is especially useful to setup custom networks, since getting the first block data is otherwise an annoying extra step that requires some form of extra indexer.

Besides the above, this PR makes the Era settings optional, in which case the epochs are not computed. We need to have the setting for Milkomeda, since we don't parse the entire chain there, so we can't know when shelley started, but in carp we can figure this out (although it has some tricky parts). This is mostly (again) done to simplify using carp with new networks.

Also, the from setting is made optional. This is still needed for some internal reasons (the interaction with the multiverse), but we should be able to remove it eventually.

There is however some follow up work that this PR doesn't cover:

  1. We probably can get rid of the source that uses the multiverse to handle rollbacks, and just put the logic directly in the cardano source, by using the chainsync Rollback messages.
  2. Adding support for unix sockets instead of only dns and port. Not needed but nice to have.
  3. We may want to re-work the code into using

@ecioppettini ecioppettini self-assigned this Sep 24, 2024
todo!();
};

let (slot, hash) = match raw_header.variant {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rooooooooob I was wondering if it would make sense to have this logic be in CML somehow? Or if there is already a way of writing this that I didn't think about.

Copy link
Contributor

@rooooooooob rooooooooob Sep 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have part of this code in the MultiEraBlock::hash() (in multi_era/rust/src/utils.rs) for the hash part, but not the slot/difficulty part.

I guess this might not be relevant though since you'd need the whole block not just the header though. It's not a huge amount of code so it could be fine to just duplicate it here or we could expose just the header part.

},
}
} else {
todo!();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo?

"preprod" => dcspark_blockchain_source::cardano::NetworkConfiguration::preprod(),
"preview" => dcspark_blockchain_source::cardano::NetworkConfiguration::preview(),
"sancho" => dcspark_blockchain_source::cardano::NetworkConfiguration::sancho(),
_ => return Err(anyhow::anyhow!("network not supported by source")),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

won't this break for localhost?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just a testing tool, it's just designed as a quick way to get blocks to test deserialization (without having to sync the entire chain with carp), at least that was the purpose of the original oura fetcher, which this replaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants