Files
cocos/cli
Sammy Kerata Oina 997fb3bf48 COCOS-83 - Add hash verification for datasets and algorithms (#84)
* Add hash verification for datasets and algorithms

Enhanced data integrity checking by incorporating hash fields in Dataset and Algorithm structures, and modified the corresponding service logic to validate these hashes during processing. The update includes SHA-3 for hash computation, replacing the former SHA-256 usage, and ensures the provided data matches the expected hash from the manifest to prevent processing malformed or corrupted data.

- Introduce `Hash` field to both Dataset and Algorithm structs to store the expected hash value.
- Implement SHA-3 hashing within service methods that process the data, ensuring consistency with newly added `Hash` fields.
- Add error handling for hash mismatches, preventing further processing and alerting to potential data integrity issues.
- Update Protocol Buffers serialization to accommodate the new hash fields for gRPC communication.
- Modify manager service's Run method to pass the hash information when creating agent configurations.

Go module dependencies were updated to include the new SHA-3 package and upgrade Go version to 1.21.6 for improved stability and compatibility.

Signed-off-by: SammyOina <sammyoina@gmail.com>

* Remove identifiers from protobuf and related code

The protobuf definitions and related service handling code have been revised to drop specific identifier fields (`AlgorithmID` and `DatasetID`) to simplify API responses and internal function signatures. These removals streamline the overall data flow between components, reduce unnecessary data transmission, and lead to an aligned server-client expectation where identifiers are no longer a part of the response payload. Consequently, these changes simplify the logic within various functions and client commands, reinforcing encapsulation by ensuring that internal identifiers do not need to be managed or exposed unnecessarily.

Signed-off-by: SammyOina <sammyoina@gmail.com>

* fix lint

Signed-off-by: SammyOina <sammyoina@gmail.com>

---------

Signed-off-by: SammyOina <sammyoina@gmail.com>
2024-02-19 15:31:35 +01:00
..
2024-01-25 15:07:33 +01:00
2024-02-07 16:16:27 +01:00

Agent CLI

This repository contains the command-line interface (CLI) tool for interacting with the Agent and manager service. The CLI allows you to perform various tasks such as running computations, uploading algorithms and datasets, and retrieving results.

Build

From the project root:

make cli

Usage

Run Computation

To run a computation, use the following command:

./build/cocos-cli manager run --computation '{"name": "my-computation"}'

Get attestation

To retrieve attestation from agent, use the following command:

./build/cocos-cli agent attestation get '<report_data>'

Validate attestation

To validate and verify attestation from agent, use the following command:

./build/cocos-cli agent attestation validate '<attestation>' '<report_data>'

Upload Algorithm

To upload an algorithm, use the following command:

./build/cocos-cli agent algo /path/to/algorithm

Upload Dataset

To upload a dataset, use the following command:

./build/cocos-cli agent data /path/to/dataset.csv

Retrieve result

To retrieve the computation result, use the following command:

./build/cocos-cli agent result

Installtion

To use the CLI, you have the option to install it globally on your system. Here's how:

Build the CLI:

Navigate to the project root and run the following command to build the CLI binary:

make install-cli