Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feat/tsc-update
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrm50 committed May 18, 2022
1 parent e31afe7 commit 08d5043
Show file tree
Hide file tree
Showing 221 changed files with 21,792 additions and 10,316 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
runs-on:
- ubuntu-latest
container:
image: gohornet/goreleaser-cgo-cross-compiler:1.18
image: gohornet/goreleaser-cgo-cross-compiler:1.18.1
volumes: [/repo]
steps:
- name: Checkout
Expand Down
40 changes: 9 additions & 31 deletions .github/workflows/test-docs-build.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,21 @@
name: Test Docs Wiki Build
name: Test Docs Build

on:
pull_request:
branches:
- develop

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: Install dependencies
run: |
cd documentation
npm ci
- name: Setup Wiki and Test Build
- uses: actions/checkout@v3
- name: Test Build
run: |
# Move into the documentation folder
cd documentation
# Export this projects configuration as a variable
export config=$(cat EXTERNAL_DOCS_CONFIG)
# Set up the wiki using iota wiki cli. This will clone the wiki repository as well the current repository
npm run setup
# Sync the PRs static content with the freshly created wiki instance
rsync -av --progress ./static/img/ ./local-wiki/iota-wiki/static/img/
cd ../
# Sync the PR content with the freshly created wiki instance
rsync -av --progress ./ ./documentation/local-wiki/iota-wiki/external/goshimmer --exclude .git --exclude node_modules --exclude local-wiki
# Change directory into the wiki
cd documentation/local-wiki/iota-wiki
# Install docusaurus and it's dependencies
yarn
# Replace the configuration placeholder with the configuration variable text
export replace_string='/\* AUTO GENERATED EXTERNAL DOCS CONFIG \*/'
perl -0pe 's#$ENV{replace_string}#$ENV{config}#' docusaurus.config.js > docusaurus.config.js.cpy
# Replace the existing configuration file with the edited one
rm -f docusaurus.config.js && mv docusaurus.config.js.cpy docusaurus.config.js
sed -i "s+baseUrl: '/',+baseUrl: '/goshimmer/',+g" docusaurus.config.js
# Run the build process to test for any errors
yarn install --immutable
yarn build
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ testNodes/*

# Project files
.idea
go.work

# Database directory
mainnetdb/
Expand All @@ -43,4 +44,4 @@ book

config.json
.env
.vscode
.vscode
35 changes: 34 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ builds:
- id: goshimmer
binary: goshimmer
flags:
- -tags=rocksdb,builtin_static,netgo
- -tags=rocksdb
ldflags:
- -s -w -X github.com/iotaledger/goshimmer/plugins/banner.AppVersion={{.Version}}
goos:
Expand All @@ -34,6 +34,20 @@ builds:
goarch:
- amd64

# evil-spammer AMD64 all OS
- id: evil-spammer
dir: ./tools/evil-spammer
binary: evil-spammer
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- amd64


# Archives
archives:
# GoShimmer with config and snapshot
Expand Down Expand Up @@ -75,6 +89,25 @@ archives:
files:
- LICENSE

# evil-spammer
- id: evil-spammer
builds:
- evil-spammer
name_template: "evil-spammer-{{.Version}}_{{.Os}}_{{.Arch}}"
replacements:
amd64: x86_64
arm: ARM
arm64: ARM64
darwin: macOS
linux: Linux
windows: Windows
format_overrides:
- goos: windows
format: zip
files:
- LICENSE


# Checksum
checksum:
name_template: "checksums.txt"
Expand Down
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
# v0.8.14 - 2022-05-16

> Minor revision introducing small docker changes.
The snapshot has been taken at 2022-05-07 16:30 UTC.
- Fix several Docker discrepancies (#2201, #2206)

# v0.8.13 - 2022-05-06

> This release introduces serix, a reflection-based serialization library that enables us to automatically serialize all models.
The snapshot has been taken at 2022-05-04 15:05 UTC.
- Avoid failing on duplicated unlock blocks with serix (#2197)
- Use serix library (#2187)
- Buffer size calculation update for congestion control (#2166)
- Feat/evil spammer improvements and fixes (#2191)
- Fix bugs in evil spammer and tutorial (#2185)


# v0.8.12 - 2022-04-25

> This release introduces the evil wallet and a fix where nodes could not express their opinion on conflicts properly.
The snapshot has been taken at 2022-03-21 15:40 UTC.
- Decrease activity message interval (#2182)
- Fix issue where liked branch is not returned when LikedConflictMember is called with the liked branch of the conflict set (#2174)
- Evil Wallet and Evil Spammer tool (#2172)
- Build(deps): bump ansi-regex from 3.0.0 to 3.0.1 in /documentation (#2173)
- Build(deps): bump async from 2.6.3 to 2.6.4 for all frontends (#2171)
- Build(deps): bump minimist from 1.2.5 to 1.2.6 in /plugins/dashboard/frontend (#2152)
- Build(deps): bump moment from 2.29.1 to 2.29.2 in dagsvisualizer and dashboard (#2150)

# v0.8.11 - 2022-03-23

> This release upgrades to Go 1.18 and fixes a bug that rendered tips unreferenceable.
Expand Down
39 changes: 25 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
ARG REMOTE_DEBUGGING=0

############################
# golang 1.18-buster multi-arch
FROM golang:1.18-buster AS build
# golang 1.18-bullseye multi-arch
FROM golang:1.18.1-bullseye AS build

ARG RUN_TEST=0
ARG BUILD_TAGS=rocksdb,builtin_static
ARG BUILD_TAGS=rocksdb

# Define second time inside the build stage to work in bash conditions.
ARG REMOTE_DEBUGGING=0
Expand Down Expand Up @@ -90,17 +90,21 @@ RUN if [ "$DOWNLOAD_SNAPSHOT" -gt 0 ] && [ "$CUSTOM_SNAPSHOT_URL" = "" ] ; then
touch /tmp/snapshot.bin ; \
fi

RUN mkdir -p /tmp/db/mainnetdb /tmp/db/peerdb
# 65532:65532 is the UID:GUID of nonroot user of distroless image
RUN chown 65532:65532 /tmp/db/mainnetdb /tmp/db/peerdb

############################
# Image
############################
# https://github.com/GoogleContainerTools/distroless/tree/master/cc
# using distroless cc image, which includes everything in the base image (glibc, libssl and openssl)
FROM gcr.io/distroless/cc@sha256:4cad7484b00d98ecb300916b1ab71d6c71babd6860c6c5dd6313be41a8c55adb as prepare-runtime
FROM gcr.io/distroless/cc-debian11:nonroot as prepare-runtime

# Gossip
EXPOSE 14666/tcp
# AutoPeering
#EXPOSE 14626/udp
EXPOSE 14626/udp
# Pprof Profiling
EXPOSE 6061/tcp
# Prometheus exporter
Expand All @@ -112,25 +116,32 @@ EXPOSE 8081/tcp
# DAGs Visualizer
EXPOSE 8061/tcp

# Copy configuration
COPY --from=build /tmp/snapshot.bin /snapshot.bin
COPY config.default.json /config.json
# Default directory and drop privileges
WORKDIR /app
USER nonroot

# Copy the Pre-built binary file from the previous stage
COPY --chown=nonroot:nonroot --from=build /go/bin/goshimmer /run/goshimmer
COPY --chown=nonroot:nonroot --from=build /go/bin/goshimmer /app/goshimmer

# Copy configuration and snapshot from the previous stage
COPY config.default.json /app/config.json
COPY --from=build /tmp/snapshot.bin /app/snapshot.bin

# Fix permission issue when mounting volumes
COPY --chown=nonroot:nonroot --from=build /tmp/db/ /app/

# We execute this stage only if debugging is disabled, i.e REMOTE_DEBUGGIN==0.
# We execute this stage only if debugging is disabled, i.e REMOTE_DEBUGGIN==0
FROM prepare-runtime as debugger-enabled-0

ENTRYPOINT ["/run/goshimmer", "--config=/config.json"]
ENTRYPOINT ["/app/goshimmer", "--config=/app/config.json"]

# We execute this stage only if debugging is enabled, i.e REMOTE_DEBUGGIN==1.
# We execute this stage only if debugging is enabled, i.e REMOTE_DEBUGGIN==1
FROM prepare-runtime as debugger-enabled-1
EXPOSE 40000

# Copy the Delve binary
COPY --chown=nonroot:nonroot --from=build /go/bin/dlv /run/dlv
ENTRYPOINT ["/run/dlv","--listen=:40000", "--headless" ,"--api-version=2", "--accept-multiclient", "exec", "--continue", "/run/goshimmer", "--", "--config=/config.json"]
COPY --chown=nonroot:nonroot --from=build /go/bin/dlv /app/dlv
ENTRYPOINT ["/app/dlv", "--listen=:40000", "--headless", "--api-version=2", "--accept-multiclient", "exec", "--continue", "/app/goshimmer", "--", "--config=/app/config.json"]

# Execute corresponding build stage depending on the REMOTE_DEBUGGING build arg.
FROM debugger-enabled-${REMOTE_DEBUGGING} as runtime
60 changes: 60 additions & 0 deletions client/evilspammer/errors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package evilspammer

import (
"fmt"
"github.com/cockroachdb/errors"
"go.uber.org/atomic"
"sync"
)

var (
ErrFailPostTransaction = errors.New("failed to post transaction")
ErrFailSendDataMessage = errors.New("failed to send a data message")
ErrTransactionIsNil = errors.New("provided transaction is nil")
ErrFailToPrepareBatch = errors.New("custom conflict batch could not be prepared")
ErrInsufficientClients = errors.New("insufficient clients to send conflicts")
ErrInputsNotSolid = errors.New("not all inputs are solid")
)

// ErrorCounter counts errors that appeared during the spam,
// as during the spam they are ignored and allows to print the summary (might be useful for debugging).
type ErrorCounter struct {
errorsMap map[error]*atomic.Int64
errInTotalCount *atomic.Int64
mutex sync.RWMutex
}

func NewErrorCount() *ErrorCounter {
e := &ErrorCounter{
errorsMap: make(map[error]*atomic.Int64),
errInTotalCount: atomic.NewInt64(0),
}
return e
}

func (e *ErrorCounter) CountError(err error) {
e.mutex.Lock()
defer e.mutex.Unlock()

// check if error is already in the map
if _, ok := e.errorsMap[err]; !ok {
e.errorsMap[err] = atomic.NewInt64(0)
}
e.errInTotalCount.Add(1)
e.errorsMap[err].Add(1)
}

func (e *ErrorCounter) GetTotalErrorCount() int64 {
return e.errInTotalCount.Load()
}

func (e *ErrorCounter) GetErrorsSummary() string {
if len(e.errorsMap) == 0 {
return "No errors encountered"
}
msg := "Errors encountered during spam:\n"
for key, value := range e.errorsMap {
msg += fmt.Sprintf("%s: %d\n", key.Error(), value.Load())
}
return msg
}
Loading

0 comments on commit 08d5043

Please sign in to comment.