Skip to content

Commit

Permalink
Initial release (#1)
Browse files Browse the repository at this point in the history
* 0.1.0 Initial commit of Reti Open Pooling development work.

---------

Co-authored-by: Doug Richar <[email protected]>
Co-authored-by: Patrick Bennett <[email protected]>
Co-authored-by: John Mizzoni <[email protected]>
Co-authored-by: gitbook-bot <[email protected]>
  • Loading branch information
5 people authored Apr 2, 2024
1 parent 23b5f6a commit df8dade
Show file tree
Hide file tree
Showing 272 changed files with 104,152 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodemgr/.env.sandbox
**/node_modules/
go.work
28 changes: 28 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
on:
release:
types: [created]

permissions:
contents: write
packages: write

jobs:
releases-matrix:
name: Release Go Binary
runs-on: ubuntu-latest
strategy:
matrix:
# build and publish in parallel: linux/windows/darwin, amd64/arm64
goos: [linux, windows, darwin]
goarch: [amd64, arm64]
steps:
- uses: actions/checkout@v4
- uses: wangyoucao577/go-release-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
extra_files: LICENSE README.md
goversion: '1.21'
project_path: './nodemgr'

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.env.*
node_modules/
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/jsLibraryMappings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/reti.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"typescript.tsdk": "./ui/node_modules/typescript/lib"
}
5 changes: 5 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* @pbennett @drichar
/contracts/ @pbennett
/nodemgr/ @pbennett
/ui/ @drichar
/docs/ @johnmizz
23 changes: 23 additions & 0 deletions Dockerfile-nodemgr
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM golang:1.21-alpine as builder
# Install git and certificates
RUN apk --no-cache add tzdata zip ca-certificates git
# Make repository path
RUN mkdir -p /go/src/app
WORKDIR /go/src/app

# just fetch the dependencies in a cachable layer
COPY nodemgr/go.* ./nodemgr/
RUN cd nodemgr && go mod download && cd ..

# Copy all project files (.env's are skipped due to .dockerignore)
COPY . ./
RUN --mount=type=cache,target=/root/.cache/go-build env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -C nodemgr -v -o /out/ .

FROM scratch

WORKDIR /app

COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /out/* /app/

ENTRYPOINT ["/app/reti"]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 TxnLab Inc
Copyright (c) 2024 Algorand Foundation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.PHONY: none load_env docker-push docker-build

.DEFAULT_GOAL := none

none:
@echo bleha bleah

IMAGE_REPO ?= us-central1-docker.pkg.dev/nfd-nodes/nodes

# preference would be to fetch version from latest vX.X tag in git
VERSION ?= latest

IMAGE := reti:$(VERSION)

docker-build:
docker build --no-cache --platform linux/amd64 -f Dockerfile-nodemgr -t $(IMAGE_REPO)/$(IMAGE) .

docker-push: docker-build
docker push $(IMAGE_REPO)/$(IMAGE)
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
# reti
Contracts and node sidecar for Algorand 'The Reti' consensus incentives
# Reti Open Pooling

See [Reti Open Pooling](./docs/reti-open-pooling.md) for details on the proposal this implementation is for.

## Tealscript Contracts

See [Contracts](./contracts/README.md)

## Node Daemon

## UI

See [UI](./ui/README.md)
16 changes: 16 additions & 0 deletions contracts/.devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"forwardPorts": [4001, 4002, 8980],
"portsAttributes": {
"4001": {
"label": "algod"
},
"4002": {
"label": "kmd"
},
"8980": {
"label": "indexer"
}
},
"postCreateCommand": "pipx install algokit-cli",
"postStartCommand": "algokit localnet start"
}
77 changes: 77 additions & 0 deletions contracts/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
'airbnb-base',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:prettier/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/ban-ts-comment': 'warn',
'import/prefer-default-export': 'off',
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: ['**/*.test.ts'],
},
],
'prettier/prettier': [
'error',
{
tabWidth: 4,
},
],
},
overrides: [
{
files: ['*.ts'],
rules: {
'no-continue': 'off',
},
},
{
files: ['*.algo.ts'],
rules: {
'import/no-extraneous-dependencies': 'off',
'object-shorthand': 'off',
'class-methods-use-this': 'off',
'no-undef': 'off',
'max-classes-per-file': 'off',
'no-bitwise': 'off',
'operator-assignment': 'off',
'prefer-template': 'off',
'prefer-destructuring': 'off',
'no-param-reassign': 'off',
'no-restricted-syntax': 'off',
'no-continue': 'off',
},
},
{
files: ['*.test.ts'],
rules: {
'no-await-in-loop': 'off',
},
},
],
};
2 changes: 2 additions & 0 deletions contracts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
/bootstrap/dist/
6 changes: 6 additions & 0 deletions contracts/.prettierrc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# .prettierrc.toml
trailingComma = "es5"
tabWidth = 4
semi = true
singleQuote = true
printWidth = 120
5 changes: 5 additions & 0 deletions contracts/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
]
}
5 changes: 5 additions & 0 deletions contracts/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
}
34 changes: 34 additions & 0 deletions contracts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Reti Open Pooling

## Documentation

These contracts, node daemon, and UI are for the proposal described in [Reti Open Pooling](../docs/reti-open-pooling.md).

The contracts themselves are written in Tealscript. See [Tealscript](https://tealscript.algo.xyz) for details.

## Usage

### Algokit

This repository assumes you have [AlgoKit](https://github.com/algorandfoundation/algokit-cli) installed and have a local network running on your machine. The default 'devmode' sandbox (`algokit localnet start`) is required for the system tests as they manipulate the block time offsets.template assumes you have a local network running on your machine.

### PNPM

The PNPM package manager was used for this project. See [pnpm](https://pnpm.io/) for installation details. Be sure to `pnpm install` first.

### Build Contracts

`pnpm run build` will compile the contracts to TEAL and generate ABI and appspec JSON files in [./contracts/artifacts](./contracts/artifacts/) and AlgoKit TypeScript clients in [./contracts/clients](./contracts/clients/).

`pnpm run compile-contract` or `pnpm run generate-client` can be used to compile the contract or generate the contract seperately.

### Run Tests

`pnpm run test` will execute the tests defined in [./\_\_test\_\_](./__test__)

## Deploying

### Bootstrap script

A bootstrap script is in the ./bootstrap directory. Running `pnpm run bootstrap --network {network}` will bootstrap the validator. The localnet networkbootstraps the local sandbox and also funds two new test accounts - updating an .env.sandbox file inside the nodemgr directory for local CLI use/testing. It is recommended to use a named sandbox configuration that has devmode disabled so blocks proceed normally.

Loading

0 comments on commit df8dade

Please sign in to comment.