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

feat: integration to preprod and preview networks #177

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ authors = ["Santiago Carmuega <[email protected]>"]


[dependencies]
pallas = { git = "https://github.com/txpipe/pallas.git", features = ["unstable"] }
pallas = { git = "https://github.com/txpipe/pallas.git", branch = "feat/protocol-parameters-preprod-and-preview", features = ["unstable"] }
# pallas = { version = "^0.23", features = ["unstable"] }
# pallas = { path = "../pallas/pallas", features = ["unstable"] }

Expand Down
6 changes: 6 additions & 0 deletions src/bin/dolos/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ pub struct Args {
#[arg(long, short)]
epoch: u64,

#[arg(long, short)]
block_slot: u64,

#[arg(long, short)]
network_id: u8,
}
Expand Down Expand Up @@ -82,6 +85,9 @@ pub fn run(config: &super::Config, args: &Args) -> miette::Result<()> {
},
&ledger,
args.epoch,
args.block_slot,
config.upstream.network_magic as u32,
config.upstream.network_id,
)
.into_diagnostic()
.context("computing protocol params")?;
Expand Down
13 changes: 11 additions & 2 deletions src/sync/ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ pub struct Stage {
ledger: ApplyDB,
byron: byron::GenesisFile,
shelley: shelley::GenesisFile,
network_magic: u64,
network_id: u8,

current_pparams: Option<(u64, Environment)>,

Expand All @@ -41,6 +43,8 @@ impl Stage {
byron: byron::GenesisFile,
shelley: shelley::GenesisFile,
phase1_validation_enabled: bool,
network_magic: u64,
network_id: u8,
) -> Self {
Self {
ledger,
Expand All @@ -50,6 +54,8 @@ impl Stage {
.unwrap(),
byron,
shelley,
network_magic,
network_id,
current_pparams: None,
phase1_validation_enabled,
upstream: Default::default(),
Expand All @@ -58,7 +64,7 @@ impl Stage {
}
}

fn ensure_pparams(&mut self, epoch: u64) -> Result<(), WorkerError> {
fn ensure_pparams(&mut self, epoch: u64, block_slot: u64) -> Result<(), WorkerError> {
if self
.current_pparams
.as_ref()
Expand All @@ -74,6 +80,9 @@ impl Stage {
},
&self.ledger,
epoch,
block_slot,
self.network_magic as u32,
self.network_id,
)?;

warn!(?pparams, "pparams for new epoch");
Expand Down Expand Up @@ -152,7 +161,7 @@ impl gasket::framework::Worker<Stage> for Worker {
if stage.phase1_validation_enabled {
debug!("performing phase-1 validations");
let (epoch, _) = block.epoch(&stage.genesis_values);
stage.ensure_pparams(epoch)?;
stage.ensure_pparams(epoch, block.slot())?;
stage.execute_phase1_validation(&block)?;
}

Expand Down
9 changes: 8 additions & 1 deletion src/sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,14 @@ pub fn pipeline(
let mut roll = roll::Stage::new(wal, cursor_chain, cursor_ledger);

let mut chain = chain::Stage::new(chain);
let mut ledger = ledger::Stage::new(ledger, byron, shelley, config.phase1_validation_enabled);
let mut ledger = ledger::Stage::new(
ledger,
byron,
shelley,
config.phase1_validation_enabled,
config.network_magic,
config.network_id,
);

let (to_roll, from_pull) = gasket::messaging::tokio::mpsc_channel(50);
pull.downstream.connect(to_roll);
Expand Down
Loading
Loading