Skip to content

Commit

Permalink
Specblockasm master 2ba3f4b (#5064)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianolson authored Jan 26, 2023
1 parent d42feb0 commit 341a804
Show file tree
Hide file tree
Showing 1,062 changed files with 12,857 additions and 6,781 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ commands:
- run:
working_directory: /tmp
command: |
sudo rm -rf ${HOME}/node_pkg/*
sudo rm -rf << parameters.build_dir >>
sudo mkdir -p << parameters.build_dir >>
sudo chown -R $USER:$GROUP << parameters.build_dir >>
Expand Down
1 change: 1 addition & 0 deletions .github/.release.yml → .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ changelog:
- title: Other
labels:
- "*"

57 changes: 57 additions & 0 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: container

on:
workflow_dispatch:
push:
branches:
- master
- rel/*
- feature/*
tags:
- "*"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Generate Container Metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
docker.io/${{ github.repository_owner }}/algod
tags: |
type=sha,format=long,prefix=
type=ref,event=tag
type=ref,event=branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'rel/stable') }}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Setup QEMU
uses: docker/setup-qemu-action@v2

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and Push
uses: docker/build-push-action@v3
with:
context: ./
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
SHA=${{ github.sha }}
URL=${{ github.server_url }}/${{ github.repository }}.git
BRANCH=${{ github.ref_name }}
38 changes: 21 additions & 17 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0 # required for new-from-rev option in .golangci.yml
- name: Install libraries
Expand All @@ -33,7 +33,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0 # required for new-from-rev option in .golangci.yml
- name: Install libraries
Expand All @@ -46,14 +46,14 @@ jobs:
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
echo "$RUNNER_WORKSPACE/$(basename $GITHUB_REPOSITORY)/bin" >> $GITHUB_PATH
- name: Install specific golang
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: '1.17.13'
- name: Create folders for golangci-lint
run: mkdir -p cicdtmp/golangci-lint
- name: Check if custom golangci-lint is already built
id: cache-golangci-lint
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: cicdtmp/golangci-lint/golangci-lint-cgo
key: cicd-golangci-lint-cgo-v0.0.1
Expand All @@ -69,7 +69,7 @@ jobs:
cd ../../
- name: Install reviewdog
run: |
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/v0.13.0/install.sh | sh -s
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/v0.14.1/install.sh | sh -s
reviewdog --version
- name: Build custom linters
run: |
Expand All @@ -80,21 +80,25 @@ jobs:
- name: Run golangci-lint with reviewdog
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
./cicdtmp/golangci-lint/golangci-lint-cgo run
--out-format line-number
-c .golangci-warnings.yml
--allow-parallel-runners
| reviewdog
-f=golangci-lint
-name="Lint Warnings"
-reporter=github-check
-filter-mode=added
-fail-on-error=false
run: |
set -e
./cicdtmp/golangci-lint/golangci-lint-cgo run \
--out-format line-number \
-c .golangci-warnings.yml \
--issues-exit-code 0 \
--allow-parallel-runners > temp_golangci-lint-cgo.txt
cat temp_golangci-lint-cgo.txt | reviewdog \
-f=golangci-lint \
-name="Lint Warnings" \
-reporter=github-check \
-filter-mode=added \
-fail-on-error=true \
-level=warning
- name: Slack Notification
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
run: |
curl -X POST --data-urlencode "payload={\"text\": \"Reviewdog failed. ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \"}" $SLACK_WEBHOOK
if: ${{ failure() && (contains(github.ref_name, 'rel/nightly') || contains(github.ref_name, 'rel/beta') || contains(github.ref_name, 'rel/stable') || contains(github.ref_name, 'master')) }}
if: ${{ failure() && (contains(github.ref_name, 'rel/nightly') || contains(github.ref_name, 'rel/beta') || contains(github.ref_name, 'rel/stable') || contains(github.ref_name, 'master')) }}
4 changes: 0 additions & 4 deletions .golangci-warnings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ linters:
- partitiontest
- structcheck
- varcheck
- unconvert
- unused


linters-settings:
custom:
partitiontest:
Expand Down Expand Up @@ -55,15 +53,13 @@ issues:
- deadcode
- structcheck
- varcheck
- unconvert
- unused
# Add all linters here -- Comment this block out for testing linters
- path: test/linttest/lintissues\.go
linters:
- deadcode
- structcheck
- varcheck
- unconvert
- unused
- path: crypto/secp256k1/secp256_test\.go
linters:
Expand Down
56 changes: 55 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,61 @@ issues:
- staticcheck
- typecheck
# Ignore missing parallel tests in existing packages
- path: (agreement|catchup|cmd|config|crypto|daemon|data|gen|ledger|logging|netdeploy|network|node|protocol|rpcs|shared|stateproof|test|tools|util).*_test.go
- path: agreement.*_test\.go
linters:
- paralleltest
- path: catchup.*_test\.go
linters:
- paralleltest
- path: cmd.*_test\.go
linters:
- paralleltest
- path: config.*_test\.go
linters:
- paralleltest
- path: crypto.*_test\.go
linters:
- paralleltest
- path: daemon.*_test\.go
linters:
- paralleltest
- path: data.*_test\.go
linters:
- paralleltest
- path: gen.*_test\.go
linters:
- paralleltest
- path: ledger.*_test\.go
linters:
- paralleltest
- path: logging.*_test\.go
linters:
- paralleltest
- path: netdeploy.*_test\.go
linters:
- paralleltest
- path: network.*_test\.go
linters:
- paralleltest
- path: node.*_test\.go
linters:
- paralleltest
- path: protocol.*_test\.go
linters:
- paralleltest
- path: rpcs.*_test\.go
linters:
- paralleltest
- path: stateproof.*_test\.go
linters:
- paralleltest
- path: test.*_test\.go
linters:
- paralleltest
- path: tools.*_test\.go
linters:
- paralleltest
- path: util.*_test\.go
linters:
- paralleltest
# Add all linters here -- Comment this block out for testing linters
Expand Down
87 changes: 39 additions & 48 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,75 +1,66 @@
ARG GO_VERSION=1.17.5
FROM golang:$GO_VERSION-bullseye as builder
FROM ubuntu:18.04 as builder

ARG CHANNEL=nightly
ARG URL=
ARG BRANCH=
ARG SHA=
ARG GO_VERSION="1.17.13"

ARG CHANNEL
ARG URL
ARG BRANCH
ARG SHA
ARG TARGETARCH

ADD https://go.dev/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz /go.tar.gz

# Basic dependencies.
ENV HOME /node
ENV DEBIAN_FRONTEND noninteractive
ENV HOME="/node" DEBIAN_FRONTEND="noninteractive" GOPATH="/dist"

RUN apt-get update && \
apt-get install -y \
apt-get install -y --no-install-recommends \
ca-certificates \
apt-utils \
bsdmainutils \
curl \
git \
git-core \
python3
&& rm -rf /var/lib/apt/lists/* && \
\
tar -C /usr/local -xzf /go.tar.gz && \
rm -rf /go.tar.gz

COPY ./docker/files/ /node/files
COPY ./installer/genesis /node/files/run/genesis
COPY ./cmd/updater/update.sh /node/files/build/update.sh
COPY ./installer/config.json.example /node/files/build/config.json
ENV PATH="/usr/local/go/bin:${PATH}"

RUN find /node/files
COPY ./docker/files/ /dist/files
COPY ./installer/genesis /dist/files/run/genesis
COPY ./cmd/updater/update.sh /dist/files/build/update.sh
COPY ./installer/config.json.example /dist/files/run/config.json.example

# Install algod binaries.
RUN /node/files/build/install.sh \
-p "/node/bin" \
-d "/node/data" \
RUN /dist/files/build/install.sh \
-p "${GOPATH}/bin" \
-d "/algod/data" \
-c "${CHANNEL}" \
-u "${URL}" \
-b "${BRANCH}" \
-s "${SHA}"

# Copy binaries into a clean image
# TODO: We don't need most of the binaries.
# Should we delete everything except goal/algod/algocfg/tealdbg?
FROM debian:bullseye-slim as final
COPY --from=builder "/node/bin/" "/node/bin"
COPY --from=builder "/node/data/" "/node/dataTemplate"
COPY --from=builder "/node/files/run" "/node/run"

ENV BIN_DIR="/node/bin"
ENV PATH="$BIN_DIR:${PATH}"
ENV ALGOD_PORT=8080
ENV ALGORAND_DATA="/algod/data"
RUN mkdir -p "$ALGORAND_DATA"
WORKDIR /node/data
ENV PATH="/node/bin:${PATH}" ALGOD_PORT="8080" ALGORAND_DATA="/algod/data"

# curl is needed to lookup the fast catchup url
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl && \
rm -rf /var/lib/apt/lists/* && \
mkdir -p "$ALGORAND_DATA" && \
groupadd --system algorand && \
useradd --no-log-init --create-home --system --gid algorand algorand && \
chown -R algorand:algorand /algod

# TODO: This works fine, but causes problems when mounting a volume
# Use algorand user instead of root
#RUN groupadd -r algorand && \
# useradd --no-log-init -r -g algorand algorand && \
# chown -R algorand.algorand /node && \
# chown -R algorand.algorand /algod
#USER algorand
USER algorand

# Algod REST API
EXPOSE $ALGOD_PORT
COPY --chown=algorand:algorand --from=builder "/dist/bin/" "/node/bin/"
COPY --chown=algorand:algorand --from=builder "/dist/files/run/" "/node/run/"

# Algod Gossip Port
EXPOSE 4160
# Expose Algod REST API, Algod Gossip, and Prometheus Metrics ports
EXPOSE $ALGOD_PORT 4160 9100

# Prometheus Metrics
EXPOSE 9100
WORKDIR /algod

CMD ["/node/run/run.sh"]
#CMD ["/bin/bash"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ GOLDFLAGS := $(GOLDFLAGS_BASE) \
UNIT_TEST_SOURCES := $(sort $(shell GOPATH=$(GOPATH) && GO111MODULE=off && go list ./... | grep -v /go-algorand/test/ ))
ALGOD_API_PACKAGES := $(sort $(shell GOPATH=$(GOPATH) && GO111MODULE=off && cd daemon/algod/api; go list ./... ))

MSGP_GENERATE := ./protocol ./protocol/test ./crypto ./crypto/merklearray ./crypto/merklesignature ./crypto/stateproof ./data/basics ./data/transactions ./data/stateproofmsg ./data/committee ./data/bookkeeping ./data/hashable ./agreement ./rpcs ./node ./ledger ./ledger/ledgercore ./ledger/store ./stateproof ./data/account ./daemon/algod/api/spec/v2
MSGP_GENERATE := ./protocol ./protocol/test ./crypto ./crypto/merklearray ./crypto/merklesignature ./crypto/stateproof ./data/basics ./data/transactions ./data/stateproofmsg ./data/committee ./data/bookkeeping ./data/hashable ./agreement ./rpcs ./node ./ledger ./ledger/ledgercore ./ledger/store ./ledger/encoded ./stateproof ./data/account ./daemon/algod/api/spec/v2

default: build

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,6 @@ A number of packages provide utilities for the various components:

Please see the [COPYING_FAQ](COPYING_FAQ) for details about how to apply our license.

Copyright (C) 2019-2022, Algorand Inc.
Copyright (C) 2019-2023, Algorand Inc.

[developer site url]: https://developer.algorand.org/
2 changes: 1 addition & 1 deletion agreement/abstractions.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2019-2022 Algorand, Inc.
// Copyright (C) 2019-2023 Algorand, Inc.
// This file is part of go-algorand
//
// go-algorand is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion agreement/actions.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2019-2022 Algorand, Inc.
// Copyright (C) 2019-2023 Algorand, Inc.
// This file is part of go-algorand
//
// go-algorand is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion agreement/actor.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2019-2022 Algorand, Inc.
// Copyright (C) 2019-2023 Algorand, Inc.
// This file is part of go-algorand
//
// go-algorand is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion agreement/agreementtest/keyManager.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2019-2022 Algorand, Inc.
// Copyright (C) 2019-2023 Algorand, Inc.
// This file is part of go-algorand
//
// go-algorand is free software: you can redistribute it and/or modify
Expand Down
Loading

0 comments on commit 341a804

Please sign in to comment.