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

Fix serialization issue #319

Merged
merged 12 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ target/

.vscode/

.env
.env

**/.idea
2 changes: 1 addition & 1 deletion backend-rust/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ services:
- ./data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: ${PGPASSWORD}
POSTGRES_DB: ccd-scan
POSTGRES_DB: ccdscan
lassemand marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 0 additions & 4 deletions backend-rust/src/graphql_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4159,7 +4159,6 @@ pub fn events_from_summary(
} => {
vec![Event::DataRegistered(DataRegistered {
data_as_hex: hex::encode(data.as_ref()),
decoded: DecodedText::from_bytes(data.as_ref()),
})]
}
AccountTransactionEffects::BakerConfigured {
Expand Down Expand Up @@ -4675,7 +4674,6 @@ impl TryFrom<concordium_rust_sdk::types::RejectReason> for TransactionRejectReas
impl From<concordium_rust_sdk::types::Memo> for TransferMemo {
fn from(value: concordium_rust_sdk::types::Memo) -> Self {
TransferMemo {
decoded: DecodedText::from_bytes(value.as_ref()),
raw_hex: hex::encode(value.as_ref()),
}
}
Expand Down Expand Up @@ -4918,7 +4916,6 @@ pub struct CredentialsUpdated {

#[derive(SimpleObject, serde::Serialize, serde::Deserialize)]
pub struct DataRegistered {
decoded: DecodedText,
data_as_hex: String,
}

Expand Down Expand Up @@ -5005,7 +5002,6 @@ impl TryFrom<concordium_rust_sdk::types::NewEncryptedAmountEvent> for NewEncrypt

#[derive(SimpleObject, serde::Serialize, serde::Deserialize)]
pub struct TransferMemo {
decoded: DecodedText,
raw_hex: String,
}

Expand Down
19 changes: 18 additions & 1 deletion backend-rust/src/indexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ use prometheus_client::{
},
registry::Registry,
};
use sqlx::PgPool;
use sqlx::{Execute, PgPool};
use tokio::{time::Instant, try_join};
use tokio_util::sync::CancellationToken;
use tracing::{error, info, warn};
use base64::{encode, DecodeError};

/// Service traversing each block of the chain, indexing it into a database.
///
Expand Down Expand Up @@ -786,6 +787,21 @@ impl PreparedBlock {
context.last_finalized_hash = block.block_last_finalized.clone();
}
}
// Log each argument
println!("Heights: {:?}", heights);
println!("Hashes: {:?}", hashes);
println!("Slot Times: {:?}", slot_times);
println!("Block Times: {:?}", block_times);
println!(
"Baker IDs: {:?}",
baker_ids
.iter()
.map(|id| id.map_or("NULL".to_string(), |v| v.to_string()))
.collect::<Vec<_>>()
);
println!("Total Amounts: {:?}", total_amounts);
println!("Total Staked: {:?}", total_staked);
println!("Cumulative Num TXs: {:?}", cumulative_num_txss);

sqlx::query!(
r#"INSERT INTO blocks
Expand Down Expand Up @@ -960,6 +976,7 @@ impl PreparedBlockItem {
&self,
tx: &mut sqlx::Transaction<'static, sqlx::Postgres>,
) -> anyhow::Result<()> {

let tx_idx = sqlx::query_scalar!(
"INSERT INTO transactions (
index,
Expand Down
Loading