From 7fbb7631bbb4c88c02866367b5411dfc3cab5ed6 Mon Sep 17 00:00:00 2001 From: Tupui <23188539+tupui@users.noreply.github.com> Date: Sun, 4 Aug 2024 11:39:31 +0200 Subject: [PATCH] Clean some react and architecture API --- website/docs/developers/architecture.mdx | 39 +++++++++++-------- website/docs/intro.md | 2 +- .../src/components/HomepageFeatures/index.tsx | 9 +++-- website/src/pages/index.tsx | 5 ++- 4 files changed, 31 insertions(+), 24 deletions(-) diff --git a/website/docs/developers/architecture.mdx b/website/docs/developers/architecture.mdx index d5fd9a80..dfead048 100644 --- a/website/docs/developers/architecture.mdx +++ b/website/docs/developers/architecture.mdx @@ -6,8 +6,6 @@ sidebar_position: 2 ![General diagram flow](./architecture.png) - - :::note Maintainer: a person which is part of a project’s team. This is not necessarily tight to any specific role nor commit rights. @@ -24,37 +22,44 @@ Maintainer: a person which is part of a project’s team. This is not necessaril The Soroban contract handles all on-chain features of the projects from registration, administration, to pushing new code versions. It provides the following minimal Application Programming Interface (API): ```rust -fn register(maintainer: address, name: bytes, maintainers: vec
, url: bytes, hash: bytes) -> bytes +fn register(maintainer: Address, name: String, maintainers: Vec
, url: String, hash: String, domain_contract_id: Address) -> Bytes -fn update_config(maintainer: address, key: bytes, maintainers: vec
, url: bytes, hash: bytes) +fn update_config(maintainer: Address, key: Bytes, maintainers: Vec
, url: String, hash: String) -fn commit(maintainer: address, project_key: bytes, hash: bytes) +fn commit(maintainer: Address, project_key: Bytes, hash: String) -fn get_commit(project_key: bytes) -> bytes +fn get_commit(project_key: Bytes) -> String -#[contracttype] struct Config { - hash: bytes, - url: bytes + hash: String, + url: String } -#[contracttype] struct Project { config: Config, - maintainers: vec
, - name: bytes + maintainers: Vec
, + name: String } -#[contracttype] enum ProjectKey { - Key(bytes), - LastHash(bytes) + Key(Bytes), + LastHash(Bytes) +} + +enum ContractErrors { + UnexpectedError = 0, + InvalidKey = 1, + ProjectAlreadyExist = 2, + UnregisteredMaintainer = 3, + NoHashFound = 4, + InvalidDomainError = 5, + MaintainerNotDomainOwner = 6, } ``` -When maintainers register their projects, a unique hash based on the project name is created. This serves as a project_key to uniquely identify a project and is stored as a data entry on the ledger. +When maintainers register their projects, a unique hash based on the project name is created. This serves as a `project_key` to uniquely identify a project and is stored as a data entry on the ledger. -We intend to use Soroban domain as a way to prevent name squatting and other nefarious registration. The community will have easy tools to report issues. This will effectively prevent misuse of our contract. We would then use the node address provided by Soroban domain as a project_key. +We intend to use Soroban domain as a way to prevent name squatting and other nefarious registration. The community will have easy tools to report issues. This will effectively prevent misuse of our contract. We would then use the node address provided by Soroban domain as a `project_key`. Each project stores 3 elements on-chain: diff --git a/website/docs/intro.md b/website/docs/intro.md index 064efccd..5e62a09d 100644 --- a/website/docs/intro.md +++ b/website/docs/intro.md @@ -4,4 +4,4 @@ sidebar_position: 1 # Welcome to Tansu! - +Tansu adds an extra layer of security when developing Open Source projects. In essence, it proposes a solution to track code changes and enable anyone to verify that the code hosted on GitHub is indeed the same. Coupled with other best practices, such as, code signing and attestation of provenance, Tansu guarantees that the code history has not been tempered with. diff --git a/website/src/components/HomepageFeatures/index.tsx b/website/src/components/HomepageFeatures/index.tsx index 6e8e2df0..c4a46068 100644 --- a/website/src/components/HomepageFeatures/index.tsx +++ b/website/src/components/HomepageFeatures/index.tsx @@ -1,16 +1,17 @@ import clsx from 'clsx'; import Heading from '@theme/Heading'; import styles from './styles.module.css'; +import React from "react"; type FeatureItem = { title: string; Svg: React.ComponentType>; - description: JSX.Element; + description: React.JSX.Element; }; const FeatureList: FeatureItem[] = [ { - title: 'Built with Soroban', + title: 'Secure', Svg: require('@site/static/img/soroban-wordmark-temp.svg').default, description: ( <> @@ -19,7 +20,7 @@ const FeatureList: FeatureItem[] = [ ), }, { - title: 'Git on-chain', + title: 'Decentralized', Svg: require('@site/static/img/git-logo.svg').default, description: ( <> @@ -52,7 +53,7 @@ function Feature({title, Svg, description}: FeatureItem) { ); } -export default function HomepageFeatures(): JSX.Element { +export default function HomepageFeatures(): React.JSX.Element { return (
diff --git a/website/src/pages/index.tsx b/website/src/pages/index.tsx index bf28811a..b61a5583 100644 --- a/website/src/pages/index.tsx +++ b/website/src/pages/index.tsx @@ -6,6 +6,7 @@ import HomepageFeatures from '@site/src/components/HomepageFeatures'; import Heading from '@theme/Heading'; import styles from './index.module.css'; +import React from "react"; function HomepageHeader() { const {siteConfig} = useDocusaurusContext(); @@ -28,12 +29,12 @@ function HomepageHeader() { ); } -export default function Home(): JSX.Element { +export default function Home(): React.JSX.Element { const {siteConfig} = useDocusaurusContext(); return ( + description="Tansu - Where Git meet the blockchain">