Skip to content

Commit

Permalink
feat(applying): scaffold Shelley phase-1 validations
Browse files Browse the repository at this point in the history
  • Loading branch information
MaicoLeberle committed Nov 15, 2023
1 parent 317e23f commit 478aac1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pallas-applying/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
//! Logic for validating and applying new blocks and txs to the chain state
pub mod byron;
pub mod shelley;

Check failure on line 4 in pallas-applying/src/lib.rs

View workflow job for this annotation

GitHub Actions / Test Suite

file not found for module `shelley`

Check failure on line 4 in pallas-applying/src/lib.rs

View workflow job for this annotation

GitHub Actions / Check (windows-latest, stable)

file not found for module `shelley`

Check failure on line 4 in pallas-applying/src/lib.rs

View workflow job for this annotation

GitHub Actions / Check (ubuntu-latest, stable)

file not found for module `shelley`

Check failure on line 4 in pallas-applying/src/lib.rs

View workflow job for this annotation

GitHub Actions / Check (macOS-latest, stable)

file not found for module `shelley`
pub mod types;

use byron::validate_byron_tx;

use pallas_traverse::{MultiEraTx, MultiEraTx::Byron as ByronTxPayload};
use pallas_traverse::{
Era, MultiEraTx, MultiEraTx::AlonzoCompatible, MultiEraTx::Byron as ByronTxPayload,
};
use shelley::validate_shelley_tx;

Check failure on line 11 in pallas-applying/src/lib.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unresolved import `shelley::validate_shelley_tx`

Check failure on line 11 in pallas-applying/src/lib.rs

View workflow job for this annotation

GitHub Actions / Check (windows-latest, stable)

unresolved import `shelley::validate_shelley_tx`

Check failure on line 11 in pallas-applying/src/lib.rs

View workflow job for this annotation

GitHub Actions / Check (ubuntu-latest, stable)

unresolved import `shelley::validate_shelley_tx`

Check failure on line 11 in pallas-applying/src/lib.rs

View workflow job for this annotation

GitHub Actions / Check (macOS-latest, stable)

unresolved import `shelley::validate_shelley_tx`

pub use types::{Environment, MultiEraProtParams, UTxOs, ValidationResult};

Expand All @@ -18,6 +21,13 @@ pub fn validate(metx: &MultiEraTx, utxos: &UTxOs, env: &Environment) -> Validati
prot_magic,
},
) => validate_byron_tx(mtxp, utxos, bpp, prot_magic),
(
AlonzoCompatible(shelley_minted_tx, Era::Shelley),
Environment {
prot_params: MultiEraProtParams::Shelley(spp),
prot_magic,
},
) => validate_shelley_tx(shelley_minted_tx, utxos, spp, prot_magic),
// TODO: implement the rest of the eras.
_ => Ok(()),
}
Expand Down
4 changes: 4 additions & 0 deletions pallas-applying/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ pub struct ByronProtParams {
pub max_tx_size: u64,
}

#[derive(Debug, Clone)]
pub struct ShelleyProtParams;

// TODO: add variants for the other eras.
#[derive(Debug)]
#[non_exhaustive]
pub enum MultiEraProtParams {
Byron(ByronProtParams),
Shelley(ShelleyProtParams),
}

#[derive(Debug)]
Expand Down

0 comments on commit 478aac1

Please sign in to comment.