Skip to content

Commit

Permalink
Merge pull request #82 from TxnLab/dev
Browse files Browse the repository at this point in the history
chore: release v0.6.0
  • Loading branch information
drichar authored Apr 17, 2024
2 parents 3a72cbc + c881a60 commit 2cca13b
Show file tree
Hide file tree
Showing 52 changed files with 2,425 additions and 1,637 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/ci-contracts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CI Workflow (Contracts)

on:
push:
branches: [ dev, main ]
paths:
- 'contracts/**'
- '.github/workflows/ci-contracts.yaml'

pull_request:
branches: [ dev, main ]
paths:
- 'contracts/**'
- '.github/workflows/ci-contracts.yaml'

jobs:
run-ci:
if: "!contains(github.event.head_commit.message, 'chore: release v')"
name: Lint, Typecheck
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm --filter ./contracts install

- name: Install dependencies (bootstrap)
run: pnpm --filter ./contracts/bootstrap install

- name: Lint
run: pnpm --filter ./contracts run lint

- name: Prettier
run: pnpm --filter ./contracts run prettier

- name: Typecheck (bootstrap)
run: pnpm --filter ./contracts/bootstrap run typecheck
17 changes: 15 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ on:
types: [created]

permissions:
contents: write
packages: write
contents: read

jobs:
releases-matrix:
name: Release Go Binary
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
strategy:
matrix:
# build and publish in parallel: linux/windows/darwin, amd64/arm64
Expand Down Expand Up @@ -63,3 +65,14 @@ jobs:
REL_VER=${{ github.ref_name }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
github-releases-to-discord:
needs: [releases-matrix, docker]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Github Releases To Discord
uses: SethCohen/[email protected]
with:
webhook_url: ${{ secrets.WEBHOOK_URL }}
username: "Reti Releases"
2 changes: 1 addition & 1 deletion Dockerfile-nodemgr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine as builder
FROM golang:1.22-alpine as builder
ARG REL_VER
# Install git and certificates
RUN apk --no-cache add tzdata zip ca-certificates git
Expand Down
8 changes: 4 additions & 4 deletions contracts/.devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"forwardPorts": [4001, 4002, 8980],
"portsAttributes": {
"4001": {
"label": "algod"
"label": "algod"
},
"4002": {
"label": "kmd"
"label": "kmd"
},
"8980": {
"label": "indexer"
"label": "indexer"
}
},
"postCreateCommand": "pipx install algokit-cli",
"postStartCommand": "algokit localnet start"
}
}
81 changes: 81 additions & 0 deletions contracts/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"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",
"no-console": "off",
"max-classes-per-file": "off",
"import/no-extraneous-dependencies": "off"
}
},
{
"files": ["*.algo.ts"],
"rules": {
"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",
"no-unused-vars": "off",
"@typescript-eslint/ban-ts-comment": "off"
}
},
{
"files": ["*.test.ts"],
"rules": {
"no-await-in-loop": "off"
}
}
]
}
78 changes: 0 additions & 78 deletions contracts/.eslintrc.js

This file was deleted.

2 changes: 2 additions & 0 deletions contracts/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
contracts/artifacts
contracts/clients
6 changes: 2 additions & 4 deletions contracts/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
]
}
"recommendations": ["dbaeumer.vscode-eslint"]
}
8 changes: 5 additions & 3 deletions contracts/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
}
"source.fixAll.eslint": "explicit"
}
}
11 changes: 5 additions & 6 deletions contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

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.
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.
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.
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

Expand All @@ -24,11 +24,10 @@ The PNPM package manager was used for this project. See [pnpm](https://pnpm.io/

### Run Tests

`pnpm run test` will execute the tests defined in [./\_\_test\_\_](./__test__)
`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.

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.
5 changes: 2 additions & 3 deletions contracts/__test__/contracts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,16 +440,15 @@ describe('StakeAdds', () => {
});

test('addMaxPoolsAndFill', async () => {
const pools = [];
const stakers = [];
const pools: ValidatorPoolKey[] = [];
const stakers: Account[] = [];
const poolsToCreate = MaxPoolsPerNode;

// capture current 'total' state for all pools
const origValidatorState = await getValidatorState(validatorMasterClient, validatorId);

// we create 'max pools per node' new pools on new node (first pool is still there which wee added as part of beforeAll)
for (let i = 0; i < poolsToCreate; i += 1) {
// eslint-disable-next-line no-await-in-loop
const newPool = await addStakingPool(
fixture.context,
validatorMasterClient,
Expand Down
15 changes: 8 additions & 7 deletions contracts/__test__/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -422,14 +422,14 @@ export function getValidatorListBoxName(validatorId: number) {
return concatUint8Arrays(prefix, encodeUint64(validatorId));
}

function getStakerPoolSetBoxName(stakerAccount: Account) {
const prefix = new TextEncoder().encode('sps');
return concatUint8Arrays(prefix, decodeAddress(stakerAccount.addr).publicKey);
}
// function getStakerPoolSetBoxName(stakerAccount: Account) {
// const prefix = new TextEncoder().encode('sps');
// return concatUint8Arrays(prefix, decodeAddress(stakerAccount.addr).publicKey);
// }

function getStakersBoxName() {
return new TextEncoder().encode('stakers');
}
// function getStakersBoxName() {
// return new TextEncoder().encode('stakers');
// }

export async function getMbrAmountsFromValidatorClient(validatorClient: ValidatorRegistryClient) {
return (await validatorClient.compose().getMbrAmounts({}, {}).simulate()).returns![0];
Expand Down Expand Up @@ -518,6 +518,7 @@ export async function addStakingPool(
suggestedParams,
});

// eslint-disable-next-line @typescript-eslint/no-explicit-any
let addPoolResults: any;
// Before validator can add pools it needs to be funded
try {
Expand Down
Loading

0 comments on commit 2cca13b

Please sign in to comment.