Skip to content

Commit

Permalink
eth-bytecode-db: bump sea-orm to v0.12.2; bump blockscout-service-lau…
Browse files Browse the repository at this point in the history
…ncher to v0.8.0 (#604)

* Bump sea-orm to v0.12.2; bump blockscout-service-launcher to v0.8.0
  • Loading branch information
rimrakhimov authored Sep 4, 2023
1 parent 01400a4 commit edb289a
Show file tree
Hide file tree
Showing 18 changed files with 512 additions and 233 deletions.
668 changes: 473 additions & 195 deletions eth-bytecode-db/Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions eth-bytecode-db/eth-bytecode-db-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ amplify = { version = "3.13.0", features = ["derive"] }
anyhow = "1.0"
async-trait = "0.1"
blockscout-display-bytes = "1.0"
blockscout-service-launcher = { version = "0.7.1", features = [ "database-0_11" ] }
blockscout-service-launcher = { version = "0.8.0", features = [ "database-0_12" ] }
config = "0.13"
ethers = "2.0.0"
sea-orm = "0.11"
sea-orm = "0.12.2"
serde = "1.0"
serde_json = "1.0.96"
serde_with = "2.1"
Expand Down
10 changes: 5 additions & 5 deletions eth-bytecode-db/eth-bytecode-db-server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
},
settings::Settings,
};
use blockscout_service_launcher::LaunchSettings;
use blockscout_service_launcher::{database, launcher, launcher::LaunchSettings, tracing};
use eth_bytecode_db::verification::Client;
use migration::Migrator;
use std::sync::Arc;
Expand Down Expand Up @@ -52,7 +52,7 @@ impl Router {
}
}

impl blockscout_service_launcher::HttpRouter for Router {
impl launcher::HttpRouter for Router {
fn register_routes(&self, service_config: &mut actix_web::web::ServiceConfig) {
service_config.configure(|config| route_health(config, self.health.clone()));

Expand All @@ -72,11 +72,11 @@ impl blockscout_service_launcher::HttpRouter for Router {
}

pub async fn run(settings: Settings) -> Result<(), anyhow::Error> {
blockscout_service_launcher::init_logs(SERVICE_NAME, &settings.tracing, &settings.jaeger)?;
tracing::init_logs(SERVICE_NAME, &settings.tracing, &settings.jaeger)?;

let health = Arc::new(HealthService::default());

blockscout_service_launcher::database::initialize_postgres::<Migrator>(
database::initialize_postgres::<Migrator>(
&settings.database.url,
settings.database.create_database,
settings.database.run_migrations,
Expand Down Expand Up @@ -114,5 +114,5 @@ pub async fn run(settings: Settings) -> Result<(), anyhow::Error> {
metrics: settings.metrics,
};

blockscout_service_launcher::launch(&launch_settings, http_router, grpc_router).await
launcher::launch(&launch_settings, http_router, grpc_router).await
}
3 changes: 2 additions & 1 deletion eth-bytecode-db/eth-bytecode-db-server/src/settings.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use blockscout_service_launcher::{
JaegerSettings, MetricsSettings, ServerSettings, TracingSettings,
launcher::{MetricsSettings, ServerSettings},
tracing::{JaegerSettings, TracingSettings},
};
use config::{Config, File};
use serde::{de, Deserialize};
Expand Down
2 changes: 1 addition & 1 deletion eth-bytecode-db/eth-bytecode-db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ethabi = "18.0"
ethers-core = "2.0.0"
hex = "0.4"
mismatch = "1.0"
sea-orm = { version = "0.11", features = [
sea-orm = { version = "0.12.2", features = [
"sqlx-postgres",
"runtime-tokio-rustls",
"macros",
Expand Down
2 changes: 1 addition & 1 deletion eth-bytecode-db/eth-bytecode-db/entity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ name = "entity"
path = "src/lib.rs"

[dependencies]
sea-orm = { version = "0.11", features = [ "sqlx-postgres", "runtime-tokio-rustls", "macros" ] }
sea-orm = { version = "0.12.2", features = [ "sqlx-postgres", "runtime-tokio-rustls", "macros" ] }

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.2
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
use sea_orm::entity::prelude::*;

Expand Down
14 changes: 7 additions & 7 deletions eth-bytecode-db/eth-bytecode-db/entity/src/bytecodes.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.2
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
use super::sea_orm_active_enums::BytecodeType;
use sea_orm::entity::prelude::*;
Expand All @@ -16,6 +16,8 @@ pub struct Model {

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::bytecode_parts::Entity")]
BytecodeParts,
#[sea_orm(
belongs_to = "super::sources::Entity",
from = "Column::SourceId",
Expand All @@ -24,19 +26,17 @@ pub enum Relation {
on_delete = "NoAction"
)]
Sources,
#[sea_orm(has_many = "super::bytecode_parts::Entity")]
BytecodeParts,
}

impl Related<super::sources::Entity> for Entity {
impl Related<super::bytecode_parts::Entity> for Entity {
fn to() -> RelationDef {
Relation::Sources.def()
Relation::BytecodeParts.def()
}
}

impl Related<super::bytecode_parts::Entity> for Entity {
impl Related<super::sources::Entity> for Entity {
fn to() -> RelationDef {
Relation::BytecodeParts.def()
Relation::Sources.def()
}
}

Expand Down
2 changes: 1 addition & 1 deletion eth-bytecode-db/eth-bytecode-db/entity/src/files.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.2
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
use sea_orm::entity::prelude::*;

Expand Down
2 changes: 1 addition & 1 deletion eth-bytecode-db/eth-bytecode-db/entity/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.2
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
pub mod prelude;

Expand Down
2 changes: 1 addition & 1 deletion eth-bytecode-db/eth-bytecode-db/entity/src/parts.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.2
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
use super::sea_orm_active_enums::PartType;
use sea_orm::entity::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion eth-bytecode-db/eth-bytecode-db/entity/src/prelude.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.2
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
pub use super::{
bytecode_parts::Entity as BytecodeParts, bytecodes::Entity as Bytecodes,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.2
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
use sea_orm::entity::prelude::*;

#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, DeriveDisplay)]
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "bytecode_type")]
pub enum BytecodeType {
#[sea_orm(string_value = "creation_input")]
CreationInput,
#[sea_orm(string_value = "deployed_bytecode")]
DeployedBytecode,
}
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, DeriveDisplay)]
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "part_type")]
pub enum PartType {
#[sea_orm(string_value = "main")]
Main,
#[sea_orm(string_value = "metadata")]
Metadata,
}
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, DeriveDisplay)]
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "source_type")]
pub enum SourceType {
#[sea_orm(string_value = "solidity")]
Expand All @@ -28,7 +28,7 @@ pub enum SourceType {
#[sea_orm(string_value = "yul")]
Yul,
}
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, DeriveDisplay)]
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "verification_type")]
pub enum VerificationType {
#[sea_orm(string_value = "flattened_contract")]
Expand Down
2 changes: 1 addition & 1 deletion eth-bytecode-db/eth-bytecode-db/entity/src/source_files.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.2
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
use sea_orm::entity::prelude::*;

Expand Down
14 changes: 7 additions & 7 deletions eth-bytecode-db/eth-bytecode-db/entity/src/sources.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.2
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
use super::sea_orm_active_enums::SourceType;
use sea_orm::entity::prelude::*;
Expand Down Expand Up @@ -27,23 +27,23 @@ pub struct Model {

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::source_files::Entity")]
SourceFiles,
#[sea_orm(has_many = "super::bytecodes::Entity")]
Bytecodes,
#[sea_orm(has_many = "super::source_files::Entity")]
SourceFiles,
#[sea_orm(has_many = "super::verified_contracts::Entity")]
VerifiedContracts,
}

impl Related<super::source_files::Entity> for Entity {
impl Related<super::bytecodes::Entity> for Entity {
fn to() -> RelationDef {
Relation::SourceFiles.def()
Relation::Bytecodes.def()
}
}

impl Related<super::bytecodes::Entity> for Entity {
impl Related<super::source_files::Entity> for Entity {
fn to() -> RelationDef {
Relation::Bytecodes.def()
Relation::SourceFiles.def()
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.2
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2
use super::sea_orm_active_enums::{BytecodeType, VerificationType};
use sea_orm::entity::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion eth-bytecode-db/eth-bytecode-db/migration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ path = "src/lib.rs"
async-std = { version = "^1", features = ["attributes", "tokio1"] }

[dependencies.sea-orm-migration]
version = "0.11"
version = "0.12.2"
features = [
# Enable at least one `ASYNC_RUNTIME` and `DATABASE_DRIVER` feature if you want to run migration via CLI.
# View the list of supported features at https://www.sea-ql.org/SeaORM/docs/install-and-config/database-and-async-runtime.
Expand Down
2 changes: 1 addition & 1 deletion eth-bytecode-db/eth-bytecode-db/migration/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pub use sea_orm_migration::prelude::*;
use sea_orm_migration::sea_orm::{ConnectionTrait, Statement, TransactionTrait};
use sea_orm_migration::sea_orm::{Statement, TransactionTrait};

mod m20220101_000001_initial_tables;
mod m20221122_222955_add_indexes;
Expand Down

0 comments on commit edb289a

Please sign in to comment.