Compare commits

..

11 Commits

Author SHA1 Message Date
Clayton Calabrese 4ccaca399f Merge branch 'fix_missing_node_py_changes' of https://github.com/AntelopeIO/leap into fix_missing_node_py_changes 2023-03-22 18:14:16 -05:00
Clayton Calabrese 09390a4725 return lost changes to Node.py functions 2023-03-22 18:13:24 -05:00
Matt Witherspoon 7c94e3a102 add PACKED_STRUCT on ControlStructureImm to silence warning 2023-03-22 18:12:54 -05:00
Matt Witherspoon f469d2b78a add static_assert()s on required size of IR::OpcodeAndImm<>s 2023-03-22 18:12:54 -05:00
Matt Witherspoon a9c5cd9f95 fix comparison of different signedness warning in log_index 2023-03-22 18:12:54 -05:00
Lin Huang 41f5a148bb correct version after merging from 4.0.0-rc1 2023-03-22 18:12:54 -05:00
Zach Butler 1f0f5280d5 Restore markdown formatting erroneously deleted in commit 06c9e25327 2023-03-22 18:12:54 -05:00
Zach Butler 6b54dac75f Cardinal objects should be in a numbered list 2023-03-22 18:12:54 -05:00
Zach Butler df4a974b8a Pull note about sudo into its own quote block 2023-03-22 18:12:54 -05:00
Zach Butler c9596cd699 Minor pinned build script README changes 2023-03-22 18:12:54 -05:00
Clayton Calabrese 6c8441bc6c return lost changes to Node.py functions 2023-03-22 17:15:59 -05:00
805 changed files with 25975 additions and 32839 deletions
-9
View File
@@ -1,9 +0,0 @@
{
"cdt":{
"target":"4",
"prerelease":false
},
"referencecontracts":{
"ref":"main"
}
}
+11
View File
@@ -0,0 +1,11 @@
{
"ubuntu18": {
"dockerfile": ".cicd/platforms/ubuntu18.Dockerfile"
},
"ubuntu20": {
"dockerfile": ".cicd/platforms/ubuntu20.Dockerfile"
},
"ubuntu22": {
"dockerfile": ".cicd/platforms/ubuntu22.Dockerfile"
}
}
-37
View File
@@ -1,37 +0,0 @@
# syntax=docker/dockerfile:1
FROM ubuntu:jammy
ENV TZ="America/New_York"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y build-essential \
cmake \
git \
jq \
libcurl4-openssl-dev \
libgmp-dev \
llvm-11-dev \
lsb-release \
ninja-build \
python3-numpy \
software-properties-common \
file \
wget \
zlib1g-dev \
zstd
RUN yes | bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" llvm.sh 18
#make sure no confusion on what llvm library leap's cmake should pick up on
RUN rm -rf /usr/lib/llvm-18/lib/cmake
ENV LEAP_PLATFORM_HAS_EXTRAS_CMAKE=1
COPY <<-EOF /extras.cmake
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "" FORCE)
set(CMAKE_C_COMPILER "clang-18" CACHE STRING "")
set(CMAKE_CXX_COMPILER "clang++-18" CACHE STRING "")
set(CMAKE_C_FLAGS "-fsanitize=address -fno-omit-frame-pointer" CACHE STRING "")
set(CMAKE_CXX_FLAGS "-fsanitize=address -fno-omit-frame-pointer" CACHE STRING "")
EOF
ENV ASAN_OPTIONS=detect_leaks=0
-29
View File
@@ -1,29 +0,0 @@
# syntax=docker/dockerfile:1
#the exact version of Ubuntu doesn't matter for the purpose of asserton builds. Feel free to upgrade in future
FROM ubuntu:jammy
ENV TZ="America/New_York"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y build-essential \
cmake \
git \
jq \
libcurl4-openssl-dev \
libgmp-dev \
llvm-11-dev \
ninja-build \
python3-numpy \
file \
zlib1g-dev \
zstd
ENV LEAP_PLATFORM_HAS_EXTRAS_CMAKE=1
COPY <<-EOF /extras.cmake
# reset the build type to empty to disable any cmake default flags
set(CMAKE_BUILD_TYPE "" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS "-O3" CACHE STRING "")
set(CMAKE_CXX_FLAGS "-O3" CACHE STRING "")
set(LEAP_ENABLE_RELEASE_BUILD_TEST "Off" CACHE BOOL "")
EOF
-42
View File
@@ -1,42 +0,0 @@
# syntax=docker/dockerfile:1
FROM ubuntu:jammy
ENV TZ="America/New_York"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y build-essential \
cmake \
git \
jq \
libcurl4-openssl-dev \
libgmp-dev \
llvm-11-dev \
lsb-release \
ninja-build \
python3-numpy \
software-properties-common \
file \
wget \
zlib1g-dev \
zstd
RUN yes | bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" llvm.sh 18
#make sure no confusion on what llvm library leap's cmake should pick up on
RUN rm -rf /usr/lib/llvm-18/lib/cmake
COPY <<-EOF /ubsan.supp
vptr:wasm_eosio_validation.hpp
vptr:wasm_eosio_injection.hpp
EOF
ENV LEAP_PLATFORM_HAS_EXTRAS_CMAKE=1
COPY <<-EOF /extras.cmake
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "" FORCE)
set(CMAKE_C_COMPILER "clang-18" CACHE STRING "")
set(CMAKE_CXX_COMPILER "clang++-18" CACHE STRING "")
set(CMAKE_C_FLAGS "-fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer" CACHE STRING "")
set(CMAKE_CXX_FLAGS "-fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer" CACHE STRING "")
EOF
ENV UBSAN_OPTIONS=print_stacktrace=1,suppressions=/ubsan.supp
+40
View File
@@ -0,0 +1,40 @@
FROM ubuntu:bionic
RUN apt-get update && apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential \
cmake \
curl \
g++-8 \
git \
jq \
libcurl4-openssl-dev \
libgmp-dev \
libssl-dev \
llvm-7-dev \
ninja-build \
python3 \
python3-numpy \
python3-pip \
software-properties-common \
zlib1g-dev \
zstd
RUN python3 -m pip install dataclasses
# GitHub's actions/checkout requires git 2.18+ but Ubuntu 18 only provides 2.17
RUN add-apt-repository ppa:git-core/ppa && apt update && apt install -y git
# Leap requires boost 1.67+ but Ubuntu 18 only provides 1.65
# Probably need 1.70+ to work properly with old cmake provided in Ubuntu 18
RUN curl -L https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.tar.bz2 | tar jx && \
cd boost_* && \
./bootstrap.sh --prefix=/boost && \
./b2 --with-iostreams --with-date_time --with-filesystem --with-system \
--with-program_options --with-chrono --with-test -j$(nproc) install && \
cd .. && \
rm -rf boost_*
ENV CC=gcc-8
ENV CXX=g++-8
ENV BOOST_ROOT=/boost
ENV LLVM_DIR=/usr/lib/llvm-7/
+14 -20
View File
@@ -1,22 +1,16 @@
FROM ubuntu:focal
ENV TZ="America/New_York"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y build-essential \
g++-10 \
cmake \
git \
jq \
libcurl4-openssl-dev \
libgmp-dev \
llvm-11-dev \
ninja-build \
python3-numpy \
file \
zlib1g-dev \
zstd && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave \
/usr/bin/g++ g++ /usr/bin/g++-10 --slave \
/usr/bin/gcov gcov /usr/bin/gcov-10
RUN apt-get update && apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential \
cmake \
curl \
git \
jq \
libboost-all-dev \
libcurl4-openssl-dev \
libgmp-dev \
libssl-dev \
llvm-11-dev \
ninja-build \
python3-numpy \
zstd
+14 -14
View File
@@ -1,16 +1,16 @@
FROM ubuntu:jammy
ENV TZ="America/New_York"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y build-essential \
cmake \
git \
jq \
libcurl4-openssl-dev \
libgmp-dev \
llvm-11-dev \
ninja-build \
python3-numpy \
file \
zlib1g-dev \
zstd
DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential \
cmake \
curl \
git \
jq \
libboost-all-dev \
libcurl4-openssl-dev \
libgmp-dev \
libssl-dev \
llvm-11-dev \
ninja-build \
python3-numpy \
zstd
@@ -9,8 +9,6 @@ inputs:
required: true
tests-label:
required: true
test-timeout:
required: true
runs:
using: 'node20'
using: 'node16'
main: 'dist/index.mjs'
File diff suppressed because one or more lines are too long
@@ -10,27 +10,25 @@ const container = core.getInput('container', {required: true});
const error_log_paths = JSON.parse(core.getInput('error-log-paths', {required: true}));
const log_tarball_prefix = core.getInput('log-tarball-prefix', {required: true});
const tests_label = core.getInput('tests-label', {required: true});
const test_timeout = core.getInput('test-timeout', {required: true});
const repo_name = process.env.GITHUB_REPOSITORY.split('/')[1];
try {
if(child_process.spawnSync("docker", ["run", "--name", "base", "-v", `${process.cwd()}/build.tar.zst:/build.tar.zst`, "--workdir", `/__w/${repo_name}/${repo_name}`, container, "sh", "-c", "zstdcat /build.tar.zst | tar x"], {stdio:"inherit"}).status)
if(child_process.spawnSync("docker", ["run", "--name", "base", "-v", `${process.cwd()}/build.tar.zst:/build.tar.zst`, "--workdir", "/__w/leap/leap", container, "sh", "-c", "zstdcat /build.tar.zst | tar x"], {stdio:"inherit"}).status)
throw new Error("Failed to create base container");
if(child_process.spawnSync("docker", ["commit", "base", "baseimage"], {stdio:"inherit"}).status)
throw new Error("Failed to create base image");
if(child_process.spawnSync("docker", ["rm", "base"], {stdio:"inherit"}).status)
throw new Error("Failed to remove base container");
const test_query_result = child_process.spawnSync("docker", ["run", "--rm", "baseimage", "bash", "-e", "-o", "pipefail", "-c", `cd build; ctest -L '${tests_label}' --show-only=json-v1`]);
// the correct approach is by far "--show-only=json-v1" and then pluck out .tests[].name; but that doesn't work on U18's cmake 3.10 since it lacks json-v1 output
const test_query_result = child_process.spawnSync("docker", ["run", "--rm", "baseimage", "bash", "-e", "-o", "pipefail", "-c", `cd build; ctest -L '${tests_label}' --show-only | head -n -1 | cut -d ':' -f 2 -s | jq -cnR '[inputs | select(length>0)[1:]]'`]);
if(test_query_result.status)
throw new Error("Failed to discover tests with label")
const tests = JSON.parse(test_query_result.stdout).tests;
const tests = JSON.parse(test_query_result.stdout);
let subprocesses = [];
tests.forEach(t => {
subprocesses.push(new Promise(resolve => {
child_process.spawn("docker", ["run", "--security-opt", "seccomp=unconfined", "-e", "GITHUB_ACTIONS=True", "--name", t.name, "--init", "baseimage", "bash", "-c", `cd build; ctest --output-on-failure -R '^${t.name}$' --timeout ${test_timeout}`], {stdio:"inherit"}).on('close', code => resolve(code));
child_process.spawn("docker", ["run", "--security-opt", "seccomp=unconfined", "-e", "GITHUB_ACTIONS=True", "--name", t, "--init", "baseimage", "bash", "-c", `cd build; ctest --output-on-failure -R '^${t}$'`], {stdio:"inherit"}).on('close', code => resolve(code));
}));
});
@@ -47,13 +45,13 @@ try {
let packer = tar.pack();
extractor.on('entry', (header, stream, next) => {
if(!header.name.startsWith(`__w/${repo_name}/${repo_name}/build`)) {
if(!header.name.startsWith(`__w/leap/leap/build`)) {
stream.on('end', () => next());
stream.resume();
return;
}
header.name = header.name.substring(`__w/${repo_name}/${repo_name}/`.length);
header.name = header.name.substring(`__w/leap/leap/`.length);
if(header.name !== "build/" && error_log_paths.filter(p => header.name.startsWith(p)).length === 0) {
stream.on('end', () => next());
stream.resume();
@@ -63,8 +61,8 @@ try {
stream.pipe(packer.entry(header, next));
}).on('finish', () => {packer.finalize()});
child_process.spawn("docker", ["export", tests[i].name]).stdout.pipe(extractor);
stream.promises.pipeline(packer, zlib.createGzip(), fs.createWriteStream(`${log_tarball_prefix}-${tests[i].name}-logs.tar.gz`));
child_process.spawn("docker", ["export", tests[i]]).stdout.pipe(extractor);
stream.promises.pipeline(packer, zlib.createGzip(), fs.createWriteStream(`${log_tarball_prefix}-${tests[i]}-logs.tar.gz`));
}
} catch(e) {
core.setFailed(`Uncaught exception ${e.message}`);
+136 -279
View File
@@ -7,20 +7,6 @@ on:
- "release/*"
pull_request:
workflow_dispatch:
inputs:
override-cdt:
description: 'Override cdt target'
type: string
override-cdt-prerelease:
type: choice
description: Override cdt prelease
options:
- default
- true
- false
override-reference-contracts:
description: 'Override reference contracts ref'
type: string
permissions:
packages: read
@@ -31,321 +17,192 @@ defaults:
shell: bash
jobs:
platform-cache:
name: Platform Cache
uses: AntelopeIO/platform-cache-workflow/.github/workflows/platformcache.yaml@v1
permissions:
packages: write
contents: read
with:
runs-on: '["self-hosted", "enf-x86-beefy"]'
platform-files: |
.cicd/platforms
tools/reproducible.Dockerfile:builder
build-base:
name: Run Build Workflow
uses: ./.github/workflows/build_base.yaml
needs: [platform-cache]
with:
platforms: ${{needs.platform-cache.outputs.platforms}}
platform-list: ${{needs.platform-cache.outputs.platform-list}}
v:
name: Discover Versions
d:
name: Discover Platforms
runs-on: ubuntu-latest
outputs:
cdt-target: ${{steps.versions.outputs.cdt-target}}
cdt-prerelease: ${{steps.versions.outputs.cdt-prerelease}}
reference-contracts-ref: ${{steps.versions.outputs.reference-contracts-ref}}
missing-platforms: ${{steps.discover.outputs.missing-platforms}}
p: ${{steps.discover.outputs.platforms}}
steps:
- name: Setup cdt and reference-contracts versions
id: versions
env:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
DEFAULTS_JSON=$(curl -sSfL $(gh api https://api.github.com/repos/${{github.repository}}/contents/.cicd/defaults.json?ref=${{github.sha}} --jq .download_url))
echo cdt-target=$(echo "$DEFAULTS_JSON" | jq -r '.cdt.target') >> $GITHUB_OUTPUT
echo cdt-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '.cdt.prerelease') >> $GITHUB_OUTPUT
echo reference-contracts-ref=$(echo "$DEFAULTS_JSON" | jq -r '.referencecontracts.ref') >> $GITHUB_OUTPUT
if [[ "${{inputs.override-cdt}}" != "" ]]; then
echo cdt-target=${{inputs.override-cdt}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-cdt-prerelease}}" == +(true|false) ]]; then
echo cdt-prerelease=${{inputs.override-cdt-prerelease}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-reference-contracts}}" != "" ]]; then
echo reference-contracts-ref=${{inputs.override-reference-contracts}} >> $GITHUB_OUTPUT
fi
package:
name: Build deb packages
needs: [platform-cache, build-base]
- name: Discover Platforms
id: discover
uses: AntelopeIO/discover-platforms-action@v1
with:
platform-file: .cicd/platforms.json
password: ${{secrets.GITHUB_TOKEN}}
package-name: builders
build-platforms:
name: Build Platforms
needs: d
if: needs.d.outputs.missing-platforms != '[]'
strategy:
fail-fast: false
matrix:
platform: [ubuntu20, ubuntu22, reproducible]
runs-on: ubuntu-latest
container: ${{fromJSON(needs.platform-cache.outputs.platforms)[matrix.platform].image}}
platform: ${{fromJSON(needs.d.outputs.missing-platforms)}}
runs-on: ["self-hosted", "enf-x86-beefy"]
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Login to Container Registry
uses: docker/login-action@v2
with:
submodules: recursive
registry: ghcr.io
username: ${{github.repository_owner}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
tags: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}
file: ${{fromJSON(needs.d.outputs.p)[matrix.platform].dockerfile}}
Build:
needs: [d, build-platforms]
if: always() && needs.d.result == 'success' && (needs.build-platforms.result == 'success' || needs.build-platforms.result == 'skipped')
strategy:
fail-fast: false
matrix:
platform: [ubuntu18, ubuntu20, ubuntu22]
runs-on: ["self-hosted", "enf-x86-beefy"]
container: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Build
id: build
run: |
# https://github.com/actions/runner/issues/2033
chown -R $(id -u):$(id -g) $PWD
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -GNinja ..
ninja
tar -pc -C .. --exclude "*.o" build | zstd --long -T0 -9 > ../build.tar.zst
- name: Upload builddir
uses: AntelopeIO/upload-artifact-large-chunks-action@v1
with:
name: ${{matrix.platform}}-build
path: build.tar.zst
dev-package:
name: Build leap-dev package
needs: [d, Build]
if: always() && needs.Build.result == 'success'
runs-on: ubuntu-latest
container: ${{fromJSON(needs.d.outputs.p)['ubuntu20'].image}}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Download builddir
uses: actions/download-artifact@v4
uses: actions/download-artifact@v3
with:
name: ${{matrix.platform}}-build
- name: Build packages
name: ubuntu20-build
- name: Build dev package
run: |
zstdcat build.tar.zst | tar x
cd build
cpack
../tools/tweak-deb.sh leap_*.deb
- name: Install dev package
if: matrix.platform != 'reproducible'
run: |
apt-get update && apt-get upgrade -y
apt-get install -y ./build/leap_*.deb ./build/leap-dev*.deb
- name: Test using TestHarness
if: matrix.platform != 'reproducible'
run: |
python3 -c "from TestHarness import Cluster"
- name: Upload dev package
uses: actions/upload-artifact@v4
if: matrix.platform != 'reproducible'
uses: actions/upload-artifact@v3
with:
name: leap-dev-${{matrix.platform}}-amd64
name: leap-dev-ubuntu20-amd64
path: build/leap-dev*.deb
compression-level: 0
- name: Upload leap package
uses: actions/upload-artifact@v4
if: matrix.platform == 'reproducible'
with:
name: leap-deb-amd64
path: build/leap_*.deb
compression-level: 0
tests:
name: Tests (${{matrix.cfg.name}})
needs: [platform-cache, build-base]
name: Tests
needs: [d, Build]
if: always() && needs.Build.result == 'success'
strategy:
fail-fast: false
matrix:
include:
- cfg: {name: 'ubuntu20', base: 'ubuntu20', builddir: 'ubuntu20'}
- cfg: {name: 'ubuntu22', base: 'ubuntu22', builddir: 'ubuntu22'}
- cfg: {name: 'asserton', base: 'asserton', builddir: 'asserton'}
- cfg: {name: 'ubsan', base: 'ubsan', builddir: 'ubsan'}
- cfg: {name: 'asan', base: 'asan', builddir: 'asan'}
- cfg: {name: 'ubuntu20repro', base: 'ubuntu20', builddir: 'reproducible'}
- cfg: {name: 'ubuntu22repro', base: 'ubuntu22', builddir: 'reproducible'}
platform: [ubuntu20, ubuntu22]
runs-on: ["self-hosted", "enf-x86-hightier"]
container:
image: ${{fromJSON(needs.platform-cache.outputs.platforms)[matrix.cfg.base].image}}
options: --security-opt seccomp=unconfined --mount type=bind,source=/var/lib/systemd/coredump,target=/cores
container:
image: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}
options: --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Download builddir
uses: actions/download-artifact@v4
uses: actions/download-artifact@v3
with:
name: ${{matrix.cfg.builddir}}-build
name: ${{matrix.platform}}-build
- name: Run Parallel Tests
run: |
# https://github.com/actions/runner/issues/2033 -- need this because of full version label test looking at git revs
chown -R $(id -u):$(id -g) $PWD
# jammy's boost 1.74 can stumble on an EXDEV via copy_file_range() it doesn't have a fallback for; re-eval once moving to std::filesystem
export TMPDIR="$PWD/tmp"
mkdir -p $TMPDIR
zstdcat build.tar.zst | tar x
cd build
ctest --output-on-failure -j $(nproc) -LE "(nonparallelizable_tests|long_running_tests)" --timeout 420
- name: Upload core files from failed tests
uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{matrix.cfg.name}}-tests-logs
if-no-files-found: ignore
path: /cores
compression-level: 0
- name: Check CPU Features
run: awk 'BEGIN {err = 1} /bmi2/ && /adx/ {err = 0} END {exit err}' /proc/cpuinfo
ctest --output-on-failure -j $(nproc) -LE "(nonparallelizable_tests|long_running_tests)"
np-tests:
name: NP Tests (${{matrix.cfg.name}})
needs: [platform-cache, build-base]
name: NP Tests
needs: [d, Build]
if: always() && needs.Build.result == 'success'
strategy:
fail-fast: false
matrix:
include:
- cfg: {name: 'ubuntu20', base: 'ubuntu20', builddir: 'ubuntu20'}
- cfg: {name: 'ubuntu22', base: 'ubuntu22', builddir: 'ubuntu22'}
- cfg: {name: 'asserton', base: 'asserton', builddir: 'asserton'}
- cfg: {name: 'ubsan', base: 'ubsan', builddir: 'ubsan'}
- cfg: {name: 'ubuntu20repro', base: 'ubuntu20', builddir: 'reproducible'}
- cfg: {name: 'ubuntu22repro', base: 'ubuntu22', builddir: 'reproducible'}
platform: [ubuntu18, ubuntu20, ubuntu22]
runs-on: ["self-hosted", "enf-x86-midtier"]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Download builddir
uses: actions/download-artifact@v4
with:
name: ${{matrix.cfg.builddir}}-build
- name: Run tests in parallel containers
uses: ./.github/actions/parallel-ctest-containers
with:
container: ${{fromJSON(needs.platform-cache.outputs.platforms)[matrix.cfg.base].image}}
error-log-paths: '["build/etc", "build/var", "build/leap-ignition-wd", "build/TestLogs"]'
log-tarball-prefix: ${{matrix.cfg.name}}
tests-label: nonparallelizable_tests
test-timeout: 420
- name: Export core dumps
run: docker run --mount type=bind,source=/var/lib/systemd/coredump,target=/cores alpine sh -c 'tar -C /cores/ -c .' | tar x
if: failure()
- name: Upload logs from failed tests
uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{matrix.cfg.name}}-np-logs
path: |
*-logs.tar.gz
core*.zst
compression-level: 0
lr-tests:
name: LR Tests (${{matrix.cfg.name}})
needs: [platform-cache, build-base]
strategy:
fail-fast: false
matrix:
include:
- cfg: {name: 'ubuntu20', base: 'ubuntu20', builddir: 'ubuntu20'}
- cfg: {name: 'ubuntu22', base: 'ubuntu22', builddir: 'ubuntu22'}
- cfg: {name: 'asserton', base: 'asserton', builddir: 'asserton'}
- cfg: {name: 'ubsan', base: 'ubsan', builddir: 'ubsan'}
- cfg: {name: 'ubuntu20repro', base: 'ubuntu20', builddir: 'reproducible'}
- cfg: {name: 'ubuntu22repro', base: 'ubuntu22', builddir: 'reproducible'}
runs-on: ["self-hosted", "enf-x86-lowtier"]
steps:
- uses: actions/checkout@v4
- name: Download builddir
uses: actions/download-artifact@v4
with:
name: ${{matrix.cfg.builddir}}-build
- name: Run tests in parallel containers
uses: ./.github/actions/parallel-ctest-containers
with:
container: ${{fromJSON(needs.platform-cache.outputs.platforms)[matrix.cfg.base].image}}
error-log-paths: '["build/etc", "build/var", "build/leap-ignition-wd", "build/TestLogs"]'
log-tarball-prefix: ${{matrix.cfg.name}}
tests-label: long_running_tests
test-timeout: 1800
- name: Export core dumps
run: docker run --mount type=bind,source=/var/lib/systemd/coredump,target=/cores alpine sh -c 'tar -C /cores/ -c .' | tar x
if: failure()
- name: Upload logs from failed tests
uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{matrix.cfg.name}}-lr-logs
path: |
*-logs.tar.gz
core*.zst
compression-level: 0
libtester-tests:
name: libtester tests
needs: [platform-cache, build-base, v, package]
strategy:
fail-fast: false
matrix:
platform: [ubuntu22]
test: [build-tree, make-dev-install, deb-install]
runs-on: ["self-hosted", "enf-x86-midtier"]
container: ${{ matrix.test != 'deb-install' && fromJSON(needs.platform-cache.outputs.platforms)[matrix.platform].image || 'ubuntu:jammy' }}
env:
DEBIAN_FRONTEND: noninteractive
TZ: Etc/UTC
steps:
- name: Update Package Index & Upgrade Packages
run: |
apt-get update
apt-get upgrade -y
# LEAP
- if: ${{ matrix.test != 'deb-install' }}
name: Clone leap
uses: actions/checkout@v4
with:
submodules: recursive
- if: ${{ matrix.test != 'deb-install' }}
name: Download leap builddir
uses: actions/download-artifact@v4
uses: actions/download-artifact@v3
with:
name: ${{matrix.platform}}-build
- if: ${{ matrix.test != 'deb-install' }}
name: Extract leap build
run: |
zstdcat build.tar.zst | tar x
- if: ${{ matrix.test == 'build-tree' }}
name: Set leap_DIR env var
run: |
echo "leap_DIR=$PWD/build/lib/cmake/leap" >> "$GITHUB_ENV"
- if: ${{ matrix.test == 'make-dev-install' }}
name: leap dev-install
run: |
cmake --install build
cmake --install build --component dev
- if: ${{ matrix.test == 'make-dev-install' }}
name: Delete leap artifacts
run: |
rm -r *
- if: ${{ matrix.test == 'deb-install' }}
name: Download leap-dev
uses: actions/download-artifact@v4
- name: Run tests in parallel containers
uses: ./.github/actions/parallel-ctest-containers
with:
name: leap-dev-${{matrix.platform}}-amd64
- if: ${{ matrix.test == 'deb-install' }}
name: Install leap-dev Package
run: |
apt-get install -y ./*.deb
rm ./*.deb
container: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}
error-log-paths: '["build/etc", "build/var", "build/leap-ignition-wd", "build/TestLogs"]'
log-tarball-prefix: ${{matrix.platform}}
tests-label: nonparallelizable_tests
- name: Upload logs from failed tests
uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{matrix.platform}}-np-logs
path: '*-logs.tar.gz'
# CDT
- name: Download cdt
uses: AntelopeIO/asset-artifact-download-action@v3
lr-tests:
name: LR Tests
needs: [d, Build]
if: always() && needs.Build.result == 'success'
strategy:
fail-fast: false
matrix:
platform: [ubuntu18, ubuntu20, ubuntu22]
runs-on: ["self-hosted", "enf-x86-lowtier"]
steps:
- uses: actions/checkout@v3
- name: Download builddir
uses: actions/download-artifact@v3
with:
owner: AntelopeIO
repo: cdt
file: 'cdt_.*amd64.deb'
target: '${{needs.v.outputs.cdt-target}}'
prereleases: ${{fromJSON(needs.v.outputs.cdt-prerelease)}}
artifact-name: cdt_ubuntu_package_amd64
- name: Install cdt Packages
run: |
apt-get install -y ./*.deb
rm ./*.deb
# Reference Contracts
- name: checkout reference-contracts
uses: actions/checkout@v4
name: ${{matrix.platform}}-build
- name: Run tests in parallel containers
uses: ./.github/actions/parallel-ctest-containers
with:
repository: AntelopeIO/reference-contracts
path: reference-contracts
ref: '${{needs.v.outputs.reference-contracts-ref}}'
- if: ${{ matrix.test == 'deb-install' }}
name: Install reference-contracts deps
run: |
apt-get -y install cmake build-essential
- name: Build & Test reference-contracts
run: |
cmake -S reference-contracts -B reference-contracts/build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=On -DSYSTEM_ENABLE_LEAP_VERSION_CHECK=Off -DSYSTEM_ENABLE_CDT_VERSION_CHECK=Off
cmake --build reference-contracts/build -- -j $(nproc)
cd reference-contracts/build/tests
ctest --output-on-failure -j $(nproc)
container: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}
error-log-paths: '["build/etc", "build/var", "build/leap-ignition-wd", "build/TestLogs"]'
log-tarball-prefix: ${{matrix.platform}}
tests-label: long_running_tests
- name: Upload logs from failed tests
uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{matrix.platform}}-lr-logs
path: '*-logs.tar.gz'
all-passing:
name: All Required Tests Passed
needs: [tests, np-tests, libtester-tests]
needs: [dev-package, tests, np-tests]
if: always()
runs-on: ubuntu-latest
steps:
- if: needs.tests.result != 'success' || needs.np-tests.result != 'success' || needs.libtester-tests.result != 'success'
- if: needs.dev-package.result != 'success' || needs.tests.result != 'success' || needs.np-tests.result != 'success'
run: false
-49
View File
@@ -1,49 +0,0 @@
name: "Build leap"
on:
workflow_call:
inputs:
platforms:
description: "Platforms definitions"
type: string
required: true
platform-list:
description: "Array of platforms"
type: string
required: true
permissions:
packages: read
contents: read
defaults:
run:
shell: bash
jobs:
Build:
name: Build leap
strategy:
fail-fast: false
matrix:
platform: ${{fromJSON(inputs.platform-list)}}
runs-on: ["self-hosted", "enf-x86-beefy"]
container: ${{fromJSON(inputs.platforms)[matrix.platform].image}}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Build
id: build
run: |
# https://github.com/actions/runner/issues/2033
chown -R $(id -u):$(id -g) $PWD
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_LEAP_DEV_DEB=On ${LEAP_PLATFORM_HAS_EXTRAS_CMAKE:+-C /extras.cmake} -GNinja
cmake --build build
tar -pc --exclude "*.o" build | zstd --long -T0 -9 > build.tar.zst
- name: Upload builddir
uses: actions/upload-artifact@v4
with:
name: ${{matrix.platform}}-build
path: build.tar.zst
compression-level: 0
-18
View File
@@ -1,18 +0,0 @@
# .github/workflows/trigger-coopenomics.yml
name: Trigger Contracts Docs Deploy
on:
push:
branches: [main] # или когда нужно триггерить
jobs:
trigger-coopenomics:
runs-on: ubuntu-latest
steps:
- name: Trigger Coopenomics deployment
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.COOPENOMICS_PAT }}
repository: coopenomics/coopenomics # укажи правильный owner/repo
event-type: deploy_from_mono
client-payload: '{"repository": "${{ github.repository }}", "sha": "${{ github.sha }}", "ref": "${{ github.ref }}", "actor": "${{ github.actor }}"}'
@@ -1,157 +0,0 @@
name: "Performance Harness Run"
on:
workflow_dispatch:
inputs:
platform-choice:
description: 'Select Platform'
type: choice
options:
- ubuntu20
- ubuntu22
override-test-params:
description: 'Override perf harness params'
type: string
override-leap:
description: Override leap target
type: string
override-leap-prerelease:
type: choice
description: Override leap prelease
options:
- default
- true
- false
permissions:
packages: read
contents: read
defaults:
run:
shell: bash
jobs:
v:
name: Discover Inputs
runs-on: ubuntu-latest
outputs:
test-params: ${{steps.overrides.outputs.test-params}}
leap-target: ${{steps.overrides.outputs.leap-target}}
leap-prerelease: ${{steps.overrides.outputs.leap-prerelease}}
steps:
- name: Setup Input Params
id: overrides
run: |
echo test-params=findMax testBpOpMode >> $GITHUB_OUTPUT
echo leap-target="DEFAULT" >> $GITHUB_OUTPUT
echo leap-prerelease="false" >> $GITHUB_OUTPUT
if [[ "${{inputs.override-test-params}}" != "" ]]; then
echo test-params=${{inputs.override-test-params}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-leap}}" != "" ]]; then
echo leap-target=${{inputs.override-leap}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-leap-prerelease}}" == +(true|false) ]]; then
echo leap-prerelease=${{inputs.override-leap-prerelease}} >> $GITHUB_OUTPUT
fi
platform-cache:
name: Platform Cache
uses: AntelopeIO/platform-cache-workflow/.github/workflows/platformcache.yaml@v1
permissions:
packages: write
contents: read
with:
runs-on: '["self-hosted", "enf-x86-beefy"]'
platform-files: .cicd/platforms
reuse-build:
name: Reuse leap build
needs: [v]
runs-on: ubuntu-latest
outputs:
build-artifact: ${{steps.downloadBuild.outputs.downloaded-file}}
steps:
- name: Download builddir
id: downloadBuild
uses: AntelopeIO/asset-artifact-download-action@v3
with:
owner: AntelopeIO
repo: leap
file: build.tar.zst
target: ${{github.sha}}
artifact-name: ${{github.event.inputs.platform-choice}}-build
fail-on-missing-target: false
- name: Upload builddir
if: steps.downloadBuild.outputs.downloaded-file != ''
uses: AntelopeIO/upload-artifact-large-chunks-action@v1
with:
name: ${{github.event.inputs.platform-choice}}-build
path: build.tar.zst
build-base:
name: Run Build Workflow
needs: [platform-cache, reuse-build]
if: needs.reuse-build.outputs.build-artifact == ''
uses: ./.github/workflows/build_base.yaml
with:
platforms: ${{needs.platform-cache.outputs.platforms}}
platform-list: '["${{github.event.inputs.platform-choice}}"]'
tests:
name: Tests
needs: [v, platform-cache, reuse-build, build-base]
if: always() && (needs.build-base.result == 'success' || needs.reuse-build.result == 'success')
runs-on: ["Leap-Perf-Ubuntu-22-16x64x600"]
container:
image: ${{fromJSON(needs.platform-cache.outputs.platforms)[github.event.inputs.platform-choice].image}}
steps:
- name: Download builddir
uses: actions/download-artifact@v3
with:
name: ${{github.event.inputs.platform-choice}}-build
- name: Extract Build Directory
run: |
zstdcat build.tar.zst | tar x
- if: ${{ needs.v.outputs.leap-target != 'DEFAULT' }}
name: Download Prev Leap Version
uses: AntelopeIO/asset-artifact-download-action@v3
with:
owner: AntelopeIO
repo: leap
target: '${{needs.v.outputs.leap-target}}'
prereleases: ${{fromJSON(needs.v.outputs.leap-prerelease)}}
file: 'leap.*${{github.event.inputs.platform-choice}}.*(x86_64|amd64).deb'
- if: ${{ needs.v.outputs.leap-target != 'DEFAULT' }}
name: Install leap & replace binaries for PH use
run: |
apt-get update
apt-get install -y ./leap*.deb
rm build/bin/nodeos
rm build/bin/cleos
cp /usr/bin/nodeos build/bin
cp /usr/bin/cleos build/bin
./build/bin/nodeos --full-version
./build/bin/cleos version full
- name: Run Performance Test
run: |
cd build
./tests/PerformanceHarnessScenarioRunner.py ${{needs.v.outputs.test-params}}
- name: Prepare results
id: prep-results
run: |
tar -pc build/PHSRLogs | zstd --long -T0 -9 > PHSRLogs.tar.zst
- name: Upload results
uses: AntelopeIO/upload-artifact-large-chunks-action@v1
with:
name: performance-test-results
path: PHSRLogs.tar.zst
- name: Upload report
uses: actions/upload-artifact@v3
with:
name: performance-test-report
path: ./build/PHSRLogs/**/report.json
@@ -1,83 +0,0 @@
name: "Performance Harness Backwards Compatibility"
on:
workflow_dispatch:
permissions:
packages: read
contents: read
defaults:
run:
shell: bash
jobs:
platform-cache:
name: Platform Cache
uses: AntelopeIO/platform-cache-workflow/.github/workflows/platformcache.yaml@v1
permissions:
contents: read
packages: write
with:
runs-on: '["self-hosted", "enf-x86-beefy"]'
platform-files: .cicd/platforms
build-base:
name: Run Build Workflow
uses: ./.github/workflows/build_base.yaml
needs: [platform-cache]
with:
platforms: ${{needs.platform-cache.outputs.platforms}}
platform-list: ${{needs.platform-cache.outputs.platform-list}}
permissions:
packages: write
contents: read
tests:
name: Tests
needs: [platform-cache, build-base]
strategy:
fail-fast: false
matrix:
platform: ${{fromJSON(needs.platform-cache.outputs.platform-list)}}
release: [3.1, 3.2, 4.0]
runs-on: ["self-hosted", "enf-x86-lowtier"]
container:
image: ${{fromJSON(needs.platform-cache.outputs.platforms)[matrix.platform].image}}
options: --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v4
- name: Download builddir
uses: actions/download-artifact@v3
with:
name: ${{matrix.platform}}-build
- name: Extract Build Directory
run: |
zstdcat build.tar.zst | tar x
- name: Download Prev Leap Version
uses: AntelopeIO/asset-artifact-download-action@v3
with:
owner: AntelopeIO
repo: leap
file: '(leap).*${{matrix.platform}}.04.*(x86_64|amd64).deb'
target: '${{matrix.release}}'
- name: Install leap & replace binaries for PH use
run: |
apt-get update
apt-get install -y ./leap*.deb
rm build/bin/nodeos
rm build/bin/cleos
cp /usr/bin/nodeos build/bin
cp /usr/bin/cleos build/bin
./build/bin/nodeos --full-version
./build/bin/cleos version full
- if: ${{ matrix.release == '3.1' || matrix.release == '3.2' }}
name: Run Performance Tests (<v4.0)
run: |
cd build
ctest --output-on-failure -R performance_test -E read_only --timeout 480
- if: ${{ matrix.release != '3.1' && matrix.release != '3.2' }}
name: Run Performance Tests (>=v4.0)
run: |
cd build
ctest --output-on-failure -R performance_test --timeout 480
-11
View File
@@ -1,11 +0,0 @@
name: "Pinned Build"
on:
workflow_dispatch:
jobs:
dummy:
runs-on: ubuntu-latest
steps:
- name: Dummy
run: echo This workflow is a stub on main to allow it to be manually run on 3.x/4.0
-53
View File
@@ -1,53 +0,0 @@
name: Release Actions
on:
release:
types: [published]
jobs:
eb:
name: experimental-binaries
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
actions: read
steps:
- name: Get ubuntu20 leap-dev.deb
uses: AntelopeIO/asset-artifact-download-action@v3
with:
owner: ${{github.repository_owner}}
repo: ${{github.event.repository.name}}
file: 'leap-dev.*amd64.deb'
target: ${{github.sha}}
artifact-name: leap-dev-ubuntu20-amd64
wait-for-exact-target: true
- name: Get ubuntu22 leap-dev.deb
uses: AntelopeIO/asset-artifact-download-action@v3
with:
owner: ${{github.repository_owner}}
repo: ${{github.event.repository.name}}
file: 'leap-dev.*amd64.deb'
target: ${{github.sha}}
artifact-name: leap-dev-ubuntu22-amd64
wait-for-exact-target: true
- name: Create Dockerfile
run: |
cat <<EOF > Dockerfile
FROM scratch
LABEL org.opencontainers.image.description="A collection of experimental Leap binary packages"
COPY *.deb /
EOF
- name: Login to ghcr
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.repository_owner}}
password: ${{github.token}}
- run: echo "REPOSITORY_OWNER_LOWER=${GITHUB_REPOSITORY_OWNER,,}" >> "${GITHUB_ENV}"
- name: Build and push experimental-binaries
uses: docker/build-push-action@v3
with:
push: true
tags: ghcr.io/${{env.REPOSITORY_OWNER_LOWER}}/experimental-binaries:${{github.ref_name}}
context: .
+1 -1
View File
@@ -11,7 +11,7 @@ jobs:
steps:
- name: Checkout
run: |
git clone https://x-access-token:${{github.token}}@github.com/${GITHUB_REPOSITORY} .
git clone https://github.com/${GITHUB_REPOSITORY} .
git fetch -v --prune origin +refs/pull/${PR_NUMBER}/merge:refs/remotes/pull/${PR_NUMBER}/merge
git checkout --force --progress refs/remotes/pull/${PR_NUMBER}/merge
git submodule sync --recursive
+8 -7
View File
@@ -5,21 +5,26 @@
*.bc
*.wast
*.wast.hpp
*.s
*.dot
*.abi.hpp
*.cmake
!.cicd
!package.cmake
!CMakeModules/*.cmake
*.ninja
\#*
\.#*
CMakeCache.txt
CMakeFiles
cmake-build-*/
cmake_install.cmake
cmake-build-debug/
cmake-build-release/
Makefile
compile_commands.json
moc_*
*.moc
.cache
genesis.json
hardfork.hpp
@@ -70,8 +75,6 @@ witness_node_data_dir
*.pyc
*.pyo
*.gdb_history
Testing/*
build.tar.gz
[Bb]uild*/*
@@ -90,5 +93,3 @@ CMakeLists.txt.user
node_modules
package-lock.json
snapshots
-9
View File
@@ -31,12 +31,3 @@
[submodule "libraries/cli11/cli11"]
path = libraries/cli11/cli11
url = https://github.com/AntelopeIO/CLI11.git
[submodule "libraries/libfc/libraries/bls12-381"]
path = libraries/libfc/libraries/bls12-381
url = https://github.com/AntelopeIO/bls12-381
[submodule "libraries/boost"]
path = libraries/boost
url = https://github.com/boostorg/boost.git
[submodule "libraries/libfc/libraries/boringssl/boringssl"]
path = libraries/libfc/libraries/boringssl/boringssl
url = https://github.com/AntelopeIO/boringssl-build
+46 -41
View File
@@ -1,6 +1,6 @@
cmake_minimum_required( VERSION 3.16 )
cmake_minimum_required( VERSION 3.8 )
project( coopos )
project( leap )
include(CTest) # suppresses DartConfiguration.tcl error
enable_testing()
@@ -9,11 +9,11 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
include( GNUInstallDirs )
include( MASSigning )
set( CMAKE_CXX_STANDARD 20 )
set( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_EXTENSIONS ON )
set( CXX_STANDARD_REQUIRED ON)
set(VERSION_MAJOR 5)
set(VERSION_MAJOR 4)
set(VERSION_MINOR 1)
set(VERSION_PATCH 0)
set(VERSION_SUFFIX dev)
@@ -37,8 +37,12 @@ set( LEAP_UTIL_EXECUTABLE_NAME leap-util )
# http://stackoverflow.com/a/18369825
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.2)
message(FATAL_ERROR "GCC version must be at least 10.2.0!")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
message(FATAL_ERROR "GCC version must be at least 8.0!")
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
message(FATAL_ERROR "Clang version must be at least 5.0!")
endif()
endif()
@@ -54,6 +58,15 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS "ON")
set(BUILD_DOXYGEN FALSE CACHE BOOL "Build doxygen documentation on every make")
set(ENABLE_MULTIVERSION_PROTOCOL_TEST FALSE CACHE BOOL "Enable nodeos multiversion protocol test")
# add defaults for openssl
if(APPLE AND UNIX AND "${OPENSSL_ROOT_DIR}" STREQUAL "")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
set(OPENSSL_ROOT_DIR "/opt/homebrew/opt/openssl@3;/opt/homebrew/opt/openssl@1.1")
else()
set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl@3;/usr/local/opt/openssl@1.1")
endif()
endif()
option(ENABLE_OC "Enable eosvm-oc on supported platforms" ON)
# WASM runtimes to enable. Each runtime in this list will have:
@@ -66,7 +79,7 @@ if(ENABLE_OC AND CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32)
# can be created with the exact version found
find_package(LLVM REQUIRED CONFIG)
if(LLVM_VERSION_MAJOR VERSION_LESS 7 OR LLVM_VERSION_MAJOR VERSION_GREATER_EQUAL 12)
message(FATAL_ERROR "Coopos requires an LLVM version 7 through 11")
message(FATAL_ERROR "Leap requires an LLVM version 7 through 11")
endif()
endif()
endif()
@@ -92,6 +105,12 @@ else()
set(no_whole_archive_flag "--no-whole-archive")
endif()
set(Boost_USE_MULTITHREADED ON)
set( Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF" )
# Most boost deps get implictly picked up via fc, as just about everything links to fc. In addition we pick up
# the pthread dependency through fc.
find_package(Boost 1.67 REQUIRED COMPONENTS program_options unit_test_framework system)
if( APPLE AND UNIX )
# Apple Specific Options Here
message( STATUS "Configuring Leap on macOS" )
@@ -123,13 +142,13 @@ if(ENABLE_WEXTRA)
endif()
option(EOSIO_ENABLE_DEVELOPER_OPTIONS "enable developer options for Coopos" OFF)
option(EOSIO_ENABLE_DEVELOPER_OPTIONS "enable developer options for Leap" OFF)
# based on http://www.delorie.com/gnu/docs/gdb/gdb_70.html
# uncomment this line to tell GDB about macros (slows compile times)
# set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -gdwarf-2 -g3" )
set(ENABLE_COVERAGE_TESTING FALSE CACHE BOOL "Build Coopos for code coverage analysis")
set(ENABLE_COVERAGE_TESTING FALSE CACHE BOOL "Build Leap for code coverage analysis")
if(ENABLE_COVERAGE_TESTING)
SET(CMAKE_C_FLAGS "--coverage ${CMAKE_C_FLAGS}")
@@ -159,10 +178,9 @@ endif()
message( STATUS "Using '${EOSIO_ROOT_KEY}' as public key for 'eosio' account" )
option(ENABLE_TCMALLOC "use tcmalloc (requires gperftools)" OFF)
if( ENABLE_TCMALLOC )
find_package( Gperftools REQUIRED )
message( STATUS "Compiling Coopos with TCMalloc")
find_package( Gperftools QUIET )
if( GPERFTOOLS_FOUND )
message( STATUS "Found gperftools; compiling Leap with TCMalloc")
#if doing this by the book, simply link_libraries( ${GPERFTOOLS_TCMALLOC} ) here. That will
#give the performance benefits of tcmalloc but since it won't be linked last
#the heap profiler & checker may not be accurate. This here is rather undocumented behavior
@@ -171,14 +189,6 @@ if( ENABLE_TCMALLOC )
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} ${GPERFTOOLS_TCMALLOC}")
endif()
# leap includes a bundled BoringSSL which conflicts with OpenSSL. Make sure any other bundled libraries (such as boost)
# do not attempt to use an external OpenSSL in any manner
set(CMAKE_DISABLE_FIND_PACKAGE_OpenSSL On)
# many tests require handling of signals themselves and even when they don't we'd like for them to generate a core dump, this
# is effectively --catch_system_errors=no broadly across all tests
add_compile_definitions(BOOST_TEST_DEFAULTS_TO_CORE_DUMP)
add_subdirectory( libraries )
add_subdirectory( plugins )
add_subdirectory( programs )
@@ -198,7 +208,7 @@ set(EOS_ROOT_DIR "${CMAKE_BINARY_DIR}/lib")
configure_file(${CMAKE_SOURCE_DIR}/CMakeModules/eosio-config.cmake.in ${CMAKE_BINARY_DIR}/lib/cmake/eosio/eosio-config.cmake @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/CMakeModules/EosioTesterBuild.cmake.in ${CMAKE_BINARY_DIR}/lib/cmake/eosio/EosioTester.cmake @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/CMakeModules/EosioCheckVersion.cmake ${CMAKE_BINARY_DIR}/lib/cmake/eosio/EosioCheckVersion.cmake COPYONLY)
# new coopos CMake files
# new leap CMake files
configure_file(${CMAKE_SOURCE_DIR}/CMakeModules/leap-config.cmake.in ${CMAKE_BINARY_DIR}/lib/cmake/leap/leap-config.cmake @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/CMakeModules/EosioTesterBuild.cmake.in ${CMAKE_BINARY_DIR}/lib/cmake/leap/EosioTester.cmake @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/CMakeModules/EosioCheckVersion.cmake ${CMAKE_BINARY_DIR}/lib/cmake/leap/EosioCheckVersion.cmake COPYONLY)
@@ -210,7 +220,7 @@ configure_file(${CMAKE_SOURCE_DIR}/CMakeModules/eosio-config.cmake.in ${CMAKE_BI
install(FILES ${CMAKE_BINARY_DIR}/modules/eosio-config.cmake DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/cmake/eosio COMPONENT dev EXCLUDE_FROM_ALL)
install(FILES ${CMAKE_BINARY_DIR}/modules/EosioTester.cmake DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/cmake/eosio COMPONENT dev EXCLUDE_FROM_ALL)
install(FILES ${CMAKE_SOURCE_DIR}/CMakeModules/EosioCheckVersion.cmake DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/cmake/eosio COMPONENT dev EXCLUDE_FROM_ALL)
# new coopos CMake files
# new leap CMake files
configure_file(${CMAKE_SOURCE_DIR}/CMakeModules/leap-config.cmake.in ${CMAKE_BINARY_DIR}/modules/leap-config.cmake @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/modules/leap-config.cmake DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/cmake/leap COMPONENT dev EXCLUDE_FROM_ALL)
install(FILES ${CMAKE_BINARY_DIR}/modules/EosioTester.cmake DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/cmake/leap COMPONENT dev EXCLUDE_FROM_ALL)
@@ -224,8 +234,6 @@ configure_file(libraries/libfc/include/fc/crypto/webauthn_json/license.txt licen
configure_file(libraries/eos-vm/LICENSE licenses/leap/LICENSE.eos-vm COPYONLY)
configure_file(libraries/prometheus/prometheus-cpp/LICENSE licenses/leap/LICENSE.prom COPYONLY)
configure_file(programs/cleos/LICENSE.CLI11 licenses/leap/LICENSE.CLI11 COPYONLY)
configure_file(libraries/libfc/libraries/bls12-381/LICENSE licenses/leap/LICENSE.bls12-381 COPYONLY)
configure_file(libraries/libfc/libraries/boringssl/boringssl/src/LICENSE licenses/leap/LICENSE.boringssl COPYONLY)
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/licenses/leap" DESTINATION "${CMAKE_INSTALL_FULL_DATAROOTDIR}/licenses/" COMPONENT base)
@@ -243,6 +251,7 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tests/TestHarness DESTINATION ${CM
PATTERN "*.json"
PATTERN "__pycache__" EXCLUDE
PATTERN "CMakeFiles" EXCLUDE)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tests/launcher.py DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/leap_testing/tests COMPONENT dev EXCLUDE_FROM_ALL)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.21)
# Cmake versions < 3.21 did not support installing symbolic links to a directory via install(FILES ...)
@@ -259,8 +268,18 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.21)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib/python3/dist-packages/TestHarness DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/python3/dist-packages COMPONENT dev EXCLUDE_FROM_ALL)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/leap_testing/bin DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/leap_testing COMPONENT dev EXCLUDE_FROM_ALL)
else()
# The following install(SCRIPT ...) steps are necessary for `make dev-install` to work on cmake versions < 3.21.
install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/scripts/install_testharness_symlinks.cmake COMPONENT dev EXCLUDE_FROM_ALL)
# The following install(CODE ...) steps are necessary for `make dev-install` to work on cmake versions < 3.21.
# However, it can flag as an error if using `make package` instead of `make dev-install` for installation.
# This is due to those directories and symbolic links being created in the postinit script during the package install instead.
# Note If/when doing `make package`, it is not a true error if you see:
# Error creating directory "/<leap_install_dir>/lib/python3/dist-packages".
# CMake Error: failed to create symbolic link '/<leap_install_dir>/lib/python3/dist-packages/TestHarness': no such file or directory
# CMake Error: failed to create symbolic link '/<leap_install_dir>/share/leap_testing/bin': no such file or directory
install(CODE "execute_process( COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_INSTALL_FULL_LIBDIR}/python3/dist-packages)" COMPONENT dev EXCLUDE_FROM_ALL)
install(CODE "execute_process( COMMAND ${CMAKE_COMMAND} -E create_symlink ../../../share/leap_testing/tests/TestHarness ${CMAKE_INSTALL_FULL_LIBDIR}/python3/dist-packages/TestHarness)" COMPONENT dev EXCLUDE_FROM_ALL)
install(CODE "execute_process( COMMAND ${CMAKE_COMMAND} -E create_symlink ../../bin ${CMAKE_INSTALL_FULL_DATAROOTDIR}/leap_testing/bin)" COMPONENT dev EXCLUDE_FROM_ALL)
# The `make package` installation of symlinks happens via the `postinst` script installed in cmake.package via the line below
endif()
@@ -273,18 +292,6 @@ configure_file(${CMAKE_SOURCE_DIR}/libraries/cli11/bash-completion/completions/c
install(FILES libraries/cli11/bash-completion/completions/leap-util DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/bash-completion/completions COMPONENT base)
install(FILES libraries/cli11/bash-completion/completions/cleos DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/bash-completion/completions COMPONENT base)
# Add the boost submodule we used to build to our install package, so headers can be found for libtester
install(DIRECTORY "${CMAKE_SOURCE_DIR}/libraries/boost/"
DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/leap_boost
COMPONENT dev EXCLUDE_FROM_ALL
PATTERN ".git/*" EXCLUDE
PATTERN "example/*" EXCLUDE
PATTERN "bench/*" EXCLUDE
PATTERN "doc/*" EXCLUDE
PATTERN "libs/*/test" EXCLUDE
PATTERN "tools/*/test" EXCLUDE
)
add_custom_target(dev-install
COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}"
COMMAND "${CMAKE_COMMAND}" --install "${CMAKE_BINARY_DIR}"
@@ -294,7 +301,5 @@ add_custom_target(dev-install
include(doxygen)
option(ENABLE_LEAP_DEV_DEB "Enable building the leap-dev .deb package" OFF)
include(package.cmake)
include(CPack)
View File
View File
View File
+64 -69
View File
@@ -14,13 +14,19 @@ if (LLVM_DIR STREQUAL "" OR NOT LLVM_DIR)
set(LLVM_DIR @LLVM_DIR@)
endif()
find_package( Gperftools QUIET )
if( GPERFTOOLS_FOUND )
message( STATUS "Found gperftools; compiling tests with TCMalloc")
list( APPEND PLATFORM_SPECIFIC_LIBS tcmalloc )
endif()
if(NOT "@LLVM_FOUND@" STREQUAL "")
find_package(LLVM @LLVM_VERSION@ EXACT REQUIRED CONFIG)
llvm_map_components_to_libnames(LLVM_LIBS support core passes mcjit native DebugInfoDWARF orcjit)
link_directories(${LLVM_LIBRARY_DIR})
endif()
set( CMAKE_CXX_STANDARD 20 )
set( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_EXTENSIONS ON )
set( CXX_STANDARD_REQUIRED ON )
@@ -35,26 +41,33 @@ else ( APPLE )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS} -Wall")
endif ( APPLE )
set( Boost_USE_MULTITHREADED ON )
### Remove after Boost 1.70 CMake fixes are in place
set( Boost_NO_BOOST_CMAKE ON CACHE STRING "ON or OFF" )
set( Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF" )
set( BOOST_EXCLUDE_LIBRARIES "mysql" )
add_subdirectory( @CMAKE_INSTALL_FULL_DATAROOTDIR@/leap_boost ${PROJECT_BINARY_DIR}/libraries/boost EXCLUDE_FROM_ALL)
find_package(Boost @Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@ EXACT REQUIRED COMPONENTS
date_time
filesystem
system
chrono
iostreams
unit_test_framework)
find_library(libtester eosio_testing @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
find_library(libchain eosio_chain @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
find_library(libfc fc @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
find_library(libsecp256k1 secp256k1 @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
find_library(libbn256 bn256 @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
find_library(libbls12-381 bls12-381 @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
find_library(libwasm WASM @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
find_library(libwast WAST @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
find_library(libir IR @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
find_library(liblogging Logging @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
find_library(libruntime Runtime @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
find_library(libsoftfloat softfloat @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
find_library(libbscrypto bscrypto @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
find_library(libdecrepit decrepit @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
get_filename_component(cryptodir @OPENSSL_CRYPTO_LIBRARY@ DIRECTORY)
find_library(liboscrypto crypto "${cryptodir}" NO_DEFAULT_PATH)
get_filename_component(ssldir @OPENSSL_SSL_LIBRARY@ DIRECTORY)
find_library(libosssl ssl "${ssldir}" NO_DEFAULT_PATH)
find_library(libchainbase chainbase @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
find_library(libbuiltins builtins @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
@@ -68,72 +81,54 @@ if("eos-vm-oc" IN_LIST EOSIO_WASM_RUNTIMES)
set(WRAP_MAIN "-Wl,-wrap=main")
endif()
add_library(EosioChain INTERFACE)
target_link_libraries(EosioChain INTERFACE
${libchain}
${libfc}
${libwast}
${libwasm}
${libir}
${libsoftfloat}
${libbscrypto}
${libdecrepit}
${liblogging}
${libchainbase}
${libbuiltins}
${libsecp256k1}
${libbn256}
${libbls12-381}
@GMP_LIBRARY@
Boost::date_time
Boost::filesystem
Boost::system
Boost::chrono
Boost::multi_index
Boost::multiprecision
Boost::interprocess
Boost::asio
Boost::signals2
Boost::iostreams
"-lz" # Needed by Boost iostreams
${LLVM_LIBS}
${PLATFORM_SPECIFIC_LIBS}
${WRAP_MAIN}
Threads::Threads
)
target_include_directories(EosioChain INTERFACE
@OPENSSL_INCLUDE_DIR@
@CMAKE_INSTALL_PREFIX@
@CMAKE_INSTALL_FULL_INCLUDEDIR@
@CMAKE_INSTALL_FULL_INCLUDEDIR@/wasm-jit
@CMAKE_INSTALL_FULL_INCLUDEDIR@/leapboringssl
@CMAKE_INSTALL_FULL_INCLUDEDIR@/softfloat )
#adds -ltr. Ubuntu eosio.contracts build breaks without this
if(UNIX AND NOT APPLE)
target_link_libraries(EosioChain INTERFACE ${LIBRT})
endif()
add_library(EosioTester INTERFACE)
target_link_libraries(EosioTester INTERFACE
${libtester}
Boost::unit_test_framework
EosioChain
)
macro(add_eosio_test_executable test_name)
add_executable( ${test_name} ${ARGN} )
target_link_libraries( ${test_name}
EosioTester
${libtester}
${libchain}
${libfc}
${libwast}
${libwasm}
${libruntime}
${libir}
${libsoftfloat}
${liboscrypto}
${libosssl}
${liblogging}
${libchainbase}
${libbuiltins}
${libsecp256k1}
${libbn256}
@GMP_LIBRARY@
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_CHRONO_LIBRARY}
${Boost_IOSTREAMS_LIBRARY}
"-lz" # Needed by Boost iostreams
${Boost_DATE_TIME_LIBRARY}
${LLVM_LIBS}
${PLATFORM_SPECIFIC_LIBS}
${WRAP_MAIN}
Threads::Threads
)
#adds -ltr. Ubuntu eosio.contracts build breaks without this
if(UNIX AND NOT APPLE)
target_link_libraries(${test_name} ${LIBRT})
endif()
target_include_directories( ${test_name} PUBLIC
${Boost_INCLUDE_DIRS}
@OPENSSL_INCLUDE_DIR@
@CMAKE_INSTALL_PREFIX@
@CMAKE_INSTALL_FULL_INCLUDEDIR@
@CMAKE_INSTALL_FULL_INCLUDEDIR@/wasm-jit
@CMAKE_INSTALL_FULL_INCLUDEDIR@/softfloat )
endmacro()
macro(add_eosio_test test_name)
+67 -76
View File
@@ -12,13 +12,19 @@ if (LLVM_DIR STREQUAL "" OR NOT LLVM_DIR)
set(LLVM_DIR @LLVM_DIR@)
endif()
find_package( Gperftools QUIET )
if( GPERFTOOLS_FOUND )
message( STATUS "Found gperftools; compiling tests with TCMalloc")
list( APPEND PLATFORM_SPECIFIC_LIBS tcmalloc )
endif()
if(NOT "@LLVM_FOUND@" STREQUAL "")
find_package(LLVM @LLVM_VERSION@ EXACT REQUIRED CONFIG)
llvm_map_components_to_libnames(LLVM_LIBS support core passes mcjit native DebugInfoDWARF orcjit)
link_directories(${LLVM_LIBRARY_DIR})
endif()
set( CMAKE_CXX_STANDARD 20 )
set( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_EXTENSIONS ON )
set( CXX_STANDARD_REQUIRED ON )
@@ -32,26 +38,33 @@ else ( APPLE )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS} -Wall")
endif ( APPLE )
set( Boost_USE_MULTITHREADED ON )
### Remove after Boost 1.70 CMake fixes are in place
set( Boost_NO_BOOST_CMAKE ON CACHE STRING "ON or OFF" )
set( Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF" )
set( BOOST_EXCLUDE_LIBRARIES "mysql" )
add_subdirectory( @CMAKE_SOURCE_DIR@/libraries/boost ${PROJECT_BINARY_DIR}/libraries/boost EXCLUDE_FROM_ALL)
find_package(Boost @Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@ EXACT REQUIRED COMPONENTS
date_time
filesystem
system
chrono
iostreams
unit_test_framework)
find_library(libtester eosio_testing @CMAKE_BINARY_DIR@/libraries/testing NO_DEFAULT_PATH)
find_library(libchain eosio_chain @CMAKE_BINARY_DIR@/libraries/chain NO_DEFAULT_PATH)
find_library(libfc fc @CMAKE_BINARY_DIR@/libraries/libfc NO_DEFAULT_PATH)
find_library(libsecp256k1 secp256k1 @CMAKE_BINARY_DIR@/libraries/libfc/secp256k1 NO_DEFAULT_PATH)
find_library(libbn256 bn256 @CMAKE_BINARY_DIR@/libraries/libfc/libraries/bn256/src NO_DEFAULT_PATH)
find_library(libbls12-381 bls12-381 @CMAKE_BINARY_DIR@/libraries/libfc/libraries/bls12-381 NO_DEFAULT_PATH)
find_library(libwasm WASM @CMAKE_BINARY_DIR@/libraries/wasm-jit/Source/WASM NO_DEFAULT_PATH)
find_library(libwast WAST @CMAKE_BINARY_DIR@/libraries/wasm-jit/Source/WAST NO_DEFAULT_PATH)
find_library(libir IR @CMAKE_BINARY_DIR@/libraries/wasm-jit/Source/IR NO_DEFAULT_PATH)
find_library(liblogging Logging @CMAKE_BINARY_DIR@/libraries/wasm-jit/Source/Logging NO_DEFAULT_PATH)
find_library(libruntime Runtime @CMAKE_BINARY_DIR@/libraries/wasm-jit/Source/Runtime NO_DEFAULT_PATH)
find_library(libsoftfloat softfloat @CMAKE_BINARY_DIR@/libraries/softfloat NO_DEFAULT_PATH)
find_library(libbscrypto bscrypto @CMAKE_BINARY_DIR@/libraries/libfc/libraries/boringssl/boringssl NO_DEFAULT_PATH)
find_library(libdecrepit decrepit @CMAKE_BINARY_DIR@/libraries/libfc/libraries/boringssl/boringssl NO_DEFAULT_PATH)
get_filename_component(cryptodir @OPENSSL_CRYPTO_LIBRARY@ DIRECTORY)
find_library(liboscrypto crypto "${cryptodir}" NO_DEFAULT_PATH)
get_filename_component(ssldir @OPENSSL_SSL_LIBRARY@ DIRECTORY)
find_library(libosssl ssl "${ssldir}" NO_DEFAULT_PATH)
find_library(libchainbase chainbase @CMAKE_BINARY_DIR@/libraries/chainbase NO_DEFAULT_PATH)
find_library(libbuiltins builtins @CMAKE_BINARY_DIR@/libraries/builtins NO_DEFAULT_PATH)
@@ -65,79 +78,57 @@ if("eos-vm-oc" IN_LIST EOSIO_WASM_RUNTIMES)
set(WRAP_MAIN "-Wl,-wrap=main")
endif()
add_library(EosioChain INTERFACE)
target_link_libraries(EosioChain INTERFACE
${libchain}
${libfc}
${libwast}
${libwasm}
${libir}
${libsoftfloat}
${libbscrypto}
${libdecrepit}
${liblogging}
${libchainbase}
${libbuiltins}
${libsecp256k1}
${libbn256}
${libbls12-381}
@GMP_LIBRARY@
Boost::date_time
Boost::filesystem
Boost::system
Boost::chrono
Boost::multi_index
Boost::multiprecision
Boost::interprocess
Boost::asio
Boost::signals2
Boost::iostreams
"-lz" # Needed by Boost iostreams
${LLVM_LIBS}
${PLATFORM_SPECIFIC_LIBS}
${WRAP_MAIN}
Threads::Threads
)
target_include_directories(EosioChain INTERFACE
@OPENSSL_INCLUDE_DIR@
@CMAKE_SOURCE_DIR@/libraries/chain/include
@CMAKE_BINARY_DIR@/libraries/chain/include
@CMAKE_SOURCE_DIR@/libraries/libfc/include
@CMAKE_SOURCE_DIR@/libraries/libfc/libraries/boringssl/boringssl/src/include
@CMAKE_SOURCE_DIR@/libraries/softfloat/source/include
@CMAKE_SOURCE_DIR@/libraries/appbase/include
@CMAKE_SOURCE_DIR@/libraries/chainbase/include
@CMAKE_SOURCE_DIR@/libraries/wasm-jit/include )
#adds -ltr. Ubuntu eosio.contracts build breaks without this
if(UNIX AND NOT APPLE)
target_link_libraries(EosioChain INTERFACE ${LIBRT})
endif()
add_library(EosioTester INTERFACE)
target_link_libraries(EosioTester INTERFACE
${libtester}
Boost::unit_test_framework
EosioChain
)
target_include_directories(EosioTester INTERFACE
@CMAKE_SOURCE_DIR@/libraries/testing/include )
macro(add_eosio_test_executable test_name)
add_executable( ${test_name} ${ARGN} )
target_link_libraries( ${test_name}
EosioTester
${libtester}
${libchain}
${libfc}
${libwast}
${libwasm}
${libruntime}
${libir}
${libsoftfloat}
${liboscrypto}
${libosssl}
${liblogging}
${libchainbase}
${libbuiltins}
${libsecp256k1}
${libbn256}
@GMP_LIBRARY@
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_CHRONO_LIBRARY}
${Boost_IOSTREAMS_LIBRARY}
"-lz" # Needed by Boost iostreams
${Boost_DATE_TIME_LIBRARY}
${LLVM_LIBS}
${PLATFORM_SPECIFIC_LIBS}
${WRAP_MAIN}
Threads::Threads
)
#adds -ltr. Ubuntu eosio.contracts build breaks without this
if(UNIX AND NOT APPLE)
target_link_libraries(${test_name} ${LIBRT})
endif()
target_include_directories( ${test_name} PUBLIC
${Boost_INCLUDE_DIRS}
@OPENSSL_INCLUDE_DIR@
@CMAKE_SOURCE_DIR@/libraries/chain/include
@CMAKE_BINARY_DIR@/libraries/chain/include
@CMAKE_SOURCE_DIR@/libraries/libfc/include
@CMAKE_SOURCE_DIR@/libraries/softfloat/source/include
@CMAKE_SOURCE_DIR@/libraries/appbase/include
@CMAKE_SOURCE_DIR@/libraries/chainbase/include
@CMAKE_SOURCE_DIR@/libraries/testing/include
@CMAKE_SOURCE_DIR@/libraries/wasm-jit/Include )
endmacro()
macro(add_eosio_test test_name)
-9
View File
@@ -1,9 +0,0 @@
FROM ubuntu:latest
WORKDIR /workdir
COPY build/leap*.deb /workdir/build/
RUN apt-get update && cd build && \
apt-get install -y ./leap*.deb -y && \
rm leap*.deb
-5
View File
@@ -1,8 +1,3 @@
COOPOS/coopos
Copyright (c) 2024-2025 CBS VOSKHOD and its contributors. All rights reserved.
The MIT License
AntelopeIO/leap
Copyright (c) 2021-2022 EOS Network Foundation (ENF) and its contributors. All rights reserved.
This ENF software is based upon:
+146 -214
View File
@@ -1,163 +1,56 @@
# Coopos
# Leap
Leap is a C++ implementation of the [Antelope](https://github.com/AntelopeIO) protocol. It contains blockchain node software and supporting tools for developers and node operators.
> [!IMPORTANT]
> Coopos - операционная система смарт-контрактов платформы Кооперативной Экономики (https://coopenomics.world).
## Branches
The `main` branch is the development branch; do not use it for production. Refer to the [release page](https://github.com/AntelopeIO/leap/releases) for current information on releases, pre-releases, and obsolete releases, as well as the corresponding tags for those releases.
1. [Ветки](#branches)
2. [Быстрый старт с Docker](#docker-quick-start)
3. [Поддерживаемые операционные системы](#supported-operating-systems)
4. [Бинарная установка](#binary-installation)
5. [Сборка и установка из исходного кода](#build-and-install-from-source)
6. [Bash автодополнение](#bash-autocomplete)
Coopos - это C++ реализация протокола [Antelope](https://github.com/AntelopeIO) с расширениями для кооперативной экономики. Содержит программное обеспечение блокчейн-узла и вспомогательные инструменты для разработчиков и операторов узлов.
## Ветки
Ветка `main` является веткой разработки; не используйте её для продакшена. Обратитесь к [странице релизов](https://github.com/AntelopeIO/leap/releases) для получения актуальной информации о релизах, предварительных релизах и устаревших релизах, а также соответствующих тегах для этих релизов.
## Быстрый старт с Docker
Для быстрого знакомства с Coopos и разработки смарт-контрактов на любой операционной системе (Windows, macOS, Linux) рекомендуется использовать готовый Docker-контейнер.
### Запуск контейнера
```bash
docker run -it --rm \
-v $(pwd)/workspace:/workspace \
-p 8888:8888 \
-p 9876:9876 \
-p 8070:8070 \
dicoop/blockchain_v5.1.1:dev
```
### Что включено в контейнер
Контейнер основан на том же исходном коде Coopos и дополнительно содержит:
- **CDT (Contract Development Toolkit)** - инструменты для компиляции смарт-контрактов
- **eosio-cpp** - компилятор смарт-контрактов
- **cleos** - командная строка для взаимодействия с блокчейном
- **nodeos** - блокчейн-узел
- **leap-util** - дополнительные утилиты
- **Все необходимые зависимости** для разработки и запуска
### Использование
```bash
# В контейнере вы можете сразу начать разработку
cd /workspace
# Создать новый смарт-контракт
eosio-cpp -abigen hello.cpp -o hello.wasm
# Запустить локальный блокчейн-узел с полным набором параметров
nodeos \
# Основные плагины для работы блокчейн-узла
--plugin eosio::chain_plugin \
--plugin eosio::producer_plugin \
--plugin eosio::chain_api_plugin \
--plugin eosio::http_plugin \
--plugin eosio::state_history_plugin \
--plugin eosio::producer_api_plugin \
--plugin eosio::resource_monitor_plugin \
# Настройки производства блоков
--enable-stale-production true \
--read-only-read-window-time-us 120000 \
--producer-name eosio \
--producer-name core \
--signature-provider EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV=KEY:5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 \
# Сетевые настройки
--net-threads 2 \
--p2p-listen-endpoint 0.0.0.0:9876 \
# HTTP API настройки
--http-server-address 0.0.0.0:8888 \
--access-control-allow-origin "*" \
--access-control-allow-credentials false \
--http-validate-host false \
--verbose-http-errors true \
--http-max-response-time-ms 30000 \
--max-body-size 10485760 \
# Настройки производительности и лимитов
--max-transaction-time 2000 \
--abi-serializer-max-time-ms 200000 \
--max-block-cpu-usage-threshold-us 5000 \
--max-block-net-usage-threshold-bytes 1024 \
# Отладка и история
--contracts-console true \
--chain-state-history true \
--trace-history true \
--state-history-endpoint 0.0.0.0:8070 \
# Мониторинг ресурсов
--resource-monitor-space-threshold 90 \
--resource-monitor-not-shutdown-on-threshold-exceeded true \
# WASM runtime
--wasm-runtime eos-vm
```
### Монтирование рабочей директории
Параметр `-v $(pwd)/workspace:/workspace` монтирует вашу локальную папку `workspace` в контейнер, позволяя работать с файлами на хост-системе.
> ⚠️ **Важно:** Для регулярной стабильной работы и продакшена рекомендуется установка deb-пакета или сборка из исходного кода на нативной системе. Docker-контейнер предназначен для разработки и тестирования.
## Поддерживаемые операционные системы
В настоящее время мы поддерживаем следующие операционные системы:
## Supported Operating Systems
We currently support the following operating systems.
- Ubuntu 22.04 Jammy
- Ubuntu 20.04 Focal
- Ubuntu 18.04 Bionic
Другие Unix-производные, такие как macOS, поддерживаются в режиме best-effort и могут быть не полностью функциональными. Если вы не используете Ubuntu, посетите страницу "[Сборка неподдерживаемой ОС](./docs/00_install/01_build-from-source/00_build-unsupported-os.md)" для изучения ваших вариантов.
Other Unix derivatives such as macOS are tended to on a best-effort basis and may not be full featured. If you aren't using Ubuntu, please visit the "[Build Unsupported OS](./docs/00_install/01_build-from-source/00_build-unsupported-os.md)" page to explore your options.
Если вы используете неподдерживаемую производную Ubuntu, такую как Linux Mint, вы можете узнать версию Ubuntu, на которой она основана, используя эту команду:
If you are running an unsupported Ubuntu derivative, such as Linux Mint, you can find the version of Ubuntu your distribution was based on by using this command:
```bash
cat /etc/upstream-release/lsb-release
```
Ваш лучший вариант - следовать инструкциям для вашей базовой версии Ubuntu, но мы не даём никаких гарантий.
Your best bet is to follow the instructions for your Ubuntu base, but we make no guarantees.
## Бинарная установка
Это самый быстрый способ начать работу. Со [страницы последнего релиза](https://github.com/AntelopeIO/leap/releases/latest) скачайте бинарный файл для одной из наших [поддерживаемых операционных систем](#supported-operating-systems), или посетите [теги релизов](https://github.com/AntelopeIO/leap/releases) для скачивания бинарного файла конкретной версии Coopos.
## Binary Installation
This is the fastest way to get started. From the [latest release](https://github.com/AntelopeIO/leap/releases/latest) page, download a binary for one of our [supported operating systems](#supported-operating-systems), or visit the [release tags](https://github.com/AntelopeIO/leap/releases) page to download a binary for a specific version of Leap.
После того, как вы скачали файл `*.deb` для вашей версии Ubuntu, вы можете установить его следующим образом:
Once you have a `*.deb` file downloaded for your version of Ubuntu, you can install it as follows:
```bash
sudo apt-get update
sudo apt-get install -y ~/Downloads/coopos*.deb
sudo apt-get install -y ~/Downloads/leap*.deb
```
Ваш путь загрузки может отличаться. Если вы находитесь в Ubuntu docker контейнере, опустите `sudo`, поскольку вы работаете как `root` по умолчанию.
Your download path may vary. If you are in an Ubuntu docker container, omit `sudo` because you run as `root` by default.
Наконец, проверьте, что Coopos был установлен корректно:
Finally, verify Leap was installed correctly:
```bash
nodeos --full-version
```
Вы должны увидеть строку [семантической версии](https://semver.org), за которой следует git commit hash без ошибок. Например:
You should see a [semantic version](https://semver.org) string followed by a `git` commit hash with no errors. For example:
```
v5.1.0-abc123def456...
v3.1.2-0b64f879e3ebe2e4df09d2e62f1fc164cc1125d1
```
## Сборка и установка из исходного кода
Вы также можете собрать и установить Coopos из исходного кода.
## Build and Install from Source
You can also build and install Leap from source.
### Системные требования
### Prerequisites
You will need to build on a [supported operating system](#supported-operating-systems).
#### Требования к сборке
Для успешной сборки Coopos из исходного кода рекомендуется использовать систему с:
- **Процессор**: минимум 4 ядра (рекомендуется 8 ядер)
- **Оперативная память**: минимум 8 GB RAM (рекомендуется 16 GB)
- **Дисковое пространство**: минимум 20 GB для сборки и тестов
При меньших ресурсах сборка может быть невозможна или крайне медленной. Некоторые этапы компиляции требуют значительных ресурсов памяти.
#### Требования к работе
Для работы блокчейн-узла Coopos достаточно:
- **Процессор**: минимум 2 ядра
- **Оперативная память**: минимум 4 GB RAM
- **Дисковое пространство**: зависит от высоты цепочки блоков. На текущий момент для основной сети кооперативной экономики требуется около 20 GB, поэтому минимально рекомендуется 40 GB, оптимально - 160 GB для комфортной работы и хранения истории.
### Предварительные требования
Вам нужно собирать на [поддерживаемой операционной системе](#supported-operating-systems).
Требования для сборки:
- Компилятор C++20 и стандартная библиотека
- CMake 3.16+
- LLVM 7 - 11 - только для Linux
- более новые версии не работают
Requirements to build:
- C++17 compiler and standard library
- boost 1.67+
- CMake 3.8+
- LLVM 7 - 11 - for Linux only
- newer versions do not work
- openssl 1.1+
- curl
- libcurl 7.40.0+
- git
- GMP
@@ -165,164 +58,203 @@ v5.1.0-abc123def456...
- python3-numpy
- zlib
### Шаг 1 - Клонирование
Если у вас ещё не клонирован репозиторий Coopos, [откройте терминал](https://itsfoss.com/open-terminal-ubuntu) и перейдите в папку, где хотите клонировать репозиторий Coopos:
### Step 1 - Clone
If you don't have the Leap repo cloned to your computer yet, [open a terminal](https://itsfoss.com/open-terminal-ubuntu) and navigate to the folder where you want to clone the Leap repository:
```bash
cd ~/Downloads
```
Клонируйте Coopos используя либо HTTPS...
Clone Leap using either HTTPS...
```bash
git clone --recursive https://github.com/AntelopeIO/leap.git
```
...либо SSH:
...or SSH:
```bash
git clone --recursive git@github.com:AntelopeIO/leap.git
```
> **HTTPS vs. SSH Clone**
И HTTPS, и SSH клонирование дадут одинаковый результат - папку с именем `leap`, содержащую наш исходный код. Не важно, какой тип вы используете.
Both an HTTPS or SSH git clone will yield the same result - a folder named `leap` containing our source code. It doesn't matter which type you use.
Перейдите в эту папку:
Navigate into that folder:
```bash
cd leap
```
### Шаг 2 - Переключение на тег релиза или ветку
Выберите, какой [релиз](https://github.com/AntelopeIO/leap/releases) или [ветку](#branches) вы хотите собрать, затем переключитесь на неё. Если вы не уверены, используйте [последний релиз](https://github.com/AntelopeIO/leap/releases/latest). Например, если вы хотите собрать релиз 5.1.0, то переключитесь на его тег `v5.1.0`. В примере ниже замените `v0.0.0` на выбранный вами тег релиза:
### Step 2 - Checkout Release Tag or Branch
Choose which [release](https://github.com/AntelopeIO/leap/releases) or [branch](#branches) you would like to build, then check it out. If you are not sure, use the [latest release](https://github.com/AntelopeIO/leap/releases/latest). For example, if you want to build release 3.1.2 then you would check it out using its tag, `v3.1.2`. In the example below, replace `v0.0.0` with your selected release tag accordingly:
```bash
git fetch --all --tags
git checkout v5.1.0
git checkout v0.0.0
```
После того, как вы находитесь на ветке или теге релиза, который хотите собрать, убедитесь, что всё обновлено:
Once you are on the branch or release tag you want to build, make sure everything is up-to-date:
```bash
git pull
git submodule update --init --recursive
```
### Шаг 3 - Сборка
Выберите инструкции по сборке ниже для [закреплённой сборки](#pinned-build) (предпочтительно) или [незакреплённой сборки](#unpinned-build).
### Step 3 - Build
Select build instructions below for a [pinned build](#pinned-build) (preferred) or an [unpinned build](#unpinned-build).
> **Закреплённая vs. Незакреплённая сборка**
У нас есть два типа сборок для Coopos: "закреплённая" и "незакреплённая". Закреплённая сборка - это воспроизводимая сборка с фиксированной средой сборки и версиями зависимостей, установленными командой разработчиков. В отличие от этого, незакреплённые сборки используют версии зависимостей, предоставляемые платформой сборки. Незакреплённые сборки обычно быстрее, потому что закреплённая среда сборки должна быть построена с нуля. Закреплённые сборки, помимо воспроизводимости, обеспечивают, чтобы компилятор оставался тем же между сборками разных основных версий Coopos. Coopos требует, чтобы версия компилятора оставалась той же, иначе его состояние может потребовать восстановления из портативного снимка или цепочка должна быть перезапущена.
> **Pinned vs. Unpinned Build**
We have two types of builds for Leap: "pinned" and "unpinned." The only difference is that pinned builds use specific versions for some dependencies hand-picked by the Leap engineers - they are "pinned" to those versions. In contrast, unpinned builds use the default dependency versions available on the build system at the time. We recommend performing a "pinned" build to ensure the compiler and boost versions remain the same between builds of different Leap versions. Leap requires these versions to remain the same, otherwise its state might need to be recovered from a portable snapshot or the chain needs to be replayed.
> ⚠️ **Предупреждение о параллельных задачах компиляции (флаг `-j`)** ⚠️
При сборке программного обеспечения C/C++, часто сборка выполняется параллельно с помощью команды типа `make -j "$(nproc)"`, которая использует все доступные потоки CPU. Однако учтите, что некоторые единицы компиляции (`*.cpp` файлы) в Coopos будут потреблять почти 4GB памяти. Сбои из-за исчерпания памяти обычно, но не всегда, проявляются как сбои компилятора. Использование всех доступных потоков CPU также может помешать вам делать другие вещи на вашем компьютере во время компиляции. По этим причинам рассмотрите возможность уменьшения этого значения.
> ⚠️ **A Warning On Parallel Compilation Jobs (`-j` flag)** ⚠️
When building C/C++ software, often the build is performed in parallel via a command such as `make -j "$(nproc)"` which uses all available CPU threads. However, be aware that some compilation units (`*.cpp` files) in Leap will consume nearly 4GB of memory. Failures due to memory exhaustion will typically, but not always, manifest as compiler crashes. Using all available CPU threads may also prevent you from doing other things on your computer during compilation. For these reasons, consider reducing this value.
> 🐋 **Docker и `sudo`** 🐋
Если вы находитесь в Ubuntu docker контейнере, опустите `sudo` из всех команд, поскольку вы работаете как `root` по умолчанию. Большинство других docker контейнеров также исключают `sudo`, особенно Debian-семейные контейнеры. Если ваш промпт оболочки - хэш-тег (`#`), опустите `sudo`.
> 🐋 **Docker and `sudo`** 🐋
If you are in an Ubuntu docker container, omit `sudo` from all commands because you run as `root` by default. Most other docker containers also exclude `sudo`, especially Debian-family containers. If your shell prompt is a hash tag (`#`), omit `sudo`.
#### Закреплённая воспроизводимая сборка
Закреплённая воспроизводимая сборка требует Docker. Убедитесь, что вы находитесь в корне репозитория `leap`, затем выполните
#### Pinned Build
Make sure you are in the root of the `leap` repo, then run the `install_depts.sh` script to install dependencies:
```bash
DOCKER_BUILDKIT=1 docker build -f tools/reproducible.Dockerfile -o . .
```
Эта команда займёт существенное время, потому что цепочка инструментов собирается с нуля. После завершения текущая директория будет содержать собранные `.deb` и `.tar.gz` файлы (вы можете изменить аргумент `-o .` для размещения вывода в другой директории). Если нужно уменьшить количество параллельных задач, как предупреждалось выше, выполните команду как:
```bash
DOCKER_BUILDKIT=1 docker build --build-arg LEAP_BUILD_JOBS=4 -f tools/reproducible.Dockerfile -o . .
sudo scripts/install_deps.sh
```
#### Незакреплённая сборка
Следующие инструкции действительны для этой ветки. Другие ветки релизов могут иметь разные требования, поэтому убедитесь, что следуете указаниям в ветке или релизе, который собираетесь собирать. Если вы находитесь в Ubuntu docker контейнере, опустите `sudo`, поскольку вы работаете как `root` по умолчанию.
Next, run the pinned build script. You have to give it three arguments in the following order:
1. A temporary folder, for all dependencies that need to be built from source.
1. A build folder, where the binaries you need to install will be built to.
1. The number of jobs or CPU cores/threads to use (note the [jobs flag](#step-3---build) warning above).
Установите зависимости:
> 🔒 You do not need to run this script with `sudo` or as root.
For example, the following command runs the `pinned_build.sh` script, specifies a `deps` and `build` folder in the root of the Leap repo for the first two arguments, then builds the packages using all of your computer's CPU threads:
```bash
scripts/pinned_build.sh deps build "$(nproc)"
```
Now you can optionally [test](#step-4---test) your build, or [install](#step-5---install) the `*.deb` binary packages, which will be in the root of your build directory.
#### Unpinned Build
The following instructions are valid for this branch. Other release branches may have different requirements, so ensure you follow the directions in the branch or release you intend to build. If you are in an Ubuntu docker container, omit `sudo` because you run as `root` by default.
<details> <summary>Ubuntu 22.04 Jammy & Ubuntu 20.04 Focal</summary>
Install dependencies:
```bash
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
curl \
git \
libboost-all-dev \
libcurl4-openssl-dev \
libgmp-dev \
libssl-dev \
llvm-11-dev \
python3-numpy \
file \
zlib1g-dev
python3-numpy
```
На Ubuntu 20.04 установите gcc-10, который имеет поддержку C++20:
```bash
sudo apt-get install -y g++-10
```
Для сборки убедитесь, что вы находитесь в корне репозитория `leap`, затем выполните следующую команду:
To build, make sure you are in the root of the `leap` repo, then run the following command:
```bash
mkdir -p build
cd build
## на Ubuntu 20 укажите компилятор gcc-10
cmake -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/usr/lib/llvm-11 ..
## на Ubuntu 22 версия gcc по умолчанию 11, использование компилятора по умолчанию нормально
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/usr/lib/llvm-11 ..
make -j "$(nproc)" package
```
</details>
Теперь вы можете опционально [протестировать](#step-4---test) вашу сборку, или [установить](#step-5---install) бинарные пакеты `*.deb`, которые будут в корне вашей директории сборки.
<details> <summary>Ubuntu 18.04 Bionic</summary>
### Шаг 4 - Тестирование
Coopos поддерживает следующие наборы тестов:
Install dependencies:
```bash
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
curl \
g++-8 \
git \
libcurl4-openssl-dev \
libgmp-dev \
libssl-dev \
llvm-7-dev \
python3 \
python3-numpy \
python3-pip \
zlib1g-dev
Набор тестов | Тип теста | [Размер теста](https://testing.googleblog.com/2010/12/test-sizes.html) | Примечания
python3 -m pip install dataclasses
```
You need to build Boost from source on this distribution:
```bash
curl -fL https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.tar.bz2 -o ~/Downloads/boost_1_79_0.tar.bz2
tar -jvxf ~/Downloads/boost_1_79_0.tar.bz2 -C ~/Downloads/
pushd ~/Downloads/boost_1_79_0
./bootstrap.sh --prefix="$HOME/boost1.79"
./b2 --with-iostreams --with-date_time --with-filesystem --with-system --with-program_options --with-chrono --with-test -j "$(nproc)" install
popd
```
The Boost `*.tar.bz2` download and `boost_1_79_0` folder can be removed now if you want more space.
```bash
rm -r ~/Downloads/boost_1_79_0.tar.bz2 ~/Downloads/boost_1_79_0
```
From a terminal in the root of the `leap` repo, build.
```bash
mkdir -p build
cd build
cmake -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8 -DCMAKE_PREFIX_PATH="$HOME/boost1.79;/usr/lib/llvm-7/" -DCMAKE_BUILD_TYPE=Release ..
make -j "$(nproc)" package
```
After building, you may remove the `~/boost1.79` directory or you may keep it around for your next build.
</details>
Now you can optionally [test](#step-4---test) your build, or [install](#step-5---install) the `*.deb` binary packages, which will be in the root of your build directory.
### Step 4 - Test
Leap supports the following test suites:
Test Suite | Test Type | [Test Size](https://testing.googleblog.com/2010/12/test-sizes.html) | Notes
---|:---:|:---:|---
[Параллелизуемые тесты](#parallelizable-tests) | Модульные тесты | Маленький
[WASM spec тесты](#wasm-spec-tests) | Модульные тесты | Маленький | Модульные тесты для нашего WASM runtime, каждый короткий но _очень_ CPU-интенсивный
[Сериальные тесты](#serial-tests) | Компонент/Интеграция | Средний
[Долго выполняемые тесты](#long-running-tests) | Интеграция | Средний-Крупный | Тесты, которые занимают чрезвычайно много времени на выполнение
[Parallelizable tests](#parallelizable-tests) | Unit tests | Small
[WASM spec tests](#wasm-spec-tests) | Unit tests | Small | Unit tests for our WASM runtime, each short but _very_ CPU-intensive
[Serial tests](#serial-tests) | Component/Integration | Medium
[Long-running tests](#long-running-tests) | Integration | Medium-to-Large | Tests which take an extraordinarily long amount of time to run
При сборке из исходного кода мы рекомендуем запускать как минимум [параллелизуемые тесты](#parallelizable-tests).
When building from source, we recommended running at least the [parallelizable tests](#parallelizable-tests).
#### Параллелизуемые тесты
Этот набор тестов состоит из любых тестов, которые не требуют разделяемых ресурсов, таких как файловые дескрипторы, специфические папки или порты, и поэтому могут выполняться параллельно в разных потоках без побочных эффектов (следовательно, легко параллелизуемы). Это в основном модульные тесты и [маленькие тесты](https://testing.googleblog.com/2010/12/test-sizes.html), которые завершаются за короткое время.
#### Parallelizable Tests
This test suite consists of any test that does not require shared resources, such as file descriptors, specific folders, or ports, and can therefore be run concurrently in different threads without side effects (hence, easily parallelized). These are mostly unit tests and [small tests](https://testing.googleblog.com/2010/12/test-sizes.html) which complete in a short amount of time.
Вы можете запустить их, выполнив `ctest` из терминала в вашей директории сборки Coopos и указав следующие аргументы:
You can invoke them by running `ctest` from a terminal in your Leap build directory and specifying the following arguments:
```bash
ctest -j "$(nproc)" -LE _tests
```
#### WASM Spec тесты
WASM spec тесты проверяют, что наш движок выполнения WASM соответствует стандарту web assembly. Это очень [маленькие](https://testing.googleblog.com/2010/12/test-sizes.html), очень быстрые модульные тесты. Однако их более тысячи, так что набор может занять немного времени на выполнение. Эти тесты чрезвычайно CPU-интенсивны.
#### WASM Spec Tests
The WASM spec tests verify that our WASM execution engine is compliant with the web assembly standard. These are very [small](https://testing.googleblog.com/2010/12/test-sizes.html), very fast unit tests. However, there are over a thousand of them so the suite can take a little time to run. These tests are extremely CPU-intensive.
Вы можете запустить их, выполнив `ctest` из терминала в вашей директории сборки Coopos и указав следующие аргументы:
You can invoke them by running `ctest` from a terminal in your Leap build directory and specifying the following arguments:
```bash
ctest -j "$(nproc)" -L wasm_spec_tests
```
Мы наблюдали серьёзные проблемы с производительностью, когда несколько виртуальных машин запускают этот набор тестов на одном физическом хосте одновременно, например в системе CICD. Это можно решить, отключив hyperthreading на хосте.
We have observed severe performance issues when multiple virtual machines are running this test suite on the same physical host at the same time, for example in a CICD system. This can be resolved by disabling hyperthreading on the host.
#### Сериальные тесты
Набор сериальных тестов состоит из [средних](https://testing.googleblog.com/2010/12/test-sizes.html) компонентных или интеграционных тестов, которые используют специфические пути, порты, полагаются на имена процессов или подобное, и не могут выполняться параллельно с другими тестами. Сериальные тесты могут быть чувствительны к другому программному обеспечению, работающему на том же хосте, и они могут отправлять `SIGKILL` другим процессам `nodeos`. Эти тесты занимают умеренное время на завершение, но мы рекомендуем их запускать.
#### Serial Tests
The serial test suite consists of [medium](https://testing.googleblog.com/2010/12/test-sizes.html) component or integration tests that use specific paths, ports, rely on process names, or similar, and cannot be run concurrently with other tests. Serial tests can be sensitive to other software running on the same host and they may `SIGKILL` other `nodeos` processes. These tests take a moderate amount of time to complete, but we recommend running them.
Вы можете запустить их, выполнив `ctest` из терминала в вашей директории сборки Coopos и указав следующие аргументы:
You can invoke them by running `ctest` from a terminal in your Leap build directory and specifying the following arguments:
```bash
ctest -L "nonparallelizable_tests"
```
#### Долго выполняемые тесты
Долго выполняемые тесты - это [средние-крупные](https://testing.googleblog.com/2010/12/test-sizes.html) интеграционные тесты, которые полагаются на разделяемые ресурсы и занимают очень много времени на выполнение.
#### Long-Running Tests
The long-running tests are [medium-to-large](https://testing.googleblog.com/2010/12/test-sizes.html) integration tests that rely on shared resources and take a very long time to run.
Вы можете запустить их, выполнив `ctest` из терминала в вашей директории сборки Coopos и указав следующие аргументы:
You can invoke them by running `ctest` from a terminal in your Leap build directory and specifying the following arguments:
```bash
ctest -L "long_running_tests"
```
### Шаг 5 - Установка
После того, как вы [собрали](#step-3---build-the-source-code) Coopos и [протестировали](#step-4---test) вашу сборку, вы можете установить Coopos в вашу систему. Не забудьте опустить `sudo`, если вы работаете в docker контейнере.
### Step 5 - Install
Once you have [built](#step-3---build-the-source-code) Leap and [tested](#step-4---test) your build, you can install Leap on your system. Don't forget to omit `sudo` if you are running in a docker container.
Мы рекомендуем установить бинарный пакет, который вы только что собрали. Перейдите в вашу директорию сборки Coopos в терминале и выполните эту команду:
We recommend installing the binary package you just built. Navigate to your Leap build directory in a terminal and run this command:
```bash
sudo apt-get update
sudo apt-get install -y ./leap[-_][0-9]*.deb
```
Также возможно установить используя `make`:
It is also possible to install using `make` instead:
```bash
sudo make install
```
## Bash автодополнение
`cleos` и `leap-util` предлагают существенный объём функциональности. Рассмотрите использование поддержки автодополнения bash, которая облегчает обнаружение всех их различных опций.
Для наших предоставленных `.deb` пакетов просто установите Ubuntu пакет `bash-completion`: `apt-get install bash-completion` (вам может понадобиться выйти и войти снова после установки).
Если собираете из исходного кода, установите файлы `build/programs/cleos/bash-completion/completions/cleos` и `build/programs/leap-util/bash-completion/completions/leap-util` в вашу директорию bash-completion. Обратитесь к [документации bash-completion](https://github.com/scop/bash-completion#faq) по возможным местам установки.
+1 -2
View File
@@ -1,8 +1,7 @@
file(GLOB BENCHMARK "*.cpp")
add_executable( benchmark ${BENCHMARK} )
target_link_libraries( benchmark eosio_testing fc Boost::program_options bn256)
target_link_libraries( benchmark fc Boost::program_options bn256)
target_include_directories( benchmark PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}/../unittests/include"
)
+1 -1
View File
@@ -4,7 +4,7 @@
#include <benchmark.hpp>
namespace eosio::benchmark {
namespace benchmark {
using bytes = std::vector<char>;
using g1g2_pair = std::vector<std::string>;
+5 -8
View File
@@ -5,7 +5,7 @@
#include <benchmark.hpp>
namespace eosio::benchmark {
namespace benchmark {
// update this map when a new feature is supported
// key is the name and value is the function doing benchmarking
@@ -15,11 +15,10 @@ std::map<std::string, std::function<void()>> features {
{ "key", key_benchmarking },
{ "hash", hash_benchmarking },
{ "blake2", blake2_benchmarking },
{ "bls", bls_benchmarking }
};
// values to control cout format
constexpr auto name_width = 40;
constexpr auto name_width = 28;
constexpr auto runs_width = 5;
constexpr auto time_width = 12;
constexpr auto ns_width = 2;
@@ -47,10 +46,10 @@ void print_results(std::string name, uint32_t runs, uint64_t total, uint64_t min
std::cout.imbue(std::locale(""));
std::cout
<< std::setw(name_width) << std::left << name
<< std::setw(runs_width) << runs
// std::fixed for not printing 1234 in 1.234e3.
// setprecision(0) for not printing fractions
<< std::right << std::fixed << std::setprecision(0)
<< std::setw(runs_width) << runs
<< std::setw(time_width) << total/runs << std::setw(ns_width) << " ns"
<< std::setw(time_width) << min << std::setw(ns_width) << " ns"
<< std::setw(time_width) << max << std::setw(ns_width) << " ns"
@@ -63,10 +62,8 @@ bytes to_bytes(const std::string& source) {
return output;
};
void benchmarking(const std::string& name, const std::function<void()>& func) {
uint64_t total{0};
uint64_t min{std::numeric_limits<uint64_t>::max()};
uint64_t max{0};
void benchmarking(std::string name, const std::function<void()>& func) {
uint64_t total {0}, min {std::numeric_limits<uint64_t>::max()}, max {0};
for (auto i = 0U; i < num_runs; ++i) {
auto start_time = std::chrono::high_resolution_clock::now();
+2 -4
View File
@@ -3,11 +3,10 @@
#include <functional>
#include <map>
#include <vector>
#include <limits>
#include <fc/crypto/hex.hpp>
namespace eosio::benchmark {
namespace benchmark {
using bytes = std::vector<char>;
void set_num_runs(uint32_t runs);
@@ -20,8 +19,7 @@ void modexp_benchmarking();
void key_benchmarking();
void hash_benchmarking();
void blake2_benchmarking();
void bls_benchmarking();
void benchmarking(const std::string& name, const std::function<void()>& func);
void benchmarking(std::string name, const std::function<void()>& func);
} // benchmark
+1 -1
View File
@@ -2,7 +2,7 @@
#include <benchmark.hpp>
namespace eosio::benchmark {
namespace benchmark {
void blake2_benchmarking() {
uint32_t _rounds = 0x0C;
-444
View File
@@ -1,444 +0,0 @@
#include <benchmark.hpp>
#include <eosio/chain/apply_context.hpp>
#include <eosio/chain/webassembly/interface.hpp>
#include <eosio/testing/tester.hpp>
#include <test_contracts.hpp>
#include <bls12-381/bls12-381.hpp>
#include <random>
using namespace eosio;
using namespace eosio::chain;
using namespace eosio::testing;
using namespace bls12_381;
// Benchmark BLS host functions without relying on CDT wrappers.
//
// To run a benchmarking session, in the build directory, type
// benchmark/benchmark -f bls
namespace eosio::benchmark {
// To benchmark host functions directly without CDT wrappers,
// we need to contruct an eosio::chain::webassembly::interface object,
// because host functions are implemented in
// eosio::chain::webassembly::interface class.
struct interface_in_benchmark {
interface_in_benchmark() {
// prevent logging from interwined with output benchmark results
fc::logger::get(DEFAULT_LOGGER).set_log_level(fc::log_level::off);
// create a chain
fc::temp_directory tempdir;
auto conf_genesis = tester::default_config( tempdir );
auto& cfg = conf_genesis.second.initial_configuration;
// configure large cpu usgaes so expensive BLS functions like pairing
// can finish within a trasaction time
cfg.max_block_cpu_usage = 999'999'999;
cfg.max_transaction_cpu_usage = 999'999'990;
cfg.min_transaction_cpu_usage = 1;
chain = std::make_unique<tester>(conf_genesis.first, conf_genesis.second);
chain->execute_setup_policy( setup_policy::full );
// create account and deploy contract for a temp transaction
chain->create_accounts( {"payloadless"_n} );
chain->set_code( "payloadless"_n, test_contracts::payloadless_wasm() );
chain->set_abi( "payloadless"_n, test_contracts::payloadless_abi() );
// construct a signed transaction
fc::variant pretty_trx = fc::mutable_variant_object()
("actions", fc::variants({
fc::mutable_variant_object()
("account", name("payloadless"_n))
("name", "doit")
("authorization", fc::variants({
fc::mutable_variant_object()
("actor", name("payloadless"_n))
("permission", name(config::active_name))
}))
("data", fc::mutable_variant_object()
)
})
);
trx = std::make_unique<signed_transaction>();
abi_serializer::from_variant(pretty_trx, *trx, chain->get_resolver(), abi_serializer::create_yield_function( chain->abi_serializer_max_time ));
chain->set_transaction_headers(*trx);
trx->sign( chain->get_private_key( "payloadless"_n, "active" ), chain->control.get()->get_chain_id() );
// construct a packed transaction
ptrx = std::make_unique<packed_transaction>(*trx, eosio::chain::packed_transaction::compression_type::zlib);
// build transaction context from the packed transaction
timer = std::make_unique<platform_timer>();
trx_timer = std::make_unique<transaction_checktime_timer>(*timer);
trx_ctx = std::make_unique<transaction_context>(*chain->control.get(), *ptrx, ptrx->id(), std::move(*trx_timer));
trx_ctx->max_transaction_time_subjective = fc::microseconds::maximum();
trx_ctx->init_for_input_trx( ptrx->get_unprunable_size(), ptrx->get_prunable_size() );
trx_ctx->exec(); // this is required to generate action traces to be used by apply_context constructor
// build apply context from the control and transaction context
apply_ctx = std::make_unique<apply_context>(*chain->control.get(), *trx_ctx, 1);
// finally construct the interface
interface = std::make_unique<webassembly::interface>(*apply_ctx);
}
std::unique_ptr<tester> chain;
std::unique_ptr<signed_transaction> trx;
std::unique_ptr<packed_transaction> ptrx;
std::unique_ptr<platform_timer> timer;
std::unique_ptr<transaction_checktime_timer> trx_timer;
std::unique_ptr<transaction_context> trx_ctx;
std::unique_ptr<apply_context> apply_ctx;
std::unique_ptr<webassembly::interface> interface;
};
// utilility to create a random scalar
std::array<uint64_t, 4> random_scalar()
{
std::random_device rd;
std::mt19937_64 gen(rd());
std::uniform_int_distribution<uint64_t> dis;
return {
dis(gen) % bls12_381::fp::Q[0],
dis(gen) % bls12_381::fp::Q[1],
dis(gen) % bls12_381::fp::Q[2],
dis(gen) % bls12_381::fp::Q[3]
};
}
// utilility to create a random fp
fp random_fe()
{
std::random_device rd;
std::mt19937_64 gen(rd());
std::uniform_int_distribution<uint64_t> dis;
return fp({
dis(gen) % 0xb9feffffffffaaab,
dis(gen) % 0x1eabfffeb153ffff,
dis(gen) % 0x6730d2a0f6b0f624,
dis(gen) % 0x64774b84f38512bf,
dis(gen) % 0x4b1ba7b6434bacd7,
dis(gen) % 0x1a0111ea397fe69a
});
}
// utilility to create a random fp2
fp2 random_fe2()
{
return fp2({
random_fe(),
random_fe()
});
}
// utilility to create a random g1
bls12_381::g1 random_g1()
{
std::array<uint64_t, 4> k = random_scalar();
return bls12_381::g1::one().scale(k);
}
// utilility to create a random g2
bls12_381::g2 random_g2()
{
std::array<uint64_t, 4> k = random_scalar();
return bls12_381::g2::one().scale(k);
}
// bls_g1_add benchmarking
void benchmark_bls_g1_add() {
// prepare g1 operand in Jacobian LE format
g1 p = random_g1();
std::array<char, 96> op;
p.toAffineBytesLE(std::span<uint8_t, 96>((uint8_t*)op.data(), 96), from_mont::yes);
// prepare result operand
std::array<char, 96> result;
// set up bls_g1_add to be benchmarked
interface_in_benchmark interface;
auto benchmarked_func = [&]() {
interface.interface->bls_g1_add(op, op, result);
};
benchmarking("bls_g1_add", benchmarked_func);
}
// bls_g2_add benchmarking
void benchmark_bls_g2_add() {
// prepare g2 operand in Jacobian LE format
g2 p = random_g2();
std::array<char, 192> op;
p.toAffineBytesLE(std::span<uint8_t, 192>((uint8_t*)op.data(), 192), from_mont::yes);
// prepare result operand
std::array<char, 192> result;
// set up bls_g2_add to be benchmarked
interface_in_benchmark interface;
auto benchmarked_func = [&]() {
interface.interface->bls_g2_add(op, op, result);
};
benchmarking("bls_g2_add", benchmarked_func);
}
// bls_g1_weighted_sum benchmarking utility
void benchmark_bls_g1_weighted_sum_impl(const std::string& test_name, uint32_t num_points) {
// prepare g1 points operand
std::vector<char> g1_buf(96*num_points);
for (auto i=0u; i < num_points; ++i) {
g1 p = random_g1();
p.toAffineBytesLE(std::span<uint8_t, 96>((uint8_t*)g1_buf.data() + i * 96, 96), from_mont::yes);
}
chain::span<const char> g1_points(g1_buf.data(), g1_buf.size());
// prepare scalars operand
std::vector<char> scalars_buf(32*num_points);
for (auto i=0u; i < num_points; ++i) {
std::array<uint64_t, 4> s = random_scalar();
scalar::toBytesLE(s, std::span<uint8_t, 32>((uint8_t*)scalars_buf.data() + i*32, 32));
}
chain::span<const char> scalars(scalars_buf.data(), scalars_buf.size());
// prepare result operand
std::array<char, 96> result;
// set up bls_g1_weighted_sum to be benchmarked
interface_in_benchmark interface;
auto benchmarked_func = [&]() {
interface.interface->bls_g1_weighted_sum(g1_points, scalars, num_points, result);
};
benchmarking(test_name, benchmarked_func);
}
// bls_g1_weighted_sum benchmarking with 1 input point
void benchmark_bls_g1_weighted_sum_one_point() {
benchmark_bls_g1_weighted_sum_impl("bls_g1_weighted_sum 1 point", 1);
}
// bls_g1_weighted_sum benchmarking with 3 input points
void benchmark_bls_g1_weighted_sum_three_point() {
benchmark_bls_g1_weighted_sum_impl("bls_g1_weighted_sum 3 points", 3);
}
// bls_g1_weighted_sum benchmarking with 5 input points
void benchmark_bls_g1_weighted_sum_five_point() {
benchmark_bls_g1_weighted_sum_impl("bls_g1_weighted_sum 5 points", 5);
}
// bls_g2_weighted_sum benchmarking utility
void benchmark_bls_g2_weighted_sum_impl(const std::string& test_name, uint32_t num_points) {
// prepare g2 points operand
std::vector<char> g2_buf(192*num_points);
for (auto i=0u; i < num_points; ++i) {
g2 p = random_g2();
p.toAffineBytesLE(std::span<uint8_t, 192>((uint8_t*)g2_buf.data() + i * 192, 192), from_mont::yes);
}
eosio::chain::span<const char> g2_points(g2_buf.data(), g2_buf.size());
// prepare scalars operand
std::vector<char> scalars_buf(32*num_points);
for (auto i=0u; i < num_points; ++i) {
std::array<uint64_t, 4> s = random_scalar();
scalar::toBytesLE(s, std::span<uint8_t, 32>((uint8_t*)scalars_buf.data() + i*32, 32));
}
eosio::chain::span<const char> scalars(scalars_buf.data(), scalars_buf.size());
// prepare result operand
std::array<char, 192> result;
// set up bls_g2_weighted_sum to be benchmarked
interface_in_benchmark interface;
auto benchmarked_func = [&]() {
interface.interface->bls_g2_weighted_sum(g2_points, scalars, num_points, result);
};
benchmarking(test_name, benchmarked_func);
}
// bls_g2_weighted_sum benchmarking with 1 input point
void benchmark_bls_g2_weighted_sum_one_point() {
benchmark_bls_g2_weighted_sum_impl("bls_g2_weighted_sum 1 point", 1);
}
// bls_g2_weighted_sum benchmarking with 3 input points
void benchmark_bls_g2_weighted_sum_three_point() {
benchmark_bls_g2_weighted_sum_impl("bls_g2_weighted_sum 3 points", 3);
}
// bls_g2_weighted_sum benchmarking with 5 input points
void benchmark_bls_g2_weighted_sum_five_point() {
benchmark_bls_g2_weighted_sum_impl("bls_g2_weighted_sum 5 points", 5);
}
// bls_pairing benchmarking utility
void benchmark_bls_pairing_impl(const std::string& test_name, uint32_t num_pairs) {
// prepare g1 operand
std::vector<char> g1_buf(96*num_pairs);
for (auto i=0u; i < num_pairs; ++i) {
g1 p = random_g1();
p.toAffineBytesLE(std::span<uint8_t, 96>((uint8_t*)g1_buf.data() + i * 96, 96), from_mont::yes);
}
eosio::chain::span<const char> g1_points(g1_buf.data(), g1_buf.size());
// prepare g2 operand
std::vector<char> g2_buf(192*num_pairs);
for (auto i=0u; i < num_pairs; ++i) {
g2 p2 = random_g2();
p2.toAffineBytesLE(std::span<uint8_t, (192)>((uint8_t*)g2_buf.data() + i * 192, (192)), from_mont::yes);
}
eosio::chain::span<const char> g2_points(g2_buf.data(), g2_buf.size());
// prepare result operand
std::array<char, 576> result;
// set up bls_pairing to be benchmarked
interface_in_benchmark interface;
auto benchmarked_func = [&]() {
interface.interface->bls_pairing(g1_points, g2_points, num_pairs, result);
};
benchmarking(test_name, benchmarked_func);
}
// bls_pairing benchmarking with 1 input pair
void benchmark_bls_pairing_one_pair() {
benchmark_bls_pairing_impl("bls_pairing 1 pair", 1);
}
// bls_pairing benchmarking with 3 input pairs
void benchmark_bls_pairing_three_pair() {
benchmark_bls_pairing_impl("bls_pairing 3 pairs", 3);
}
// bls_g1_map benchmarking
void benchmark_bls_g1_map() {
// prepare e operand. Must be fp LE.
std::array<char, 48> e;
fp a = random_fe();
a.toBytesLE(std::span<uint8_t, 48>((uint8_t*)e.data(), 48), from_mont::yes);
// prepare result operand
std::array<char, 96> result;
// set up bls_g1_map to be benchmarked
interface_in_benchmark interface;
auto benchmarked_func = [&]() {
interface.interface->bls_g1_map(e, result);
};
benchmarking("bls_g1_map", benchmarked_func);
}
// bls_g2_map benchmarking
void benchmark_bls_g2_map() {
std::array<char, 96> e;
fp2 a = random_fe2();
a.toBytesLE(std::span<uint8_t, 96>((uint8_t*)e.data(), 96), from_mont::yes);
// prepare result operand
std::array<char, 192> result;
// set up bls_g2_map to be benchmarked
interface_in_benchmark interface;
auto benchmarked_func = [&]() {
interface.interface->bls_g2_map(e, result);
};
benchmarking("bls_g2_map", benchmarked_func);
}
// bls_fp_mod benchmarking
void benchmark_bls_fp_mod() {
// prepare scalar operand
std::array<char, 64> scalar;
// random_scalar returns 32 bytes. need to call it twice
for (auto i=0u; i < 2; ++i) {
std::array<uint64_t, 4> s = random_scalar();
scalar::toBytesLE(s, std::span<uint8_t, 32>((uint8_t*)scalar.data() + i*32, 32));
}
// prepare result operand
std::array<char, 48> result;
// set up bls_fp_mod to be benchmarked
interface_in_benchmark interface;
auto benchmarked_func = [&]() {
interface.interface->bls_fp_mod(scalar, result);
};
benchmarking("bls_fp_mod", benchmarked_func);
}
void benchmark_bls_fp_mul() {
// prepare op1
std::array<char, 48> op1;
fp a = random_fe();
a.toBytesLE(std::span<uint8_t, 48>((uint8_t*)op1.data(), 48), from_mont::yes);
// prepare op2
std::array<char, 48> op2;
fp b = random_fe();
b.toBytesLE(std::span<uint8_t, 48>((uint8_t*)op2.data(), 48), from_mont::yes);
// prepare result operand
std::array<char, 48> result;
// set up bls_fp_mul to be benchmarked
interface_in_benchmark interface;
auto benchmarked_func = [&]() {
interface.interface->bls_fp_mul(op1, op2, result);
};
benchmarking("bls_fp_mul", benchmarked_func);
}
void benchmark_bls_fp_exp() {
// prepare base
std::array<char, 48> base;
fp a = random_fe();
a.toBytesLE(std::span<uint8_t, 48>((uint8_t*)base.data(), 48), from_mont::yes);
// prepare exp operand
std::array<char, 64> exp;
// random_scalar returns 32 bytes. need to call it twice
for (auto i=0u; i < 2; ++i) {
std::array<uint64_t, 4> s = random_scalar();
scalar::toBytesLE(s, std::span<uint8_t, 32>((uint8_t*)exp.data() + i*32, 32));
}
// prepare result operand
std::array<char, 48> result;
// set up bls_fp_exp to be benchmarked
interface_in_benchmark interface;
auto benchmarked_func = [&]() {
interface.interface->bls_fp_exp(base, exp, result);
};
benchmarking("bls_fp_exp", benchmarked_func);
}
// register benchmarking functions
void bls_benchmarking() {
benchmark_bls_g1_add();
benchmark_bls_g2_add();
benchmark_bls_pairing_one_pair();
benchmark_bls_pairing_three_pair();
benchmark_bls_g1_weighted_sum_one_point();
benchmark_bls_g1_weighted_sum_three_point();
benchmark_bls_g1_weighted_sum_five_point();
benchmark_bls_g2_weighted_sum_one_point();
benchmark_bls_g2_weighted_sum_three_point();
benchmark_bls_g2_weighted_sum_five_point();
benchmark_bls_g1_map();
benchmark_bls_g2_map();
benchmark_bls_fp_mod();
benchmark_bls_fp_mul();
benchmark_bls_fp_exp();
}
} // namespace benchmark
+1 -1
View File
@@ -10,7 +10,7 @@
using namespace fc;
namespace eosio::benchmark {
namespace benchmark {
void hash_benchmarking() {
std::string small_message = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ01";
+1 -1
View File
@@ -9,7 +9,7 @@ using namespace fc::crypto;
using namespace fc;
using namespace std::literals;
namespace eosio::benchmark {
namespace benchmark {
void k1_sign_benchmarking() {
auto payload = "Test Cases";
+3 -3
View File
@@ -12,7 +12,7 @@ int main(int argc, char* argv[]) {
uint32_t num_runs = 1;
std::string feature_name;
auto features = eosio::benchmark::get_features();
auto features = benchmark::get_features();
options_description cli ("benchmark command line options");
cli.add_options()
@@ -61,8 +61,8 @@ int main(int argc, char* argv[]) {
std::cerr << "unknown exception" << std::endl;
}
eosio::benchmark::set_num_runs(num_runs);
eosio::benchmark::print_header();
benchmark::set_num_runs(num_runs);
benchmark::print_header();
if (feature_name.empty()) {
for (auto& [name, f]: features) {
+8 -22
View File
@@ -1,11 +1,10 @@
#include <fc/crypto/modular_arithmetic.hpp>
#include <fc/exception/exception.hpp>
#include <random>
#include <benchmark.hpp>
namespace eosio::benchmark {
namespace benchmark {
void modexp_benchmarking() {
std::mt19937 r(0x11223344);
@@ -25,14 +24,15 @@ void modexp_benchmarking() {
return result;
};
static constexpr unsigned int start_num_bytes = 8;
static constexpr unsigned int end_num_bytes = 256;
static constexpr unsigned int start_num_bytes = 128; // 64
static constexpr unsigned int end_num_bytes = 256; // 512
static constexpr unsigned int delta_num_bytes = 128; // 64
static_assert(start_num_bytes <= end_num_bytes);
static_assert((start_num_bytes & (start_num_bytes - 1)) == 0);
static_assert((end_num_bytes & (end_num_bytes - 1)) == 0);
static_assert(delta_num_bytes > 0);
static_assert((end_num_bytes - start_num_bytes) % delta_num_bytes == 0);
for (unsigned int n = start_num_bytes; n <= end_num_bytes; n *= 2) {
for (unsigned int n = start_num_bytes, slot = 0; n <= end_num_bytes; n += delta_num_bytes, ++slot) {
auto base = generate_random_bytes(r, n);
auto exponent = generate_random_bytes(r, n);
auto modulus = generate_random_bytes(r, n);
@@ -41,21 +41,7 @@ void modexp_benchmarking() {
fc::modexp(base, exponent, modulus);
};
auto even_and_odd = [&](const std::string& bm) {
//some modexp implementations have drastically different performance characteristics depending on whether the modulus is
// even or odd (this can determine whether Montgomery multiplication is used). So test both cases.
modulus.back() &= ~1;
benchmarking(std::to_string(n*8) + " bit even M, " + bm, f);
modulus.back() |= 1;
benchmarking(std::to_string(n*8) + " bit odd M, " + bm, f);
};
//some modexp implementations need to take a minor different path if base is greater than modulus, try both
FC_ASSERT(modulus[0] != '\xff' && modulus[0] != 0);
base.front() = 0;
even_and_odd("B<M");
base.front() = '\xff';
even_and_odd("B>M");
benchmarking(std::to_string(n*8) + " bit width", f);
}
// Running the above benchmark (using commented values for num_trials and *_num_bytes) with a release build on an AMD 3.4 GHz CPU
@@ -4,9 +4,13 @@ content_title: Build Antelope from Source on Other Unix-based OS
**Please keep in mind that instructions for building from source on other unsupported operating systems provided here should be considered experimental and provided AS-IS on a best-effort basis and may not be fully featured.**
**A Warning On Parallel Compilation Jobs (`-j` flag)**: When building C/C++ software often the build is performed in parallel via a command such as `make -j $(nproc)` which uses the number of CPU cores as the number of compilation jobs to perform simultaneously. However, be aware that some compilation units (.cpp files) in leap are extremely complex and will consume nearly 4GB of memory to compile. You may need to reduce the level of parallelization depending on the amount of memory on your build host. e.g. instead of `make -j $(nproc)` run `make -j2`. Failures due to memory exhaustion will typically but not always manifest as compiler crashes.
### Using DUNE
Generally we recommend performing what we refer to as a "pinned build" which ensures the compiler and boost version remain the same between builds of different leap versions (leap requires these versions remain the same otherwise its state needs to be repopulated from a portable snapshot).
For the official multi-platform support try [Docker Utilities for Node Execution](https://github.com/AntelopeIO/DUNE) which runs in an ubuntu image via a docker container.
**A Warning On Parallel Compilation Jobs (`-j` flag)**: When building C/C++ software often the build is performed in parallel via a command such as `make -j $(nproc)` which uses the number of CPU cores as the number of compilation jobs to perform simultaneously. However, be aware that some compilation units (.cpp files) in mandel are extremely complex and will consume nearly 4GB of memory to compile. You may need to reduce the level of parallelization depending on the amount of memory on your build host. e.g. instead of `make -j $(nproc)` run `make -j2`. Failures due to memory exhaustion will typically but not always manifest as compiler crashes.
Generally we recommend performing what we refer to as a "pinned build" which ensures the compiler and boost version remain the same between builds of different mandel versions (mandel requires these versions remain the same otherwise its state needs to be repopulated from a portable snapshot).
<details>
<summary>FreeBSD 13.1 Build Instructions</summary>
@@ -19,6 +23,7 @@ pkg update && pkg install \
curl \
boost-all \
python3 \
openssl \
llvm11 \
pkgconf
```
+1
View File
@@ -12,6 +12,7 @@ Antelope currently supports the following operating systems:
1. Ubuntu 22.04 Jammy
2. Ubuntu 20.04 Focal
3. Ubuntu 18.04 Bionic
[[info | Note]]
| It may be possible to build and install Antelope on other Unix-based operating systems. We gathered helpful information on the following page but please keep in mind that it is experimental and not officially supported.
@@ -29,6 +29,7 @@ nodeos \
--plugin eosio::http_plugin \
--plugin eosio::state_history_plugin \
--contracts-console \
--disable-replay-opts \
--access-control-allow-origin='*' \
--http-validate-host=false \
--verbose-http-errors \
@@ -45,7 +46,7 @@ The above `nodeos` command starts a producing node by:
* setting the blockchain data directory (`--data-dir`)
* setting the `config.ini` directory (`--config-dir`)
* loading plugins `producer_plugin`, `chain_plugin`, `http_plugin`, `state_history_plugin` (`--plugin`)
* passing `chain_plugin` options (`--contracts-console`)
* passing `chain_plugin` options (`--contracts-console`, `--disable-replay-opts`)
* passing `http-plugin` options (`--access-control-allow-origin`, `--http-validate-host`, `--verbose-http-errors`)
* passing `state_history` options (`--state-history-dir`, `--trace-history`, `--chain-state-history`)
* redirecting both `stdout` and `stderr` to the `nodeos.log` file
+13 -32
View File
@@ -120,7 +120,7 @@ Config Options for eosio::chain_plugin:
applied to them (may specify multiple
times)
--read-mode arg (=head) Database read mode ("head",
"irreversible", "speculative").
"irreversible").
In "head" mode: database contains state
changes up to the head block;
transactions received by the node are
@@ -131,13 +131,7 @@ Config Options for eosio::chain_plugin:
received via the P2P network are not
relayed and transactions cannot be
pushed via the chain API.
In "speculative" mode: database
contains state changes by transactions
in the blockchain up to the head block
as well as some transactions not yet
included in the blockchain;
transactions received by the node are
relayed if valid.
--api-accept-transactions arg (=1) Allow API transactions to be evaluated
and relayed if valid.
--validation-mode arg (=full) Chain validation mode ("full" or
@@ -163,14 +157,10 @@ Config Options for eosio::chain_plugin:
headers signed by it will be fully
validated, but transactions in those
validated blocks will be trusted.
--database-map-mode arg (=mapped) Database map mode ("mapped",
"mapped_private", "heap", or "locked").
--database-map-mode arg (=mapped) Database map mode ("mapped", "heap", or
"locked").
In "mapped" mode database is memory
mapped as a file.
In "mapped_private" mode database is
memory mapped as a file using a private
mapping (no disk writeback until
program exit).
In "heap" mode database is preloaded in
to swappable memory and will use huge
pages if available.
@@ -182,35 +172,26 @@ Config Options for eosio::chain_plugin:
code cache
--eos-vm-oc-compile-threads arg (=1) Number of threads to use for EOS VM OC
tier-up
--eos-vm-oc-enable arg (=auto) Enable EOS VM OC tier-up runtime
('auto', 'all', 'none').
'auto' - EOS VM OC tier-up is enabled
for eosio.* accounts, read-only trxs,
and applying blocks.
'all' - EOS VM OC tier-up is enabled
for all contract execution.
'none' - EOS VM OC tier-up is
completely disabled.
--eos-vm-oc-enable Enable EOS VM OC tier-up runtime
--enable-account-queries arg (=0) enable queries to find accounts by
various metadata.
--max-nonprivileged-inline-action-size arg (=4096)
maximum allowed size (in bytes) of an
inline action for a nonprivileged
account
--transaction-retry-max-storage-size-gb arg
Maximum size (in GiB) allowed to be
allocated for the Transaction Retry
feature. Setting above 0 enables this
feature.
--transaction-retry-interval-sec arg (=20)
How often, in seconds, to resend an
incoming transaction to network if not
How often, in seconds, to resend an
incoming transaction to network if not
seen in a block.
Needs to be at least twice as large as
p2p-dedup-cache-expire-time-sec.
--transaction-retry-max-expiration-sec arg (=120)
Maximum allowed transaction expiration
for retry transactions, will retry
Maximum allowed transaction expiration
for retry transactions, will retry
transactions up to this value.
Should be larger than
transaction-retry-interval-sec.
--transaction-finality-status-max-storage-size-gb arg
Maximum size (in GiB) allowed to be
allocated for the Transaction Finality
@@ -4,84 +4,87 @@ content_title: Block Production Explained
For simplicity of the explanation let's consider the following notations:
* `r` = `producer_repetitions = 12` (hard-coded value)
* `m` = `max_block_cpu_usage` (on-chain consensus value)
* `u` = `max_block_net_usage` (on-chain consensus value)
* `t` = `block-time`
* `e` = `produce-block-offset-ms` (nodeos configuration)
* `w` = `block-time-interval = 500ms` (hard-coded value)
* `a` = `produce-block-early-amount = w - (w - (e / r)) = e / r ms` (how much to release each block of round early by)
* `l` = `produce-block-time = t - a`
* `p` = `produce block time window = w - a` (amount of wall clock time to produce a block)
* `c` = `billed_cpu_in_block = minimum(m, w - a)`
* `n` = `network tcp/ip latency`
* `h` = `block header validation time ms`
m = max_block_cpu_usage
Peer validation for similar hardware/version/config will be <= `m`
t = block-time
**Let's consider the example of the following two BPs and their network topology as depicted in the below diagram**
e = last-block-cpu-effort-percent
```
+------+ +------+ +------+ +------+
-->| BP-A |---->| BP-A |------>| BP-B |---->| BP-B |
+------+ | Peer | | Peer | +------+
+------+ +------+
w = block_time_interval = 500ms
a = produce-block-early-amount = (w - w*e/100) ms
p = produce-block-time; p = t - a
c = billed_cpu_in_block = minimum(m, w - a)
n = network tcp/ip latency
peer validation for similar hardware/eosio-version/config will be <= m
**Let's consider for exemplification the following four BPs and their network topology as depicted in below diagram**
```dot-svg
#p2p_local_chain_prunning.dot - local chain prunning
#
#notes: * to see image copy/paste to https://dreampuf.github.io/GraphvizOnline
# * image will be rendered by gatsby-remark-graphviz plugin in eosio docs.
digraph {
newrank=true #allows ranks inside subgraphs (important!)
compound=true #allows edges connecting nodes with subgraphs
graph [rankdir=LR]
node [style=filled, fillcolor=lightgray, shape=square, fixedsize=true, width=.55, fontsize=10]
edge [dir=both, arrowsize=.6, weight=100]
splines=false
subgraph cluster_chain {
label="Block Producers Peers"; labelloc="b"
graph [color=invis]
b0 [label="...", color=invis, style=""]
b1 [label="BP-A"]; b2 [label="BP-A\nPeer"]; b3 [label="BP-B\nPeer"]; b4 [label="BP-B"]
b5 [label="...", color=invis, style=""]
b0 -> b1 -> b2 -> b3 -> b4 -> b5
} //cluster_chain
} //digraph
```
`BP-A` will send block at `l` and, `BP-B` needs block at time `t` or otherwise will drop it.
`BP-A` will send block at `p` and,
`BP-B` needs block at time `t` or otherwise will drop it.
If `BP-A`is producing 12 blocks as follows `b(lock) at t(ime) 1`, `bt 1.5`, `bt 2`, `bt 2.5`, `bt 3`, `bt 3.5`, `bt 4`, `bt 4.5`, `bt 5`, `bt 5.5`, `bt 6`, `bt 6.5` then `BP-B` needs `bt 6.5` by time `6.5` so it has `.5` to produce `bt 7`.
Please notice that the time of `bt 7` minus `.5` equals the time of `bt 6.5` therefore time `t` is the last block time of `BP-A` and when `BP-B` needs to start its first block.
A block is produced and sent when either it reaches `m` or `u` or `p`.
## Example 1
`BP-A` has 50% e, m = 200ms, c = 200ms, n = 0ms, a = 250ms:
`BP-A` sends at (t-250ms) <-> `BP-A-Peer` processes for 200ms and sends at (t - 50ms) <-> `BP-B-Peer` processes for 200ms and sends at (t + 150ms) <-> arrive at `BP-B` 150ms too late.
Starting in Leap 4.0, blocks are propagated after block header validation. This means instead of `BP-A Peer` & `BP-B Peer` taking `m` time to validate and forward a block it only takes a small number of milliseconds to verify the block header and then forward the block.
## Example 2
`BP-A` has 40% e and m = 200ms, c = 200ms, n = 0ms, a = 300ms:
(t-300ms) <-> (+200ms) <-> (+200ms) <-> arrive at `BP-B` 100ms too late.
Starting in Leap 5.0, blocks in a round are started immediately after the completion of the previous block. Before 5.0, blocks were always started on `w` intervals and a node would "sleep" between blocks if needed. In 5.0, the "sleeps" are all moved to the end of the block production round.
## Example 3
`BP-A` has 30% e and m = 200ms, c = 150ms, n = 0ms, a = 350ms:
(t-350ms) <-> (+150ms) <-> (+150ms) <-> arrive at `BP-B` with 50ms to spare.
## Example 1: block arrives 110ms early
* Assuming zero network latency between all nodes.
* Assuming blocks do not reach `m` and therefore take `w - a` time to produce.
* Assume block completion including signing takes zero time.
* `BP-A` has e = 120, n = 0ms, h = 5ms, a = 10ms
* `BP-A` sends b1 at `t1-10ms` => `BP-A-Peer` processes `h=5ms`, sends at `t-5ms` => `BP-B-Peer` processes `h=5ms`, sends at `t-0ms` => arrives at `BP-B` at `t`.
* `BP-A` starts b2 at `t1-10ms`, sends b2 at `t2-20ms` => `BP-A-Peer` processes `h=5ms`, sends at `t2-15ms` => `BP-B-Peer` processes `h=5ms`, sends at `t2-10ms` => arrives at `BP-B` at `t2-10ms`.
* `BP-A` starts b3 at `t2-20ms`, ...
* `BP-A` starts b12 at `t11-110ms`, sends b12 at `t12-120ms` => `BP-A-Peer` processes `h=5ms`, sends at `t12-115ms` => `BP-B-Peer` processes `h=5ms`, sends at `t12-110ms` => arrives at `BP-B` at `t12-110ms`
## Example 4
`BP-A` has 25% e and m = 200ms, c = 125ms, n = 0ms, a = 375ms:
(t-375ms) <-> (+125ms) <-> (+125ms) <-> arrive at `BP-B` with 125ms to spare.
## Example 2: block arrives 80ms early
* Assuming zero network latency between `BP-A` & `BP-A Peer` and between `BP-B Peer` & `BP-B`.
* Assuming 150ms network latency between `BP-A Peer` & `BP-B Peer`.
* Assuming blocks do not reach `m` and therefore take `w - a` time to produce.
* Assume block completion including signing takes zero time.
* `BP-A` has e = 240, n = 0ms/150ms, h = 5ms, a = 20ms
* `BP-A` sends b1 at `t1-20ms` => `BP-A-Peer` processes `h=5ms`, sends at `t-15ms` =(150ms)> `BP-B-Peer` processes `h=5ms`, sends at `t+140ms` => arrives at `BP-B` at `t+140ms`.
* `BP-A` starts b2 at `t1-20ms`, sends b2 at `t2-40ms` => `BP-A-Peer` processes `h=5ms`, sends at `t2-35ms` =(150ms)> `BP-B-Peer` processes `h=5ms`, sends at `t2+120ms` => arrives at `BP-B` at `t2+120ms`.
* `BP-A` starts b3 at `t2-40ms`, ...
* `BP-A` starts b12 at `t11-220ms`, sends b12 at `t12-240ms` => `BP-A-Peer` processes `h=5ms`, sends at `t12-235ms` =(150ms)> `BP-B-Peer` processes `h=5ms`, sends at `t12-80ms` => arrives at `BP-B` at `t12-80ms`
## Example 5
`BP-A` has 10% e and m = 200ms, c = 50ms, n = 0ms, a = 450ms:
(t-450ms) <-> (+50ms) <-> (+50ms) <-> arrive at `BP-B` with 350ms to spare.
## Example 3: block arrives 16ms late and is dropped
* Assuming zero network latency between `BP-A` & `BP-A Peer` and between `BP-B Peer` & `BP-B`.
* Assuming 200ms network latency between `BP-A Peer` & `BP-B Peer`.
* Assuming blocks do not reach `m` and therefore take `w - a` time to produce.
* Assume block completion including signing takes zero time.
* `BP-A` has e = 204, n = 0ms/200ms, h = 10ms, a = 17ms
* `BP-A` sends b1 at `t1-17ms` => `BP-A-Peer` processes `h=10ms`, sends at `t-7ms` =(200ms)> `BP-B-Peer` processes `h=10ms`, sends at `t+203ms` => arrives at `BP-B` at `t+203ms`.
* `BP-A` starts b2 at `t1-17ms`, sends b2 at `t2-34ms` => `BP-A-Peer` processes `h=10ms`, sends at `t2-24ms` =(200ms)> `BP-B-Peer` processes `h=10ms`, sends at `t2+186ms` => arrives at `BP-B` at `t2+186ms`.
* `BP-A` starts b3 at `t2-34ms`, ...
* `BP-A` starts b12 at `t11-187ms`, sends b12 at `t12-204ms` => `BP-A-Peer` processes `h=10ms`, sends at `t12-194ms` =(200ms)> `BP-B-Peer` processes `h=10ms`, sends at `t12+16ms` => arrives at `BP-B` at `t12+16ms`
## Example 4: full blocks are produced early
* Assuming zero network latency between `BP-A` & `BP-A Peer` and between `BP-B Peer` & `BP-B`.
* Assuming 200ms network latency between `BP-A Peer` & `BP-B Peer`.
* Assume all blocks are full as there are enough queued up unapplied transactions ready to fill all blocks.
* Assume a block can be produced with 200ms worth of transactions in 225ms worth of time. There is overhead for producing the block.
* `BP-A` has e = 120, m = 200ms, n = 0ms/200ms, h = 10ms, a = 10ms
* `BP-A` sends b1 at `t1-275s` => `BP-A-Peer` processes `h=10ms`, sends at `t-265ms` =(200ms)> `BP-B-Peer` processes `h=10ms`, sends at `t-55ms` => arrives at `BP-B` at `t-55ms`.
* `BP-A` starts b2 at `t1-275ms`, sends b2 at `t2-550ms (t1-50ms)` => `BP-A-Peer` processes `h=10ms`, sends at `t2-540ms` =(200ms)> `BP-B-Peer` processes `h=10ms`, sends at `t2-330ms` => arrives at `BP-B` at `t2-330ms`.
* `BP-A` starts b3 at `t2-550ms`, ...
* `BP-A` starts b12 at `t11-3025ms`, sends b12 at `t12-3300ms` => `BP-A-Peer` processes `h=10ms`, sends at `t12-3290ms` =(200ms)> `BP-B-Peer` processes `h=10ms`, sends at `t12-3080ms` => arrives at `BP-B` at `t12-3080ms`
## Example 6
`BP-A` has 10% e and m = 200ms, c = 50ms, n = 15ms, a = 450ms:
(t-450ms) <- +15ms -> (+50ms) <- +15ms -> (+50ms) <- +15ms -> `BP-B` <-> arrive with 305ms to spare.
## Example 7
Example world-wide network:`BP-A`has 10% e and m = 200ms, c = 50ms, n = 15ms/250ms, a = 450ms:
(t-450ms) <- +15ms -> (+50ms) <- +250ms -> (+50ms) <- +15ms -> `BP-B` <-> arrive with 70ms to spare.
Running wasm-runtime=eos-vm-jit eos-vm-oc-enable on relay node will reduce the validation time.
@@ -27,11 +27,10 @@ Config Options for eosio::producer_plugin:
chain is stale.
-x [ --pause-on-startup ] Start this node in a state where
production is paused
--max-transaction-time arg (=499) Setting this value (in milliseconds)
will restrict the allowed transaction
execution time to a value potentially
lower than the on-chain consensus
max_transaction_cpu_usage value.
--max-transaction-time arg (=30) Limits the maximum time (in
milliseconds) that is allowed a pushed
transaction's code to execute before
being considered invalid
--max-irreversible-block-age arg (=-1)
Limits the maximum age (in seconds) of
the DPOS Irreversible Block for a chain
@@ -72,9 +71,20 @@ Config Options for eosio::producer_plugin:
can extend during low usage (only
enforced subjectively; use 1000 to not
enforce any limit)
--produce-block-offset-ms arg (=450) The minimum time to reserve at the end
of a production round for blocks to
propagate to the next block producer.
--produce-time-offset-us arg (=0) Offset of non last block producing time
in microseconds. Valid range 0 ..
-block_time_interval.
--last-block-time-offset-us arg (=-200000)
Offset of last block producing time in
microseconds. Valid range 0 ..
-block_time_interval.
--cpu-effort-percent arg (=80) Percentage of cpu block production time
used to produce block. Whole number
percentages, e.g. 80 for 80%
--last-block-cpu-effort-percent arg (=80)
Percentage of cpu block production time
used to produce last block. Whole
number percentages, e.g. 80 for 80%
--max-block-cpu-usage-threshold-us arg (=5000)
Threshold of CPU block production to
consider block full; when within
@@ -85,6 +95,13 @@ Config Options for eosio::producer_plugin:
consider block full; when within
threshold of max-block-net-usage block
can be produced immediately
--max-scheduled-transaction-time-per-block-ms arg (=100)
Maximum wall-clock time, in
milliseconds, spent retiring scheduled
transactions (and incoming transactions
according to incoming-defer-ratio) in
any block before returning to normal
transaction processing.
--subjective-cpu-leeway-us arg (=31000)
Time in microseconds allowed for a
transaction that starts with
@@ -97,11 +114,16 @@ Config Options for eosio::producer_plugin:
--subjective-account-decay-time-minutes arg (=1440)
Sets the time to return full subjective
cpu for accounts
--incoming-defer-ratio arg (=1) ratio between incoming transactions and
deferred transactions when both are
queued for execution
--incoming-transaction-queue-size-mb arg (=1024)
Maximum size (in MiB) of the incoming
transaction queue. Exceeding this value
will subjectively drop transaction with
resource exhaustion.
--disable-subjective-billing arg (=1) Disable subjective CPU billing for
API/P2P transactions
--disable-subjective-account-billing arg
Account which is excluded from
subjective CPU billing
@@ -111,6 +133,8 @@ Config Options for eosio::producer_plugin:
--disable-subjective-api-billing arg (=1)
Disable subjective CPU billing for API
transactions
--producer-threads arg (=2) Number of worker threads in producer
thread pool
--snapshots-dir arg (="snapshots") the location of the snapshots directory
(absolute path or relative to
application data dir)
@@ -120,6 +144,21 @@ Config Options for eosio::producer_plugin:
* [`chain_plugin`](../chain_plugin/index.md)
## The priority of transaction
You can give one of the transaction types priority over another when the producer plugin has a queue of transactions pending.
The option below sets the ratio between the incoming transaction and the deferred transaction:
```console
--incoming-defer-ratio arg (=1)
```
By default value of `1`, the `producer` plugin processes one incoming transaction per deferred transaction. When `arg` sets to `10`, the `producer` plugin processes 10 incoming transactions per deferred transaction.
If the `arg` is set to a sufficiently large number, the plugin always processes the incoming transaction first until the queue of the incoming transactions is empty. Respectively, if the `arg` is 0, the `producer` plugin processes the deferred transactions queue first.
### Load Dependency Examples
```console
@@ -51,6 +51,23 @@ Config Options for eosio::state_history_plugin:
number of most recent blocks
```
## Examples
## Dependencies
* [`chain_plugin`](../chain_plugin/index.md)
### Load Dependency Examples
```console
# config.ini
plugin = eosio::chain_plugin --disable-replay-opts
```
```sh
# command-line
nodeos ... --plugin eosio::chain_plugin --disable-replay-opts
```
## How-To Guides
* [How to fast start without history on existing chains](10_how-to-fast-start-without-old-history.md)
@@ -29,7 +29,6 @@ The `nodeos` service can be run in different "read" modes. These modes control h
- `head`: this only includes the side effects of confirmed transactions, this mode processes unconfirmed transactions but does not include them.
- `irreversible`: this mode also includes confirmed transactions only up to those included in the last irreversible block.
- `speculative`: this includes the side effects of confirmed and unconfirmed transactions.
A transaction is considered confirmed when a `nodeos` instance has received, processed, and written it to a block on the blockchain, i.e. it is in the head block or an earlier block.
@@ -45,16 +44,6 @@ When `nodeos` is configured to be in irreversible read mode, it will still track
Clients such as `cleos` and the RPC API will see database state as of the current head block of the chain. It **will not** include changes made by transactions known to this node but not included in the chain, such as unconfirmed transactions.
### Speculative Mode ( Deprecated )
Clients such as `cleos` and the RPC API, will see database state as of the current head block plus changes made by all transactions known to this node but potentially not included in the chain, unconfirmed transactions for example.
Speculative mode is low latency but fragile, there is no guarantee that the transactions reflected in the state will be included in the chain OR that they will reflected in the same order the state implies.
This mode features the lowest latency, but is the least consistent.
In speculative mode `nodeos` is able to execute transactions which have TaPoS (Transaction as Proof of Stake) pointing to any valid block in a fork considered to be the best fork by this node.
## How To Specify the Read Mode
The mode in which `nodeos` is run can be specified using the `--read-mode` option from the `eosio::chain_plugin`.
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File

Some files were not shown because too many files have changed in this diff Show More