Skip to content

Commit

Permalink
[Validator API Fix]support validator txn with its events. (#454)
Browse files Browse the repository at this point in the history
* support validator txn with its events.

* update.

* update.
  • Loading branch information
larry-aptos authored Jul 12, 2024
1 parent 402f22c commit 7e24dd8
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 19 deletions.
4 changes: 2 additions & 2 deletions rust/Cargo.lock

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

2 changes: 1 addition & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ aptos-moving-average = { path = "moving-average" }

ahash = { version = "0.8.7", features = ["serde"] }
anyhow = "1.0.62"
aptos-protos = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "d76b5bb423b78b2b9affc72d3853f0d973d3f11f" }
aptos-protos = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "5c48aee129b5a141be2792ffa3d9bd0a1a61c9cb" }
aptos-system-utils = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "4541add3fd29826ec57f22658ca286d2d6134b93" }
async-trait = "0.1.53"
backtrace = "0.3.58"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ impl AccountTransaction {
),
TxnData::Genesis(inner) => (&inner.events, vec![]),
TxnData::BlockMetadata(inner) => (&inner.events, vec![]),
TxnData::Validator(inner) => (&inner.events, vec![]),
_ => {
return AHashMap::new();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,23 +321,32 @@ impl Transaction {
vec![],
vec![],
),
TxnData::Validator(_) => (
Self::from_transaction_info_with_data(
transaction_info,
None,
None,
TxnData::Validator(inner) => {
let (wsc, wsc_detail) = WriteSetChangeModel::from_write_set_changes(
&transaction_info.changes,
txn_version,
transaction_type,
0,
block_height,
epoch,
block_timestamp,
txn_size_info,
),
None,
vec![],
vec![],
),
write_set_size_info,
);
(
Self::from_transaction_info_with_data(
transaction_info,
None,
None,
txn_version,
transaction_type,
inner.events.len() as i64,
block_height,
epoch,
block_timestamp,
txn_size_info,
),
None,
wsc,
wsc_detail,
)
},
TxnData::BlockEpilogue(_) => (
Self::from_transaction_info_with_data(
transaction_info,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ impl Transaction {
epoch,
),
None,
vec![],
vec![],
wsc,
wsc_detail,
),
TxnData::BlockEpilogue(_) => (
Self::from_transaction_info_with_data(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ impl DelegatedStakingActivity {
let events = match txn_data {
TxnData::User(txn) => &txn.events,
TxnData::BlockMetadata(txn) => &txn.events,
TxnData::Validator(txn) => &txn.events,
_ => return Ok(delegator_activities),
};
for (index, event) in events.iter().enumerate() {
Expand Down
1 change: 1 addition & 0 deletions rust/processor/src/processors/events_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ impl ProcessorTrait for EventsProcessor {
TxnData::BlockMetadata(tx_inner) => &tx_inner.events,
TxnData::Genesis(tx_inner) => &tx_inner.events,
TxnData::User(tx_inner) => &tx_inner.events,
TxnData::Validator(tx_inner) => &tx_inner.events,
_ => &default,
};

Expand Down
1 change: 1 addition & 0 deletions rust/processor/src/processors/fungible_asset_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ async fn parse_v2_coin(
let default = vec![];
let (events, user_request, entry_function_id_str) = match txn_data {
TxnData::BlockMetadata(tx_inner) => (&tx_inner.events, None, None),
TxnData::Validator(tx_inner) => (&tx_inner.events, None, None),
TxnData::Genesis(tx_inner) => (&tx_inner.events, None, None),
TxnData::User(tx_inner) => {
let user_request = tx_inner
Expand Down

0 comments on commit 7e24dd8

Please sign in to comment.