Skip to content

Commit

Permalink
sync upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
Nagaprasadvr committed Jan 30, 2025
2 parents c8ffa02 + c004ce4 commit 970afa8
Show file tree
Hide file tree
Showing 56 changed files with 3,159 additions and 627 deletions.
99 changes: 36 additions & 63 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ members = [
"digital_asset_types",
"integration_tests",
"metaplex-rpc-proxy",
"metadata_json",
"migration",
"nft_ingester",
"ops",
Expand Down Expand Up @@ -48,6 +49,7 @@ cargo-lock = "9.0.0"
chrono = "0.4.19"
clap = "4.2.2"
das-core = { path = "core" }
das-metadata-json = { path = "metadata_json" }
das-bubblegum = { path = "bubblegum" }
das_api = { path = "das_api" }
derive_more = { version = "0.99.17" }
Expand Down
Empty file added backfiller.yaml
Empty file.
2 changes: 1 addition & 1 deletion core/src/metadata_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub async fn create_download_metadata_notifier(
})
}

#[derive(Parser, Clone, Debug)]
#[derive(Parser, Clone, Debug, PartialEq, Eq)]
pub struct MetadataJsonDownloadWorkerArgs {
/// The number of worker threads
#[arg(long, env, default_value = "25")]
Expand Down
2 changes: 1 addition & 1 deletion das_api/src/api/api_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub struct DasApi {
impl DasApi {
pub async fn from_config(config: Config) -> Result<Self, DasApiError> {
let pool = PgPoolOptions::new()
.max_connections(250)
.max_connections(config.max_database_connections.unwrap_or(250))
.connect(&config.database_url)
.await?;

Expand Down
2 changes: 2 additions & 0 deletions das_api/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use {
#[derive(Deserialize, Default)]
pub struct Config {
pub database_url: String,
pub max_database_connections: Option<u32>,
pub max_request_connections: Option<u32>,
pub metrics_port: Option<u16>,
pub metrics_host: Option<String>,
pub server_port: u16,
Expand Down
1 change: 1 addition & 0 deletions das_api/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ async fn main() -> Result<(), DasApiError> {

let server = ServerBuilder::default()
.set_middleware(middleware)
.max_connections(config.max_request_connections.unwrap_or(100))
.set_logger(MetricMiddleware)
.build(addr)
.await?;
Expand Down
67 changes: 67 additions & 0 deletions digital_asset_types/src/dao/generated/tree_transactions.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.5
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;

impl EntityName for Entity {
fn table_name(&self) -> &str {
"tree_transactions"
}
}

#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub signature: String,
pub tree: String,
pub slot: i64,
pub created_at: Option<DateTimeWithTimeZone>,
pub processed_at: Option<DateTimeWithTimeZone>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Signature,
Tree,
Slot,
CreatedAt,
ProcessedAt,
}

#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Signature,
}

impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}

#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {}

impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Signature => ColumnType::Text.def(),
Self::Tree => ColumnType::Text.def(),
Self::Slot => ColumnType::BigInteger.def(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::ProcessedAt => ColumnType::TimestampWithTimeZone.def().null(),
}
}
}

impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
panic!("No RelationDef")
}
}

impl ActiveModelBehavior for ActiveModel {}
36 changes: 36 additions & 0 deletions digital_asset_types/src/dapi/signatures_for_asset.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
use crate::dao::scopes;
use crate::dao::PageOptions;
use crate::rpc::filter::AssetSorting;
use crate::rpc::response::TransactionSignatureList;
use sea_orm::DatabaseConnection;
use sea_orm::DbErr;
use super::common::build_transaction_signatures_response;
use super::common::{build_asset_response, create_pagination, create_sorting};


pub async fn get_signatures_for_asset(
db: &DatabaseConnection,
asset_id: Option<Vec<u8>>,
tree: Option<Vec<u8>>,
leaf_idx: Option<i64>,
sorting: AssetSorting,
page_options: &PageOptions,
) -> Result<TransactionSignatureList, DbErr> {
let pagination = create_pagination(&page_options)?;
let (sort_direction, sort_column) = create_sorting(sorting);
let transactions = scopes::asset::get_signatures_for_asset(
db,
asset_id,
tree,
leaf_idx,
sort_direction,
&pagination,
page_options.limit
)
.await?;
Ok(build_transaction_signatures_response(
transactions,
page_options.limit,
&pagination,
))
}
9 changes: 9 additions & 0 deletions digital_asset_types/src/rpc/display_options.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, JsonSchema, Default)]
#[serde(deny_unknown_fields, rename_all = "camelCase")]
pub struct DisplayOptions {
#[serde(default)]
pub show_unverified_collections: bool,
}
16 changes: 7 additions & 9 deletions grpc-ingest/src/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ impl SubscriptionTask {
"*",
account.encode_to_vec(),
);
debug!(target: "grpc2redis", action = "process_account_update", label = ?label, stream = ?stream, maxlen = ?stream_maxlen);
}

UpdateOneof::Transaction(transaction) => {
Expand All @@ -272,7 +271,6 @@ impl SubscriptionTask {
"*",
transaction.encode_to_vec(),
);
debug!(target: "grpc2redis", action = "process_transaction_update", label = ?label, stream = ?stream, maxlen = ?stream_maxlen);
}
_ => {
warn!(target: "grpc2redis", action = "unknown_update_variant", label = ?label, message = "Unknown update variant");
Expand Down Expand Up @@ -315,14 +313,14 @@ impl SubscriptionTask {
}
}
}
_ => {
break;
}
}
None | Some(Err(_)) => {
warn!(target: "grpc2redis", action = "stream_closed", message = "Stream closed, stopping subscription task", ?label);

let mut global_shutdown_tx = global_shutdown_tx.lock().await;
if let Some(global_shutdown_tx) = global_shutdown_tx.take() {
let _ = global_shutdown_tx.send(());
let mut global_shutdown_tx = global_shutdown_tx.lock().await;
if let Some(global_shutdown_tx) = global_shutdown_tx.take() {
let _ = global_shutdown_tx.send(());
}
}
}
}
_ = &mut shutdown_rx => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
source: integration_tests/tests/integration_tests/fungibles_and_token_extensions_tests.rs
expression: response
snapshot_kind: text
---
{
"interface": "FungibleToken",
"interface": "Custom",
"id": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"content": {
"$schema": "https://schema.metaplex.com/nft1.0.json",
Expand Down
Loading

0 comments on commit 970afa8

Please sign in to comment.