Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ dist
README.md
.prettierrc
volumes
data
data/providers.json
7 changes: 6 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
NODE_ENV="dev or production"
RPC_HOST=127.0.0.1:8545
CHAIN="anvil or optimism or optimism-sepolia"
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
PORT=3000

# PROVIDER_PRIVATE_KEY_<provider tag>=
# BILLING_PRIVATE_KEY_<provider tag>=
# OPERATOR_PRIVATE_KEY_<provider tag>=
236 changes: 189 additions & 47 deletions README.md

Large diffs are not rendered by default.

Empty file removed data/details/.gitkeep
Empty file.
45 changes: 45 additions & 0 deletions data/details/pc-details.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "PostgreSQL",
"softwareStack": "Database",
"tests": [],
"offerParams": [
{
"name": "CPU",
"unit": "Cores",
"priority": 100,
"isPrimary": true
},
{
"name": "RAM",
"unit": "GB",
"priority": 90,
"isPrimary": true
},
{
"name": "Disk Type",
"unit": ["SSD", "HDD", "M2"],
"priority": 80,
"isPrimary": true
},
{
"name": "Disk Size",
"unit": "GB",
"priority": 70
},
{
"name": "Virtualization",
"unit": ["VM", "Container"],
"priority": 60
},
{
"name": "CPU Architecture",
"unit": ["x86", "ARM"]
},
{
"name": "Isolation",
"unit": ["Shared", "Dedicated"],
"isFilterable": false,
"priority": 40
}
]
}
4 changes: 4 additions & 0 deletions data/details/pco-details.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "MongoDB PCO",
"description": "Builds the best environment for MongoDB products"
}
5 changes: 5 additions & 0 deletions data/details/prov-details.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Hebele Inc.",
"description": "Provides best prices for managed OSS solutions",
"homepage": "https://hebele.io"
}
140 changes: 140 additions & 0 deletions data/spec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# This is the example OpenAPI spec. As Protocol Owner,
# you need to edit it according to your Protocol definitions
openapi: 3.0.0
info:
# Command name that going to be appear in CLI. [MUST]
x-forest-cli-command: psql

# Aliases for the command defined above. [OPTIONAL]
x-forest-cli-aliases:
- postgresql
- postgre-sql
title: PostgreSQL Protocol
description: API for PostgreSQL Protocol
version: "1.0"
license:
name: MIT
paths:
/query:
post:
# Specifies if this endpoint is Provider specific or not.
# If that is true, user has to send provider id within the request to
# point which Provider that he is going to communicate from the target operator
x-forest-provider-endpoint: true

description: Executes the given SQL query in the database
requestBody:
content:
application/json:
schema:
type: object
required:
- id
- pt
- sql
properties:
id:
type: number
description: ID of the resource
pt:
type: string
description: Protocol address that the resource created in
sql:
type: string
description: SQL query to be executed.
responses:
"200":
description: SQL executed successfully
content:
application/json:
schema:
type: object
properties:
results:
type: array
description: Results
items:
type: object
/resources:
get:
summary: Get one or all of the resources
description: Gets one or all resources of the caller. If "id" and "pt" values are not given, retrieves all of the Resources that caller has. Caller must be the owner of those resource(s).
requestBody:
content:
application/json:
schema:
type: object
properties:
id:
type: number
description: ID of the resource/agreement
pt:
type: string
description: Protocol address
responses:
"200":
description: "Resources"
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: number
name:
type: string
deploymentStatus:
type: string
enum:
- Running
- Deploying
- Closed
- Unknown
- Failed
details:
type: object
groupName:
type: string
isActive:
type: boolean
ownerAddress:
type: string
example: "0x1231231231231231231231231231231231231231"
offerId:
type: number
providerId:
type: number
providerAddress:
type: string
example: "0x1231231231231231231231231231231231231231"
ptAddress:
type: string
example: "0x1231231231231231231231231231231231231231"
"404":
description: "Resource not found"
/details:
get:
summary: Gets the detail file(s)
description: Gets the detail files for the given CIDs if they there are in this operator
requestBody:
description: CIDs of the desired detail files
required: true
content:
application/json:
schema:
type: array
items:
type: string
responses:
"200":
description: Returns the file contents. If the CID is not found, it won't be included in the response array
content:
application/json:
schema:
type: array
items:
type: string
"404":
description: If one CID is given and it is not found
71 changes: 71 additions & 0 deletions docs/README_template_1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Protocol: `{Protocol Name, make it functionally descriptive}`

## Description

`{Describe the goal of this Protocol}`

## Basic Info

| Name | Value |
| ------------------------- | -------------------------- |
| PT Smart Contract Address | `{Smart Contract Address}` |
| PT Registration Date | `{Date of registration}` |
| PT Details File CID | `{CID}` |
| PT Owner Wallet Address | `{Public Wallet Address}` |
| PT Owner Details File CID | `{CID}` |

## Supported Actions (Endpoints)

| Method-Path | Params/Body | Response | Description |
| ---------------- | --------------------------------------- | ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GET /details` | `body: string[]` | `string[]` | Retrieves the contents of detail files for the given CIDs. If one CID is given and corresponding file is not found, returns 404/Not Found. Otherwise returns an array of contents of the files |
| `GET /resources` | `params: { id?: number, pc?: Address }` | `Resource[] \| Resource` | If `id` and `pc` is given, retrieves one resource information. Otherwise returns all resources of the requester |
| `{Endpoint}` | `{Body}` | `{Return Type}` | `{Description}` |

## Configuration Parameters

This Protocol has the following configuration. Some of them are enforced by the logic of the on-chain smart contracts and the others are part of the Validator code hence enforced by the Validator consensus.

| Config | Value | Enforced by |
| ---------------------------------------- | -------------------------- | -------------- |
| Maximum Number of Validators | `{Number}` | Smart Contract |
| Maximum Number of Providers | `{Number}` | Smart Contract |
| Minimum Collateral | `{Amount of FOREST Token}` | Smart Contract |
| Validator Registration Fee | `{Amount of FOREST Token}` | Smart Contract |
| Provider Registration Fee | `{Amount of FOREST Token}` | Smart Contract |
| Offer Registration Fee | `{Amount of FOREST Token}` | Smart Contract |
| Update Delay for Terms Change | `{Block Count}` | Smart Contract |
| Validators Share of Emissions | `{+Percentage}` | Smart Contract |
| Providers Share of Emissions | `{+Percentage}` | Smart Contract |
| PT Owner Share of Emissions | `{+Percentage}` | Smart Contract |
| CID of the Details File | `{CID}` | Smart Contract |
| Performance Optimization Weight | `{*Percentage}` | Validator |
| Price Optimization Weight | `{*Percentage}` | Validator |
| Price-to-Performance Optimization Weight | `{*Percentage}` | Validator |
| Popularity Optimization Weight | `{*Percentage}` | Validator |

> Sum of the percentages mentioned with `+` sign must equal to 100. Same thing applies for `*` too.

You can always double-check the on-chain values e.g. [here](https://sepolia-optimism.etherscan.io/address/`{Smart Contract Address}`#readContract)

## Performance Requirements

The Validators are performing a number of tests on Resources to ensure quality across the board. Below is a list of checked Benchmarks:

| Name | Units | Threshold Value | Min / Max |
| --------------- | --------- | --------------- | ------------- |
| `{Test Name 1}` | `{Units}` | `{Value}` | `{Min / Max}` |
| `{Test Name 2}` | `{Units}` | `{Value}` | `{Min / Max}` |
| `{Test Name 3}` | `{Units}` | `{Value}` | `{Min / Max}` |

More in-depth descriptions of the Tests (optional):

| Name | Description |
| ------------- | ----------------------- |
| {Test Name 1} | {Long form description} |
| {Test Name 2} | {Long form description} |
| {Test Name 3} | {Long form description} |

## Become a Provider in this Protocol

If you want to start providing services in this Protocol follow this tutorial: [link](become-a-provider.md)
63 changes: 63 additions & 0 deletions docs/README_template_2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Name the Protocol, make it functionally descriptive

## Goal

Describe the goal of this Protocol.

## Basic Info

| Name | Value |
| ------------------------- | -------------------------- |
| PT Smart Contract Address | `{Smart Contract Address}` |
| PT Registration Date | `{Date of registration}` |
| PT Details File CID | `{CID}` |
| PT Owner Wallet Address | `{Public Wallet Address}` |
| PT Owner Details File CID | `{CID}` |

## Evaluation

How will validators score AI models provided. It should be described in high level English. One can define hard constraints that should force a score of zero or other more advanced heuristic point systems in addition to the English definition.

## Supported Actions

### `details()`

- **Params**:
- `cids` (body: string[]): An array of CIDs for files that a user is interested in fetching
- **Returns**:
- `string[]`: Retrieves the contents of detail files for the given CIDs. If one CID is given and corresponding file is not found, returns 404/Not Found. Otherwise returns an array of contents of the files

### `resources()`

- **Params**:
- `id` (number, optional): Id of the resource for which to fetch information
- `pt` (Address, optional): PT address where the resource of interest lives
- **Returns**:
- `Resource[] | Resource`: If `id` and `pt` is given, retrieves one resource information. Otherwise returns all resources of the requester

### `actionNameSimilarToFunctionName()`

- **Params**:
- `parameterName` (datatype): Describe parameter. Optionally state max character length or other restrictions.
- `otherParameter` (string, optional): specific options avaliable `realistic`, `cartoon` or `minimalist`.
- **Returns**:
- `returnDataTypeFormat` Describe the return object
- `subElementRetenred` (string): If the returned object is JSON or another composite data type one can describe sub elements here also
- Add any functional requirements that are not directly linekd to a datatype here

## Performance Requirements

- How quickly must the actions return Query response within 60 minutes for a video up to 1 minute length.
- Or how many queries must one be able to send per hour.

## Example

```
Give an exact example of input
```

And exact example of output

## Become a Provider in this Protocol

If you want to start providing services in this Protol follow this tutorial: [link](become-a-provider.md)
Loading