Skip to content

Commit

Permalink
chore: update seaorm to latest (#4925)
Browse files Browse the repository at this point in the history
### Description

Updated `sea-orm` and `sea-orm-migration` to `1.1.1` (latest as of
opening this PR) and resolved any issues that occurred due to the
version bump.

### Drive-by changes

- Removed `sea-orm` from `rust/sealevel`
- Updated `sea-orm-migration` data types
- Bumped up the `rust-toolchain` to `1.81.0` due to `sea-orm-cli` issue:
servo/rust-url#992

### Related issues

- Resolves #4793

### Backward compatibility

Yes

### Testing

Manual, as described in #4793
  • Loading branch information
Mantas-M authored Dec 17, 2024
1 parent 0e769f2 commit 58a5454
Show file tree
Hide file tree
Showing 19 changed files with 586 additions and 252 deletions.
723 changes: 541 additions & 182 deletions rust/main/Cargo.lock

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions rust/main/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ async-rwlock = "1.3"
auto_impl = "1.0"
axum = "0.6.1"
backtrace = "0.3"
cc = "1.2.2"
base64 = "0.21.2"
bigdecimal = "0.4.2"
bincode = "1.3"
Expand Down Expand Up @@ -80,7 +81,7 @@ hyperlane-cosmwasm-interface = "=0.0.6-rc6"
injective-protobuf = "0.2.2"
injective-std = "=0.1.5"
itertools = "*"
jobserver = "=0.1.26"
jobserver = "0.1.32"
jsonrpc-core = "18.0"
k256 = { version = "0.13.4", features = ["arithmetic", "std", "ecdsa"] }
lazy_static = "1.5.0"
Expand All @@ -106,14 +107,14 @@ reqwest = "0.11"
ripemd = "0.1.3"
rlp = "=0.5.2"
rocksdb = "0.21.0"
sea-orm = { version = "0.11.1", features = [
sea-orm = { version = "1.1.1", features = [
"sqlx-postgres",
"runtime-tokio-native-tls",
"with-bigdecimal",
"with-time",
"macros",
] }
sea-orm-migration = { version = "0.11.1", features = [
sea-orm-migration = { version = "1.1.1", features = [
"sqlx-postgres",
"runtime-tokio-native-tls",
] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod common;

const RAW_DB_PATH: &str = "./agents/scraper/src/db/generated";
const DOCKER_NAME: &str = "scraper-entity-generator";
const CLI_VERSION: &str = "0.12.3";
const CLI_VERSION: &str = "1.1.1";

struct PostgresDockerContainer;

Expand Down
2 changes: 1 addition & 1 deletion rust/main/agents/scraper/migration/bin/init_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use common::*;

mod common;

#[tokio::main]
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), DbErr> {
let db = init().await?;

Expand Down
2 changes: 1 addition & 1 deletion rust/main/agents/scraper/migration/bin/recreate_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use common::*;

mod common;

#[tokio::main]
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), DbErr> {
let db = init().await?;

Expand Down
4 changes: 2 additions & 2 deletions rust/main/agents/scraper/migration/src/l20230309_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ use sea_orm_migration::prelude::*;

/// Hashes are to be stored as binary.
#[allow(non_upper_case_globals)]
pub const Hash: ColumnType = ColumnType::Binary(BlobSize::Tiny);
pub const Hash: ColumnType = ColumnType::Blob;
/// Addresses are to be stored as binary.
#[allow(non_upper_case_globals)]
pub const Address: ColumnType = ColumnType::Binary(BlobSize::Tiny);
pub const Address: ColumnType = ColumnType::Blob;

/// 256-bit integer as base-10 digits: ceil(log_10(2^256))
const SIGNIFICANT_DIGITS_IN_256_BIT_INTEGER: u32 = 78;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,8 @@ impl MigrationTrait for Migration {
.col(ColumnDef::new_with_type(Transaction::GasUsed, Wei).not_null())
.col(ColumnDef::new_with_type(Transaction::CumulativeGasUsed, Wei).not_null())
.col(
ColumnDef::new_with_type(
Transaction::RawInputData,
ColumnType::Binary(BlobSize::Blob(None)),
)
.borrow_mut(),
ColumnDef::new_with_type(Transaction::RawInputData, ColumnType::Blob)
.borrow_mut(),
)
.foreign_key(
ForeignKey::create()
Expand Down
4 changes: 2 additions & 2 deletions rust/main/agents/scraper/src/db/generated/block.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.3
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1
use sea_orm::entity::prelude::*;

Expand Down Expand Up @@ -56,7 +56,7 @@ impl ColumnTrait for Column {
Self::Id => ColumnType::BigInteger.def(),
Self::TimeCreated => ColumnType::DateTime.def(),
Self::Domain => ColumnType::Integer.def(),
Self::Hash => ColumnType::Binary(BlobSize::Blob(None)).def().unique(),
Self::Hash => ColumnType::VarBinary(StringLen::None).def().unique(),
Self::Height => ColumnType::BigInteger.def(),
Self::Timestamp => ColumnType::DateTime.def(),
}
Expand Down
2 changes: 1 addition & 1 deletion rust/main/agents/scraper/src/db/generated/cursor.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.3
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1
use sea_orm::entity::prelude::*;

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

Expand Down Expand Up @@ -57,9 +57,9 @@ impl ColumnTrait for Column {
match self {
Self::Id => ColumnType::BigInteger.def(),
Self::TimeCreated => ColumnType::DateTime.def(),
Self::MsgId => ColumnType::Binary(BlobSize::Blob(None)).def().unique(),
Self::MsgId => ColumnType::VarBinary(StringLen::None).def().unique(),
Self::Domain => ColumnType::Integer.def(),
Self::DestinationMailbox => ColumnType::Binary(BlobSize::Blob(None)).def(),
Self::DestinationMailbox => ColumnType::VarBinary(StringLen::None).def(),
Self::DestinationTxId => ColumnType::BigInteger.def(),
Self::Sequence => ColumnType::BigInteger.def().null(),
}
Expand Down
10 changes: 1 addition & 9 deletions rust/main/agents/scraper/src/db/generated/domain.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.3
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1
use sea_orm::entity::prelude::*;

Expand Down Expand Up @@ -52,7 +52,6 @@ pub enum Relation {
Block,
Cursor,
DeliveredMessage,
GasPayment,
Message,
}

Expand All @@ -78,7 +77,6 @@ impl RelationTrait for Relation {
Self::Block => Entity::has_many(super::block::Entity).into(),
Self::Cursor => Entity::has_many(super::cursor::Entity).into(),
Self::DeliveredMessage => Entity::has_many(super::delivered_message::Entity).into(),
Self::GasPayment => Entity::has_many(super::gas_payment::Entity).into(),
Self::Message => Entity::has_many(super::message::Entity).into(),
}
}
Expand All @@ -102,12 +100,6 @@ impl Related<super::delivered_message::Entity> for Entity {
}
}

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

impl Related<super::message::Entity> for Entity {
fn to() -> RelationDef {
Relation::Message.def()
Expand Down
24 changes: 9 additions & 15 deletions rust/main/agents/scraper/src/db/generated/gas_payment.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.3
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1
use sea_orm::entity::prelude::*;

Expand All @@ -11,6 +11,8 @@ impl EntityName for Entity {
}
}

/// @NOTE: Replaced all occurrences of `Decimal` with `BigDecimal`
/// due to the following issue: https://github.com/SeaQL/sea-orm/issues/1530
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq)]
pub struct Model {
pub id: i64,
Expand Down Expand Up @@ -57,8 +59,8 @@ impl PrimaryKeyTrait for PrimaryKey {

#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Domain,
Origin,
Domain2,
Domain1,
Transaction,
}

Expand All @@ -69,16 +71,14 @@ impl ColumnTrait for Column {
Self::Id => ColumnType::BigInteger.def(),
Self::TimeCreated => ColumnType::DateTime.def(),
Self::Domain => ColumnType::Integer.def(),
Self::MsgId => ColumnType::Binary(BlobSize::Blob(None)).def(),
Self::MsgId => ColumnType::VarBinary(StringLen::None).def(),
Self::Payment => ColumnType::Decimal(Some((78u32, 0u32))).def(),
Self::GasAmount => ColumnType::Decimal(Some((78u32, 0u32))).def(),
Self::TxId => ColumnType::BigInteger.def(),
Self::LogIndex => ColumnType::BigInteger.def(),
Self::Origin => ColumnType::Integer.def(),
Self::Destination => ColumnType::Integer.def(),
Self::InterchainGasPaymaster => {
ColumnType::Binary(sea_orm::sea_query::BlobSize::Blob(None)).def()
}
Self::InterchainGasPaymaster => ColumnType::VarBinary(StringLen::None).def(),
Self::Sequence => ColumnType::BigInteger.def().null(),
}
}
Expand All @@ -87,11 +87,11 @@ impl ColumnTrait for Column {
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Domain => Entity::belongs_to(super::domain::Entity)
Self::Domain2 => Entity::belongs_to(super::domain::Entity)
.from(Column::Domain)
.to(super::domain::Column::Id)
.into(),
Self::Origin => Entity::belongs_to(super::domain::Entity)
Self::Domain1 => Entity::belongs_to(super::domain::Entity)
.from(Column::Origin)
.to(super::domain::Column::Id)
.into(),
Expand All @@ -103,12 +103,6 @@ impl RelationTrait for Relation {
}
}

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

impl Related<super::transaction::Entity> for Entity {
fn to() -> RelationDef {
Relation::Transaction.def()
Expand Down
12 changes: 6 additions & 6 deletions rust/main/agents/scraper/src/db/generated/message.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.3
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1
use sea_orm::entity::prelude::*;

Expand Down Expand Up @@ -65,14 +65,14 @@ impl ColumnTrait for Column {
match self {
Self::Id => ColumnType::BigInteger.def(),
Self::TimeCreated => ColumnType::DateTime.def(),
Self::MsgId => ColumnType::Binary(BlobSize::Blob(None)).def(),
Self::MsgId => ColumnType::VarBinary(StringLen::None).def(),
Self::Origin => ColumnType::Integer.def(),
Self::Destination => ColumnType::Integer.def(),
Self::Nonce => ColumnType::Integer.def(),
Self::Sender => ColumnType::Binary(BlobSize::Blob(None)).def(),
Self::Recipient => ColumnType::Binary(BlobSize::Blob(None)).def(),
Self::MsgBody => ColumnType::Binary(BlobSize::Blob(None)).def().null(),
Self::OriginMailbox => ColumnType::Binary(BlobSize::Blob(None)).def(),
Self::Sender => ColumnType::VarBinary(StringLen::None).def(),
Self::Recipient => ColumnType::VarBinary(StringLen::None).def(),
Self::MsgBody => ColumnType::VarBinary(StringLen::None).def().null(),
Self::OriginMailbox => ColumnType::VarBinary(StringLen::None).def(),
Self::OriginTxId => ColumnType::BigInteger.def(),
}
}
Expand Down
2 changes: 1 addition & 1 deletion rust/main/agents/scraper/src/db/generated/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.3
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1
pub mod prelude;

Expand Down
2 changes: 1 addition & 1 deletion rust/main/agents/scraper/src/db/generated/prelude.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.3
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1
#[allow(unused_imports)]
pub use super::{
block::Entity as Block, cursor::Entity as Cursor,
Expand Down
12 changes: 7 additions & 5 deletions rust/main/agents/scraper/src/db/generated/transaction.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.3
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.1
use sea_orm::entity::prelude::*;

Expand All @@ -11,6 +11,8 @@ impl EntityName for Entity {
}
}

/// @NOTE: Replaced all occurrences of `Decimal` with `BigDecimal`
/// due to the following issue: https://github.com/SeaQL/sea-orm/issues/1530
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq)]
pub struct Model {
pub id: i64,
Expand Down Expand Up @@ -75,19 +77,19 @@ impl ColumnTrait for Column {
match self {
Self::Id => ColumnType::BigInteger.def(),
Self::TimeCreated => ColumnType::DateTime.def(),
Self::Hash => ColumnType::Binary(BlobSize::Blob(None)).def().unique(),
Self::Hash => ColumnType::VarBinary(StringLen::None).def().unique(),
Self::BlockId => ColumnType::BigInteger.def(),
Self::GasLimit => ColumnType::Decimal(Some((78u32, 0u32))).def(),
Self::MaxPriorityFeePerGas => ColumnType::Decimal(Some((78u32, 0u32))).def().null(),
Self::MaxFeePerGas => ColumnType::Decimal(Some((78u32, 0u32))).def().null(),
Self::GasPrice => ColumnType::Decimal(Some((78u32, 0u32))).def().null(),
Self::EffectiveGasPrice => ColumnType::Decimal(Some((78u32, 0u32))).def().null(),
Self::Nonce => ColumnType::BigInteger.def(),
Self::Sender => ColumnType::Binary(BlobSize::Blob(None)).def(),
Self::Recipient => ColumnType::Binary(BlobSize::Blob(None)).def().null(),
Self::Sender => ColumnType::VarBinary(StringLen::None).def(),
Self::Recipient => ColumnType::VarBinary(StringLen::None).def().null(),
Self::GasUsed => ColumnType::Decimal(Some((78u32, 0u32))).def(),
Self::CumulativeGasUsed => ColumnType::Decimal(Some((78u32, 0u32))).def(),
Self::RawInputData => ColumnType::Binary(BlobSize::Blob(None)).def().null(),
Self::RawInputData => ColumnType::VarBinary(StringLen::None).def().null(),
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion rust/main/hyperlane-base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ warp.workspace = true
ya-gcp.workspace = true

backtrace = { workspace = true, optional = true }
cc = { workspace = true, optional = true }
backtrace-oneline = { path = "../utils/backtrace-oneline", optional = true }

ethers-prometheus = { path = "../ethers-prometheus", features = ["serde"] }
Expand Down Expand Up @@ -73,6 +74,6 @@ vergen = { version = "8.3.2", features = ["build", "git", "gitcl"] }

[features]
default = ["oneline-errors", "color-eyre"]
oneline-eyre = ["backtrace-oneline", "backtrace"]
oneline-eyre = ["backtrace-oneline", "backtrace", "cc"]
oneline-errors = ["oneline-eyre"]
test-utils = ["dep:tempfile"]
2 changes: 1 addition & 1 deletion rust/main/rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.80.1"
channel = "1.81.0"
profile = "default"
12 changes: 0 additions & 12 deletions rust/sealevel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ borsh = "0.9"
bs58 = "0.5.0"
bytes = "1"
clap = "4"
color-eyre = "0.6"
config = "0.13.3"
console-subscriber = "0.2.0"
convert_case = "0.6"
Expand Down Expand Up @@ -94,17 +93,6 @@ reqwest = "0.11"
ripemd = "0.1.3"
rlp = "=0.5.2"
rocksdb = "0.21.0"
sea-orm = { version = "0.11.1", features = [
"sqlx-postgres",
"runtime-tokio-native-tls",
"with-bigdecimal",
"with-time",
"macros",
] }
sea-orm-migration = { version = "0.11.1", features = [
"sqlx-postgres",
"runtime-tokio-native-tls",
] }
semver = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_bytes = "0.11"
Expand Down

0 comments on commit 58a5454

Please sign in to comment.