Grant Title
Grant Application - Modernising ethcontract-rs: Complete Migration to Alloy Stack
Author(s)
GitHub: @abhishekkochar
Experiences and qualifications
-
Blockchain Engineer with 5 years of experience in Rust, Solidity, and TypeScript
-
Built production systems using Rust, Alloy, and Reth (crvUSD liquidation solution)
-
Developed and maintained open-source SDKs and Rust libraries
Grant Description
Problem
The ethcontract-rs library is a critical piece of CoW Protocol infrastructure, providing type-safe Rust bindings for Ethereum smart contract interactions. With 321 stars and 150+ dependents, it serves as a foundational library for the CoW ecosystem.
However, the library currently depends on the web3 crate (rust-web3) and ethabi, both of these are barely maintained according to their own documentation. The maintainer explicitly states for web3:
“Note this package is barely maintained and I am looking for an active maintainer. If you are starting a new project, I’d recommend choosing ethers-rs instead.”
Furthermore, ethers-rs itself has now been officially deprecated in favor of Alloy.
Additionally, ethcontract-rs depends on several crates from parity-common including:
-
rlp- RLP encoding/decoding -
primitive-types- Core Ethereum primitive types (U256, H256, etc.) -
ethereum-types- Ethereum-specific type definitions -
ethbloom- Bloom filter implementation -
keccak-hash- Keccak hashing utilities -
fixed-hash- Fixed-size hash types
While these parity-common crates are still actively maintained, Alloy provides equivalent functionality through alloy-primitives and alloy-rlp. Migrating to Alloy’s implementations ensures stack consistency, reduces the total number of dependencies, and aligns with the direction of the broader Rust/Ethereum ecosystem.
This creates several critical issues for the CoW Protocol ecosystem:
-
Security vulnerabilities in unmaintained dependencies may go unpatched
-
Incompatibility with modern Rust tooling and newer compiler versions
-
Missing support for newer Ethereum features and EIPs
-
Developer hesitancy to build on deprecated foundations
-
Maintenance burden increases as web3 drifts further from modern standards
-
Dependency fragmentation - mixing parity-common types with other libraries requires constant type conversions
Solution
This grant proposes a comprehensive migration of ethcontract-rs to the Alloy stack, replacing both the deprecated web3 crate and the parity-common dependencies with their Alloy equivalents. This ensures a unified, consistent technology stack throughout the library.
Target: Alloy - the modern, high-performance Ethereum library that is the official successor to both web3 and ethers-rs. Alloy is actively maintained by the Paradigm team and represents the future of Rust-based Ethereum development.
Goals and Impact
-
Future-proof CoW Protocol infrastructure: Ensure ethcontract-rs remains viable and secure for years to come
-
Achieve full stack consistency: Unify all Ethereum primitives, RLP encoding, and types under a single Alloy-based stack
-
Improve developer experience: Leverage Alloy’s superior documentation, better error messages, and modern patterns
-
Maintain backward compatibility: Provide a smooth migration path for existing users of ethcontract-rs (150+ dependents)
-
Enable new integrations: Support modern Ethereum features (EIP-4844 blob transactions, EIP-1559, etc.)
-
Reduce dependency count: Consolidate multiple parity-common crates into unified Alloy equivalents
-
Strengthen ecosystem: Align CoW Protocol tooling with the broader Rust/Ethereum community direction
Technologies
-
Alloy (alloy-rs) - Core Ethereum library
-
alloy-primitives - Replacing primitive-types, ethereum-types, fixed-hash, uint, keccak-hash, ethbloom
-
alloy-rlp - Replacing rlp and rlp-derive
-
alloy-transport - Replacing web3 transports
-
alloy-sol-types - Replacing ethabi
-
alloy-contract - Contract interaction layer
Type of Grant
Milestone-Based Grant
This project has clearly defined deliverables and outcomes that can be measured at each milestone.
Milestones
| Milestone | Title | Due Date | Funding Request |
|---|---|---|---|
| Milestone 1 | Primitives & RLP Migration | 3 weeks after acceptance | 3,000 xDAI |
| Milestone 2 | Transport Layer Migration | 6 weeks after acceptance | 3,000 xDAI |
| Milestone 3 | Contract Bindings | 9 weeks after acceptance | 3,000 xDAI |
| Milestone 4 | Testing & Documentation | 11 weeks after acceptance | 2,500 xDAI |
| Milestone 5 | Review & Polish | 13 weeks after acceptance | 1,500 xDAI |
| TOTAL | 13 weeks | 13,000 xDAI |
Specifics: Milestone 1 - Primitives & RLP Migration
Duration: 3 weeks
Funding: 3,000 xDAI
Description: Replace all parity-common primitive types and RLP encoding with Alloy equivalents. This is the foundational milestone as all other components depend on these types.
Deliverables:
-
Replace
primitive-types(U256, U128, H256, H160, etc.) withalloy-primitives -
Migrate
ethereum-typesto Alloy equivalents -
Replace
fixed-hashmacro usages with Alloy’s fixed-size types -
Migrate
rlpencoding/decoding toalloy-rlp -
Replace
rlp-deriveprocedural macro withalloy-rlpderive macros -
Update
keccak-hashusages to use Alloy’skeccak256 -
Migrate
ethbloombloom filter to Alloy’sBloomtype -
Implement conversion traits (
From/Into) for backward compatibility
Success Criteria:
-
All primitive type tests pass with Alloy types
-
RLP encoding/decoding produces identical results to current implementation
-
No parity-common primitive dependencies remain in Cargo.toml
Specifics: Milestone 2 - Transport Layer Migration
Duration: 3 weeks (weeks 4-6)
Funding: 3,000 xDAI
Description: Replace the deprecated web3 transport and provider layer with Alloy’s modern transport system.
Deliverables:
-
Replace
web3::transportswithalloy-transport(HTTP, WebSocket, IPC) -
Update transaction building and signing to use Alloy’s transaction types
-
Implement provider abstraction layer for backward compatibility
-
Migrate gas estimation and nonce management
-
Update block and receipt types
Success Criteria:
-
All transport tests pass with Alloy backend
-
Basic contract calls work end-to-end
-
Transaction signing produces valid signatures
-
All existing transport features (HTTP, WS, IPC) functional
Specifics: Milestone 3 - Contract Bindings
Duration: 3 weeks (weeks 7-9)
Funding: 3,000 xDAI
Description: Update the procedural macro system and contract generation to work with Alloy types and ABI handling.
Deliverables:
-
Update
ethcontract-deriveprocedural macro for Alloy compatibility -
Migrate ABI encoding/decoding to
alloy-sol-types -
Update
ethcontract-generatefor build.rs script usage -
Maintain support for Truffle and Hardhat artifacts
-
Update
ethcontract-commonshared types -
Update event filtering and log parsing
Success Criteria:
-
Contract macro generates valid Alloy-based bindings
-
All existing examples compile and function correctly
-
Event subscriptions work correctly
-
ABI encoding/decoding matches current behaviour
Specifics: Milestone 4 - Testing & Documentation
Duration: 2 weeks (weeks 10-11)
Funding: 2,500 xDAI
Description: Comprehensive testing and documentation to ensure feature parity and provide migration guidance for existing users.
Deliverables:
-
Port and update existing test suite (all current tests passing)
-
Add integration tests against mainnet forks (using Anvil) where applicable
-
Write comprehensive migration guide for existing users
-
Update all examples in the repository
-
Update README and documentation
Success Criteria:
-
100% test parity with original test suite
-
Migration guide reviewed and approved by CoW team
-
All examples functional and documented
Specifics: Milestone 5 - Review & Polish
Duration: 2 weeks (weeks 12-13)
Funding: 1,500 xDAI
Description: Final review, optimization, and release preparation based on feedback from the CoW team and community.
Deliverables:
-
Address code review feedback from CoW team
-
Performance benchmarking and optimization
-
Prepare release candidate and changelog
-
Publish updated version to crates.io
-
Final documentation polish
Success Criteria:
-
Code review approved by CoW team
-
No performance regression vs. web3/parity-common implementation
-
Successfully published to crates.io
-
All deprecated dependencies removed
Phase 2: Maintenance
Following Phase 1 completion, I commit to maintaining the migrated ethcontract-rs for 1 year:
-
Bug fixes and security patches
-
Compatibility updates with new Alloy releases
-
Community support and issue triage
Maintenance funding to be discussed upon Phase 1 completion, potentially through Volume Grants Program or a separate maintenance grant.
Length
Total Duration: 13 weeks PTE (Part time employment), corresponds to 20hrs per week for 13 weeks. Amount to 260hrs.
Commencement Date: Upon successful passing of the proposal on Snapshot
Expected Completion: 13 weeks after commencement.
Funding Request
Total Funding Requested: 14,500 xDAI
| Category | Amount |
|---|---|
| Development/labor (primitives, transport, bindings, testing) | 13,000 xDAI |
| Total | 13,000 xDAI |
Gnosis Chain Address (to receive the grant):
gno:0xa87a0BE15A8507e0e652f80B0f898301c9a7906D
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.
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.