-
Notifications
You must be signed in to change notification settings - Fork 7
add aws kms client caching #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
621d721
3b9d581
bd08506
2452c73
6c30186
bb5ef79
423b6a5
dd1e329
246c9a0
fc9a254
ea37ab8
0dc8fd7
ddfd0ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,42 @@ | ||||||||||||||||||||||||||||
# Start local chain with anvil + speedbump proxy (300ms variable latency) | ||||||||||||||||||||||||||||
local-chain: | ||||||||||||||||||||||||||||
#!/usr/bin/env bash | ||||||||||||||||||||||||||||
set -e | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
echo "🧹 Cleaning up existing processes..." | ||||||||||||||||||||||||||||
# Kill any existing anvil or speedbump processes | ||||||||||||||||||||||||||||
pkill -f "anvil.*8546" || true | ||||||||||||||||||||||||||||
pkill -f "speedbump.*8545" || true | ||||||||||||||||||||||||||||
lsof -ti:8545 | xargs kill -9 2>/dev/null || true | ||||||||||||||||||||||||||||
lsof -ti:8546 | xargs kill -9 2>/dev/null || true | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
echo "🔨 Starting anvil on port 8546 (1s blocktime)..." | ||||||||||||||||||||||||||||
anvil --port 8546 --block-time 1 & | ||||||||||||||||||||||||||||
ANVIL_PID=$! | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
# Cleanup function | ||||||||||||||||||||||||||||
cleanup() { | ||||||||||||||||||||||||||||
echo "" | ||||||||||||||||||||||||||||
echo "🛑 Stopping services..." | ||||||||||||||||||||||||||||
kill $ANVIL_PID 2>/dev/null || true | ||||||||||||||||||||||||||||
pkill -f "speedbump.*8545" || true | ||||||||||||||||||||||||||||
exit 0 | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
trap cleanup INT TERM EXIT | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
# Wait a moment for anvil to start | ||||||||||||||||||||||||||||
sleep 2 | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
echo "🐌 Starting speedbump proxy on port 8545 (→ localhost:8546)" | ||||||||||||||||||||||||||||
echo " Latency: 300ms base + 150ms sine wave (150-450ms variable)" | ||||||||||||||||||||||||||||
echo " Connect to: http://localhost:8545" | ||||||||||||||||||||||||||||
echo "" | ||||||||||||||||||||||||||||
speedbump --port=8545 --latency=300ms --sine-amplitude=150ms --sine-period=1m localhost:8546 | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
# Fund an address with 1 ETH (bypasses speedbump for faster setup) | ||||||||||||||||||||||||||||
fund address: | ||||||||||||||||||||||||||||
@echo "💰 Funding {{address}} with 1 ETH..." | ||||||||||||||||||||||||||||
@cast rpc anvil_setBalance {{address}} $(cast to-wei 1) --rpc-url http://localhost:8546 | ||||||||||||||||||||||||||||
@echo "✅ Done!" | ||||||||||||||||||||||||||||
Comment on lines
+38
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Add validation and error handling for address parameter. The target doesn't validate that the fund address:
+ @test -n "{{address}}" || (echo "❌ Error: address parameter is required" && exit 1)
@echo "💰 Funding {{address}} with 1 ETH..."
- @cast rpc anvil_setBalance {{address}} $(cast to-wei 1) --rpc-url http://localhost:8546
- @echo "✅ Done!"
+ @if cast rpc anvil_setBalance {{address}} $(cast to-wei 1) --rpc-url http://localhost:8546; then \
+ echo "✅ Done!"; \
+ else \
+ echo "❌ Failed to fund address"; \
+ exit 1; \
+ fi 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cleanup logic may kill unrelated processes.
The
pkill -f
patterns andlsof | xargs kill -9
commands may be too broad and could terminate unrelated processes that happen to match the patterns or use the ports.Consider using more precise process identification or maintaining PID files for safer cleanup.