feat: scaffold Byron phase-1 validations (#300)
Co-authored-by: Santiago Carmuega <santiago@carmuega.me>
This commit is contained in:
parent
aafe37573a
commit
986ee75761
14 changed files with 306 additions and 19 deletions
|
|
@ -3,7 +3,7 @@
|
|||
//! Handcrafted, idiomatic rust artifacts based on based on the [Alonzo CDDL](https://github.com/input-output-hk/cardano-ledger/blob/master/eras/alonzo/test-suite/cddl-files/alonzo.cddl) file in IOHK repo.
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{fmt, ops::Deref};
|
||||
use std::{fmt, hash::Hash as StdHash, ops::Deref};
|
||||
|
||||
use pallas_codec::minicbor::{data::Tag, Decode, Encode};
|
||||
use pallas_crypto::hash::Hash;
|
||||
|
|
@ -78,7 +78,9 @@ pub struct Header {
|
|||
pub body_signature: Bytes,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Encode, Decode, Debug, PartialEq, Eq, PartialOrd, Ord, Clone)]
|
||||
#[derive(
|
||||
Serialize, Deserialize, Encode, Decode, Debug, PartialEq, Eq, PartialOrd, Ord, Clone, StdHash,
|
||||
)]
|
||||
pub struct TransactionInput {
|
||||
#[n(0)]
|
||||
pub transaction_id: Hash<32>,
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ use pallas_codec::utils::{
|
|||
// required for derive attrs to work
|
||||
use pallas_codec::minicbor;
|
||||
|
||||
use std::hash::Hash as StdHash;
|
||||
|
||||
// Basic Cardano Types
|
||||
|
||||
pub type Blake2b256 = Hash<32>;
|
||||
|
|
@ -64,7 +66,7 @@ pub struct Address {
|
|||
// Transactions
|
||||
|
||||
// txout = [address, u64]
|
||||
#[derive(Debug, Encode, Decode, Clone)]
|
||||
#[derive(Debug, Encode, Decode, Clone, PartialEq, Eq)]
|
||||
pub struct TxOut {
|
||||
#[n(0)]
|
||||
pub address: Address,
|
||||
|
|
@ -73,7 +75,7 @@ pub struct TxOut {
|
|||
pub amount: u64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, StdHash)]
|
||||
pub enum TxIn {
|
||||
// [0, #6.24(bytes .cbor ([txid, u32]))]
|
||||
Variant0(CborWrap<(TxId, u32)>),
|
||||
|
|
@ -121,7 +123,7 @@ impl<C> minicbor::Encode<C> for TxIn {
|
|||
}
|
||||
|
||||
// tx = [[+ txin], [+ txout], attributes]
|
||||
#[derive(Debug, Encode, Decode, Clone)]
|
||||
#[derive(Debug, Encode, Decode, Clone, PartialEq, Eq)]
|
||||
pub struct Tx {
|
||||
#[n(0)]
|
||||
pub inputs: MaybeIndefArray<TxIn>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue