Skip to content

Commit 682c960

Browse files
tvinagrezizou0xlouise-poole
authored
feat: UniswapV4 Hooks support (#232)
* feat: Adapt UniV4 Substreams to emmit storage changes * feat: Split UniswapV4 into hooks and no-hooks * feat: Add yaml config file for UniV4 with no Hooks * feat: Identify Euler pools on initialization, pause Uninstalled pools * fix: Bump Substreams version * refactor: rust fmt * refactor: optimize store, remove unused params and code * refactor: improve `store_pool_per_euler_hook` This commit reduces the `store_pool_per_euler_hook` store size to the minimum required. We only use it for euler pools and only store one pool per hook. * refactor: cargo fmt * refactor: update `euler_pools_per_hook_store` lookup * fix: Attach pausing attribute to the correct transaction * fix: Attach pausing attribute to the correct transaction * chore: cargo fmt * feat: bump version to 0.5.0 to use new Tycho-substreams interface with previous slot value * chore: use crate.io for `tycho-substreams` dependency * fix: update tycho-substreams version This new version has a bugfix for block storage extraction. * fix: update tycho-substreams version to include native balances * feat: remove full `block_storage_changes` from core usv4 * refactor: apply clippy suggestions * ci: include all workspace packages on workspace change and skip checking for changes in non-substream submodules * feat: create usv4 helper fn to collect block changes This allows us to centralise repeated code between the hooks and no hooks implementations. --------- Co-authored-by: zizou <[email protected]> Co-authored-by: Louise Poole <[email protected]>
1 parent 78d6f68 commit 682c960

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+15946
-48
lines changed

.github/actions/substreams-check/action.yml

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,68 @@ runs:
2323
2424
# Initialize empty array for package names
2525
PACKAGE_NAMES=()
26+
# Track workspaces where changes occurred outside of packages
27+
WORKSPACE_DIRS=()
2628
2729
# Process each changed file
2830
while IFS= read -r file; do
31+
[ -z "$file" ] && continue
32+
2933
# Get the directory of the file
3034
dir=$(dirname "$file")
35+
FOUND_PACKAGE=false
36+
ENCOUNTERED_WORKSPACE=""
3137
3238
# Find the nearest parent directory containing Cargo.toml
3339
while [ "$dir" != "substreams" ] && [ "$dir" != "." ]; do
3440
if [ -f "$dir/Cargo.toml" ]; then
35-
PACKAGE_NAME=$(grep -m1 '^name = ' "$dir/Cargo.toml" | cut -d'"' -f2)
41+
# Check if this Cargo.toml is a workspace (has [workspace] section)
42+
if grep -q '^\[workspace\]' "$dir/Cargo.toml" 2>/dev/null; then
43+
# Track workspace for potential addition of all members
44+
if [ -z "$ENCOUNTERED_WORKSPACE" ]; then
45+
ENCOUNTERED_WORKSPACE="$dir"
46+
fi
47+
dir=$(dirname "$dir")
48+
continue
49+
fi
50+
51+
# Extract package name, handle case where grep finds nothing
52+
PACKAGE_NAME=$(grep -m1 '^name = ' "$dir/Cargo.toml" 2>/dev/null | cut -d'"' -f2)
3653
if [ -n "$PACKAGE_NAME" ]; then
3754
PACKAGE_NAMES+=("$PACKAGE_NAME")
55+
FOUND_PACKAGE=true
3856
break
3957
fi
4058
fi
4159
dir=$(dirname "$dir")
4260
done
61+
62+
# If no package was found but we encountered a workspace, add it to the list
63+
if [ "$FOUND_PACKAGE" = false ] && [ -n "$ENCOUNTERED_WORKSPACE" ]; then
64+
WORKSPACE_DIRS+=("$ENCOUNTERED_WORKSPACE")
65+
fi
4366
done < changed_files.txt
4467
68+
# Add all packages from workspaces that had changes outside of specific packages
69+
for workspace_dir in "${WORKSPACE_DIRS[@]}"; do
70+
# Extract workspace members from Cargo.toml
71+
if [ -f "$workspace_dir/Cargo.toml" ]; then
72+
# Get members section, extract quoted strings
73+
MEMBERS=$(awk '/^members = \[/,/^\]/ {print}' "$workspace_dir/Cargo.toml" | grep '.*' | sed 's/.*"\(.*\)".*/\1/')
74+
75+
# For each member, try to find the package name
76+
for member in $MEMBERS; do
77+
MEMBER_PATH="$workspace_dir/$member"
78+
if [ -f "$MEMBER_PATH/Cargo.toml" ]; then
79+
PACKAGE_NAME=$(grep -m1 '^name = ' "$MEMBER_PATH/Cargo.toml" 2>/dev/null | cut -d'"' -f2)
80+
if [ -n "$PACKAGE_NAME" ]; then
81+
PACKAGE_NAMES+=("$PACKAGE_NAME")
82+
fi
83+
fi
84+
done
85+
fi
86+
done
87+
4588
# Remove duplicates and sort
4689
PACKAGE_NAMES=($(printf "%s\n" "${PACKAGE_NAMES[@]}" | sort -u))
4790

.github/workflows/substream.cd.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
steps:
2323
- uses: actions/checkout@v3
2424
with:
25-
submodules: recursive
25+
submodules: false
2626

2727
- name: Setup toolchain
2828
uses: dtolnay/rust-toolchain@v1

.github/workflows/substream.ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v3
1313
with:
14-
submodules: recursive
14+
submodules: false
1515

1616
- name: Check if any Substreams files changed
1717
id: substreams-files-changed
@@ -65,7 +65,7 @@ jobs:
6565
steps:
6666
- uses: actions/checkout@v3
6767
with:
68-
submodules: recursive
68+
submodules: false
6969

7070
- name: Check if any Substreams files changed
7171
id: substreams-files-changed

substreams/Cargo.lock

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

substreams/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ members = [
1313
"ethereum-uniswap-v3-logs-only",
1414
"ethereum-template-factory",
1515
"ethereum-template-singleton",
16-
"ethereum-uniswap-v4",
16+
"ethereum-uniswap-v4/shared",
17+
"ethereum-uniswap-v4/no-hooks",
18+
"ethereum-uniswap-v4/with-hooks",
1719
"ethereum-ekubo-v2",
1820
"ethereum-maverick-v2",
1921
"ethereum-balancer-v3",

0 commit comments

Comments
 (0)