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: improve access to genesis utxos #302

Merged
merged 2 commits into from
Oct 4, 2023
Merged
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
21 changes: 2 additions & 19 deletions pallas-addresses/src/byron.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,10 @@ impl From<AddressPayload> for ByronAddress {
#[derive(Debug, Encode, Decode, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ByronAddress {
#[n(0)]
payload: TagWrap<ByteVec, 24>,
pub payload: TagWrap<ByteVec, 24>,

#[n(1)]
crc: u32,
pub crc: u32,
}

const CRC: crc::Crc<u32> = crc::Crc::<u32>::new(&crc::CRC_32_ISO_HDLC);
Expand Down Expand Up @@ -343,11 +343,6 @@ mod tests {
"Ae2tdPwUPEZLs4HtbuNey7tK4hTKrwNwYtGqp7bDfCy2WdR3P6735W5Yfpe",
];

// const ROOT_HASH: &str = "7e9ee4a9527dea9091e2d580edd6716888c42f75d96276290f98fe0b";

//const NON_AVVM_BYRON_ADDRESS_FROM_PREVIEW_GENESIS =
// "FHnt4NL7yPXjpZtYj1YUiX9QYYUZGXDT9gA2PJXQFkTSMx3EgawXK5BUrCHdhe2";

#[test]
fn roundtrip_base58() {
for vector in TEST_VECTORS {
Expand Down Expand Up @@ -376,16 +371,4 @@ mod tests {
assert_eq!(crc2, addr.crc);
}
}

// #[test]
// fn address_id_matches() {
// let addr = ByronAddress::from_base58(TEST_VECTOR).unwrap();

// let payload = addr.decode().unwrap();
// let computed =
// AddressPayload::hash_address_id(&payload.addrtype, spending_data,
// &payload.attributes);

// assert_eq!(payload.root.to_string(), ROOT_HASH);
// }
}
7 changes: 7 additions & 0 deletions pallas-configs/src/byron.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ pub fn genesis_non_avvm_utxos(config: &GenesisFile) -> Vec<GenesisUtxo> {
.collect()
}

pub fn genesis_utxos(config: &GenesisFile) -> Vec<GenesisUtxo> {
let avvm = genesis_avvm_utxos(config);
let non_avvm = genesis_non_avvm_utxos(config);

[avvm, non_avvm].concat().to_vec()
}

#[cfg(test)]
mod tests {
use std::str::FromStr;
Expand Down
Loading