Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraccaman committed Dec 17, 2024
1 parent 509c992 commit fbbd3bd
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 18 deletions.
3 changes: 2 additions & 1 deletion chain/src/repository/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ pub fn insert_tokens(
#[cfg(test)]
mod tests {

use std::collections::HashSet;

use anyhow::Context;
use diesel::{
BoolExpressionMethods, ExpressionMethods, QueryDsl, SelectableHelper,
Expand All @@ -86,7 +88,6 @@ mod tests {
use shared::balance::{Amount, Balance};
use shared::id::Id;
use shared::token::IbcToken;
use std::collections::HashSet;
use test_helpers::db::TestDb;

use super::*;
Expand Down
6 changes: 4 additions & 2 deletions orm/src/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ impl BlockInsertDb {
pub fn fake(height: i32) -> Self {
Self {
height,
hash: Some(height.to_string()), /* fake hash but ensures uniqueness
hash: Some(height.to_string()), /* fake hash but ensures
* uniqueness
* with height */
app_hash: Some("fake_app_hash".to_string()), // doesn't require uniqueness
app_hash: Some("fake_app_hash".to_string()), /* doesn't require
* uniqueness */
timestamp: Some(
chrono::DateTime::from_timestamp(0, 0).unwrap().naive_utc(),
),
Expand Down
60 changes: 50 additions & 10 deletions orm/src/schema.rs
Original file line number Diff line number Diff line change
@@ -1,43 +1,83 @@
// @generated automatically by Diesel CLI.

pub mod sql_types {
#[derive(diesel::query_builder::QueryId, std::fmt::Debug, diesel::sql_types::SqlType)]
#[derive(
diesel::query_builder::QueryId,
std::fmt::Debug,
diesel::sql_types::SqlType,
)]
#[diesel(postgres_type(name = "crawler_name"))]
pub struct CrawlerName;

#[derive(diesel::query_builder::QueryId, std::fmt::Debug, diesel::sql_types::SqlType)]
#[derive(
diesel::query_builder::QueryId,
std::fmt::Debug,
diesel::sql_types::SqlType,
)]
#[diesel(postgres_type(name = "governance_kind"))]
pub struct GovernanceKind;

#[derive(diesel::query_builder::QueryId, std::fmt::Debug, diesel::sql_types::SqlType)]
#[derive(
diesel::query_builder::QueryId,
std::fmt::Debug,
diesel::sql_types::SqlType,
)]
#[diesel(postgres_type(name = "governance_result"))]
pub struct GovernanceResult;

#[derive(diesel::query_builder::QueryId, std::fmt::Debug, diesel::sql_types::SqlType)]
#[derive(
diesel::query_builder::QueryId,
std::fmt::Debug,
diesel::sql_types::SqlType,
)]
#[diesel(postgres_type(name = "governance_tally_type"))]
pub struct GovernanceTallyType;

#[derive(diesel::query_builder::QueryId, std::fmt::Debug, diesel::sql_types::SqlType)]
#[derive(
diesel::query_builder::QueryId,
std::fmt::Debug,
diesel::sql_types::SqlType,
)]
#[diesel(postgres_type(name = "ibc_status"))]
pub struct IbcStatus;

#[derive(diesel::query_builder::QueryId, std::fmt::Debug, diesel::sql_types::SqlType)]
#[derive(
diesel::query_builder::QueryId,
std::fmt::Debug,
diesel::sql_types::SqlType,
)]
#[diesel(postgres_type(name = "token_type"))]
pub struct TokenType;

#[derive(diesel::query_builder::QueryId, std::fmt::Debug, diesel::sql_types::SqlType)]
#[derive(
diesel::query_builder::QueryId,
std::fmt::Debug,
diesel::sql_types::SqlType,
)]
#[diesel(postgres_type(name = "transaction_kind"))]
pub struct TransactionKind;

#[derive(diesel::query_builder::QueryId, std::fmt::Debug, diesel::sql_types::SqlType)]
#[derive(
diesel::query_builder::QueryId,
std::fmt::Debug,
diesel::sql_types::SqlType,
)]
#[diesel(postgres_type(name = "transaction_result"))]
pub struct TransactionResult;

#[derive(diesel::query_builder::QueryId, std::fmt::Debug, diesel::sql_types::SqlType)]
#[derive(
diesel::query_builder::QueryId,
std::fmt::Debug,
diesel::sql_types::SqlType,
)]
#[diesel(postgres_type(name = "validator_state"))]
pub struct ValidatorState;

#[derive(diesel::query_builder::QueryId, std::fmt::Debug, diesel::sql_types::SqlType)]
#[derive(
diesel::query_builder::QueryId,
std::fmt::Debug,
diesel::sql_types::SqlType,
)]
#[diesel(postgres_type(name = "vote_kind"))]
pub struct VoteKind;
}
Expand Down
8 changes: 5 additions & 3 deletions shared/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,16 @@ pub struct Block {
pub hash: Id,
pub header: BlockHeader,
pub transactions: Vec<(WrapperTransaction, Vec<InnerTransaction>)>,
pub epoch: Epoch
pub epoch: Epoch,
}

impl Block {
pub fn from(
block_response: &TendermintBlockResponse,
block_results: &BlockResult,
proposer_address_namada: &Option<Id>, // Provide the namada address of the proposer, if available
proposer_address_namada: &Option<Id>, /* Provide the namada address
* of the proposer, if
* available */
checksums: Checksums,
epoch: Epoch,
block_height: BlockHeight,
Expand Down Expand Up @@ -154,7 +156,7 @@ impl Block {
app_hash: Id::from(&block_response.block.header.app_hash),
},
transactions,
epoch
epoch,
}
}

Expand Down
3 changes: 1 addition & 2 deletions shared/src/block_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,7 @@ impl BlockResult {
}

pub fn gas_used(&self, tx_hash: &Id) -> Option<String> {
self
.end_events
self.end_events
.iter()
.filter_map(|event| {
if let Some(TxAttributesType::TxApplied(data)) =
Expand Down

0 comments on commit fbbd3bd

Please sign in to comment.