Skip to content

Commit

Permalink
Ipfs functionality (#15)
Browse files Browse the repository at this point in the history
* feat(ipfs): add IPFS utilities crate

- Create new ipfs-utils crate for IPFS file operations
- Implement IpfsManager for database file upload and download
- Add comprehensive test suite including edge cases:
  - Basic upload and fetch functionality
  - Empty file handling
  - Invalid hash handling
  - Non-existent file handling
  - Invalid path handling

* feat: Add IPFS utilities for MMR database files

Add new ipfs-utils crate for handling MMR database files through IPFS. Features include:

- Basic IPFS file upload and download functionality
- File size limits and validation
- Atomic file writes using temporary files
- Error handling with custom error types
- Basic hash validation
- Comprehensive test suite

Key functionality:
- Upload .db files to IPFS and get CID
- Fetch .db files from IPFS using hash
- Connection checking and error handling
- Configurable file size limits (default 50MB)

Tests cover:
- Basic upload/fetch operations
- Empty file handling
- Invalid hash handling
- Invalid path handling
- Nonexistent file handling

* feat: integrate IPFS storage for MMR batch files

- Add new ipfs-utils crate for IPFS operations
- Integrate IPFS storage in BatchProcessor
- Upload MMR state to IPFS after each update
- Add proper error handling for IPFS operations
- Clean up temporary files after batch completion

Key changes:
- Upload MMR state to IPFS after every update, not just on completion
- Use temporary local files during processing
- Add StorageError variant for IPFS-related errors
- Add IPFS manager to BatchProcessor
- Convert paths properly between String and PathBuf

* feat(scripts): update both .env.local and .env.docker in docker mode

- Modified deploy-ethereum.sh to update both environment files in docker mode
- Modified deploy-starknet.sh to update both environment files in docker mode
- Added ENV_FILES array to handle multiple environment files
- Added verification steps for environment file updates
- Maintained backward compatibility for non-docker environments

* refactor(starknet-handler): improve IPFS hash conversion to Felt

- Replace felt!(hash) with Felt::from_hex() for IPFS hash conversion
- Remove unused felt macro import
- Use existing FeltConversion error handler

* refactor: improve IPFS hash handling across crates

- Replace felt!(hash) with Felt::from_hex() for IPFS hash conversion in starknet-handler
- Remove unused felt macro import
- Use existing FeltConversion error handler
- Add IPFS hash to BatchResult in batch processor
- Update accumulator to handle IPFS hash storage

* fixed logs

* docker fixes + added IPFS CID onchain for completed batches

* added batch size option to client

* misc fixes + improved logging + retries for db connection

* ipfs integration test as feature
  • Loading branch information
ametel01 authored Jan 9, 2025
1 parent 90dd9ab commit ca997e7
Show file tree
Hide file tree
Showing 26 changed files with 920 additions and 97 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ contracts/starknet/account-sepolia
contracts/starknet/keystore

terminal

logs/anvil.log
Loading

0 comments on commit ca997e7

Please sign in to comment.