Skip to content

Conversation

@snissn
Copy link
Contributor

@snissn snissn commented Feb 12, 2025

Changes Introduced:

  • Added client.go to handle CAR file creation, CommP computation, and blockchain offer submission.
  • Implemented offer-file CLI command, which automates the file preprocessing and submission process.
  • Updated xchain.go to integrate the offer-file command alongside existing offer-car functionality.
  • Improved CLI flexibility by introducing configuration flags for specifying the blockchain source.

Why This Change?

This feature streamlines the offering process by automating the required file conversions and CommP calculations, reducing the need for manual intervention.

How to Test:

  1. Build the project using go build -o xchainClient.
  2. Run ./xchainClient client offer-file <file_path> <payment-addr> <payment-amount> --chain ethereum --config ./config/config.json.
  3. Verify the transaction details and on-chain submission logs.

Related Issues:

Closes #6

- Introduced a dedicated `config` package (`config/config.go`) to manage configuration.
- Updated `.gitignore` to properly exclude `config/xchain_key.json`.
- Refactored `config.json` structure to support multiple source chains (e.g., Ethereum, Polygon, Avalanche).
- Updated CLI to require a `--chain` argument to specify the source blockchain.
- Modified `xchain.go` to dynamically load source chain configuration based on `--chain`.
- Updated `NewAggregator` and other functions to use `config.SourceChainConfig`.
- Fixed logging issue in `processDealStatus` by using `%v` instead of `%s` for structured data.
- Removed old hardcoded `Config` struct from `xchain.go` and replaced it with the `config` package.
- Updated tests (`xchain_test.go`) to use the new config structure and support multiple chains.
- Updated `go.mod` to include `github.com/stretchr/testify` and `github.com/filecoin-project/go-cbor-util` for improved testing and CBOR support.

This refactor improves modularity, allowing seamless integration of multiple blockchains.
This reverts commit e3d43d3.
…rocessing

- Introduced `offer-file` command to handle file preprocessing before offering data.
- Implemented `client.go` to manage file conversion to CAR format, CommP calculation, and offer submission.
- Updated `xchain.go` to register `offer-file` under the `client` subcommand.
- Improved CLI usability with configurable parameters.
@snissn snissn requested a review from longfeiWan9 February 12, 2025 20:07
@longfeiWan9 longfeiWan9 merged commit 4862f7e into main Feb 13, 2025
1 check passed
@longfeiWan9 longfeiWan9 deleted the feat/offer-file-command branch February 13, 2025 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement the script to simulate the process of storing data

3 participants