Speed up development (#303)

* [ci] Extract setup of nimbus build system into separate file

* [ci] Cleanup NodeJS setup

* [ci] Use amd64 by default

* [ci] Separate steps for unit, contract and integration tests

* [ci] Separate build job for coverage that is allowed to fail

* [ci] Separate build job for Nim 1.2

* [ci] Calculate coverage on unit tests only

This enables faster development cycles at
the expense of code coverage accuracy.

* [PoR] Test proofs of retrievability with a small block size

To get a reasonable test execution time.

* [ci] Set NIM_COMMIT environment variable

To prevent subsequent `make` command to build a
different version of Nim.

* [ci] Checkout submodules recursively

So that nimbus-build-system doesn't have to
do it afterwards.

* [ci] Update caches on every run

Will automatically update caches when a new minor version
of Nim is released.

See also:
https://github.com/actions/cache/blob/main/workarounds.md#update-a-cache

* [ci] Set cache_nonce for all jobs, not just those in the matrix

* [build] update to latest nimbus-build-system

Requires an update to latest nim-nat-traversal

* [erasure] Test erasure coding with a small block size

To get a reasonable test execution time.

* [erasure] fix typo

* [PoR] Test PoR store with a small block size

To get a reasonable test execution time.

* [PoR] Test PoR network with a small block size

To get a reasonable test execution time.

* [ci] Ensure that unit tests are not dependent on Ethereum

Start Ethereum node *after* the unit tests are run.

* [ci] Cancel all other jobs when one fails

Allows for faster feedback loops; a next attempt to run
the CI will start sooner.
This commit is contained in:
markspanbroek 2022-11-14 08:50:00 -05:00 committed by GitHub
parent 4175689745
commit ccf3d04dc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 252 additions and 207 deletions

View File

@ -0,0 +1,169 @@
# Adapted from:
# https://github.com/status-im/nimbus-eth2/blob/stable/.github/workflows/ci.yml
name: Setup Nimbus Build System
inputs:
os:
description: "Operating system to build for"
required: true
cpu:
description: "CPU to build for"
default: "amd64"
nim_branch:
description: "Nim version"
default: "version-1-6"
shell:
description: "Shell to run commands in"
default: "bash --noprofile --norc -e -o pipefail"
runs:
using: "composite"
steps:
- name: APT (Linux amd64)
if: inputs.os == 'linux' && inputs.cpu == 'amd64'
shell: ${{ inputs.shell }} {0}
run: |
sudo apt-fast update -qq
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \
--no-install-recommends -yq lcov
- name: APT (Linux i386)
if: inputs.os == 'linux' && inputs.cpu == 'i386'
shell: ${{ inputs.shell }} {0}
run: |
sudo dpkg --add-architecture i386
sudo apt-fast update -qq
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \
--no-install-recommends -yq gcc-multilib g++-multilib
- name: Homebrew (macOS)
if: inputs.os == 'macos'
shell: ${{ inputs.shell }} {0}
run: |
brew install libomp
- name: MSYS2 (Windows amd64)
if: inputs.os == 'windows' && inputs.cpu == 'amd64'
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
install: >
base-devel
git
mingw-w64-ucrt-x86_64-toolchain
mingw-w64-ucrt-x86_64-cmake
mingw-w64-ucrt-x86_64-ntldd-git
- name: MSYS2 (Windows i386)
if: inputs.os == 'windows' && inputs.cpu == 'i386'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW32
install: >
base-devel
git
mingw-w64-i686-toolchain
mingw-w64-i686-cmake
mingw-w64-i686-ntldd-git
- name: Derive environment variables
shell: ${{ inputs.shell }} {0}
run: |
quote () {
local quoted=${1//\'/\'\\\'\'};
printf "'%s'" "$quoted"
}
if [[ '${{ inputs.cpu }}' == 'amd64' ]]; then
PLATFORM=x64
else
PLATFORM=x86
fi
echo "PLATFORM=${PLATFORM}" >> ${GITHUB_ENV}
# Stack usage on Linux amd64
if [[ '${{ inputs.os }}' == 'linux' && '${{ inputs.cpu }}' == 'amd64' ]]; then
NIMFLAGS="${NIMFLAGS} -d:limitStackUsage"
echo "NIMFLAGS=${NIMFLAGS}" >> $GITHUB_ENV
fi
# Disable ADX on Linux i386
if [[ '${{ inputs.os }}' == 'linux' && '${{ inputs.cpu }}' == 'i386' ]]; then
CFLAGS="${CFLAGS} -m32 -mno-adx"
echo "CFLAGS=${CFLAGS}" >> ${GITHUB_ENV}
CXXFLAGS="${CXXFLAGS} -m32 -mno-adx"
echo "CXXFLAGS=${CXXFLAGS}" >> ${GITHUB_ENV}
mkdir -p external/bin
cat << EOF > external/bin/gcc
#!/bin/bash
exec $(which gcc) -m32 -mno-adx "\$@"
EOF
cat << EOF > external/bin/g++
#!/bin/bash
exec $(which g++) -m32 -mno-adx "\$@"
EOF
chmod 755 external/bin/gcc external/bin/g++
echo "$(pwd)/external/bin" >> ${GITHUB_PATH}
# --passC:'-m32 -mno-adx' is redundant but harmless, and can be
# helpful when reviewing build output with increased verbosity
NIMFLAGS="${NIMFLAGS} $(quote "--passC:'-m32 -mno-adx' -d:LeopardCmakeFlags='-DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=$(pwd)/external/bin/gcc -DCMAKE_CXX_COMPILER=$(pwd)/external/bin/g++'")"
echo "NIMFLAGS=${NIMFLAGS}" >> $GITHUB_ENV
fi
# Disable ADX on Windows i386
if [[ '${{ inputs.os }}' == 'windows' && '${{ inputs.cpu }}' == 'i386' ]]; then
CFLAGS="${CFLAGS} -mno-adx"
echo "CFLAGS=${CFLAGS}" >> ${GITHUB_ENV}
CXXFLAGS="${CXXFLAGS} -mno-adx"
echo "CXXFLAGS=${CXXFLAGS}" >> ${GITHUB_ENV}
NIMFLAGS="${NIMFLAGS} --passC:-mno-adx"
echo "NIMFLAGS=${NIMFLAGS}" >> $GITHUB_ENV
fi
# Enable OpenMP on macOS
if [[ '${{ inputs.os }}' == 'macos' ]]; then
libomp_lib_dir="$(brew --prefix)/opt/libomp/lib"
# See https://github.com/actions/virtual-environments/pull/5819
llvm_dir="$(ls -d $(brew --prefix)/opt/llvm* | tail -1)"
llvm_bin_dir="${llvm_dir}/bin"
llvm_lib_dir="${llvm_dir}/lib"
echo "${llvm_bin_dir}" >> ${GITHUB_PATH}
echo "LDFLAGS=${LDFLAGS} -L${libomp_lib_dir} -L${llvm_lib_dir} -Wl,-rpath,${llvm_lib_dir}" >> ${GITHUB_ENV}
NIMFLAGS="${NIMFLAGS} $(quote "-d:LeopardCmakeFlags='-DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=${llvm_bin_dir}/clang -DCMAKE_CXX_COMPILER=${llvm_bin_dir}/clang++' -d:LeopardExtraCompilerlags='-fopenmp' -d:LeopardExtraLinkerFlags='-fopenmp -L${libomp_lib_dir}'")"
echo "NIMFLAGS=${NIMFLAGS}" >> $GITHUB_ENV
fi
# Use all available CPUs for build process
ncpu=""
case '${{ inputs.os }}' in
'linux')
ncpu=$(nproc)
;;
'macos')
ncpu=$(sysctl -n hw.ncpu)
;;
'windows')
ncpu=${NUMBER_OF_PROCESSORS}
;;
esac
[[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1
echo "ncpu=${ncpu}" >> ${GITHUB_ENV}
- name: Restore Nim toolchain binaries from cache
id: nim-cache
uses: actions/cache@v3
with:
path: NimBinaries
key: ${{ inputs.os }}-${{ inputs.cpu }}-nim-${{ inputs.nim_branch }}-cache-${{ env.cache_nonce }}-${{ github.run_id }}
restore-keys: ${{ inputs.os }}-${{ inputs.cpu }}-nim-${{ inputs.nim_branch }}-cache-${{ env.cache_nonce }}
- name: Set NIM_COMMIT
shell: ${{ inputs.shell }} {0}
run: echo "NIM_COMMIT=${{ inputs.nim_branch }}" >> ${GITHUB_ENV}
- name: Build Nim and Codex dependencies
shell: ${{ inputs.shell }} {0}
run: |
make -j${ncpu} CI_CACHE=NimBinaries ARCH_OVERRIDE=${PLATFORM} QUICK_AND_DIRTY_COMPILER=1 update
echo
./env.sh nim --version

View File

@ -1,6 +1,3 @@
# Adapted from:
# https://github.com/status-im/nimbus-eth2/blob/stable/.github/workflows/ci.yml
name: CI name: CI
on: on:
push: push:
@ -8,37 +5,21 @@ on:
- main - main
pull_request: pull_request:
workflow_dispatch: workflow_dispatch:
env:
cache_nonce: 0 # Allows for easily busting actions/cache caches
jobs: jobs:
build: build:
strategy: strategy:
fail-fast: false
matrix: matrix:
cache_nonce: [ 0 ] # Allows for easily busting actions/cache caches os: [linux, macos, windows]
target:
- os: linux
cpu: amd64
# - os: linux
# cpu: i386
- os: macos
cpu: amd64
- os: windows
cpu: amd64
# - os: windows
# cpu: i386
nim_branch: [version-1-2, version-1-6]
cov_branch: [version-1-6]
include: include:
- target: - os: linux
os: linux
builder: ubuntu-latest builder: ubuntu-latest
shell: bash --noprofile --norc -eo pipefail shell: bash --noprofile --norc -e -o pipefail
- target: - os: macos
os: macos
builder: macos-latest builder: macos-latest
shell: bash --noprofile --norc -eo pipefail shell: bash --noprofile --norc -e -o pipefail
- target: - os: windows
os: windows
builder: windows-latest builder: windows-latest
shell: msys2 shell: msys2
@ -46,191 +27,58 @@ jobs:
run: run:
shell: ${{ matrix.shell }} {0} shell: ${{ matrix.shell }} {0}
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (Nim ${{ matrix.nim_branch }})' name: '${{ matrix.os }}'
runs-on: ${{ matrix.builder }} runs-on: ${{ matrix.builder }}
timeout-minutes: 80 timeout-minutes: 80
steps: steps:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: APT (Linux amd64)
if: runner.os == 'Linux' && matrix.target.cpu == 'amd64'
run: |
sudo apt-fast update -qq
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \
--no-install-recommends -yq lcov
- name: APT (Linux i386)
if: runner.os == 'Linux' && matrix.target.cpu == 'i386'
run: |
sudo dpkg --add-architecture i386
sudo apt-fast update -qq
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \
--no-install-recommends -yq gcc-multilib g++-multilib
- name: Homebrew (macOS)
if: runner.os == 'macOS'
run: |
brew install libomp
- name: MSYS2 (Windows amd64)
if: runner.os == 'Windows' && matrix.target.cpu == 'amd64'
uses: msys2/setup-msys2@v2
with: with:
msystem: UCRT64 submodules: recursive
install: >
base-devel
git
mingw-w64-ucrt-x86_64-toolchain
mingw-w64-ucrt-x86_64-cmake
mingw-w64-ucrt-x86_64-ntldd-git
- name: MSYS2 (Windows i386) - name: Setup Nimbus Build System
if: runner.os == 'Windows' && matrix.target.cpu == 'i386' uses: ./.github/actions/nimbus-build-system
uses: msys2/setup-msys2@v2
with: with:
msystem: MINGW32 os: ${{ matrix.os }}
install: > shell: ${{ matrix.shell }}
base-devel
git
mingw-w64-i686-toolchain
mingw-w64-i686-cmake
mingw-w64-i686-ntldd-git
- name: Derive environment variables - name: Unit tests
run: | run: make -j${ncpu} test
quote () {
local quoted=${1//\'/\'\\\'\'};
printf "'%s'" "$quoted"
}
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then
PLATFORM=x64
else
PLATFORM=x86
fi
echo "PLATFORM=${PLATFORM}" >> ${GITHUB_ENV}
# Stack usage on Linux amd64
if [[ '${{ runner.os }}' == 'Linux' && '${{ matrix.target.cpu }}' == 'amd64' ]]; then
NIMFLAGS="${NIMFLAGS} -d:limitStackUsage"
echo "NIMFLAGS=${NIMFLAGS}" >> $GITHUB_ENV
fi
# Disable ADX on Linux i386
if [[ '${{ runner.os }}' == 'Linux' && '${{ matrix.target.cpu }}' == 'i386' ]]; then
CFLAGS="${CFLAGS} -m32 -mno-adx"
echo "CFLAGS=${CFLAGS}" >> ${GITHUB_ENV}
CXXFLAGS="${CXXFLAGS} -m32 -mno-adx"
echo "CXXFLAGS=${CXXFLAGS}" >> ${GITHUB_ENV}
mkdir -p external/bin
cat << EOF > external/bin/gcc
#!/bin/bash
exec $(which gcc) -m32 -mno-adx "\$@"
EOF
cat << EOF > external/bin/g++
#!/bin/bash
exec $(which g++) -m32 -mno-adx "\$@"
EOF
chmod 755 external/bin/gcc external/bin/g++
echo "$(pwd)/external/bin" >> ${GITHUB_PATH}
# --passC:'-m32 -mno-adx' is redundant but harmless, and can be
# helpful when reviewing build output with increased verbosity
NIMFLAGS="${NIMFLAGS} $(quote "--passC:'-m32 -mno-adx' -d:LeopardCmakeFlags='-DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=$(pwd)/external/bin/gcc -DCMAKE_CXX_COMPILER=$(pwd)/external/bin/g++'")"
echo "NIMFLAGS=${NIMFLAGS}" >> $GITHUB_ENV
fi
# Disable ADX on Windows i386
if [[ '${{ runner.os }}' == 'Windows' && '${{ matrix.target.cpu }}' == 'i386' ]]; then
CFLAGS="${CFLAGS} -mno-adx"
echo "CFLAGS=${CFLAGS}" >> ${GITHUB_ENV}
CXXFLAGS="${CXXFLAGS} -mno-adx"
echo "CXXFLAGS=${CXXFLAGS}" >> ${GITHUB_ENV}
NIMFLAGS="${NIMFLAGS} --passC:-mno-adx"
echo "NIMFLAGS=${NIMFLAGS}" >> $GITHUB_ENV
fi
# Enable OpenMP on macOS
if [[ '${{ runner.os }}' == 'macOS' ]]; then
libomp_lib_dir="$(brew --prefix)/opt/libomp/lib"
# See https://github.com/actions/virtual-environments/pull/5819
llvm_dir="$(ls -d $(brew --prefix)/opt/llvm* | tail -1)"
llvm_bin_dir="${llvm_dir}/bin"
llvm_lib_dir="${llvm_dir}/lib"
echo "${llvm_bin_dir}" >> ${GITHUB_PATH}
echo "LDFLAGS=${LDFLAGS} -L${libomp_lib_dir} -L${llvm_lib_dir} -Wl,-rpath,${llvm_lib_dir}" >> ${GITHUB_ENV}
NIMFLAGS="${NIMFLAGS} $(quote "-d:LeopardCmakeFlags='-DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=${llvm_bin_dir}/clang -DCMAKE_CXX_COMPILER=${llvm_bin_dir}/clang++' -d:LeopardExtraCompilerlags='-fopenmp' -d:LeopardExtraLinkerFlags='-fopenmp -L${libomp_lib_dir}'")"
echo "NIMFLAGS=${NIMFLAGS}" >> $GITHUB_ENV
fi
# Use all available CPUs for build process
ncpu=""
case '${{ runner.os }}' in
'Linux')
ncpu=$(nproc)
;;
'macOS')
ncpu=$(sysctl -n hw.ncpu)
;;
'Windows')
ncpu=${NUMBER_OF_PROCESSORS}
;;
esac
[[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1
echo "ncpu=${ncpu}" >> ${GITHUB_ENV}
- name: Restore Nim toolchain binaries from cache
id: nim-cache
uses: actions/cache@v3
with:
path: NimBinaries
key: ${{ matrix.target.os }}-${{ matrix.target.cpu }}-nim-${{ matrix.nim_branch }}-cache_nonce:${{ matrix.cache_nonce }}
- name: Build Nim and Codex dependencies
run: |
make -j${ncpu} CI_CACHE=NimBinaries NIM_COMMIT=${{ matrix.nim_branch }} ARCH_OVERRIDE=${PLATFORM} QUICK_AND_DIRTY_COMPILER=1 update
echo
./env.sh nim --version
# Rely on NodeJS LTS installed in GitHub Actions virtual environments
- name: Start Ethereum node with Codex contracts - name: Start Ethereum node with Codex contracts
working-directory: vendor/dagger-contracts working-directory: vendor/dagger-contracts
run: | run: |
if [[ '${{ runner.os }}' == 'Windows' ]]; then if [[ '${{ matrix.os }}' == 'windows' ]]; then
export PATH="/c/Program Files/nodejs:${PATH}" export PATH="${PATH}:/c/program files/nodejs"
export PATH="$(cygpath -u "$(npm --location=global prefix 2>/dev/null)"):${PATH}"
fi fi
echo node --version
node --version
echo npm --version
npm --version 2>/dev/null
echo
npm install npm install
npm start & npm start &
- name: Build and run Codex tests - name: Contract tests
run: | run: make -j${ncpu} testContracts
make -j${ncpu} NIM_COMMIT="${{ matrix.nim_branch }}" testAll
echo
if [[ '${{ runner.os }}' == macOS ]]; then
echo otool -L build/codex
otool -L build/codex
elif [[ '${{ runner.os }}' == 'Windows' ]]; then
echo ntldd build/codex
ntldd build/codex
else
echo ldd build/codex
ldd build/codex
fi
- name: Generate coverage data (Linux amd64, Nim ${{ matrix.cov_branch }}) - name: Integration tests
if: runner.os == 'Linux' && matrix.target.cpu == 'amd64' && matrix.nim_branch == matrix.cov_branch run: make -j${ncpu} testIntegration
run: |
rm -rf build nimcache
make -j${ncpu} NIM_COMMIT="${{ matrix.nim_branch }}" coverage
- name: Upload coverage data to Codecov (Linux amd64, Nim ${{ matrix.cov_branch }}) coverage:
if: runner.os == 'Linux' && matrix.target.cpu == 'amd64' && matrix.nim_branch == matrix.cov_branch continue-on-error: true
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Nimbus Build System
uses: ./.github/actions/nimbus-build-system
with:
os: linux
- name: Generate coverage data
run: make -j${ncpu} coverage
shell: bash
- name: Upload coverage data to Codecov
uses: codecov/codecov-action@v3 uses: codecov/codecov-action@v3
with: with:
directory: ./coverage/ directory: ./coverage/
@ -239,3 +87,20 @@ jobs:
flags: unittests flags: unittests
name: codecov-umbrella name: codecov-umbrella
verbose: true verbose: true
nim_1_2:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Nimbus Build System
uses: ./.github/actions/nimbus-build-system
with:
os: linux
nim_branch: version-1-2
- name: Unit tests
run: make -j${ncpu} test

View File

@ -81,9 +81,19 @@ test: | build deps
echo -e $(BUILD_MSG) "build/$@" && \ echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim test $(NIM_PARAMS) codex.nims $(ENV_SCRIPT) nim test $(NIM_PARAMS) codex.nims
# Builds and runs the smart contract tests
testContracts: | build deps
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim testContracts $(NIM_PARAMS) codex.nims
# Builds and runs the integration tests
testIntegration: | build deps
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim testIntegration $(NIM_PARAMS) codex.nims
# Builds and runs all tests # Builds and runs all tests
testAll: | build deps testAll: | build deps
echo -e $(BUILD_MSG) "build/testCodex" "build/testContracts" && \ echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim testAll $(NIM_PARAMS) codex.nims $(ENV_SCRIPT) nim testAll $(NIM_PARAMS) codex.nims
# Builds the codex binary # Builds the codex binary
@ -110,13 +120,10 @@ else
endif endif
coverage: coverage:
$(MAKE) NIMFLAGS="$(NIMFLAGS) --lineDir:on --passC:-fprofile-arcs --passC:-ftest-coverage --passL:-fprofile-arcs --passL:-ftest-coverage" testAll $(MAKE) NIMFLAGS="$(NIMFLAGS) --lineDir:on --passC:-fprofile-arcs --passC:-ftest-coverage --passL:-fprofile-arcs --passL:-ftest-coverage" test
cd nimcache/release/codex && rm -f *.c
cd nimcache/release/testCodex && rm -f *.c cd nimcache/release/testCodex && rm -f *.c
cd nimcache/release/testContracts && rm -f *.c
cd nimcache/release/testIntegration && rm -f *.c
mkdir -p coverage mkdir -p coverage
lcov --capture --directory nimcache/release/codex --directory nimcache/release/testCodex --directory nimcache/release/testContracts --directory nimcache/release/testIntegration --output-file coverage/coverage.info lcov --capture --directory nimcache/release/testCodex --output-file coverage/coverage.info
shopt -s globstar && ls $$(pwd)/codex/{*,**/*}.nim shopt -s globstar && ls $$(pwd)/codex/{*,**/*}.nim
shopt -s globstar && lcov --extract coverage/coverage.info $$(pwd)/codex/{*,**/*}.nim --output-file coverage/coverage.f.info shopt -s globstar && lcov --extract coverage/coverage.info $$(pwd)/codex/{*,**/*}.nim --output-file coverage/coverage.f.info
echo -e $(BUILD_MSG) "coverage/report/index.html" echo -e $(BUILD_MSG) "coverage/report/index.html"

View File

@ -21,6 +21,7 @@ import ../examples
import ../helpers import ../helpers
const const
BlockSize = 31 * 64
SectorSize = 31 SectorSize = 31
SectorsPerBlock = BlockSize div SectorSize SectorsPerBlock = BlockSize div SectorSize
DataSetSize = BlockSize * 100 DataSetSize = BlockSize * 100

View File

@ -14,6 +14,7 @@ import pkg/codex/blocktype as bt
import ../helpers import ../helpers
const const
BlockSize = 31 * 4
SectorSize = 31 SectorSize = 31
SectorsPerBlock = BlockSize div SectorSize SectorsPerBlock = BlockSize div SectorSize
DataSetSize = BlockSize * 100 DataSetSize = BlockSize * 100

View File

@ -12,6 +12,7 @@ import pkg/codex/blocktype as bt
import ../helpers import ../helpers
const const
BlockSize = 31 * 64
SectorSize = 31 SectorSize = 31
SectorsPerBlock = BlockSize div SectorSize SectorsPerBlock = BlockSize div SectorSize
DataSetSize = BlockSize * 100 DataSetSize = BlockSize * 100

View File

@ -16,6 +16,7 @@ import ./helpers
suite "Erasure encode/decode": suite "Erasure encode/decode":
const BlockSize = 1024
const dataSetSize = BlockSize * 123 # weird geometry const dataSetSize = BlockSize * 123 # weird geometry
var rng: Rng var rng: Rng
@ -53,7 +54,7 @@ suite "Erasure encode/decode":
return encoded return encoded
test "Should tolerate loosing M data blocks in a single random column": test "Should tolerate losing M data blocks in a single random column":
const const
buffers = 20 buffers = 20
parity = 10 parity = 10
@ -81,7 +82,7 @@ suite "Erasure encode/decode":
let present = await store.hasBlock(d) let present = await store.hasBlock(d)
check present.tryGet() check present.tryGet()
test "Should not tolerate loosing more than M data blocks in a single random column": test "Should not tolerate losing more than M data blocks in a single random column":
const const
buffers = 20 buffers = 20
parity = 10 parity = 10
@ -107,7 +108,7 @@ suite "Erasure encode/decode":
let present = await store.hasBlock(d) let present = await store.hasBlock(d)
check not present.tryGet() check not present.tryGet()
test "Should tolerate loosing M data blocks in M random columns": test "Should tolerate losing M data blocks in M random columns":
const const
buffers = 20 buffers = 20
parity = 10 parity = 10
@ -135,7 +136,7 @@ suite "Erasure encode/decode":
let present = await store.hasBlock(d) let present = await store.hasBlock(d)
check present.tryGet() check present.tryGet()
test "Should not tolerate loosing more than M data blocks in M random columns": test "Should not tolerate losing more than M data blocks in M random columns":
const const
buffers = 20 buffers = 20
parity = 10 parity = 10
@ -169,7 +170,7 @@ suite "Erasure encode/decode":
expect ResultFailure: expect ResultFailure:
decoded = (await erasure.decode(encoded)).tryGet() decoded = (await erasure.decode(encoded)).tryGet()
test "Should tolerate loosing M (a.k.a row) contiguous data blocks": test "Should tolerate losing M (a.k.a row) contiguous data blocks":
const const
buffers = 20 buffers = 20
parity = 10 parity = 10
@ -185,7 +186,7 @@ suite "Erasure encode/decode":
let present = await store.hasBlock(d) let present = await store.hasBlock(d)
check present.tryGet() check present.tryGet()
test "Should tolerate loosing M (a.k.a row) contiguous parity blocks": test "Should tolerate losing M (a.k.a row) contiguous parity blocks":
const const
buffers = 20 buffers = 20
parity = 10 parity = 10

@ -1 +1 @@
Subproject commit 8994b67b07813955c61bebddf4bd2325439c3535 Subproject commit 27d314d65c9078924b3239fe4e2f5af0c512b28c

@ -1 +1 @@
Subproject commit daff2b46700894a1771241dafcf26ee31bb2fdf5 Subproject commit dc535cd4627e6c1ec023ee6d6d0c3e5d66d414e5