diff --git a/rust/main/agents/scraper/migration/bin/generate_entities.rs b/rust/main/agents/scraper/migration/bin/generate_entities.rs index 5ec3e6c66a..9481ece179 100644 --- a/rust/main/agents/scraper/migration/bin/generate_entities.rs +++ b/rust/main/agents/scraper/migration/bin/generate_entities.rs @@ -57,8 +57,8 @@ impl Drop for PostgresDockerContainer { async fn main() -> Result<(), DbErr> { assert_eq!( std::env::current_dir().unwrap().file_name().unwrap(), - "rust", - "Must run from the rust dir" + "main", + "Must run from the rust/main dir" ); let postgres = PostgresDockerContainer::start(); diff --git a/rust/main/agents/scraper/migration/src/m20230309_000003_create_table_transaction.rs b/rust/main/agents/scraper/migration/src/m20230309_000003_create_table_transaction.rs index daacfb6b7a..283968c6d6 100644 --- a/rust/main/agents/scraper/migration/src/m20230309_000003_create_table_transaction.rs +++ b/rust/main/agents/scraper/migration/src/m20230309_000003_create_table_transaction.rs @@ -52,6 +52,13 @@ impl MigrationTrait for Migration { .col(ColumnDef::new_with_type(Transaction::Recipient, Address).borrow_mut()) .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(), + ) .foreign_key( ForeignKey::create() .from_col(Transaction::BlockId) @@ -128,4 +135,6 @@ pub enum Transaction { GasUsed, /// Cumulative gas used within the block after this was executed CumulativeGasUsed, + /// Raw input data from Ethereum transaction + RawInputData, } diff --git a/rust/main/agents/scraper/src/db/generated/transaction.rs b/rust/main/agents/scraper/src/db/generated/transaction.rs index 216545b372..4f1139c8c9 100644 --- a/rust/main/agents/scraper/src/db/generated/transaction.rs +++ b/rust/main/agents/scraper/src/db/generated/transaction.rs @@ -27,6 +27,7 @@ pub struct Model { pub recipient: Option>, pub gas_used: BigDecimal, pub cumulative_gas_used: BigDecimal, + pub raw_input_data: Option>, } #[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] @@ -45,6 +46,7 @@ pub enum Column { Recipient, GasUsed, CumulativeGasUsed, + RawInputData, } #[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] @@ -85,6 +87,7 @@ impl ColumnTrait for Column { Self::Recipient => ColumnType::Binary(BlobSize::Blob(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(), } } } diff --git a/rust/main/agents/scraper/src/db/txn.rs b/rust/main/agents/scraper/src/db/txn.rs index d5cec03dc7..c482569cb7 100644 --- a/rust/main/agents/scraper/src/db/txn.rs +++ b/rust/main/agents/scraper/src/db/txn.rs @@ -94,6 +94,7 @@ impl ScraperDb { recipient: Set(txn.recipient.as_ref().map(address_to_bytes)), max_fee_per_gas: Set(txn.max_fee_per_gas.map(u256_to_decimal)), cumulative_gas_used: Set(u256_to_decimal(receipt.cumulative_gas_used)), + raw_input_data: Set(txn.raw_input_data.clone()), }) }) .collect::>>()?; diff --git a/rust/main/chains/hyperlane-cosmos/src/providers/cosmos/provider.rs b/rust/main/chains/hyperlane-cosmos/src/providers/cosmos/provider.rs index 2ab0388be7..62076974bc 100644 --- a/rust/main/chains/hyperlane-cosmos/src/providers/cosmos/provider.rs +++ b/rust/main/chains/hyperlane-cosmos/src/providers/cosmos/provider.rs @@ -441,6 +441,7 @@ impl HyperlaneProvider for CosmosProvider { cumulative_gas_used: U256::from(response.tx_result.gas_used), effective_gas_price: Some(gas_price), }), + raw_input_data: None, }; Ok(tx_info) diff --git a/rust/main/chains/hyperlane-ethereum/src/rpc_clients/provider.rs b/rust/main/chains/hyperlane-ethereum/src/rpc_clients/provider.rs index d89cf9f43f..44a9f99e73 100644 --- a/rust/main/chains/hyperlane-ethereum/src/rpc_clients/provider.rs +++ b/rust/main/chains/hyperlane-ethereum/src/rpc_clients/provider.rs @@ -106,7 +106,7 @@ where }) .transpose()?; - Ok(TxnInfo { + let txn_info = TxnInfo { hash: *hash, max_fee_per_gas: txn.max_fee_per_gas.map(Into::into), max_priority_fee_per_gas: txn.max_priority_fee_per_gas.map(Into::into), @@ -116,7 +116,10 @@ where sender: txn.from.into(), recipient: txn.to.map(Into::into), receipt, - }) + raw_input_data: Some(txn.input.to_vec()), + }; + + Ok(txn_info) } #[instrument(err, skip(self))] diff --git a/rust/main/chains/hyperlane-fuel/src/provider.rs b/rust/main/chains/hyperlane-fuel/src/provider.rs index cdd32650e1..f4c6ee1345 100644 --- a/rust/main/chains/hyperlane-fuel/src/provider.rs +++ b/rust/main/chains/hyperlane-fuel/src/provider.rs @@ -381,6 +381,7 @@ impl HyperlaneProvider for FuelProvider { gas_price: Some(gas_price.into()), recipient, receipt: None, + raw_input_data: None, }) } None => Err(ChainCommunicationError::CustomError(format!( diff --git a/rust/main/chains/hyperlane-sealevel/src/provider.rs b/rust/main/chains/hyperlane-sealevel/src/provider.rs index a0c5a41ead..1b03872ed6 100644 --- a/rust/main/chains/hyperlane-sealevel/src/provider.rs +++ b/rust/main/chains/hyperlane-sealevel/src/provider.rs @@ -116,6 +116,7 @@ impl HyperlaneProvider for SealevelProvider { sender: Default::default(), recipient: None, receipt: Some(receipt), + raw_input_data: None, }) } diff --git a/rust/main/hyperlane-core/src/types/chain_data.rs b/rust/main/hyperlane-core/src/types/chain_data.rs index 219f6989da..b4c80c8461 100644 --- a/rust/main/hyperlane-core/src/types/chain_data.rs +++ b/rust/main/hyperlane-core/src/types/chain_data.rs @@ -49,6 +49,8 @@ pub struct TxnInfo { /// If the txn has been processed, we can also report some additional /// information. pub receipt: Option, + /// Raw input data of a transaction + pub raw_input_data: Option>, } /// Information about the execution of a transaction.