Skip to content

Commit 7e24dd8

Browse files
authored
[Validator API Fix]support validator txn with its events. (#454)
* support validator txn with its events. * update. * update.
1 parent 402f22c commit 7e24dd8

File tree

8 files changed

+32
-19
lines changed

8 files changed

+32
-19
lines changed

rust/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ aptos-moving-average = { path = "moving-average" }
1919

2020
ahash = { version = "0.8.7", features = ["serde"] }
2121
anyhow = "1.0.62"
22-
aptos-protos = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "d76b5bb423b78b2b9affc72d3853f0d973d3f11f" }
22+
aptos-protos = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "5c48aee129b5a141be2792ffa3d9bd0a1a61c9cb" }
2323
aptos-system-utils = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "4541add3fd29826ec57f22658ca286d2d6134b93" }
2424
async-trait = "0.1.53"
2525
backtrace = "0.3.58"

rust/processor/src/db/common/models/account_transaction_models/account_transactions.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ impl AccountTransaction {
7171
),
7272
TxnData::Genesis(inner) => (&inner.events, vec![]),
7373
TxnData::BlockMetadata(inner) => (&inner.events, vec![]),
74+
TxnData::Validator(inner) => (&inner.events, vec![]),
7475
_ => {
7576
return AHashMap::new();
7677
},

rust/processor/src/db/common/models/default_models/parquet_transactions.rs

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -321,23 +321,32 @@ impl Transaction {
321321
vec![],
322322
vec![],
323323
),
324-
TxnData::Validator(_) => (
325-
Self::from_transaction_info_with_data(
326-
transaction_info,
327-
None,
328-
None,
324+
TxnData::Validator(inner) => {
325+
let (wsc, wsc_detail) = WriteSetChangeModel::from_write_set_changes(
326+
&transaction_info.changes,
329327
txn_version,
330-
transaction_type,
331-
0,
332328
block_height,
333-
epoch,
334329
block_timestamp,
335-
txn_size_info,
336-
),
337-
None,
338-
vec![],
339-
vec![],
340-
),
330+
write_set_size_info,
331+
);
332+
(
333+
Self::from_transaction_info_with_data(
334+
transaction_info,
335+
None,
336+
None,
337+
txn_version,
338+
transaction_type,
339+
inner.events.len() as i64,
340+
block_height,
341+
epoch,
342+
block_timestamp,
343+
txn_size_info,
344+
),
345+
None,
346+
wsc,
347+
wsc_detail,
348+
)
349+
},
341350
TxnData::BlockEpilogue(_) => (
342351
Self::from_transaction_info_with_data(
343352
transaction_info,

rust/processor/src/db/common/models/default_models/transactions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ impl Transaction {
296296
epoch,
297297
),
298298
None,
299-
vec![],
300-
vec![],
299+
wsc,
300+
wsc_detail,
301301
),
302302
TxnData::BlockEpilogue(_) => (
303303
Self::from_transaction_info_with_data(

rust/processor/src/db/common/models/stake_models/delegator_activities.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ impl DelegatedStakingActivity {
5050
let events = match txn_data {
5151
TxnData::User(txn) => &txn.events,
5252
TxnData::BlockMetadata(txn) => &txn.events,
53+
TxnData::Validator(txn) => &txn.events,
5354
_ => return Ok(delegator_activities),
5455
};
5556
for (index, event) in events.iter().enumerate() {

rust/processor/src/processors/events_processor.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ impl ProcessorTrait for EventsProcessor {
130130
TxnData::BlockMetadata(tx_inner) => &tx_inner.events,
131131
TxnData::Genesis(tx_inner) => &tx_inner.events,
132132
TxnData::User(tx_inner) => &tx_inner.events,
133+
TxnData::Validator(tx_inner) => &tx_inner.events,
133134
_ => &default,
134135
};
135136

rust/processor/src/processors/fungible_asset_processor.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ async fn parse_v2_coin(
482482
let default = vec![];
483483
let (events, user_request, entry_function_id_str) = match txn_data {
484484
TxnData::BlockMetadata(tx_inner) => (&tx_inner.events, None, None),
485+
TxnData::Validator(tx_inner) => (&tx_inner.events, None, None),
485486
TxnData::Genesis(tx_inner) => (&tx_inner.events, None, None),
486487
TxnData::User(tx_inner) => {
487488
let user_request = tx_inner

0 commit comments

Comments
 (0)