Skip to content

Commit

Permalink
Simpler Transaction Filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
CapCap committed May 31, 2024
1 parent b412cc8 commit 1891c31
Show file tree
Hide file tree
Showing 18 changed files with 1,512 additions and 6 deletions.
42 changes: 38 additions & 4 deletions rust/Cargo.lock

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

5 changes: 4 additions & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[workspace]
resolver = "2"

members = ["indexer-metrics", "moving-average", "processor", "server-framework"]
members = ["indexer-metrics", "moving-average", "processor", "server-framework", "transaction-filter"]

[workspace.package]
authors = ["Aptos Labs <[email protected]>"]
Expand Down Expand Up @@ -67,6 +67,8 @@ jemallocator = { version = "0.5.0", features = [
] }
kanal = { version = "0.1.0-pre8", features = ["async"] }
once_cell = "1.10.0"
# SIMD for string search
memchr = "2.7.2"
num_cpus = "1.16.0"
pbjson = "0.5.1"
prometheus = { version = "0.13.0", default-features = false }
Expand All @@ -86,6 +88,7 @@ sha2 = "0.9.3"
sha3 = "0.9.1"
strum = { version = "0.24.1", features = ["derive"] }
tempfile = "3.3.0"
thiserror = "1.0.61"
toml = "0.7.4"
tracing-subscriber = { version = "0.3.17", features = ["json", "env-filter"] }
tokio = { version = "1.35.1", features = ["full"] }
Expand Down
5 changes: 4 additions & 1 deletion rust/processor/src/utils/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ pub struct MultisigPayloadClean {
}

/// Standardizes all addresses and table handles to be length 66 (0x-64 length hash)
#[inline]
pub fn standardize_address(handle: &str) -> String {
if let Some(handle) = handle.strip_prefix("0x") {
if handle.len() == 66 {
handle.to_string()
} else if let Some(handle) = handle.strip_prefix("0x") {
format!("0x{:0>64}", handle)
} else {
format!("0x{:0>64}", handle)
Expand Down
32 changes: 32 additions & 0 deletions rust/transaction-filter/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[package]
name = "transaction-filter"
version = "0.1.0"

# Workspace inherited keys
authors = { workspace = true }
edition = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
publish = { workspace = true }
repository = { workspace = true }
rust-version = { workspace = true }
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow = { workspace = true }
aptos-protos = { workspace = true }

# SIMD for string search. TODO: benchmark this on various real inputs to see if it's worth it
memchr = { workspace = true }

prost = { workspace = true }

serde = { workspace = true }
serde_json = { workspace = true }

thiserror = { workspace = true }

[dev-dependencies]
# we only decompress the fixture protos in tests
lz4 = "1.24.0"

Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 1891c31

Please sign in to comment.