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

refactor(cat-gateway): update MultiEraBlock and MultiEraTx to use with WithRawAuxiliary suffix #1043

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
6 changes: 3 additions & 3 deletions catalyst-gateway/bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ workspace = true
cardano-chain-follower = { version = "0.0.5", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "cardano-chain-follower-v0.0.5" }
c509-certificate = { version = "0.0.3", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "v0.0.3" }

pallas = { version = "0.30.1", git = "https://github.com/input-output-hk/catalyst-pallas.git", rev = "9b5183c8b90b90fe2cc319d986e933e9518957b3" }
pallas-traverse = { version = "0.30.1", git = "https://github.com/input-output-hk/catalyst-pallas.git", rev = "9b5183c8b90b90fe2cc319d986e933e9518957b3" }
#pallas-crypto = { version = "0.30.1", git = "https://github.com/input-output-hk/catalyst-pallas.git", rev = "9b5183c8b90b90fe2cc319d986e933e9518957b3" }
pallas = { version = "0.31.0", git = "https://github.com/input-output-hk/catalyst-pallas.git", rev = "51c0aa752926ecebafbf7b4ba90f62f835b78805" }
pallas-traverse = { version = "0.31.0", git = "https://github.com/input-output-hk/catalyst-pallas.git", rev = "51c0aa752926ecebafbf7b4ba90f62f835b78805" }
#pallas-crypto = { version = "0.31.0", git = "https://github.com/input-output-hk/catalyst-pallas.git", rev = "51c0aa752926ecebafbf7b4ba90f62f835b78805" }

clap = { version = "4.5.20", features = ["derive", "env"] }
tracing = { version = "0.1.40", features = ["log"] }
Expand Down
2 changes: 1 addition & 1 deletion catalyst-gateway/bin/src/cardano/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub fn extract_stake_credentials_from_certs(
StakeCredential::AddrKeyhash(stake_credential) => {
stake_credentials.push(hex::encode(stake_credential.as_slice()));
},
StakeCredential::Scripthash(_) => (),
StakeCredential::ScriptHash(_) => (),
}
},
_ => continue,
Expand Down
6 changes: 3 additions & 3 deletions catalyst-gateway/bin/src/db/index/block/certs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ impl CertInsertQuery {
// witnessed.
(cred.to_vec(), addr.clone(), false)
},
pallas::ledger::primitives::conway::StakeCredential::Scripthash(script) => {
pallas::ledger::primitives::conway::StakeCredential::ScriptHash(script) => {
(script.to_vec(), default_addr, true)
},
};
Expand Down Expand Up @@ -251,8 +251,8 @@ impl CertInsertQuery {

/// Index the certificates in a transaction.
pub(crate) fn index(
&mut self, txs: &pallas::ledger::traverse::MultiEraTx<'_>, slot_no: u64, txn: i16,
block: &MultiEraBlock,
&mut self, txs: &pallas::ledger::traverse::MultiEraTxWithRawAuxiliary<'_>, slot_no: u64,
txn: i16, block: &MultiEraBlock,
) {
#[allow(clippy::match_same_arms)]
txs.certs().iter().for_each(|cert| {
Expand Down
4 changes: 3 additions & 1 deletion catalyst-gateway/bin/src/db/index/block/txi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ impl TxiInsertQuery {
}

/// Index the transaction Inputs.
pub(crate) fn index(&mut self, txs: &pallas_traverse::MultiEraTx<'_>, slot_no: u64) {
pub(crate) fn index(
&mut self, txs: &pallas_traverse::MultiEraTxWithRawAuxiliary<'_>, slot_no: u64,
) {
// Index the TXI's.
for txi in txs.inputs() {
let txn_hash = txi.hash().to_vec();
Expand Down
10 changes: 5 additions & 5 deletions catalyst-gateway/bin/src/db/index/block/txo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ impl TxoInsertQuery {

/// Index the transaction Inputs.
pub(crate) fn index(
&mut self, txs: &pallas::ledger::traverse::MultiEraTx<'_>, slot_no: u64, txn_hash: &[u8],
txn: i16,
&mut self, txs: &pallas::ledger::traverse::MultiEraTxWithRawAuxiliary<'_>, slot_no: u64,
txn_hash: &[u8], txn: i16,
) {
let txn_id = hex::encode_upper(txn_hash);

Expand All @@ -159,7 +159,7 @@ impl TxoInsertQuery {
txn,
txo_index,
&address,
txo.lovelace_amount(),
txo.value().coin(),
txn_hash,
);

Expand All @@ -171,13 +171,13 @@ impl TxoInsertQuery {
slot_no,
txn,
&address,
txo.lovelace_amount(),
txo.value().coin(),
);

self.unstaked_txo.push(params);
}

for asset in txo.non_ada_assets() {
for asset in txo.value().assets() {
let policy_id = asset.policy().to_vec();
for policy_asset in asset.assets() {
if policy_asset.is_output() {
Expand Down
Loading