Skip to content

Commit

Permalink
Merge pull request #15 from lorenz234/main
Browse files Browse the repository at this point in the history
Add bulk attestations and update folder structure
  • Loading branch information
lorenz234 authored Jan 16, 2025
2 parents b64a5fe + 943b1a9 commit 1761bee
Show file tree
Hide file tree
Showing 35 changed files with 6,416 additions and 2,024 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dbml_to_svg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Convert DBML to SVG
on:
push:
paths:
- '**/data_model/data_model.dbml'
- '**/data_model/img/data_model.dbml'

permissions:
contents: write
Expand All @@ -22,7 +22,7 @@ jobs:
run: npm install -g @softwaretechnik/dbml-renderer

- name: Convert DBML to SVG
run: dbml-renderer -i ./data_model/data_model.dbml -o ./data_model/data_model.svg
run: dbml-renderer -i ./data_model/img/data_model.dbml -o ./data_model/img/data_model.svg


- name: Commit and Push SVG Images
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# bulk attesting
data_pool/bulk_attesting/node_modules
data_pool/bulk_attesting/attestation_logs_*.json
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Labelling is performed by assigning a pre-defined `tag_id` with a `value` to an
* `tag_id`: tag IDs represent a wide range of concepts. For OLI-compliant tags, please refer to [tag_defintions.yml](https://github.com/openlabelsinitiative/OLI/blob/main/tags/tag_definitions.yml). We encourage anyone to submit a PR to contribute new tags to the framework. The framework also allows for other tag ID namespaces for more detailed project based labelling.
* `value`: Each `tag_id` has a value field that specifies the content of the tag applied.

<img src="data_model/data_model.svg" alt="Data Model" width="400">
<img src="data_model/img/data_model.svg" alt="Data Model" width="400">


## Datasets
Expand Down
Empty file added data_model/README.md
Empty file.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
43 changes: 26 additions & 17 deletions data_entry/README.md → data_pool/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OLI Data Entry / Contract Labeling

** OLI DATA ENTRY IS CURRENTLY IN BETA - USE AT OWN RISK **
** OLI DATA ENTRY IS CURRENTLY IN BETA **

OLI Data Entry focuses specifically on the process of data entry for address labels. While the broader OLI framework defines how labels are stored, OLI Data Entry provides the tools and guidelines necessary for labeling EVM smart contracts as part of a collaborative community effort.

Expand All @@ -11,42 +11,51 @@ This repository provides the latest schemas for attestations and a step by step

With OLI Data Entry, we try to fix the labeling challenge by providing a straightforward, fair and universally accessible solution, enabling everyone to benefit from crowdsourced contract labels.

## Workflow
## Attesting

### **Data Entry (Creating Attestations)**
Users can label a contract by attesting to the [EAS smart contract](https://github.com/ethereum-attestation-service/eas-contracts?tab=readme-ov-file#optimism). There are multiple ways to attest, and we present two options here: using the EAS front end or a bulk attestation tool. Whichever method you choose, ensure that you are attesting to the [latest OLI schema hash](attestation_schema/EAS_schema_versioning.yml).

Users can label a contract by attesting to the [EAS smart contract](https://github.com/ethereum-attestation-service/eas-contracts?tab=readme-ov-file#optimism). Make sure you are attesting to the [latest OLI schema hash](EAS_schema_versioning.yml):
### **Attesting: EAS Front End**

1. **Attestation Front-End:**
While our custom white label front end is under development, please use the EAS dApp [here](https://optimism.easscan.org/attestation/attestWithSchema/0xacb55ee4f0b0bf4987ba23f863e41e78ea1863e1c5aa881c520d16dae76a0c7b) and make sure you attest to the [latest schema](EAS_schema_versioning.yml).
1. **EAS Front-End:**
While our custom white label front end is under development, please use the EAS dApp [here](https://optimism.easscan.org/attestation/attestWithSchema/0x5283a290268ebd286c379b633b1f8f8241edb577a074d67a3ceea636461dd13f) and make sure you are attesting to the [latest schema hash](attestation_schema/EAS_schema_versioning.yml).

2. **Connect Your Wallet:**
Ensure your wallet is connected and you are on the correct network.
Ensure your wallet is connected and you are on the correct network (optimism).

3. **Create an Attestation**

- **Recipient**: Enter the address to be labeled.

- **Chain ID**: Provide the chain ID corresponding to the location of the address you want to label.
- **Chain ID**: Provide the chain ID corresponding to the location of the address/contract you want to label.

- **Ownership Proof**: If you are the owner of the contract you are labeling, toggle this option to `True`. This will prove that you are the owner and that your label is of high quality. Otherwise, set it to `False`.
- This feature only works if you are on the same chain where the contract is deployed.
- The address from which you send the transaction must also be the owner of the contract you are attesting. The contract must implement the OpenZeppelin `Ownable.sol` extension.

- **OLI-Compliant Labels**: Provide as much detail as possible for each label in the attestation. Leaving fields blank, especially if they are redundant, is acceptable.
- **OLI-Compliant Labels**: Provide as much detail as possible for each label in the attestation. Leaving fields blank, especially if they are unknown, is acceptable. Some fields require a value, therefore it is important to note:

- **True/False Fields**:
For fields such as `is_eoa`, `is_contract`, `is_factory_contract`, `is_proxy`, and `is_safe_contract`, use the following values:
- `0`: No value.
- `1`: True.
- `2`: False.

- Refer to [tag_definitions.yml](../tags/tag_definitions.yml) for a detailed explanation of each tag.
- **Boolean Values**: Columns representing boolean values (e.g., `is_owner`, `is_eoa`) are using `uint8` format:
- `0` = No Value
- `1` = True
- `2` = False

- **Address Fields**: Any field requiring an address cannot be left empty. If no value is available, use `0x0000000000000000000000000000000000000000`

- **Uint Fields**: Any `uint` fields, such as `deployment_date` or `erc20_decimals`, should be set to `0` if no value is provided.

- **String Fields**: These can be left as `null` if no value is provided.

- Refer to [tag_definitions.yml](../data_model/tags/tag_definitions.yml) for a detailed explanation of each tag.

4. **Sign and Submit Onchain or Offchain:**
- Select your preferred submission method: onchain or offchain.
- Select your preferred submission method: onchain or offchain. Default should be set to offchain.
- Use your wallet to sign the attestation.

### **Attesting: Bulk Attesting**

To bulk attest a CSV file, refer to the directory [bulk_attesting](bulk_attesting/README.md). This TypeScript project provides all the necessary tools to use ethers for signing and submitting the labels.

### **Data Retrieval**

coming soon
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,37 @@ version_history:
"contract_monitored": "string",
"source_code_verified": "string"
}
- version: "0.1.1"
date: "2025-01-15"
schemas:
- chain: "Optimism"
chain_id: "10"
schema_hash: "0x5283a290268ebd286c379b633b1f8f8241edb577a074d67a3ceea636461dd13f"
custom_resolver: "0xedfea228da3bdb0efd231707b2ee588224ee0886"
schema: |
{
"chain_id": "uint256",
"is_owner": "bool",
"is_eoa": "uint8",
"is_contract": "uint8",
"is_factory_contract": "uint8",
"is_proxy": "uint8",
"is_safe_contract": "uint8",
"name": "string",
"deployment_tx": "string",
"deployer_address": "address",
"owner_project": "string",
"deployment_date": "uint256",
"erc_type": "uint16[]",
"erc20_symbol": "string",
"erc20_decimals": "uint8",
"erc721_name": "string",
"erc721_symbol": "string",
"erc1155_name": "string",
"erc1155_symbol": "string",
"usage_category": "string",
"version": "uint8",
"audit": "string",
"contract_monitored": "string",
"source_code_verified": "string"
}
File renamed without changes.
99 changes: 99 additions & 0 deletions data_pool/bulk_attesting/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Bulk Attestation Uploader

This project allows bulk attesting and uploading of labels to the OLI data pool by signing each attestation before submitting it to the EAS IPFS servers (offchain), which validate the signatures. The input is a CSV file containing labels in the [OLI-compliant format](./data_model) and the script processes each row iteratively, attesting one by one.

---

## Features

- Bulk attestation of labels from a CSV file
- Local signing of attestations (schema v0.1.1)
- Submit signed attestations to the EAS network
- Generates attestation logs, including success and error details

---

## Requirements

- Node.js (version 16 or later)
- npm (Node Package Manager)
- A valid Ethereum private key with sufficient funds for gas fees on the Optimism network.

---

## Usage

0. Navigate to the repository:

```bash
cd data_pool/bulk_attesting
```

1. Install the required packages by running:

```bash
npm install
```

2. Compile the TypeScript files:

```bash
npm run build
```

3. Run the compiled script for `bulk_attest.ts`:

```bash
node dist/bulk_attest.js
```

---

## Important Preparations

1. Prepare your CSV file containing the attestation data. The column names must match the following format exactly ([OLI data model v0.1.1](../attestation_schema/EAS_schema_versioning.yml)), along with their corresponding data types:

- `address (address)`
- `chain_id (uint256)`
- `is_owner (bool)`
- `is_eoa (uint8)`
- `is_contract (uint8)`
- `is_factory_contract (uint8)`
- `is_proxy (uint8)`
- `is_safe_contract (uint8)`
- `name (string)`
- `deployment_tx (string)`
- `deployer_address (address)`
- `owner_project (string)`
- `deployment_date (uint256)`
- `erc_type (uint16[])`
- `erc20_symbol (string)`
- `erc20_decimals (uint8)`
- `erc721_name (string)`
- `erc721_symbol (string)`
- `erc1155_name (string)`
- `erc1155_symbol (string)`
- `usage_category (string)`
- `version (uint8)`
- `audit (string)`
- `contract_monitored (string)`
- `source_code_verified (string)`

An example CSV file can be found at: `data_entry/bulk_attesting/example-labels.csv`

Refer to [tag_definitions.yml](../../data_model/tags/tag_definitions.yml) for a detailed explanation of each tag.

Important Notes:
- **Boolean Values**: Columns representing boolean values (e.g., `is_owner`, `is_eoa`) must be converted to `uint8` format:
- `0` = No Value
- `1` = True
- `2` = False
- **Address Fields**: Any field requiring an address cannot be left empty. If no value is available, use `0x0000000000000000000000000000000000000000`.
- **Uint Fields**: Any `uint` fields, such as `deployment_date` or `erc20_decimals`, should be set to `0` if no value is provided.
- **String Fields**: These can be left as `null` if no value is provided.

For more details on the attestation format, see [data_pool README.md](../README.md).

2. Place your converted CSV file in the project root directory.

3. Replace the `privateKey` variable with your private key (no need for funds in the wallet) and `fileContent` with your csv file name.
Loading

0 comments on commit 1761bee

Please sign in to comment.