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

feat(eth-bytecode-db): update verifier alliance schema to v1 #1134

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
82 changes: 74 additions & 8 deletions eth-bytecode-db/Cargo.lock

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

15 changes: 12 additions & 3 deletions eth-bytecode-db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ members = [
"eth-bytecode-db/migration",
"eth-bytecode-db/verifier-alliance-entity",
"eth-bytecode-db/verifier-alliance-migration",
"verifier-alliance-database",
]

[workspace.dependencies]
Expand All @@ -16,8 +17,13 @@ eth-bytecode-db = { path = "eth-bytecode-db" }
eth-bytecode-db-proto = { path = "eth-bytecode-db-proto" }
eth-bytecode-db-server = { path = "eth-bytecode-db-server" }
migration = { path = "eth-bytecode-db/migration" }
verifier-alliance-entity = { path = "eth-bytecode-db/verifier-alliance-entity" }
verifier-alliance-migration = { path = "eth-bytecode-db/verifier-alliance-migration" }
verifier-alliance-entity = { git = "https://github.com/blockscout/blockscout-rs", rev = "ec1c755" }
verifier-alliance-database = { path = "verifier-alliance-database" }
bragov4ik marked this conversation as resolved.
Show resolved Hide resolved
verifier-alliance-migration = { git = "https://github.com/blockscout/blockscout-rs", rev = "ec1c755" }

verifier-alliance-entity-v1 = { path = "eth-bytecode-db/verifier-alliance-entity", package = "verifier-alliance-entity" }
verifier-alliance-migration-v1 = { path = "eth-bytecode-db/verifier-alliance-migration", package = "verifier-alliance-migration" }
verification-common-v1 = { git = "https://github.com/blockscout/blockscout-rs", rev = "1164e09", package = "verification-common" }

actix-prost = { git = "https://github.com/blockscout/actix-prost", rev = "4cbba2a" }
actix-prost-macros = { git = "https://github.com/blockscout/actix-prost", rev = "4cbba2a" }
Expand All @@ -29,7 +35,7 @@ anyhow = { version = "1" }
async-std = { version = "^1" }
async-trait = { version = "0.1" }
blockscout-display-bytes = { version = "1.1.0" }
blockscout-service-launcher = { version = "0.14.0", features = ["database-1_0"] }
blockscout-service-launcher = { version = "0.15.0", default-features = false, features = ["database-1_0"] }
bytes = { version = "1.2" }
ethabi = { version = "18.0" }
ethers = { version = "2.0.0" }
Expand All @@ -56,9 +62,12 @@ semver = { version = "1.0" }
serde = { version = "1" }
serde_json = { version = "1.0" }
serde_with = { version = "3.11.0" }
sha2 = { version = "0.10.8" }
sha3 = { version = "0.10.8" }
smart-contract-verifier-proto = { git = "https://github.com/blockscout/blockscout-rs", rev = "7a6e9400" }
solidity-metadata = { version = "1.0" }
sourcify = { git = "https://github.com/blockscout/blockscout-rs", rev = "457af68" }
strum = { version = "0.26.3", default-features = false, features = ["derive"] }
thiserror = { version = "1" }
tokio = { version = "1" }
tokio-stream = { version = "0.1" }
Expand Down
2 changes: 1 addition & 1 deletion eth-bytecode-db/eth-bytecode-db-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ amplify = { workspace = true }
anyhow = { workspace = true }
async-trait = { workspace = true }
blockscout-display-bytes = { workspace = true }
blockscout-service-launcher = { workspace = true }
blockscout-service-launcher = { workspace = true, features = ["launcher", "tracing"] }
eth-bytecode-db = { workspace = true }
eth-bytecode-db-proto = { workspace = true }
ethers = { workspace = true, features = ["solc"] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl<'a, Request> From<&'a Request> for RequestWrapper<'a, Request> {
}
}

impl<'a, Request> RequestWrapper<'a, Request> {
impl<Request> RequestWrapper<'_, Request> {
pub fn header(&mut self, key: &str, value: &str) {
let key = reqwest::header::HeaderName::from_str(key)
.expect("Error converting key string into header name");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ impl<'a> VerifierAllianceDbAction<'a> {
}
}

impl<'a> VerifierAllianceDbAction<'a> {
impl VerifierAllianceDbAction<'_> {
fn contract_address(&self) -> Option<blockscout_display_bytes::Bytes> {
match self {
VerifierAllianceDbAction::IgnoreDb => None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ pub struct Model {
column_type = "VarBinary(StringLen::None)"
)]
pub code_hash: Vec<u8>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub created_by: String,
pub updated_by: String,
#[sea_orm(column_type = "VarBinary(StringLen::None)")]
pub code_hash_keccak: Vec<u8>,
#[sea_orm(column_type = "VarBinary(StringLen::None)", nullable)]
pub code: Option<Vec<u8>>,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ pub struct Model {
pub name: String,
pub fully_qualified_name: String,
#[sea_orm(column_type = "JsonBinary")]
pub sources: Json,
#[sea_orm(column_type = "JsonBinary")]
pub compiler_settings: Json,
#[sea_orm(column_type = "JsonBinary")]
pub compilation_artifacts: Json,
Expand Down Expand Up @@ -50,10 +48,18 @@ pub enum Relation {
on_delete = "NoAction"
)]
Code1,
#[sea_orm(has_many = "super::compiled_contracts_sources::Entity")]
CompiledContractsSources,
#[sea_orm(has_many = "super::verified_contracts::Entity")]
VerifiedContracts,
}

impl Related<super::compiled_contracts_sources::Entity> for Entity {
fn to() -> RelationDef {
Relation::CompiledContractsSources.def()
}
}

impl Related<super::verified_contracts::Entity> for Entity {
fn to() -> RelationDef {
Relation::VerifiedContracts.def()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0

use sea_orm::entity::prelude::*;

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "compiled_contracts_sources")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
pub compilation_id: Uuid,
#[sea_orm(column_type = "VarBinary(StringLen::None)")]
pub source_hash: Vec<u8>,
pub path: String,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::compiled_contracts::Entity",
from = "Column::CompilationId",
to = "super::compiled_contracts::Column::Id",
on_update = "NoAction",
on_delete = "NoAction"
)]
CompiledContracts,
#[sea_orm(
belongs_to = "super::sources::Entity",
from = "Column::SourceHash",
to = "super::sources::Column::SourceHash",
on_update = "NoAction",
on_delete = "NoAction"
)]
Sources,
}

impl Related<super::compiled_contracts::Entity> for Entity {
fn to() -> RelationDef {
Relation::CompiledContracts.def()
}
}

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

impl ActiveModelBehavior for ActiveModel {}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ use sea_orm::entity::prelude::*;
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub created_by: String,
pub updated_by: String,
rimrakhimov marked this conversation as resolved.
Show resolved Hide resolved
pub chain_id: Decimal,
#[sea_orm(column_type = "VarBinary(StringLen::None)")]
pub address: Vec<u8>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ use sea_orm::entity::prelude::*;
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub created_by: String,
pub updated_by: String,
#[sea_orm(column_type = "VarBinary(StringLen::None)")]
pub creation_code_hash: Vec<u8>,
#[sea_orm(column_type = "VarBinary(StringLen::None)")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ pub mod prelude;

pub mod code;
pub mod compiled_contracts;
pub mod compiled_contracts_sources;
pub mod contract_deployments;
pub mod contracts;
pub mod sources;
pub mod verified_contracts;
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

pub use super::{
code::Entity as Code, compiled_contracts::Entity as CompiledContracts,
compiled_contracts_sources::Entity as CompiledContractsSources,
contract_deployments::Entity as ContractDeployments, contracts::Entity as Contracts,
verified_contracts::Entity as VerifiedContracts,
sources::Entity as Sources, verified_contracts::Entity as VerifiedContracts,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0

use sea_orm::entity::prelude::*;

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "sources")]
pub struct Model {
#[sea_orm(
primary_key,
auto_increment = false,
column_type = "VarBinary(StringLen::None)"
)]
pub source_hash: Vec<u8>,
#[sea_orm(column_type = "VarBinary(StringLen::None)")]
pub source_hash_keccak: Vec<u8>,
pub content: String,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub created_by: String,
pub updated_by: String,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::compiled_contracts_sources::Entity")]
CompiledContractsSources,
}

impl Related<super::compiled_contracts_sources::Entity> for Entity {
fn to() -> RelationDef {
Relation::CompiledContractsSources.def()
}
}

impl ActiveModelBehavior for ActiveModel {}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ pub struct Model {
pub creation_values: Option<Json>,
#[sea_orm(column_type = "JsonBinary", nullable)]
pub creation_transformations: Option<Json>,
pub creation_metadata_match: Option<bool>,
pub runtime_match: bool,
#[sea_orm(column_type = "JsonBinary", nullable)]
pub runtime_values: Option<Json>,
#[sea_orm(column_type = "JsonBinary", nullable)]
pub runtime_transformations: Option<Json>,
pub runtime_metadata_match: Option<bool>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
Expand Down
Loading
Loading