Grant Application - CoW Protocol Backend Alloy Migration
Author(s)
Pactum Nova LLC builds blockchain solutions specialising in Ethereum, smart contracts, and Rust development with a focus on protocol-level improvements for ecosystem projects.
Team Qualifications:
- mfw78: Former CoW Protocol Core Contributor with deep knowledge of the backend architecture, CoW Protocol specific requirements, and execution risk management
- 0xferrous: Extensive open source contributions to alloy and foundry-rs ecosystems, with multiple smart contract projects delivered for CoW DAO
- Collective Experience: Combined expertise in Ethereum tooling migration, performance optimisation, and maintaining production-grade blockchain infrastructure
Relevant Links:
- GitHub/Discord: @mfw78 @0xferrous
- Previous contributions to CoW DAO
- Experience with alloy-rs migration patterns
Grant Description:
The CoW Protocol backend currently relies on ethcontract-rs
, which depends on the web3
crate that has seen minimal updates (last release v0.19.0 in June 2023). This creates significant technical debt and blocks future innovation, particularly our planned implementation of EIP-7702 delegate handlers to bring complex swap capabilities to EOAs through Type 4 transactions—functionality that web3
cannot support.
Self-Sufficient Execution: This grant is designed to minimise demands on the CoW Protocol core team, with grantees managing all development, testing infrastructure, and coordination independently.
Problem Statement:
ethcontract-rs
depends on the stagnantweb3
crate (last updated June 2023), creating maintenance overhead that currently consumes significant backend team resources- Current architecture depending on stagnant crates hinders the ability for CoW Protocol to inherit new feature functionality such as Type 4 transactions for EIP-7702 implementations
- Performance limitations from outdated Ethereum interaction primitives impact operational efficiency
- Technical debt from deprecated dependencies creates security and maintenance risks whilst diverting development resources from innovation
- Legacy tooling stack prevents CoW Protocol from leveraging ecosystem advances in Ethereum infrastructure
- Current architecture creates development bottlenecks that limit protocol evolution
Proposed Solution:
Migration to alloy-rs
addresses these challenges by providing:
- Future Protocol Support: Allows for immediately inheriting new features, such as native type 4 transaction support for EIP-7702 implementations
- Performance Improvements: Faster U256 arithmetic and ABI encoding
- Modern Architecture: Industry-standard tooling used by Reth, Foundry, and other leading Ethereum projects
- Active Development: Backed by Paradigm with comprehensive documentation and ecosystem support
- Ecosystem Alignment: Positions CoW Protocol alongside cutting-edge infrastructure adopted by leading DeFi protocols
Expected Impact:
This migration eliminates critical technical debt that currently burdens the backend team with maintenance overhead, freeing up development resources for innovation. By positioning CoW Protocol for advanced features like EIP-7702 delegate handlers, it represents strategic infrastructure investment that enables the protocol to rapidly adopt new Ethereum capabilities. This foundational upgrade serves as the cornerstone for a planned series of modernisation grants that will unlock next-generation CoW Protocol capabilities whilst reducing long-term maintenance burden.
Type of Grant:
Milestone-based grant with a single comprehensive milestone reflecting the interconnected nature of the migration.
Milestones:
Milestones | Title | Due date (*) | Funding request |
---|---|---|---|
Milestone 1 | Complete CoW Protocol Backend Alloy Migration | 6 weeks after acceptance | €80,000 + €20,000 COW equivalent |
(*) 6 weeks estimated for core migration work, with additional time for reviews, testing, and coordination with backend team
Specifics: Milestone 1
Complete CoW Protocol Backend Alloy Migration
This milestone encompasses the full migration of CoW Protocol backend services from ethcontract-rs to alloy-rs, following the technical strategy coordinated with the backend team.
Key Deliverables:
-
Fork Management & Development
- Maintain rebased fork of CoW services repository
- Regular rebasing on master to track upstream changes
- Granular commit structure for comprehensive reviewability
-
Core Migration Implementation
- Migration of shared primitive types
- RPC and transport layer updates to alloy
Provider
- Gas estimation workflow migration with performance optimisation
- EIP-712 signing implementation updates ensuring full compatibility
-
Testing & Validation Framework
- Before/after test framework for behavioural parity validation
- Automated testing of transaction inputs/outputs and gas estimation
- API and Database Compatibility Testing: Comprehensive validation to ensure zero breaking changes for solvers and front-end users, including endpoint response formats, data serialisation, and database schema compatibility
- Performance Requirements Validation: Memory consumption and CPU usage validation against current production requirements, including:
- Testing on production loads via shadow competition methodology
- Validation on staging cluster with grantee-managed devops access to minimise core team overhead
- Performance regression testing to ensure migration maintains or improves current benchmarks
- Metrics Alignment and Modification: Analysis and potential adjustment of Grafana/Prometheus metrics to ensure like-for-like performance comparisons post-migration, including:
- Identification of metrics that may change due to alloy implementation differences
- Creation of equivalent or improved metrics for monitoring consistency
- Documentation of any metric changes for operational teams
-
Integration & Documentation
- Single comprehensive “mega merge” PR with complete migration
- Detailed documentation of changes and architectural improvements
- Migration guide for future reference and knowledge transfer
- Coordination with backend team for seamless integration
Technical Scope:
Based on coordination with the CoW Protocol backend team, this migration addresses the cross-cutting nature of shared primitives through a fork-and-rebase strategy, ensuring minimal disruption and core team burden whilst enabling comprehensive modernisation.
Length
Project Duration: 6 weeks for core migration work
Total Timeline: 8-10 weeks including reviews, testing coordination, and integration
Commencement Date: Upon successful approval on Snapshot
Funding Request:
Total Funding Request: €80,000 EUR + €20,000 EUR COW equivalent (COW tokens vesting over 1 year)
Token Component Rationale: The COW token portion ensures ecosystem alignment and sustained commitment to CoW Protocol’s long-term success, particularly as this foundational work enables future protocol enhancements.
Payment Terms: [UPFRONT FUNDING REQUEST] Seeking €20,000 downpayment upon commencement of work, with risk offset by the team’s previous contributions to CoW Protocol development and established track record. This upfront payment enables immediate resource allocation and project initiation whilst maintaining accountability through milestone delivery.
Resource Allocation & Cost Breakdown:
Team Composition: 2 senior developers (mfw78, 0xferrous) working full-time over 6-8 weeks
Resource Allocation Structure:
- Core Migration Development: ~7.5 man-weeks (3.75 weeks per developer)
- Shared primitive migration and type system updates
- RPC/transport layer restructuring
- Gas estimation and EIP-712 signing workflow updates
- Testing & Validation Infrastructure: ~3 man-weeks
- Before/after behavioural parity framework development
- Performance validation on staging clusters
- API/database compatibility testing automation
- Integration & Documentation: ~2 man-weeks
- Comprehensive migration documentation
- Code review coordination and iteration
- Knowledge transfer and architectural guidance
Total Estimated Effort: ~12.5 man-weeks of specialised Ethereum infrastructure development
Value Proposition Context:
Modern blockchain infrastructure migrations of this complexity typically command premium rates due to the specialised knowledge required and production system risks involved. The funding request reflects:
- Specialised Domain Knowledge: Deep understanding of both CoW Protocol’s architecture and modern Ethereum tooling ecosystem
- Infrastructure Complexity: Migration touches fundamental types across the entire backend, requiring careful orchestration to avoid breaking changes
- Risk Management: Self-managed testing infrastructure and comprehensive validation frameworks minimise core team disruption
- Operational Efficiency: Independent execution model reduces coordination overhead for CoW Protocol team
- Strategic Foundation: Enables future protocol enhancements (EIP-7702, Type 4 transactions) that would otherwise be blocked by technical debt
- Parallel execution burden: Maintaining a fork with regular rebasing inherits overhead required for addressing repetitive merge conflicts
The funding represents efficient resource allocation for modernising critical infrastructure whilst positioning CoW Protocol for next-generation capabilities.
Gnosis Chain Address (to receive the grant)
0xbC394D0D2B2A2E681F831e1768A7501A1C2e8fe4
Other Information
Conflict of Interest Disclosure: mfw78, as a member of this grant application team, currently serves on the CoW DAO grants committee. To ensure complete transparency and maintain the integrity of the grant evaluation process, mfw78 commits to fully abstaining from any voting or decision-making related to this grant application. Whilst mfw78 may participate in discussions as a grant applicant to provide clarifications or answer questions, he will abstain from all committee voting and decision-making processes. This abstention applies to all phases of the grant evaluation, approval, and oversight processes.
Scope Coordination: This project scope has been extensively coordinated with the CoW Protocol backend team, ensuring alignment on technical approach and deliverables.
Strategic Context: This migration represents the first in a series of planned grants to modernise CoW Protocol infrastructure, with future grants building on this foundation to implement EIP-7702 delegate handlers and other advanced capabilities.
Risk Mitigation: Our team’s deep familiarity with CoW Protocol’s architecture significantly reduces implementation risks, ensures domain knowledge continuity, and enables independent execution with minimal core team dependencies.
Future Roadmap: This migration enables subsequent grants for EIP-7702 implementation, bringing complex swap capabilities directly to EOAs through Type 4 transactions—innovations impossible with the current web3-based stack.
Terms and Conditions
By submitting this grant application, I acknowledge and agree to be bound by the CoW DAO Participation Agreement and the CoW DAO Grant Agreement Terms.
INCLUDE NOTE TO COMMITTEE: Please notify the Grantee of their reviewer and their steward in the thread and latest upon successful approval of the Grant on Snapshot.