Add enhanced concurrency patterns, rate limiting, market management, and pipeline processing

This commit is contained in:
Krypto Kajun
2025-09-12 01:35:50 -05:00
parent 300976219a
commit fbb85e529a
17 changed files with 1440 additions and 190 deletions

View File

@@ -0,0 +1,27 @@
You are an expert in Go concurrency patterns and high-performance systems. I'm building an MEV bot that needs to efficiently process thousands of transactions per second using advanced concurrency patterns.
I need help with:
1. Implementing efficient worker pools for transaction processing
2. Creating pipeline patterns for multi-stage processing
3. Implementing fan-in and fan-out patterns for data distribution
4. Using channels effectively for communication between goroutines
5. Managing rate limiting across multiple RPC endpoints
6. Implementing backpressure handling to prevent resource exhaustion
7. Optimizing memory usage and garbage collection
8. Using context for cancellation and timeouts
Please provide production-ready Go code that:
- Implements efficient concurrency patterns
- Handles errors gracefully without leaking goroutines
- Uses appropriate buffering for channels
- Follows Go best practices for concurrent programming
- Includes comprehensive comments explaining the patterns used
- Provides metrics for monitoring performance
The code should:
- Process transactions with minimal latency
- Scale efficiently across multiple CPU cores
- Handle backpressure gracefully
- Provide clear error handling and recovery
- Include benchmarks for critical functions

26
@prompts/rate-limiting.md Normal file
View File

@@ -0,0 +1,26 @@
You are an expert in rate limiting and resource management for distributed systems. I'm building an MEV bot that needs to efficiently manage requests to multiple RPC endpoints with different rate limits.
I need help with:
1. Implementing adaptive rate limiting that adjusts to endpoint capacity
2. Creating a rate limiter manager for multiple endpoints
3. Handling rate limit errors gracefully with fallback strategies
4. Implementing retry mechanisms with exponential backoff
5. Monitoring and adjusting rate limits based on observed performance
6. Balancing load across multiple endpoints
7. Handling different rate limit types (RPS, concurrent requests, etc.)
8. Implementing circuit breakers for failed endpoints
Please provide production-ready Go code that:
- Implements efficient rate limiting for multiple endpoints
- Handles errors gracefully
- Follows Go best practices
- Includes comprehensive comments explaining the rate limiting strategies
- Provides metrics for monitoring rate limit usage
The code should:
- Respect rate limits for all endpoints
- Automatically adjust to endpoint capacity
- Handle rate limit errors gracefully
- Provide clear metrics for monitoring
- Include benchmarks for critical functions

View File

@@ -0,0 +1,27 @@
You are an expert in Ethereum transaction processing and MEV optimization. I'm building an MEV bot that needs to efficiently decode and analyze Uniswap V3 swap transactions.
I need help with:
1. Decoding transaction calldata for Uniswap V3 swap functions
2. Extracting token addresses and amounts from swap transactions
3. Identifying the pool contract and fee tier from transaction data
4. Calculating price impact of swaps using Uniswap V3 mathematics
5. Detecting multi-hop swaps and complex routing patterns
6. Efficiently processing large volumes of transactions
7. Handling different versions of Uniswap contracts
8. Working with Ethereum event logs for additional data
Please provide production-ready Go code that:
- Uses the go-ethereum library for transaction processing
- Implements efficient decoding of transaction data
- Handles errors gracefully
- Follows Go best practices
- Includes comprehensive comments explaining the decoding process
- Provides metrics for monitoring performance
The code should:
- Accurately decode Uniswap V3 swap transactions
- Extract all relevant data for MEV analysis
- Handle various edge cases and error conditions
- Process transactions with minimal latency
- Include benchmarks for critical functions