Skip to content

Conversation

@banool
Copy link
Contributor

@banool banool commented Jun 14, 2024

Description

There are two types of transaction filtering we will support in the future:

  1. Per stream configuration: The downstream declares what txns they want to receive.
  2. Global configuration: At the data service level we refuse to include full txns for all streams.

This PR implements the second of these, using @CapCap's work here:
aptos-labs/aptos-indexer-processors#398 #13715.

Rather than not sending txns at all if they match the blocklist filters, we just omit the writesets and events (and payload + signature, like we did with sender_addresses_to_ignore). Not sending the txns entirely would cause issues with processors, which today assume that they will receive all txns.

The txn filtering stuff is a superset of the existing sender_addresses_to_ignore functionality, so I remove that in this PR. I will include how to express sender_addresses_to_ignore using the txn filter stuff in the runbook.

Type of Change

  • New feature
  • Bug fix
  • Breaking change
  • Performance improvement
  • Refactoring
  • Dependency update
  • Documentation update
  • Tests

Which Components or Systems Does This Change Impact?

  • Validator Node
  • Full Node (API, Indexer, etc.)
  • Move/Aptos Virtual Machine
  • Aptos Framework
  • Aptos CLI/SDK
  • Developer Infrastructure
  • Other (specify)

How Has This Been Tested?

See updated unit test. We'll try this out in devnet first and release as per the release strategy.

Key Areas to Review

Make sure the configuration approach seems ergonomic.

Checklist

  • I have read and followed the CONTRIBUTING doc
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I identified and added all stakeholders and component owners affected by this change as reviewers
  • I tested both happy and unhappy path of the functionality
  • I have made corresponding changes to the documentation

@trunk-io
Copy link

trunk-io bot commented Jun 14, 2024

⏱️ 4h 47m total CI duration on this PR
Job Cumulative Duration Recent Runs
rust-targeted-unit-tests 1h 16m 🟥🟥🟥 (+2 more)
rust-move-tests 1h 3m 🟩🟩🟩 (+2 more)
rust-lints 38m 🟥🟩🟩 (+2 more)
test-fuzzers 35m 🟩
run-tests-main-branch 31m 🟩🟩🟩🟩🟩 (+2 more)
forge-framework-upgrade-test / forge 16m 🟩
check-dynamic-deps 12m 🟩🟩🟩🟩🟩 (+2 more)
general-lints 11m 🟩🟩🟩🟩 (+2 more)
semgrep/ci 3m 🟩🟩🟩🟩🟩 (+2 more)
file_change_determinator 1m 🟩🟩🟩🟩🟩 (+2 more)
file_change_determinator 1m 🟩🟩🟩🟩🟩 (+2 more)
permission-check 21s 🟩🟩🟩🟩🟩 (+2 more)
permission-check 21s 🟩🟩🟩🟩🟩 (+2 more)
permission-check 20s 🟩🟩🟩🟩🟩 (+2 more)
permission-check 19s 🟩🟩🟩🟩🟩 (+2 more)

🚨 2 jobs on the last run were significantly faster/slower than expected

Job Duration vs 7d avg Delta
rust-targeted-unit-tests 23m 13m +81%
rust-move-tests 12m 9m +42%

settingsfeedbackdocs ⋅ learn more about trunk.io

@banool banool force-pushed the banool/data-service-filters branch 2 times, most recently from 1b965b2 to bb5a4e7 Compare June 14, 2024 12:35
@banool banool changed the base branch from main to max_aptos-transaction-filter June 19, 2024 17:42
@banool banool force-pushed the banool/data-service-filters branch 2 times, most recently from e10b908 to d73b44f Compare June 19, 2024 17:46
@banool banool marked this pull request as ready for review June 19, 2024 17:46
@banool banool force-pushed the banool/data-service-filters branch from d73b44f to dd22f7a Compare June 19, 2024 17:47
// 2. Push the data to the response channel, i.e. stream the data to the client.
let current_batch_size = transaction_data.as_slice().len();
let end_of_batch_version = transaction_data.as_slice().last().unwrap().version;
let resp_items = get_transactions_responses_builder(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Re: line 524]

Should we have some metrics to measure the filtering, like "bytes after filtering" or "number of transactions filtered"?

See this comment inline on Graphite.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great call, done for both!

@banool banool force-pushed the max_aptos-transaction-filter branch 2 times, most recently from ce4b9be to 8af264b Compare June 21, 2024 09:18
@banool banool force-pushed the banool/data-service-filters branch from dd22f7a to 1148dc7 Compare June 21, 2024 09:19
@banool banool force-pushed the max_aptos-transaction-filter branch 4 times, most recently from 8482bb7 to 7815ce6 Compare June 21, 2024 18:58
Base automatically changed from max_aptos-transaction-filter to main June 21, 2024 19:33
There are two types of transaction filtering we will support in the future:
1. Per stream configuration: The downstream declares what txns they want to receive.
2. Global configuration: At the data service level we refuse to include full txns for all streams.

This PR implements the second of these, using @CapCap's work here:
aptos-labs/aptos-indexer-processors#398.

Rather than not sending txns at all if they match the blocklist filters, we just omit the writesets and events. Not sending the txns entirely would cause issues with processors, which today assume that they will receive all txns.
@banool banool force-pushed the banool/data-service-filters branch from 1148dc7 to 05aa06d Compare June 21, 2024 19:38
@banool banool enabled auto-merge (squash) June 21, 2024 19:39
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

✅ Forge suite compat success on f648076a280621dbfd4e73b1ca83e3a3f52878ed ==> 05aa06d2b8b12f3c72851024876cf71d11ddc25b

Compatibility test results for f648076a280621dbfd4e73b1ca83e3a3f52878ed ==> 05aa06d2b8b12f3c72851024876cf71d11ddc25b (PR)
1. Check liveness of validators at old version: f648076a280621dbfd4e73b1ca83e3a3f52878ed
compatibility::simple-validator-upgrade::liveness-check : committed: 8076.490104410453 txn/s, latency: 3955.0996653493116 ms, (p50: 3000 ms, p90: 6000 ms, p99: 28700 ms), latency samples: 313760
2. Upgrading first Validator to new version: 05aa06d2b8b12f3c72851024876cf71d11ddc25b
compatibility::simple-validator-upgrade::single-validator-upgrade : committed: 2758.697647928201 txn/s, latency: 10977.176545123062 ms, (p50: 11200 ms, p90: 16700 ms, p99: 18500 ms), latency samples: 109700
3. Upgrading rest of first batch to new version: 05aa06d2b8b12f3c72851024876cf71d11ddc25b
compatibility::simple-validator-upgrade::half-validator-upgrade : committed: 3338.7370459404506 txn/s, latency: 9301.685701054432 ms, (p50: 9400 ms, p90: 14100 ms, p99: 14400 ms), latency samples: 140360
4. upgrading second batch to new version: 05aa06d2b8b12f3c72851024876cf71d11ddc25b
compatibility::simple-validator-upgrade::rest-validator-upgrade : committed: 6490.859549583594 txn/s, latency: 5076.346798871698 ms, (p50: 4800 ms, p90: 8300 ms, p99: 9300 ms), latency samples: 233980
5. check swarm health
Compatibility test for f648076a280621dbfd4e73b1ca83e3a3f52878ed ==> 05aa06d2b8b12f3c72851024876cf71d11ddc25b passed
Test Ok

@github-actions
Copy link
Contributor

✅ Forge suite realistic_env_max_load success on 05aa06d2b8b12f3c72851024876cf71d11ddc25b

two traffics test: inner traffic : committed: 8677.322930709499 txn/s, latency: 4517.741224891669 ms, (p50: 4400 ms, p90: 5100 ms, p99: 9900 ms), latency samples: 3747760
two traffics test : committed: 99.91648852554233 txn/s, latency: 2083.1342696629213 ms, (p50: 2000 ms, p90: 2300 ms, p99: 7600 ms), latency samples: 1780
Latency breakdown for phase 0: ["QsBatchToPos: max: 0.219, avg: 0.213", "QsPosToProposal: max: 0.252, avg: 0.242", "ConsensusProposalToOrdered: max: 0.306, avg: 0.288", "ConsensusOrderedToCommit: max: 0.382, avg: 0.370", "ConsensusProposalToCommit: max: 0.673, avg: 0.659"]
Max round gap was 1 [limit 4] at version 1836472. Max no progress secs was 5.063414 [limit 15] at version 1836472.
Test Ok

@github-actions
Copy link
Contributor

✅ Forge suite framework_upgrade success on f648076a280621dbfd4e73b1ca83e3a3f52878ed ==> 05aa06d2b8b12f3c72851024876cf71d11ddc25b

Compatibility test results for f648076a280621dbfd4e73b1ca83e3a3f52878ed ==> 05aa06d2b8b12f3c72851024876cf71d11ddc25b (PR)
Upgrade the nodes to version: 05aa06d2b8b12f3c72851024876cf71d11ddc25b
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 1056.4770151876187 txn/s, submitted: 1059.1952236314976 txn/s, failed submission: 2.71820844387895 txn/s, expired: 2.71820844387895 txn/s, latency: 2877.034916380789 ms, (p50: 1800 ms, p90: 6200 ms, p99: 12000 ms), latency samples: 93280
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 1087.6610938832507 txn/s, submitted: 1089.3351544938891 txn/s, failed submission: 1.6740606106382487 txn/s, expired: 1.6740606106382487 txn/s, latency: 2949.805255057168 ms, (p50: 2100 ms, p90: 5400 ms, p99: 9000 ms), latency samples: 90960
5. check swarm health
Compatibility test for f648076a280621dbfd4e73b1ca83e3a3f52878ed ==> 05aa06d2b8b12f3c72851024876cf71d11ddc25b passed
Upgrade the remaining nodes to version: 05aa06d2b8b12f3c72851024876cf71d11ddc25b
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 1107.7195137019933 txn/s, submitted: 1108.5997040188006 txn/s, failed submission: 0.8801903168073049 txn/s, expired: 0.8801903168073049 txn/s, latency: 2859.023202224871 ms, (p50: 1900 ms, p90: 5400 ms, p99: 9700 ms), latency samples: 100680
Test Ok

Comment on lines +987 to +989
// Note: `is_allowed` means the txn matches the filter, in which case
// we strip it.
if txns_to_strip_filter.is_allowed(&txn) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: is_allowed is a bit confusing, maybe we can rename later?

@banool banool merged commit 153133b into main Jun 21, 2024
@banool banool deleted the banool/data-service-filters branch June 21, 2024 21:14
rtso pushed a commit that referenced this pull request Jun 24, 2024
There are two types of transaction filtering we will support in the future:
1. Per stream configuration: The downstream declares what txns they want to receive.
2. Global configuration: At the data service level we refuse to include full txns for all streams.

This PR implements the second of these, using @CapCap's work here:
aptos-labs/aptos-indexer-processors#398.

Rather than not sending txns at all if they match the blocklist filters, we just omit the writesets and events. Not sending the txns entirely would cause issues with processors, which today assume that they will receive all txns.
rtso pushed a commit that referenced this pull request Jun 24, 2024
There are two types of transaction filtering we will support in the future:
1. Per stream configuration: The downstream declares what txns they want to receive.
2. Global configuration: At the data service level we refuse to include full txns for all streams.

This PR implements the second of these, using @CapCap's work here:
aptos-labs/aptos-indexer-processors#398.

Rather than not sending txns at all if they match the blocklist filters, we just omit the writesets and events. Not sending the txns entirely would cause issues with processors, which today assume that they will receive all txns.
rtso pushed a commit that referenced this pull request Jun 24, 2024
There are two types of transaction filtering we will support in the future:
1. Per stream configuration: The downstream declares what txns they want to receive.
2. Global configuration: At the data service level we refuse to include full txns for all streams.

This PR implements the second of these, using @CapCap's work here:
aptos-labs/aptos-indexer-processors#398.

Rather than not sending txns at all if they match the blocklist filters, we just omit the writesets and events. Not sending the txns entirely would cause issues with processors, which today assume that they will receive all txns.
rtso added a commit that referenced this pull request Jun 24, 2024
* [GRPC] Enable data service ZSTD and update crate that uses old tonic (#13621)

* replace println with tracing

* [GRPC] Simple Transaction Filtering

* Improve transaction filter comments, exports, README, fix lz4 in tests

* [Data Service] Implement simple upstream transaction filtering (#13699)

There are two types of transaction filtering we will support in the future:
1. Per stream configuration: The downstream declares what txns they want to receive.
2. Global configuration: At the data service level we refuse to include full txns for all streams.

This PR implements the second of these, using @CapCap's work here:
aptos-labs/aptos-indexer-processors#398.

Rather than not sending txns at all if they match the blocklist filters, we just omit the writesets and events. Not sending the txns entirely would cause issues with processors, which today assume that they will receive all txns.

---------

Co-authored-by: Max Kaplan <[email protected]>
Co-authored-by: yuunlimm <[email protected]>
Co-authored-by: CapCap <[email protected]>
Co-authored-by: Daniel Porteous <[email protected]>
rtso pushed a commit that referenced this pull request Jun 24, 2024
There are two types of transaction filtering we will support in the future:
1. Per stream configuration: The downstream declares what txns they want to receive.
2. Global configuration: At the data service level we refuse to include full txns for all streams.

This PR implements the second of these, using @CapCap's work here:
aptos-labs/aptos-indexer-processors#398.

Rather than not sending txns at all if they match the blocklist filters, we just omit the writesets and events. Not sending the txns entirely would cause issues with processors, which today assume that they will receive all txns.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants