Compare commits
319 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| efd3086af2 | |||
| 30f69ec758 | |||
| c673e984b0 | |||
| a8d48d4060 | |||
| 0c6ea09caf | |||
| edbaedb989 | |||
| 28f8ac1704 | |||
| c5543ffbc0 | |||
| f4227f6179 | |||
| 5dc9667ddf | |||
| f8e297943f | |||
| 5889037854 | |||
| 94bee32151 | |||
| 631b3bf914 | |||
| d0874b1011 | |||
| 66f1d6184a | |||
| 88266e4a79 | |||
| 6d84717e3e | |||
| 3b1f748bb9 | |||
| e288d80030 | |||
| bf24a0c9f5 | |||
| 173d4077d2 | |||
| 8939ff9b0f | |||
| 60e0ad1ec2 | |||
| d5df14df11 | |||
| 57338c0979 | |||
| 44fdec7885 | |||
| 81afb58554 | |||
| 94749d14d4 | |||
| 294fa457f5 | |||
| efd953406a | |||
| 3b83c1b835 | |||
| d198de9ce6 | |||
| bb462ef789 | |||
| 90ce207393 | |||
| ced3542da5 | |||
| 17aada579e | |||
| 908cc0e516 | |||
| c0a20305d0 | |||
| 3a95707e6f | |||
| 26b8e59066 | |||
| b8b0e75513 | |||
| 472ccc3929 | |||
| b16ed1de3b | |||
| 167f9216be | |||
| 1a9de428cb | |||
| 2f201f4590 | |||
| 0c203a7c14 | |||
| 873c2b9dc1 | |||
| 24b23ab3b9 | |||
| ef9ea24769 | |||
| 6ee33c23e4 | |||
| 2001477110 | |||
| 36ff69f941 | |||
| 4ce9a8ce60 | |||
| fad7891100 | |||
| 5cce2cc12f | |||
| 60781e26d4 | |||
| 81f016bbfc | |||
| 6df8582f1a | |||
| 3011a2b2c5 | |||
| 5153211f6e | |||
| 4186f5e4b8 | |||
| 70129af847 | |||
| bf1f40a4f5 | |||
| 78d04774d8 | |||
| b99e842e93 | |||
| d1fd865c35 | |||
| ab8fdf7e57 | |||
| ce68373277 | |||
| b4992ab037 | |||
| 62e5800b67 | |||
| d491f6adef | |||
| 16cd06db1c | |||
| 9dfeb086ba | |||
| 56b52a1aa5 | |||
| de8e62584e | |||
| 2d92aa9480 | |||
| 957e24fd48 | |||
| e0da4671a7 | |||
| eaeaf4ab3d | |||
| bed1ac996e | |||
| ba983dba2a | |||
| c0efca0617 | |||
| dd3e6e01b1 | |||
| dfbc9cda6d | |||
| 55d9bb551c | |||
| fcafd0cb1f | |||
| 9c8e0d0e76 | |||
| 2599b8d0d9 | |||
| 1f0b40f1aa | |||
| cd5a76f49f | |||
| de0756acce | |||
| 2bbcdae2f6 | |||
| 61176512ef | |||
| 6cccdfa98c | |||
| 847d114e62 | |||
| 287a6e799a | |||
| 27cb589ad9 | |||
| 0da59704a6 | |||
| 4c8f1fd39f | |||
| 05099f957a | |||
| d5af1838fb | |||
| 57cbae4ed9 | |||
| 92b790b8e4 | |||
| 74cd5fabdc | |||
| e401c23f0e | |||
| 4449095716 | |||
| 0571a0a6c0 | |||
| 5c76188db3 | |||
| 86ea6b39e9 | |||
| c665605d5a | |||
| f2d077f70f | |||
| 68b2543557 | |||
| 5086dee55b | |||
| cb58bba324 | |||
| 0d4b6a7aaf | |||
| f1d2ff57ca | |||
| 31e631473b | |||
| dec785155c | |||
| fa87b159ed | |||
| 954ee42233 | |||
| 2c877bae80 | |||
| 5d87e004d7 | |||
| 511f6dbc69 | |||
| e592a4a584 | |||
| 239bb348d1 | |||
| b288dacd75 | |||
| 8827ce38a4 | |||
| 6393c07995 | |||
| efd6f0bd78 | |||
| 62ae11f75a | |||
| a73b5236e6 | |||
| 57fa42d816 | |||
| 1cc2fce50f | |||
| da1d88c069 | |||
| 885d8faba1 | |||
| b888d9a3b3 | |||
| a465ecebfa | |||
| bf4267ef1a | |||
| 58102971ea | |||
| 746cc81f29 | |||
| f12be2fdec | |||
| 893e0ab424 | |||
| c58668f3bb | |||
| 508ff97100 | |||
| 2bfddd467b | |||
| bf53b6334c | |||
| ced3887878 | |||
| 2c7a00408b | |||
| 6aae754d9c | |||
| 013ed37253 | |||
| 1a47912020 | |||
| 8aca9cbd17 | |||
| 8282cd5a90 | |||
| 79d74aca1b | |||
| 77d4029a12 | |||
| 89466843df | |||
| 04a831e77a | |||
| ea7e3a34ea | |||
| 25db760ad7 | |||
| 6c56cb823a | |||
| b7f969d699 | |||
| 3b57d5a258 | |||
| e06b19696b | |||
| 84f6fed4ba | |||
| 78aa0b1727 | |||
| 18d7287461 | |||
| cf24fe9cbf | |||
| 08e0f22643 | |||
| d351840a70 | |||
| 78c6c77c00 | |||
| 46582601ea | |||
| cdb4156702 | |||
| 642653a37f | |||
| 6544a1aacd | |||
| 3ef3e847cb | |||
| 296b797a39 | |||
| 43cfa0fe4c | |||
| 9718e52802 | |||
| 75ffc6b6f4 | |||
| 02ef7fc6c7 | |||
| f548d3698b | |||
| c7edfc6796 | |||
| 7a064a58ce | |||
| 471b08ef22 | |||
| 94378c4b4d | |||
| b316199f14 | |||
| 20b3fe654c | |||
| 9b49989ddc | |||
| b767da350e | |||
| dfbe904db7 | |||
| 5564e9c325 | |||
| 781aae4cbd | |||
| e3addf9da4 | |||
| b98a223b01 | |||
| 56f858d97a | |||
| b47f3f5635 | |||
| eaeaec0278 | |||
| 85cab27623 | |||
| 5c38a6d8d8 | |||
| e9d99f71f5 | |||
| 2aefa0d3c9 | |||
| 44ec05bfce | |||
| 86ca76dbf1 | |||
| b473d78aa0 | |||
| 58a772f677 | |||
| 04c625bcbf | |||
| 5074bea663 | |||
| f0427832a9 | |||
| 15472c4186 | |||
| f66af885ab | |||
| b189847825 | |||
| c0233fbc3c | |||
| 1911080876 | |||
| 134c448d3a | |||
| acc1a62ea1 | |||
| 4829bcf17a | |||
| 45e33e594b | |||
| cf70327975 | |||
| 7aa26d5dc3 | |||
| 3395c0dcaa | |||
| ddfe2b6bb0 | |||
| 8bef87fdd6 | |||
| 9f66b0b0e5 | |||
| ad84c3afa3 | |||
| 8cd2e11610 | |||
| 3220de9527 | |||
| 1cf95cf7c4 | |||
| bf115f72ae | |||
| d6b3efebe3 | |||
| b7bb2d3e94 | |||
| 758a033c63 | |||
| e7457c83ec | |||
| acd452e37b | |||
| b650d0aa13 | |||
| 88e6f0dd10 | |||
| 636c0f5855 | |||
| bdfba6720c | |||
| ac6fdb8ccd | |||
| 0b1c8ab293 | |||
| bfac689761 | |||
| 613627f4e9 | |||
| e56ea68db1 | |||
| 7175728e96 | |||
| 1f1ec234ad | |||
| c714f8b235 | |||
| a0747e7f91 | |||
| 623477958b | |||
| 474acaaf92 | |||
| 6bb5f503eb | |||
| 5c20fa3744 | |||
| 1710441d57 | |||
| ac0cf77f5a | |||
| e46a6386df | |||
| c489ba4c19 | |||
| be8f3c973c | |||
| cf4835170a | |||
| 06d6cf371d | |||
| c18ed8f63b | |||
| 78dc95e81e | |||
| 086ba23c0c | |||
| c325c1746e | |||
| f3d9591453 | |||
| 1364041fb6 | |||
| 48d55efe31 | |||
| 60969166db | |||
| 48caccb287 | |||
| fa6a9e1dad | |||
| fc9643125c | |||
| 3784516086 | |||
| 8bc082636e | |||
| 1a0d3ef5d5 | |||
| 54b7eac369 | |||
| 457b12da91 | |||
| 9fce462de5 | |||
| 39d2830104 | |||
| 9a6bb11bf9 | |||
| 76ab6ccdef | |||
| 04469894b6 | |||
| 539f8a5107 | |||
| 30736e9b0c | |||
| da60fe3ec5 | |||
| 3a63ac5ccd | |||
| 06ac1bcc8c | |||
| 2d03e6526c | |||
| 9c43225f4c | |||
| cbbe80dd07 | |||
| 705b54155b | |||
| f36e59e554 | |||
| b5c43e1c9b | |||
| 65f8b20b39 | |||
| 76e3e418f4 | |||
| a4bef57acd | |||
| 5290de022e | |||
| 7935ba8134 | |||
| 7c9d1bd73b | |||
| 782dfafd45 | |||
| d3e8c4ab55 | |||
| 9f4f9a76bf | |||
| ea86288f6a | |||
| 68827edfd6 | |||
| 95321fc44e | |||
| 1061b94501 | |||
| 97c19806d9 | |||
| 21cb19d8ef | |||
| c42b1b4334 | |||
| d961205788 | |||
| 92dc116c8e | |||
| 5fce72cb71 | |||
| 408afb5817 | |||
| c54d0c2716 | |||
| 2520099f7f | |||
| ea5ce7cc6d | |||
| aff122104e | |||
| 30c833f701 | |||
| 46445273ad | |||
| 1892a29891 | |||
| afa88ddaaf |
@@ -7,10 +7,13 @@ RUN apt-get update && apt-get upgrade -y && \
|
||||
g++-8 \
|
||||
git \
|
||||
jq \
|
||||
libcurl4-openssl-dev \
|
||||
libgmp-dev \
|
||||
libssl-dev \
|
||||
libusb-1.0-0-dev \
|
||||
llvm-7-dev \
|
||||
ninja-build \
|
||||
pkg-config \
|
||||
python3 \
|
||||
software-properties-common \
|
||||
zlib1g-dev \
|
||||
|
||||
@@ -7,8 +7,11 @@ RUN apt-get update && apt-get upgrade -y && \
|
||||
git \
|
||||
jq \
|
||||
libboost-all-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libgmp-dev \
|
||||
libssl-dev \
|
||||
libusb-1.0-0-dev \
|
||||
llvm-11-dev \
|
||||
ninja-build \
|
||||
pkg-config \
|
||||
zstd
|
||||
|
||||
@@ -7,8 +7,11 @@ RUN apt-get update && apt-get upgrade -y && \
|
||||
git \
|
||||
jq \
|
||||
libboost-all-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libgmp-dev \
|
||||
libssl-dev \
|
||||
libusb-1.0-0-dev \
|
||||
llvm-11-dev \
|
||||
ninja-build \
|
||||
pkg-config \
|
||||
zstd
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
name: 'Parallel ctest'
|
||||
description: 'Runs a set of labeled ctests in parallel via multiple docker containers'
|
||||
inputs:
|
||||
container:
|
||||
required: true
|
||||
error-log-paths:
|
||||
required: true
|
||||
log-tarball-prefix:
|
||||
required: true
|
||||
tests-label:
|
||||
required: true
|
||||
runs:
|
||||
using: 'node16'
|
||||
main: 'dist/index.mjs'
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,69 @@
|
||||
import child_process from 'node:child_process';
|
||||
import process from 'node:process';
|
||||
import stream from 'node:stream';
|
||||
import fs from 'node:fs';
|
||||
import zlib from 'node:zlib';
|
||||
import tar from 'tar-stream';
|
||||
import core from '@actions/core'
|
||||
|
||||
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});
|
||||
|
||||
try {
|
||||
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");
|
||||
|
||||
// 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);
|
||||
|
||||
let subprocesses = [];
|
||||
tests.forEach(t => {
|
||||
subprocesses.push(new Promise(resolve => {
|
||||
child_process.spawn("docker", ["run", "--name", t, "--init", "baseimage", "bash", "-c", `cd build; ctest --output-on-failure -R '^${t}$'`], {stdio:"inherit"}).on('close', code => resolve(code));
|
||||
}));
|
||||
});
|
||||
|
||||
const results = await Promise.all(subprocesses);
|
||||
|
||||
for(let i = 0; i < results.length; ++i) {
|
||||
if(results[i] === 0)
|
||||
continue;
|
||||
|
||||
//failing test
|
||||
core.setFailed("Some tests failed");
|
||||
|
||||
let extractor = tar.extract();
|
||||
let packer = tar.pack();
|
||||
|
||||
extractor.on('entry', (header, stream, next) => {
|
||||
if(!header.name.startsWith(`__w/leap/leap/build`)) {
|
||||
stream.on('end', () => next());
|
||||
stream.resume();
|
||||
return;
|
||||
}
|
||||
|
||||
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();
|
||||
return;
|
||||
}
|
||||
|
||||
stream.pipe(packer.entry(header, next));
|
||||
}).on('finish', () => {packer.finalize()});
|
||||
|
||||
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}`);
|
||||
}
|
||||
@@ -0,0 +1,351 @@
|
||||
{
|
||||
"name": "parallel-ctest-containers",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.9.1",
|
||||
"@vercel/ncc": "^0.34.0",
|
||||
"tar-stream": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/core": {
|
||||
"version": "1.9.1",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.9.1.tgz",
|
||||
"integrity": "sha512-5ad+U2YGrmmiw6du20AQW5XuWo7UKN2052FjSV7MX+Wfjf8sCqcsZe62NfgHys4QI4/Y+vQvLKYL8jWtA1ZBTA==",
|
||||
"dependencies": {
|
||||
"@actions/http-client": "^2.0.1",
|
||||
"uuid": "^8.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/http-client": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
|
||||
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
|
||||
"dependencies": {
|
||||
"tunnel": "^0.0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/@vercel/ncc": {
|
||||
"version": "0.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.34.0.tgz",
|
||||
"integrity": "sha512-G9h5ZLBJ/V57Ou9vz5hI8pda/YQX5HQszCs3AmIus3XzsmRn/0Ptic5otD3xVST8QLKk7AMk7AqpsyQGN7MZ9A==",
|
||||
"bin": {
|
||||
"ncc": "dist/ncc/cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/base64-js": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/bl": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
|
||||
"integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
|
||||
"dependencies": {
|
||||
"buffer": "^5.5.0",
|
||||
"inherits": "^2.0.4",
|
||||
"readable-stream": "^3.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/buffer": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
||||
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"base64-js": "^1.3.1",
|
||||
"ieee754": "^1.1.13"
|
||||
}
|
||||
},
|
||||
"node_modules/end-of-stream": {
|
||||
"version": "1.4.4",
|
||||
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
|
||||
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
|
||||
"dependencies": {
|
||||
"once": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/fs-constants": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
|
||||
"integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="
|
||||
},
|
||||
"node_modules/ieee754": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
||||
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"node_modules/once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
||||
"dependencies": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/readable-stream": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
"util-deprecate": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/string_decoder": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||
"dependencies": {
|
||||
"safe-buffer": "~5.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tar-stream": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
|
||||
"integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
|
||||
"dependencies": {
|
||||
"bl": "^4.0.3",
|
||||
"end-of-stream": "^1.4.1",
|
||||
"fs-constants": "^1.0.0",
|
||||
"inherits": "^2.0.3",
|
||||
"readable-stream": "^3.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/tunnel": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
|
||||
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==",
|
||||
"engines": {
|
||||
"node": ">=0.6.11 <=0.7.0 || >=0.7.3"
|
||||
}
|
||||
},
|
||||
"node_modules/util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
|
||||
},
|
||||
"node_modules/uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": {
|
||||
"version": "1.9.1",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.9.1.tgz",
|
||||
"integrity": "sha512-5ad+U2YGrmmiw6du20AQW5XuWo7UKN2052FjSV7MX+Wfjf8sCqcsZe62NfgHys4QI4/Y+vQvLKYL8jWtA1ZBTA==",
|
||||
"requires": {
|
||||
"@actions/http-client": "^2.0.1",
|
||||
"uuid": "^8.3.2"
|
||||
}
|
||||
},
|
||||
"@actions/http-client": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
|
||||
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
|
||||
"requires": {
|
||||
"tunnel": "^0.0.6"
|
||||
}
|
||||
},
|
||||
"@vercel/ncc": {
|
||||
"version": "0.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.34.0.tgz",
|
||||
"integrity": "sha512-G9h5ZLBJ/V57Ou9vz5hI8pda/YQX5HQszCs3AmIus3XzsmRn/0Ptic5otD3xVST8QLKk7AMk7AqpsyQGN7MZ9A=="
|
||||
},
|
||||
"base64-js": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
|
||||
},
|
||||
"bl": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
|
||||
"integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
|
||||
"requires": {
|
||||
"buffer": "^5.5.0",
|
||||
"inherits": "^2.0.4",
|
||||
"readable-stream": "^3.4.0"
|
||||
}
|
||||
},
|
||||
"buffer": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
||||
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
|
||||
"requires": {
|
||||
"base64-js": "^1.3.1",
|
||||
"ieee754": "^1.1.13"
|
||||
}
|
||||
},
|
||||
"end-of-stream": {
|
||||
"version": "1.4.4",
|
||||
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
|
||||
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
|
||||
"requires": {
|
||||
"once": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"fs-constants": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
|
||||
"integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="
|
||||
},
|
||||
"ieee754": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
||||
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
||||
"requires": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
"util-deprecate": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||
"requires": {
|
||||
"safe-buffer": "~5.2.0"
|
||||
}
|
||||
},
|
||||
"tar-stream": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
|
||||
"integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
|
||||
"requires": {
|
||||
"bl": "^4.0.3",
|
||||
"end-of-stream": "^1.4.1",
|
||||
"fs-constants": "^1.0.0",
|
||||
"inherits": "^2.0.3",
|
||||
"readable-stream": "^3.1.1"
|
||||
}
|
||||
},
|
||||
"tunnel": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
|
||||
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg=="
|
||||
},
|
||||
"util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
|
||||
},
|
||||
"uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.9.1",
|
||||
"@vercel/ncc": "^0.34.0",
|
||||
"tar-stream": "^2.2.0"
|
||||
}
|
||||
}
|
||||
@@ -7,13 +7,9 @@ on:
|
||||
- "release/*"
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
run-lr-tests:
|
||||
description: 'Run long running tests'
|
||||
type: boolean
|
||||
|
||||
permissions:
|
||||
packages: write
|
||||
packages: read
|
||||
contents: read
|
||||
|
||||
defaults:
|
||||
@@ -44,6 +40,9 @@ jobs:
|
||||
matrix:
|
||||
platform: ${{fromJSON(needs.d.outputs.missing-platforms)}}
|
||||
runs-on: ["self-hosted", "enf-x86-beefy"]
|
||||
permissions:
|
||||
packages: write
|
||||
contents: read
|
||||
steps:
|
||||
- name: Login to Container Registry
|
||||
uses: docker/login-action@v2
|
||||
@@ -65,8 +64,6 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [ubuntu18, ubuntu20, ubuntu22]
|
||||
outputs:
|
||||
lr-tests: ${{steps.build.outputs.lr-tests}}
|
||||
runs-on: ["self-hosted", "enf-x86-beefy"]
|
||||
container: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}
|
||||
steps:
|
||||
@@ -82,8 +79,6 @@ jobs:
|
||||
cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -GNinja ..
|
||||
ninja
|
||||
# the correct approach is by far "--show-only=json-v1 | jq '.tests[].name' | jq -sc" but that doesn't work on U18's cmake 3.10 since it lacks json-v1
|
||||
echo ::set-output name=lr-tests::$(ctest -L "long_running_tests" --show-only | head -n -1 | cut -d ':' -f 2 -s | jq -cnR '[inputs | select(length>0)[1:]]')
|
||||
tar -pc -C .. --exclude "*.o" build | zstd --long -T0 -9 > ../build.tar.zst
|
||||
- name: Upload builddir
|
||||
uses: AntelopeIO/upload-artifact-large-chunks-action@v1
|
||||
@@ -123,13 +118,11 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [ubuntu20]
|
||||
runs-on: ["self-hosted", "enf-x86-beefy"]
|
||||
platform: [ubuntu20, ubuntu22]
|
||||
runs-on: ["self-hosted", "enf-x86-hightier"]
|
||||
container: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Download builddir
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
@@ -138,6 +131,9 @@ jobs:
|
||||
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)"
|
||||
@@ -149,65 +145,56 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [ubuntu20]
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}
|
||||
options: --init
|
||||
platform: [ubuntu18, ubuntu20, ubuntu22]
|
||||
runs-on: ["self-hosted", "enf-x86-midtier"]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Download builddir
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{matrix.platform}}-build
|
||||
- name: Run NP Tests
|
||||
run: |
|
||||
zstdcat build.tar.zst | tar x
|
||||
cd build
|
||||
ctest --output-on-failure -L "nonparallelizable_tests"
|
||||
- name: Bundle logs from failed tests
|
||||
if: failure()
|
||||
run: tar -czf ${{matrix.platform}}-serial-logs.tar.gz build/var build/etc build/leap-ignition-wd
|
||||
- name: Run tests in parallel containers
|
||||
uses: ./.github/actions/parallel-ctest-containers
|
||||
with:
|
||||
container: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}
|
||||
error-log-paths: '["build/etc", "build/var", "build/leap-ignition-wd"]'
|
||||
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}}-serial-logs
|
||||
path: ${{matrix.platform}}-serial-logs.tar.gz
|
||||
name: ${{matrix.platform}}-np-logs
|
||||
path: '*-logs.tar.gz'
|
||||
|
||||
lr-tests:
|
||||
name: LR Tests
|
||||
needs: [d, Build]
|
||||
if: always() && needs.Build.result == 'success' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || inputs.run-lr-tests)
|
||||
if: always() && needs.Build.result == 'success'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [ubuntu20]
|
||||
test-name: ${{fromJSON(needs.Build.outputs.lr-tests)}}
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}
|
||||
options: --init
|
||||
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:
|
||||
name: ${{matrix.platform}}-build
|
||||
- name: Run ${{matrix.test-name}} Test
|
||||
run: |
|
||||
zstdcat build.tar.zst | tar x
|
||||
cd build
|
||||
ctest --output-on-failure -R ${{matrix.test-name}}
|
||||
- name: Bundle logs from failed tests
|
||||
if: failure()
|
||||
run: tar -czf ${{matrix.platform}}-${{matrix.test-name}}-logs.tar.gz build/var build/etc build/leap-ignition-wd
|
||||
- name: Upload logs from failed tests
|
||||
- name: Run tests in parallel containers
|
||||
uses: ./.github/actions/parallel-ctest-containers
|
||||
with:
|
||||
container: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}
|
||||
error-log-paths: '["build/etc", "build/var", "build/leap-ignition-wd"]'
|
||||
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}}-${{matrix.test-name}}-logs
|
||||
path: ${{matrix.platform}}-${{matrix.test-name}}-logs.tar.gz
|
||||
name: ${{matrix.platform}}-lr-logs
|
||||
path: '*-logs.tar.gz'
|
||||
|
||||
all-passing:
|
||||
name: All Required Tests Passed
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
name: Label New Issue
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: opened
|
||||
|
||||
jobs:
|
||||
label_new_issue:
|
||||
uses: AntelopeIO/issue-project-labeler-workflow/.github/workflows/issue-project-labeler.yaml@v1
|
||||
with:
|
||||
issue-id: ${{github.event.issue.node_id}}
|
||||
label: triage
|
||||
org-project: 'Team Backlog'
|
||||
project-field: Status=Todo
|
||||
secrets:
|
||||
token: ${{secrets.ENFCIBOT_REPO_AND_PROJECTS}}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*.abi.hpp
|
||||
*.cmake
|
||||
!.cicd
|
||||
!package.cmake
|
||||
!CMakeModules/*.cmake
|
||||
*.ninja
|
||||
\#*
|
||||
|
||||
+18
-6
@@ -7,15 +7,27 @@
|
||||
[submodule "libraries/eos-vm"]
|
||||
path = libraries/eos-vm
|
||||
url = https://github.com/AntelopeIO/eos-vm
|
||||
[submodule "libraries/fc"]
|
||||
path = libraries/fc
|
||||
url = https://github.com/AntelopeIO/fc
|
||||
[submodule "libraries/softfloat"]
|
||||
path = libraries/softfloat
|
||||
url = https://github.com/AntelopeIO/berkeley-softfloat-3
|
||||
[submodule "libraries/rapidjson"]
|
||||
path = libraries/rapidjson
|
||||
url = https://github.com/Tencent/rapidjson/
|
||||
[submodule "libraries/yubihsm"]
|
||||
path = libraries/yubihsm
|
||||
url = https://github.com/Yubico/yubihsm-shell
|
||||
[submodule "tests/abieos"]
|
||||
path = tests/abieos
|
||||
url = https://github.com/AntelopeIO/abieos
|
||||
[submodule "wasm-spec-tests"]
|
||||
path = wasm-spec-tests
|
||||
url = https://github.com/AntelopeIO/wasm-spec-tests
|
||||
[submodule "libraries/libfc/include/fc/crypto/webauthn_json"]
|
||||
path = libraries/libfc/include/fc/crypto/webauthn_json
|
||||
url = https://github.com/Tencent/rapidjson/
|
||||
[submodule "libraries/libfc/secp256k1/secp256k1"]
|
||||
path = libraries/libfc/secp256k1/secp256k1
|
||||
url = https://github.com/bitcoin-core/secp256k1
|
||||
[submodule "libraries/libfc/libraries/ff"]
|
||||
path = libraries/libfc/libraries/ff
|
||||
url = https://github.com/AntelopeIO/libff
|
||||
[submodule "libraries/prometheus-cpp"]
|
||||
path = libraries/prometheus-cpp
|
||||
url = https://github.com/jupp0r/prometheus-cpp.git
|
||||
|
||||
+22
-12
@@ -27,6 +27,7 @@ endif()
|
||||
set( CLI_CLIENT_EXECUTABLE_NAME cleos )
|
||||
set( NODE_EXECUTABLE_NAME nodeos )
|
||||
set( KEY_STORE_EXECUTABLE_NAME keosd )
|
||||
set( LEAP_UTIL_EXECUTABLE_NAME leap-util )
|
||||
|
||||
# http://stackoverflow.com/a/18369825
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
@@ -185,10 +186,6 @@ add_subdirectory( benchmark )
|
||||
|
||||
option(DISABLE_WASM_SPEC_TESTS "disable building of wasm spec unit tests" OFF)
|
||||
|
||||
if (NOT DISABLE_WASM_SPEC_TESTS)
|
||||
add_subdirectory( wasm-spec-tests/generated-tests )
|
||||
endif()
|
||||
|
||||
install(FILES testnet.template DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/eosio/launcher COMPONENT dev EXCLUDE_FROM_ALL)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testnet.template ${CMAKE_CURRENT_BINARY_DIR}/etc/eosio/launcher/testnet.template COPYONLY)
|
||||
|
||||
@@ -218,17 +215,27 @@ install(FILES ${CMAKE_BINARY_DIR}/modules/leap-config.cmake DESTINATION ${CMAKE_
|
||||
install(FILES ${CMAKE_BINARY_DIR}/modules/EosioTester.cmake DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/cmake/leap COMPONENT dev EXCLUDE_FROM_ALL)
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/CMakeModules/EosioCheckVersion.cmake DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/cmake/leap COMPONENT dev EXCLUDE_FROM_ALL)
|
||||
|
||||
configure_file(LICENSE licenses/leap/LICENSE COPYONLY)
|
||||
configure_file(libraries/softfloat/COPYING.txt licenses/leap/LICENSE.softfloat COPYONLY)
|
||||
configure_file(libraries/wasm-jit/LICENSE licenses/leap/LICENSE.wavm COPYONLY)
|
||||
configure_file(libraries/fc/secp256k1/secp256k1/COPYING licenses/leap/LICENSE.secp256k1 COPYONLY)
|
||||
configure_file(libraries/fc/include/fc/crypto/webauthn_json/license.txt licenses/leap/LICENSE.rapidjson COPYONLY)
|
||||
configure_file(libraries/fc/src/network/LICENSE.go licenses/leap/LICENSE.go COPYONLY)
|
||||
configure_file(libraries/eos-vm/LICENSE licenses/leap/LICENSE.eos-vm COPYONLY)
|
||||
configure_file(libraries/fc/libraries/ff/LICENSE licenses/leap/LICENSE.libff COPYONLY)
|
||||
configure_file(LICENSE licenses/leap/LICENSE COPYONLY)
|
||||
configure_file(libraries/softfloat/COPYING.txt licenses/leap/LICENSE.softfloat COPYONLY)
|
||||
configure_file(libraries/wasm-jit/LICENSE licenses/leap/LICENSE.wavm COPYONLY)
|
||||
configure_file(libraries/libfc/secp256k1/secp256k1/COPYING licenses/leap/LICENSE.secp256k1 COPYONLY)
|
||||
configure_file(libraries/libfc/include/fc/crypto/webauthn_json/license.txt licenses/leap/LICENSE.rapidjson COPYONLY)
|
||||
configure_file(libraries/libfc/src/network/LICENSE.go licenses/leap/LICENSE.go COPYONLY)
|
||||
configure_file(libraries/eos-vm/LICENSE licenses/leap/LICENSE.eos-vm COPYONLY)
|
||||
configure_file(libraries/libfc/libraries/ff/LICENSE licenses/leap/LICENSE.libff COPYONLY)
|
||||
configure_file(programs/cleos/LICENSE.CLI11 licenses/leap/LICENSE.CLI11 COPYONLY)
|
||||
configure_file(libraries/yubihsm/LICENSE licenses/leap/LICENSE.yubihsm COPYONLY)
|
||||
|
||||
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/licenses/leap" DESTINATION "${CMAKE_INSTALL_FULL_DATAROOTDIR}/licenses/" COMPONENT base)
|
||||
|
||||
configure_file(${CMAKE_SOURCE_DIR}/libraries/cli11/bash-completion/completions/leap-util
|
||||
${CMAKE_BINARY_DIR}/programs/leap-util/bash-completion/completions/leap-util COPYONLY)
|
||||
configure_file(${CMAKE_SOURCE_DIR}/libraries/cli11/bash-completion/completions/cleos
|
||||
${CMAKE_BINARY_DIR}/programs/cleos/bash-completion/completions/cleos COPYONLY)
|
||||
|
||||
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_custom_target(dev-install
|
||||
COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}"
|
||||
COMMAND "${CMAKE_COMMAND}" --install "${CMAKE_BINARY_DIR}"
|
||||
@@ -236,6 +243,9 @@ add_custom_target(dev-install
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
||||
get_property(_CTEST_CUSTOM_TESTS_IGNORE GLOBAL PROPERTY CTEST_CUSTOM_TESTS_IGNORE)
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/CTestCustom.cmake" "SET(CTEST_CUSTOM_TESTS_IGNORE ${_CTEST_CUSTOM_TESTS_IGNORE})")
|
||||
|
||||
include(doxygen)
|
||||
|
||||
include(package.cmake)
|
||||
|
||||
@@ -54,13 +54,8 @@ find_package(Boost @Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@ EXACT REQUIRED CO
|
||||
|
||||
find_library(libtester eosio_testing @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
|
||||
find_library(libchain eosio_chain @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
|
||||
if ( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" )
|
||||
find_library(libfc fc_debug @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
|
||||
find_library(libsecp256k1 secp256k1_debug @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_library(libfc fc @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
|
||||
find_library(libsecp256k1 secp256k1 @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
|
||||
endif()
|
||||
find_library(libfc fc @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
|
||||
find_library(libsecp256k1 secp256k1 @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
|
||||
|
||||
find_library(libff ff @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
|
||||
find_library(libwasm WASM @CMAKE_INSTALL_FULL_LIBDIR@ NO_DEFAULT_PATH)
|
||||
|
||||
@@ -51,16 +51,10 @@ find_package(Boost @Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@ EXACT REQUIRED CO
|
||||
|
||||
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)
|
||||
if ( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" )
|
||||
find_library(libfc fc_debug @CMAKE_BINARY_DIR@/libraries/fc NO_DEFAULT_PATH)
|
||||
find_library(libsecp256k1 secp256k1_debug @CMAKE_BINARY_DIR@/libraries/fc/secp256k1 NO_DEFAULT_PATH)
|
||||
find_library(libfc fc @CMAKE_BINARY_DIR@/libraries/fc NO_DEFAULT_PATH)
|
||||
find_library(libsecp256k1 secp256k1 @CMAKE_BINARY_DIR@/libraries/libfc/secp256k1 NO_DEFAULT_PATH)
|
||||
|
||||
else()
|
||||
find_library(libfc fc @CMAKE_BINARY_DIR@/libraries/fc NO_DEFAULT_PATH)
|
||||
find_library(libsecp256k1 secp256k1 @CMAKE_BINARY_DIR@/libraries/fc/secp256k1 NO_DEFAULT_PATH)
|
||||
endif()
|
||||
|
||||
find_library(libff ff @CMAKE_BINARY_DIR@/libraries/fc/libraries/ff/libff NO_DEFAULT_PATH)
|
||||
find_library(libff ff @CMAKE_BINARY_DIR@/libraries/libfc/libraries/ff/libff 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)
|
||||
@@ -129,7 +123,7 @@ macro(add_eosio_test_executable test_name)
|
||||
@OPENSSL_INCLUDE_DIR@
|
||||
@CMAKE_SOURCE_DIR@/libraries/chain/include
|
||||
@CMAKE_BINARY_DIR@/libraries/chain/include
|
||||
@CMAKE_SOURCE_DIR@/libraries/fc/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
|
||||
@@ -176,7 +170,7 @@ if(ENABLE_COVERAGE_TESTING)
|
||||
|
||||
COMMAND ${LCOV_PATH} --directory . --capture --gcov-tool ${CMAKE_SOURCE_DIR}/tools/llvm-gcov.sh --output-file ${Coverage_NAME}.info
|
||||
|
||||
COMMAND ${LCOV_PATH} -remove ${Coverage_NAME}.info '*/boost/*' '/usr/lib/*' '/usr/include/*' '*/externals/*' '*/fc/*' '*/wasm-jit/*' --output-file ${Coverage_NAME}_filtered.info
|
||||
COMMAND ${LCOV_PATH} -remove ${Coverage_NAME}.info '*/boost/*' '/usr/lib/*' '/usr/include/*' '*/externals/*' '*/libfc/*' '*/wasm-jit/*' --output-file ${Coverage_NAME}_filtered.info
|
||||
|
||||
COMMAND ${GENHTML_PATH} -o ${Coverage_NAME} ${PROJECT_BINARY_DIR}/${Coverage_NAME}_filtered.info
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ Recent Ubuntu LTS releases are the only Linux distributions that we fully suppor
|
||||
* CMake 3.8+
|
||||
* (for Linux only) LLVM 7 - 11 (newer versions do not work)
|
||||
|
||||
A few other common libraries are tools also required such as openssl 1.1+, curl, GMP, Python 3, and zlib.
|
||||
A few other common libraries are tools also required such as openssl 1.1+, libcurl, curl, libusb, GMP, Python 3, and zlib.
|
||||
|
||||
**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.
|
||||
|
||||
@@ -33,8 +33,6 @@ The binary package will be produced in the Leap build directory that was supplie
|
||||
|
||||
#### Manual (non "pinned") Build Instructions
|
||||
|
||||
These 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.
|
||||
|
||||
<details>
|
||||
<summary>Ubuntu 20.04 & 22.04 Build Instructions</summary>
|
||||
|
||||
@@ -46,9 +44,12 @@ apt-get update && apt-get install \
|
||||
curl \
|
||||
git \
|
||||
libboost-all-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libgmp-dev \
|
||||
libssl-dev \
|
||||
llvm-11-dev
|
||||
libusb-1.0-0-dev \
|
||||
llvm-11-dev \
|
||||
pkg-config
|
||||
```
|
||||
and perform the build:
|
||||
```
|
||||
@@ -71,9 +72,12 @@ apt-get update && apt-get install \
|
||||
curl \
|
||||
g++-8 \
|
||||
git \
|
||||
libcurl4-openssl-dev \
|
||||
libgmp-dev \
|
||||
libssl-dev \
|
||||
libusb-1.0-0-dev \
|
||||
llvm-7-dev \
|
||||
pkg-config \
|
||||
python3 \
|
||||
zlib1g-dev
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
---
|
||||
content_title: Build EOSIO from Source on Other Unix-based OS
|
||||
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.**
|
||||
|
||||
### Using DUNE
|
||||
|
||||
For the official multi-platform support try [Docker Utilities for Node Execution](https://github.com/eosnetworkfoundation/DUNE) which runs in an ubuntu image via a docker container.
|
||||
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.
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
---
|
||||
content_title: Build EOSIO from Source
|
||||
content_title: Build Antelope from Source
|
||||
---
|
||||
|
||||
The shell scripts previously recommended for building the software have been removed in favor of a build process entirely driven by CMake. Those wishing to build from source are now responsible for installing the necessary dependencies. The list of dependencies and the recommended build procedure are in the README.md file. Instructions are also included for efficiently running the tests.
|
||||
|
||||
### Using DUNE
|
||||
|
||||
As an alternative to building from source try [Docker Utilities for Node Execution](https://github.com/eosnetworkfoundation/DUNE) for the easiest way to get started, and for multi-platform support.
|
||||
As an alternative to building from source try [Docker Utilities for Node Execution](https://github.com/AntelopeIO/DUNE) for the easiest way to get started, and for multi-platform support.
|
||||
|
||||
### Building From Source
|
||||
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
---
|
||||
content_title: EOSIO Software Installation
|
||||
content_title: Antelope Software Installation
|
||||
---
|
||||
|
||||
The best way to install and use the EOSIO software is to build it from source:
|
||||
The best way to install and use the Antelope software is to build it from source:
|
||||
|
||||
* [Build EOSIO from Source](01_build-from-source/index.md)
|
||||
* [Build Antelope from Source](01_build-from-source/index.md)
|
||||
|
||||
## Supported Operating Systems
|
||||
|
||||
EOSIO currently supports the following operating systems:
|
||||
Antelope currently supports the following operating systems:
|
||||
|
||||
1. Ubuntu 18.04
|
||||
2. Ubuntu 20.04
|
||||
3. Ubuntu 22.04
|
||||
|
||||
[[info | Note]]
|
||||
| It may be possible to build and install EOSIO 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.
|
||||
| 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.
|
||||
|
||||
* [Build EOSIO on Other Unix-based Systems](01_build-from-source/00_build-unsupported-os.md)
|
||||
* [Build Antelope on Other Unix-based Systems](01_build-from-source/00_build-unsupported-os.md)
|
||||
|
||||
## Docker Utilities for Node Execution (D.U.N.E.)
|
||||
|
||||
If you are using different operating system or prefer not to build EOSIO from source you can try our Docker - based set of utilities called DUNE that can get you started with exploring EOSIO and doing contract development pretty much instantly
|
||||
If you are using different operating system or prefer not to build Antelope from source you can try our Docker - based set of utilities called DUNE that can get you started with exploring Antelope and doing contract development pretty much instantly
|
||||
|
||||
* [Docker Utilities for Node Execution (D.U.N.E.)](https://github.com/eosnetworkfoundation/DUNE)
|
||||
* [Docker Utilities for Node Execution (D.U.N.E.)](https://github.com/AntelopeIO/DUNE)
|
||||
|
||||
@@ -7,15 +7,15 @@ content_title: Producing Node Setup
|
||||
|
||||
## Goal
|
||||
|
||||
This section describes how to set up a producing node within the EOSIO network. A producing node, as its name implies, is a node that is configured to produce blocks in an `EOSIO` based blockchain. This functionality if provided through the `producer_plugin` as well as other [Nodeos Plugins](../../03_plugins/index.md).
|
||||
This section describes how to set up a producing node within the Antelope network. A producing node, as its name implies, is a node that is configured to produce blocks in an `Antelope` based blockchain. This functionality if provided through the `producer_plugin` as well as other [Nodeos Plugins](../../03_plugins/index.md).
|
||||
|
||||
## Before you begin
|
||||
|
||||
* [Install the EOSIO software](../../../00_install/index.md) before starting this section.
|
||||
* [Install the Antelope software](../../../00_install/index.md) before starting this section.
|
||||
* It is assumed that `nodeos`, `cleos`, and `keosd` are accessible through the path.
|
||||
|
||||
[//]: # ( THIS IS A COMMENT LINK BELOW IS BROKEN )
|
||||
[//]: # ( If you built EOSIO using shell scripts, make sure to run the Install Script ../../../00_install/01_build-from-source/01_shell-scripts/03_install-eosio-binaries.md )
|
||||
[//]: # ( If you built Antelope using shell scripts, make sure to run the Install Script ../../../00_install/01_build-from-source/01_shell-scripts/03_install-antelope-binaries.md )
|
||||
|
||||
* Know how to pass [Nodeos options](../../02_usage/00_nodeos-options.md) to enable or disable functionality.
|
||||
|
||||
@@ -53,7 +53,7 @@ producer-name = youraccount
|
||||
You will need to set the private key for your producer. The public key should have an authority for the producer account defined above.
|
||||
|
||||
`signature-provider` is defined with a 3-field tuple:
|
||||
* `public-key` - A valid EOSIO public key in form of a string.
|
||||
* `public-key` - A valid Antelope public key in form of a string.
|
||||
* `provider-spec` - It's a string formatted like `<provider-type>:<data>`
|
||||
* `provider-type` - KEY or KEOSD
|
||||
|
||||
|
||||
@@ -4,15 +4,15 @@ content_title: Non-producing Node Setup
|
||||
|
||||
## Goal
|
||||
|
||||
This section describes how to set up a non-producing node within the EOSIO network. A non-producing node is a node that is not configured to produce blocks, instead it is connected and synchronized with other peers from an `EOSIO` based blockchain, exposing one or more services publicly or privately by enabling one or more [Nodeos Plugins](../../03_plugins/index.md), except the `producer_plugin`.
|
||||
This section describes how to set up a non-producing node within the Antelope network. A non-producing node is a node that is not configured to produce blocks, instead it is connected and synchronized with other peers from an `Antelope` based blockchain, exposing one or more services publicly or privately by enabling one or more [Nodeos Plugins](../../03_plugins/index.md), except the `producer_plugin`.
|
||||
|
||||
## Before you begin
|
||||
|
||||
* [Install the EOSIO software](../../../00_install/index.md) before starting this section.
|
||||
* [Install the Antelope software](../../../00_install/index.md) before starting this section.
|
||||
* It is assumed that `nodeos`, `cleos`, and `keosd` are accessible through the path.
|
||||
|
||||
[//]: # ( THIS IS A COMMENT NEXT LINK CONTAINS A BROKEN LINK )
|
||||
[//]: # ( If you built EOSIO using shell scripts, make sure to run the Install Script ../../../00_install/01_build-from-source/01_shell-scripts/03_install-eosio-binaries.md )
|
||||
[//]: # ( If you built Antelope using shell scripts, make sure to run the Install Script ../../../00_install/01_build-from-source/01_shell-scripts/03_install-antelope-binaries.md )
|
||||
|
||||
* Know how to pass [Nodeos options](../../02_usage/00_nodeos-options.md) to enable or disable functionality.
|
||||
|
||||
@@ -41,4 +41,4 @@ nodeos ... --p2p-peer-address=106.10.42.238:9876
|
||||
|
||||
### 2. Enable one or more available plugins
|
||||
|
||||
Each available plugin is listed and detailed in the [Nodeos Plugins](../../03_plugins/index.md) section. When `nodeos` starts, it will expose the functionality provided by the enabled plugins it was started with. For example, if you start `nodeos` with [`state_history_plugin`](../../03_plugins/state_history_plugin/index.md) enabled, you will have a non-producing node that offers full blockchain history. If you start `nodeos` with [`http_plugin`](../../03_plugins/http_plugin/index.md) enabled, you will have a non-producing node which exposes the EOSIO RPC API. Therefore, you can extend the basic functionality provided by a non-producing node by enabling any number of existing plugins on top of it. Another aspect to consider is that some plugins have dependencies to other plugins. Therefore, you need to satisfy all dependencies for a plugin in order to enable it.
|
||||
Each available plugin is listed and detailed in the [Nodeos Plugins](../../03_plugins/index.md) section. When `nodeos` starts, it will expose the functionality provided by the enabled plugins it was started with. For example, if you start `nodeos` with [`state_history_plugin`](../../03_plugins/state_history_plugin/index.md) enabled, you will have a non-producing node that offers full blockchain history. If you start `nodeos` with [`http_plugin`](../../03_plugins/http_plugin/index.md) enabled, you will have a non-producing node which exposes the Antelope RPC API. Therefore, you can extend the basic functionality provided by a non-producing node by enabling any number of existing plugins on top of it. Another aspect to consider is that some plugins have dependencies to other plugins. Therefore, you need to satisfy all dependencies for a plugin in order to enable it.
|
||||
|
||||
@@ -12,11 +12,11 @@ This section describes how to set up a single-node blockchain configuration runn
|
||||
|
||||
## Before you begin
|
||||
|
||||
* [Install the EOSIO software](../../../00_install/index.md) before starting this section.
|
||||
* [Install the Antelope software](../../../00_install/index.md) before starting this section.
|
||||
* It is assumed that `nodeos`, `cleos`, and `keosd` are accessible through the path.
|
||||
|
||||
[//]: # (THIS IS A COMMENT, NEXT LINK HAS BROKEN LINK)
|
||||
[//]: # (If you built EOSIO using shell scripts, make sure to run the Install Script ../../../00_install/01_build-from-source/01_shell-scripts/03_install-eosio-binaries.md .)
|
||||
[//]: # (If you built Antelope using shell scripts, make sure to run the Install Script ../../../00_install/01_build-from-source/01_shell-scripts/03_install-antelope-binaries.md .)
|
||||
|
||||
* Know how to pass [Nodeos options](../../02_usage/00_nodeos-options.md) to enable or disable functionality.
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ This section describes how to set up a multi-node blockchain configuration runni
|
||||
|
||||
## Before you begin
|
||||
|
||||
* [Install the EOSIO software](../../../00_install/index.md) before starting this section.
|
||||
* [Install the Antelope software](../../../00_install/index.md) before starting this section.
|
||||
* It is assumed that `nodeos`, `cleos`, and `keosd` are accessible through the path.
|
||||
* Know how to pass [Nodeos options](../../02_usage/00_nodeos-options.md) to enable or disable functionality.
|
||||
|
||||
@@ -20,7 +20,7 @@ Open four "terminal" windows and perform the following steps:
|
||||
|
||||
1. [Start the Wallet Manager](#1-start-the-wallet-manager)
|
||||
2. [Create a Default Wallet](#2-create-a-default-wallet)
|
||||
3. [Loading the EOSIO Key](#3-loading-the-eosio-key)
|
||||
3. [Loading the Antelope Key](#3-loading-the-antelope-key)
|
||||
4. [Start the First Producer Node](#4-start-the-first-producer-node)
|
||||
5. [Start the Second Producer Node](#5-start-the-second-producer-node)
|
||||
6. [Get Nodes Info](#6-get-nodes-info)
|
||||
@@ -66,7 +66,7 @@ Without password imported keys will not be retrievable.
|
||||
|
||||
`keosd` will generate some status output in its window. We will continue to use this second window for subsequent `cleos` commands.
|
||||
|
||||
### 3. Loading the EOSIO Key
|
||||
### 3. Loading the Antelope Key
|
||||
|
||||
The private blockchain launched in the steps above is created with a default initial key which must be loaded into the wallet.
|
||||
|
||||
@@ -90,7 +90,8 @@ This creates a special producer, known as the "bios" producer. Assuming everythi
|
||||
|
||||
### 5. Start the Second Producer Node
|
||||
|
||||
The following commands assume that you are running this tutorial from the `eos\build` directory, from which you ran `./eosio_build.sh` to build the EOSIO binaries.
|
||||
[//]: # (don't render for now)
|
||||
[//]: # (The following commands assume that you are running this tutorial from the `eos\build` directory, from which you ran `./eosio_build.sh` to build the Antelope binaries.)
|
||||
|
||||
To start additional nodes, you must first load the `eosio.bios` contract. This contract enables you to have direct control over the resource allocation of other accounts and to access other privileged API calls. Return to the second terminal window and run the following command to load the contract:
|
||||
|
||||
|
||||
@@ -19,11 +19,11 @@ While this option can technically be used for smart contract development, it may
|
||||
|
||||
## Official Testing Node
|
||||
|
||||
Try [Docker Utilities for Node Execution](https://github.com/eosnetworkfoundation/DUNE) for the easiest way to get started, and for multi-platform support.
|
||||
Try [Docker Utilities for Node Execution](https://github.com/AntelopeIO/DUNE) for the easiest way to get started, and for multi-platform support.
|
||||
|
||||
## Third-Party Testnets
|
||||
|
||||
The following third-party testnets are available for testing EOSIO dApps and smart contracts:
|
||||
The following third-party testnets are available for testing Antelope dApps and smart contracts:
|
||||
|
||||
* Jungle Testnet [monitor](https://monitor.jungletestnet.io/), [website](https://jungletestnet.io/)
|
||||
* [CryptoKylin Testnet](https://www.cryptokylin.io/)
|
||||
|
||||
@@ -1 +1 @@
|
||||
<!-- THIS IS A PLACEHOLDER, WILL BE REPLACED BY REDOC INSTANCE -->
|
||||
[Chain API Reference](https://docs.eosnetwork.com/leap-plugins/latest/chain.api/)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Description
|
||||
|
||||
The `chain_plugin` is a core plugin required to process and aggregate chain data on an EOSIO node.
|
||||
The `chain_plugin` is a core plugin required to process and aggregate chain data on an Antelope node.
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
<!-- THIS IS A PLACEHOLDER, WILL BE REPLACED BY REDOC INSTANCE -->
|
||||
[DB Size API Reference](https://docs.eosnetwork.com/leap-plugins/latest/db_size.api/)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Description
|
||||
|
||||
The `login_plugin` supports the concept of applications authenticating with the EOSIO blockchain. The `login_plugin` API allows an application to verify whether an account is allowed to sign in order to satisfy a specified authority.
|
||||
The `login_plugin` supports the concept of applications authenticating with the Antelope blockchain. The `login_plugin` API allows an application to verify whether an account is allowed to sign in order to satisfy a specified authority.
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
<!-- THIS IS A PLACEHOLDER, WILL BE REPLACED BY REDOC INSTANCE -->
|
||||
[Net API Reference](https://docs.eosnetwork.com/leap-plugins/latest/net.api/)
|
||||
|
||||
@@ -8,7 +8,7 @@ The `net_api_plugin` provides four RPC API endpoints:
|
||||
* connections
|
||||
* status
|
||||
|
||||
See [Net API Reference Documentation](https://docs.eosnetwork.com/reference/mandel-plugins/net_api.html).
|
||||
See [Net API Reference Documentation](https://docs.eosnetwork.com/leap-plugins/latest/net.api/).
|
||||
|
||||
[[caution | Caution]]
|
||||
| This plugin exposes endpoints that allow management of p2p connections. Running this plugin on a publicly accessible node is not recommended as it can be exploited.
|
||||
|
||||
@@ -1 +1 @@
|
||||
<!-- THIS IS A PLACEHOLDER, WILL BE REPLACED BY REDOC INSTANCE -->
|
||||
[Producer API Reference](https://docs.eosnetwork.com/leap-plugins/latest/producer.api/)
|
||||
|
||||
@@ -49,7 +49,7 @@ Config Options for eosio::producer_plugin:
|
||||
<public-key>=<provider-spec>
|
||||
Where:
|
||||
<public-key> is a string form of
|
||||
a vaild EOSIO public
|
||||
a vaild Antelope public
|
||||
key
|
||||
|
||||
<provider-spec> is a string in the
|
||||
@@ -59,7 +59,7 @@ Config Options for eosio::producer_plugin:
|
||||
<provider-type> is KEY, or KEOSD
|
||||
|
||||
KEY:<data> is a string form of
|
||||
a valid EOSIO
|
||||
a valid Antelope
|
||||
private key which
|
||||
maps to the provided
|
||||
public key
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ This procedure records the current chain state and future history, without previ
|
||||
|
||||
## Before you begin
|
||||
|
||||
* Make sure [EOSIO is installed](../../../00_install/index.md).
|
||||
* Make sure [Antelope is installed](../../../00_install/index.md).
|
||||
* Learn about [Using Nodeos](../../02_usage/index.md).
|
||||
* Get familiar with [state_history_plugin](../../03_plugins/state_history_plugin/index.md).
|
||||
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ This procedure records the entire chain history.
|
||||
|
||||
## Before you begin
|
||||
|
||||
* Make sure [EOSIO is installed](../../../00_install/index.md).
|
||||
* Make sure [Antelope is installed](../../../00_install/index.md).
|
||||
* Learn about [Using Nodeos](../../02_usage/index.md).
|
||||
* Get familiar with [state_history_plugin](../../03_plugins/state_history_plugin/index.md).
|
||||
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ This procedure creates a database containing the chain state, with full history
|
||||
|
||||
## Before you begin
|
||||
|
||||
* Make sure [EOSIO is installed](../../../00_install/index.md).
|
||||
* Make sure [Antelope is installed](../../../00_install/index.md).
|
||||
* Learn about [Using Nodeos](../../02_usage/index.md).
|
||||
* Get familiar with [state_history_plugin](../../03_plugins/state_history_plugin/index.md).
|
||||
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ This procedure restores an existing snapshot with full history, so the node can
|
||||
|
||||
## Before you begin
|
||||
|
||||
* Make sure [EOSIO is installed](../../../00_install/index.md).
|
||||
* Make sure [Antelope is installed](../../../00_install/index.md).
|
||||
* Learn about [Using Nodeos](../../02_usage/index.md).
|
||||
* Get familiar with [state_history_plugin](../../03_plugins/state_history_plugin/index.md).
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
<!-- THIS IS A PLACEHOLDER, WILL BE REPLACED BY REDOC INSTANCE -->
|
||||
[Trace API Reference](https://docs.eosnetwork.com/leap-plugins/latest/trace.api/)
|
||||
|
||||
@@ -5,11 +5,11 @@ The `trace_api_plugin` provides a consumer-focused long-term API for retrieving
|
||||
|
||||
## Purpose
|
||||
|
||||
While integrating applications such as block explorers and exchanges with an EOSIO blockchain, the user might require a complete transcript of actions processed by the blockchain, including those spawned from the execution of smart contracts and scheduled transactions. The `trace_api_plugin` serves this need. The purpose of the plugin is to provide:
|
||||
While integrating applications such as block explorers and exchanges with an Antelope blockchain, the user might require a complete transcript of actions processed by the blockchain, including those spawned from the execution of smart contracts and scheduled transactions. The `trace_api_plugin` serves this need. The purpose of the plugin is to provide:
|
||||
|
||||
* A transcript of retired actions and related metadata
|
||||
* A consumer-focused long-term API to retrieve blocks
|
||||
* Maintainable resource commitments at the EOSIO nodes
|
||||
* Maintainable resource commitments at the Antelope nodes
|
||||
|
||||
Therefore, one crucial goal of the `trace_api_plugin` is to improve the maintenance of node resources (file system, disk space, memory used, etc.). This goal is different from the existing `history_plugin` which provides far more configurable filtering and querying capabilities, or the existing `state_history_plugin` which provides a binary streaming interface to access structural chain data, action data, as well as state deltas.
|
||||
|
||||
@@ -101,7 +101,7 @@ nodeos ... --plugin eosio::chain_plugin [options] \
|
||||
|
||||
## Configuration Example
|
||||
|
||||
Here is a `nodeos` configuration example for the `trace_api_plugin` when tracing some EOSIO reference contracts:
|
||||
Here is a `nodeos` configuration example for the `trace_api_plugin` when tracing some Antelope reference contracts:
|
||||
|
||||
```sh
|
||||
nodeos --data-dir data_dir --config-dir config_dir --trace-dir traces_dir
|
||||
@@ -191,7 +191,7 @@ If resource usage cannot be effectively managed via the `trace-minimum-irreversi
|
||||
|
||||
## Manual Maintenance
|
||||
|
||||
The `trace-dir` option defines the directory on the filesystem where the trace log files are stored by the `trace_api_plugin`. These files are stable once the LIB block has progressed past a given slice and then can be deleted at any time to reclaim filesystem space. The deployed EOSIO system will tolerate any out-of-process management system that removes some or all of these files in this directory regardless of what data they represent, or whether there is a running `nodeos` instance accessing them or not. Data which would nominally be available, but is no longer so due to manual maintenance, will result in a HTTP 404 response from the appropriate API endpoint(s).
|
||||
The `trace-dir` option defines the directory on the filesystem where the trace log files are stored by the `trace_api_plugin`. These files are stable once the LIB block has progressed past a given slice and then can be deleted at any time to reclaim filesystem space. The deployed Antelope system will tolerate any out-of-process management system that removes some or all of these files in this directory regardless of what data they represent, or whether there is a running `nodeos` instance accessing them or not. Data which would nominally be available, but is no longer so due to manual maintenance, will result in a HTTP 404 response from the appropriate API endpoint(s).
|
||||
|
||||
[[info | For node operators]]
|
||||
| Node operators can take full control over the lifetime of the historical data available in their nodes via the `trace-api-plugin` and the `trace-minimum-irreversible-history-blocks` and `trace-minimum-uncompressed-irreversible-history-blocks` options in conjunction with any external filesystem resource manager.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
The `txn_test_gen_plugin` is used for transaction test purposes.
|
||||
|
||||
[[info | For More Information]]
|
||||
For more information, check the [txn_test_gen_plugin/README.md](https://github.com/eosnetworkfoundation/mandel/tree/main/plugins/txn_test_gen_plugin) on the EOSIO/eos repository.
|
||||
For more information, check the [txn_test_gen_plugin/README.md](https://github.com/AntelopeIO/leap/tree/main/plugins/txn_test_gen_plugin) on the `AntelopeIO/leap` repository.
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
@@ -64,3 +64,24 @@ Sample `logging.json`:
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Expected Output of Log Levels
|
||||
|
||||
* `error` - Log output that likely requires operator intervention.
|
||||
- Error level logging should be reserved for conditions that are completely unexpected or otherwise need human intervention.
|
||||
- Also used to indicate software errors such as: impossible values for an `enum`, out of bounds array access, null pointers, or other conditions that likely will throw an exception.
|
||||
- *Note*: Currently, there are numerous `error` level logging that likely should be `warn` as they do not require human intervention. The `net_plugin_impl`, for example, has a number of `error` level logs for bad network connections. This is handled and processed correctly. These should be changed to `warn` or `info`.
|
||||
* `warn` - Log output indicating unexpected but recoverable errors.
|
||||
- Although, `warn` level typically does not require human intervention, repeated output of `warn` level logs might indicate actions needed by an operator.
|
||||
- `warn` should not be used simply for conveying information. A `warn` level log is something to take notice of, but not necessarily be concerned about.
|
||||
* `info` (default) - Log output that provides useful information to an operator.
|
||||
- Can be just progress indication or other useful data to a user. Care is taken not to create excessive log output with `info` level logging. For example, no `info` level logging should be produced for every transaction.
|
||||
- For progress indication, some multiple of transactions should be processed between each log output; typically, every 1000 transactions.
|
||||
* `debug` - Useful log output for when non-default logging is enabled.
|
||||
- Answers the question: is this useful information for a user that is monitoring the log output. Care should be taken not to create excessive log output; similar to `info` level logging.
|
||||
- Enabling `debug` level logging should provide greater insight into behavior without overwhelming the output with log entries.
|
||||
- `debug` level should not be used for *trace* level logging; to that end, use `all` (see below).
|
||||
- Like `info`, no `debug` level logging should be produced for every transaction. There are specific transaction level loggers dedicated to transaction level logging: `transaction`, `transaction_trace_failure`, `transaction_trace_success`, `transaction_failure_tracing`, `transaction_success_tracing`.
|
||||
* `all` (trace) - For logging that would be overwhelming if `debug` level logging were used.
|
||||
- Can be used for trace level logging. Only used in a few places and not completely supported.
|
||||
- *Note*: In the future a different logging library may provide better trace level logging support. The current logging framework is not performant enough to enable excess trace level output.
|
||||
|
||||
@@ -6,7 +6,7 @@ Logging for `nodeos` is controlled by the `logging.json` file. CLI options can b
|
||||
|
||||
## Appenders
|
||||
|
||||
The logging library built into EOSIO supports two appender types:
|
||||
The logging library built into Antelope supports two appender types:
|
||||
|
||||
- [Console](#console)
|
||||
- [GELF](#gelf) (Graylog Extended Log Format)
|
||||
@@ -74,7 +74,7 @@ Example:
|
||||
|
||||
## Loggers
|
||||
|
||||
The logging library built into EOSIO currently supports the following loggers:
|
||||
The logging library built into Antelope currently supports the following loggers:
|
||||
|
||||
- `default` - the default logger, always enabled.
|
||||
- `net_plugin_impl` - detailed logging for the net plugin.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
content_title: Storage and Read Modes
|
||||
---
|
||||
|
||||
The EOSIO platform stores blockchain information in various data structures at various stages of a transaction's lifecycle. Some of these are described below. The producing node is the `nodeos` instance run by the block producer who is currently creating blocks for the blockchain (which changes every 6 seconds, producing 12 blocks in sequence before switching to another producer.)
|
||||
The Antelope platform stores blockchain information in various data structures at various stages of a transaction's lifecycle. Some of these are described below. The producing node is the `nodeos` instance run by the block producer who is currently creating blocks for the blockchain (which changes every 6 seconds, producing 12 blocks in sequence before switching to another producer.)
|
||||
|
||||
## Blockchain State and Storage
|
||||
|
||||
@@ -15,9 +15,9 @@ Every `nodeos` instance creates some internal files to housekeep the blockchain
|
||||
* The `pending block` is an in memory block containing transactions as they are processed and pushed into the block; this will/may eventually become the head block. If the `nodeos` instance is the producing node, the pending block is distributed to other `nodeos` instances.
|
||||
* Outside the chain state, block data is cached in RAM until it becomes final/irreversible; especifically the signed block itself. After the last irreversible block (LIB) catches up to the block, that block is then retrieved from the irreversible blocks log.
|
||||
|
||||
## EOSIO Interfaces
|
||||
## Antelope Interfaces
|
||||
|
||||
EOSIO provides a set of [services](../../) and [interfaces](https://docs.eosnetwork.com/reference/mandel-cdt/files.html) that enable contract developers to persist state across action, and consequently transaction, boundaries. Contracts may use these services and interfaces for various purposes. For example, `eosio.token` contract keeps balances for all users in the chain database. Each instance of `nodeos` keeps the database in memory, so contracts can read and write data with ease.
|
||||
Antelope provides a set of [services](../../) and [interfaces](https://docs.eosnetwork.com/cdt/latest/reference/Files/) that enable contract developers to persist state across action, and consequently transaction, boundaries. Contracts may use these services and interfaces for various purposes. For example, `eosio.token` contract keeps balances for all users in the chain database. Each instance of `nodeos` keeps the database in memory, so contracts can read and write data with ease.
|
||||
|
||||
### Nodeos RPC API
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ link_text: Context-Free Data
|
||||
---
|
||||
|
||||
## Overview
|
||||
The immutable nature of the blockchain allows data to be stored securely while also enforcing the integrity of such data. However, this benefit also complicates the removal of non-essential data from the blockchain. Consequently, EOSIO blockchains contain a special section within the transaction, called the *context-free data*. As its name implies, data stored in the context-free data section is considered free of previous contexts or dependencies, which makes their potential removal possible. More importantly, such removal can be performed safely without compromising the integrity of the blockchain.
|
||||
The immutable nature of the blockchain allows data to be stored securely while also enforcing the integrity of such data. However, this benefit also complicates the removal of non-essential data from the blockchain. Consequently, Antelope blockchains contain a special section within the transaction, called the *context-free data*. As its name implies, data stored in the context-free data section is considered free of previous contexts or dependencies, which makes their potential removal possible. More importantly, such removal can be performed safely without compromising the integrity of the blockchain.
|
||||
|
||||
## Concept
|
||||
The goal of context-free data is to allow blockchain applications the option to store non-essential information within a transaction. Some examples of context-free data include:
|
||||
|
||||
@@ -28,7 +28,7 @@ Command Line Options for eosio::chain_plugin:
|
||||
|
||||
Start `nodeos` with `--shared-memory-size-mb 1024`. A 1 GB shared memory file allows approximately half a million transactions.
|
||||
|
||||
### What version of EOSIO am I running/connecting to?
|
||||
### What version of Antelope am I running/connecting to?
|
||||
|
||||
If defaults can be used, then `cleos get info` will output a block that contains a field called `server_version`. If your `nodeos` is not using the defaults, then you need to know the URL of the `nodeos`. In that case, use the following with your `nodeos` URL:
|
||||
|
||||
@@ -44,4 +44,4 @@ cleos --url http://localhost:8888 get info | grep server_version
|
||||
|
||||
### Error 3070000: WASM Exception Error
|
||||
|
||||
If you try to deploy the `eosio.bios` contract or `eosio.system` contract in an attempt to boot an EOSIO-based blockchain and you get the following error or similar: `Publishing contract... Error 3070000: WASM Exception Error Details: env.set_proposed_producers_ex unresolveable`, it is because you have to activate the `PREACTIVATE_FEATURE` protocol first.
|
||||
If you try to deploy the `eosio.bios` contract or `eosio.system` contract in an attempt to boot an Antelope-based blockchain and you get the following error or similar: `Publishing contract... Error 3070000: WASM Exception Error Details: env.set_proposed_producers_ex unresolveable`, it is because you have to activate the `PREACTIVATE_FEATURE` protocol first.
|
||||
|
||||
@@ -4,11 +4,11 @@ content_title: Nodeos
|
||||
|
||||
## Introduction
|
||||
|
||||
`nodeos` is the core service daemon that runs on every EOSIO node. It can be configured to process smart contracts, validate transactions, produce blocks containing valid transactions, and confirm blocks to record them on the blockchain.
|
||||
`nodeos` is the core service daemon that runs on every Antelope node. It can be configured to process smart contracts, validate transactions, produce blocks containing valid transactions, and confirm blocks to record them on the blockchain.
|
||||
|
||||
## Installation
|
||||
|
||||
`nodeos` is distributed as part of the [EOSIO software suite](https://github.com/eosnetworkfoundation/mandel). To install `nodeos`, visit the [EOSIO Software Installation](../00_install/index.md) section.
|
||||
`nodeos` is distributed as part of the [Antelope software suite](https://github.com/AntelopeIO/leap). To install `nodeos`, visit the [Antelope Software Installation](../00_install/index.md) section.
|
||||
|
||||
## Explore
|
||||
|
||||
@@ -23,4 +23,4 @@ Navigate the sections below to configure and use `nodeos`.
|
||||
* [Troubleshooting](08_troubleshooting/index.md) - Common `nodeos` troubleshooting questions.
|
||||
|
||||
[[info | Access Node]]
|
||||
| A local or remote EOSIO access node running `nodeos` is required for a client application or smart contract to interact with the blockchain.
|
||||
| A local or remote Antelope access node running `nodeos` is required for a client application or smart contract to interact with the blockchain.
|
||||
|
||||
@@ -11,7 +11,7 @@ Make sure you meet the following requirements:
|
||||
* Install the currently supported version of `cleos`.
|
||||
|
||||
[[info | Note]]
|
||||
| `cleos` is bundled with the EOSIO software. [Installing EOSIO](../../00_install/index.md) will also install `cleos`.
|
||||
| `cleos` is bundled with the Antelope software. [Installing Antelope](../../00_install/index.md) will also install `cleos`.
|
||||
|
||||
* Understand what an [account](/glossary.md#account) is and its role in the blockchain.
|
||||
* Understand [Accounts and Permissions](/protocol-guides/04_accounts_and_permissions.md) in the protocol documents.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Overview
|
||||
|
||||
This how-to guide provides instructions on how to create a new EOSIO blockchain account using the `cleos` CLI tool. You can use accounts to deploy smart contracts and perform other related blockchain operations. Create one or multiple accounts as part of your development environment setup.
|
||||
This how-to guide provides instructions on how to create a new Antelope blockchain account using the `cleos` CLI tool. You can use accounts to deploy smart contracts and perform other related blockchain operations. Create one or multiple accounts as part of your development environment setup.
|
||||
|
||||
The example in this how-to guide creates a new account named **bob**, authorized by the default system account **eosio**, using the `cleos` CLI tool.
|
||||
|
||||
@@ -10,8 +10,8 @@ Make sure you meet the following requirements:
|
||||
|
||||
* Install the currently supported version of `cleos`.
|
||||
[[info | Note]]
|
||||
| The cleos tool is bundled with the EOSIO software. [Installing EOSIO](../../00_install/index.md) will also install the cleos tool.
|
||||
* Learn about [EOSIO Accounts and Permissions](/protocol-guides/04_accounts_and_permissions.md)
|
||||
| The cleos tool is bundled with the Antelope software. [Installing Antelope](../../00_install/index.md) will also install the cleos tool.
|
||||
* Learn about [Antelope Accounts and Permissions](/protocol-guides/04_accounts_and_permissions.md)
|
||||
* Learn about Asymmetric Cryptography - [public key](/glossary.md#public-key) and [private key](/glossary.md#private-key) pairs.
|
||||
* Create public/private keypairs for the `owner` and `active` permissions of an account.
|
||||
|
||||
@@ -34,7 +34,7 @@ cleos create account eosio bob EOS87TQktA5RVse2EguhztfQVEh6XXxBmgkU8b4Y5YnGvtYAo
|
||||
* `bob` = the name of the new account conforming to [account naming conventions](/protocol-guides/04_accounts_and_permissions.md#2-accounts)
|
||||
* `EOS87TQ...AoLGNN` = the owner public key or permission level for the new account (**required**)
|
||||
[[info | Note]]
|
||||
| To create a new account in the EOSIO blockchain, an existing account, also referred to as a creator account, is required to authorize the creation of a new account. For a newly created EOSIO blockchain, the default system account used to create a new account is **eosio**.
|
||||
| To create a new account in the Antelope blockchain, an existing account, also referred to as a creator account, is required to authorize the creation of a new account. For a newly created Antelope blockchain, the default system account used to create a new account is **eosio**.
|
||||
|
||||
**Example Output**
|
||||
|
||||
@@ -46,4 +46,4 @@ warning: transaction executed locally, but may not be confirmed by the network y
|
||||
|
||||
### Summary
|
||||
|
||||
By following these instructions, you are able to create a new EOSIO account in your blockchain environment.
|
||||
By following these instructions, you are able to create a new Antelope account in your blockchain environment.
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
## Overview
|
||||
|
||||
This how-to guide provides instructions on how to create a keypair consisting of a public key and a private key for signing transactions in an EOSIO blockchain.
|
||||
This how-to guide provides instructions on how to create a keypair consisting of a public key and a private key for signing transactions in an Antelope blockchain.
|
||||
|
||||
## Before you begin
|
||||
|
||||
Make sure you meet the following requirements:
|
||||
* Install the currently supported version of `cleos`
|
||||
[[info | Note]]
|
||||
| The cleos tool is bundled with the EOSIO software. [Installing EOSIO](../../00_install/index.md) will also install the cleos tool.
|
||||
* Learn about asymmetric cryptography (public and private keypair) in the context of an EOSIO blockchain.
|
||||
| The cleos tool is bundled with the Antelope software. [Installing Antelope](../../00_install/index.md) will also install the cleos tool.
|
||||
* Learn about asymmetric cryptography (public and private keypair) in the context of an Antelope blockchain.
|
||||
|
||||
## Command Reference
|
||||
|
||||
|
||||
@@ -10,12 +10,12 @@ Make sure you meet the following requirements:
|
||||
* Install the currently supported version of `cleos`.
|
||||
|
||||
[[info | Note]]
|
||||
| `cleos` is bundled with the EOSIO software. [Installing EOSIO](../../00_install/index.md) will also install `cleos`.
|
||||
| `cleos` is bundled with the Antelope software. [Installing Antelope](../../00_install/index.md) will also install `cleos`.
|
||||
|
||||
* Ensure the reference system contracts from [`eosio.contracts`](https://github.com/eosnetworkfoundation/mandel-contracts) repository is deployed and used to manage system resources.
|
||||
* Ensure the reference system contracts from [`reference-contracts`](https://github.com/AntelopeIO/reference-contracts) repository is deployed and used to manage system resources.
|
||||
* Understand what an [account](/glossary.md#account) is and its role in the blockchain.
|
||||
* Understand [CPU bandwidth](/glossary.md#cpu) in an EOSIO blockchain.
|
||||
* Understand [NET bandwidth](/glossary.md#net) in an EOSIO blockchain.
|
||||
* Understand [CPU bandwidth](/glossary.md#cpu) in an Antelope blockchain.
|
||||
* Understand [NET bandwidth](/glossary.md#net) in an Antelope blockchain.
|
||||
|
||||
## Steps
|
||||
|
||||
|
||||
@@ -10,12 +10,12 @@ Make sure you meet the following requirements:
|
||||
* Install the currently supported version of `cleos`.
|
||||
|
||||
[[info | Note]]
|
||||
| `cleos` is bundled with the EOSIO software. [Installing EOSIO](../../00_install/index.md) will also install `cleos`.
|
||||
| `cleos` is bundled with the Antelope software. [Installing Antelope](../../00_install/index.md) will also install `cleos`.
|
||||
|
||||
* Ensure the reference system contracts from [`eosio.contracts`](https://github.com/eosnetworkfoundation/mandel-contracts) repository is deployed and used to manage system resources.
|
||||
* Ensure the reference system contracts from [`reference-contracts`](https://github.com/AntelopeIO/reference-contracts) repository is deployed and used to manage system resources.
|
||||
* Understand what an [account](/glossary.md#account) is and its role in the blockchain.
|
||||
* Understand [NET bandwidth](/glossary.md#net) in an EOSIO blockchain.
|
||||
* Understand [CPU bandwidth](/glossary.md#cpu) in an EOSIO blockchain.
|
||||
* Understand [NET bandwidth](/glossary.md#net) in an Antelope blockchain.
|
||||
* Understand [CPU bandwidth](/glossary.md#cpu) in an Antelope blockchain.
|
||||
|
||||
## Steps
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Goal
|
||||
|
||||
Deploy an EOSIO contract
|
||||
Deploy an Antelope contract
|
||||
|
||||
## Before you begin
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
## Overview
|
||||
|
||||
This how-to guide provides instructions on how to query infomation of an EOSIO account. The example in this how-to guide retrieves information of the `eosio` account.
|
||||
This how-to guide provides instructions on how to query infomation of an Antelope account. The example in this how-to guide retrieves information of the `eosio` account.
|
||||
|
||||
## Before you begin
|
||||
|
||||
* Install the currently supported version of `cleos`
|
||||
|
||||
[[info | Note]]
|
||||
| The cleos tool is bundled with the EOSIO software. [Installing EOSIO](../../00_install/index.md) will also install the cleos tool.
|
||||
| The cleos tool is bundled with the Antelope software. [Installing Antelope](../../00_install/index.md) will also install the cleos tool.
|
||||
|
||||
* Acquire functional understanding of [EOSIO Accounts and Permissions](/protocol-guides/04_accounts_and_permissions.md)
|
||||
* Acquire functional understanding of [Antelope Accounts and Permissions](/protocol-guides/04_accounts_and_permissions.md)
|
||||
|
||||
## Command Reference
|
||||
|
||||
@@ -28,7 +28,7 @@ cleos get account eosio
|
||||
```
|
||||
**Where**:
|
||||
|
||||
* `eosio` = The name of the default system account in the EOSIO blockchain.
|
||||
* `eosio` = The name of the default system account in the Antelope blockchain.
|
||||
|
||||
**Example Output**
|
||||
|
||||
@@ -53,4 +53,4 @@ cpu bandwidth:
|
||||
```
|
||||
|
||||
[[info | Account Fields]]
|
||||
| Depending on the EOSIO network you are connected, you might see different fields associated with an account. That depends on which system contract has been deployed on the network.
|
||||
| Depending on the Antelope network you are connected, you might see different fields associated with an account. That depends on which system contract has been deployed on the network.
|
||||
|
||||
@@ -10,10 +10,10 @@ Make sure to meet the following requirements:
|
||||
* Install the currently supported version of `cleos`.
|
||||
|
||||
[[info | Note]]
|
||||
| `cleos` is bundled with the EOSIO software. [Installing EOSIO](../../00_install/index.md) will also install `cleos`.
|
||||
| `cleos` is bundled with the Antelope software. [Installing Antelope](../../00_install/index.md) will also install `cleos`.
|
||||
|
||||
* Understand what a [block](/glossary.md#block) is and its role in the blockchain.
|
||||
* Understand the [block lifecycle](/protocol-guides/01_consensus_protocol.md#5-block-lifecycle) in the EOSIO consensus protocol.
|
||||
* Understand the [block lifecycle](/protocol-guides/01_consensus_protocol.md#5-block-lifecycle) in the Antelope consensus protocol.
|
||||
|
||||
## Steps
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Overview
|
||||
|
||||
This how-to guide provides instructions on how to retrieve infomation of an EOSIO transaction using a transaction ID.
|
||||
This how-to guide provides instructions on how to retrieve infomation of an Antelope transaction using a transaction ID.
|
||||
|
||||
The example in this how-to retrieves transaction information associated with the creation of the account **bob**.
|
||||
|
||||
@@ -9,8 +9,8 @@ The example in this how-to retrieves transaction information associated with the
|
||||
Make sure you meet the following requirements:
|
||||
* Install the currently supported version of `cleos`.
|
||||
[[info | Note]]
|
||||
| `cleos` is bundled with the EOSIO software. [Installing EOSIO](../../00_install/index.md) will also install `cleos`.
|
||||
* Understand how transactions work in an EOSIO blockchain. For more information on transactions, see the [Transactions Protocol](/protocol-guides/02_transactions_protocol.md) section.
|
||||
| `cleos` is bundled with the Antelope software. [Installing Antelope](../../00_install/index.md) will also install `cleos`.
|
||||
* Understand how transactions work in an Antelope blockchain. For more information on transactions, see the [Transactions Protocol](/protocol-guides/02_transactions_protocol.md) section.
|
||||
|
||||
## Command Reference
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Overview
|
||||
|
||||
This how-to guide provides instructions on how to import a private key into the `keosd` default wallet. You can use the private key to authorize transactions in an EOSIO blockchain.
|
||||
This how-to guide provides instructions on how to import a private key into the `keosd` default wallet. You can use the private key to authorize transactions in an Antelope blockchain.
|
||||
|
||||
## Before you Begin
|
||||
|
||||
@@ -11,7 +11,7 @@ Make sure you meet the following requirements:
|
||||
* Familiarize with the [`cleos wallet import`](../03_command-reference/wallet/import.md) command.
|
||||
* Install the currently supported version of `cleos`.
|
||||
[[info | Note]]
|
||||
| `cleos` is bundled with the EOSIO software. [Installing EOSIO](../../00_install/index.md) will also install `cleos`.
|
||||
| `cleos` is bundled with the Antelope software. [Installing Antelope](../../00_install/index.md) will also install `cleos`.
|
||||
* Understand what a [public key](/glossary.md#public-key) and [private key](/glossary.md#private-key) is.
|
||||
|
||||
## Command Reference
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Overview
|
||||
|
||||
This how-to guide provides instructions on how to list all public keys and public/private key pairs within the `keosd` default wallet. You can use the public and private keys to authorize transactions in an EOSIO blockchain.
|
||||
This how-to guide provides instructions on how to list all public keys and public/private key pairs within the `keosd` default wallet. You can use the public and private keys to authorize transactions in an Antelope blockchain.
|
||||
|
||||
The example in this how-to guide displays all public keys and public/private key pairs stored within the existing default wallet.
|
||||
|
||||
@@ -13,7 +13,7 @@ Make sure you meet the following requirements:
|
||||
* Familiarize with the [`cleos wallet`](../03_command-reference/wallet/index.md) commands.
|
||||
* Install the currently supported version of `cleos`.
|
||||
[[info | Note]]
|
||||
| `cleos` is bundled with the EOSIO software. [Installing EOSIO](../../00_install/index.md) will also install `cleos`.
|
||||
| `cleos` is bundled with the Antelope software. [Installing Antelope](../../00_install/index.md) will also install `cleos`.
|
||||
* Understand what a [public key](/glossary.md#public-key) and [private key](/glossary.md#private-key) is.
|
||||
|
||||
## Command Reference
|
||||
|
||||
@@ -30,7 +30,7 @@ Options:
|
||||
```
|
||||
|
||||
## Command
|
||||
A set of EOSIO keys is required to create an account. The EOSIO keys can be generated by using `cleos create key`.
|
||||
A set of Antelope keys is required to create an account. The Antelope keys can be generated by using `cleos create key`.
|
||||
|
||||
```sh
|
||||
cleos create account inita tester EOS4toFS3YXEQCkuuw1aqDLrtHim86Gz9u3hBdcBw5KNPZcursVHq EOS7d9A3uLe6As66jzN8j44TXJUqJSK3bFjjEEqR4oTvNAB3iM9SA
|
||||
|
||||
@@ -30,7 +30,7 @@ Make sure you meet the following requirements:
|
||||
|
||||
* Install the currently supported version of `cleos`.
|
||||
[[info | Note]]
|
||||
| `cleos` is bundled with the EOSIO software. [Installing EOSIO](../../../00_install/index.md) will also install the `cleos` and `keosd` command line tools.
|
||||
| `cleos` is bundled with the Antelope software. [Installing Antelope](../../../00_install/index.md) will also install the `cleos` and `keosd` command line tools.
|
||||
* You have access to a producing node instance with the [`net_api_plugin`](../../../01_nodeos/03_plugins/net_api_plugin/index.md) loaded.
|
||||
|
||||
## Examples
|
||||
|
||||
@@ -28,7 +28,7 @@ Make sure you meet the following requirements:
|
||||
|
||||
* Install the currently supported version of `cleos`.
|
||||
[[info | Note]]
|
||||
| `cleos` is bundled with the EOSIO software. [Installing EOSIO](../../../00_install/index.md) will also install the `cleos` and `keosd` command line tools.
|
||||
| `cleos` is bundled with the Antelope software. [Installing Antelope](../../../00_install/index.md) will also install the `cleos` and `keosd` command line tools.
|
||||
* You have access to a producing node instance with the [`net_api_plugin`](../../../01_nodeos/03_plugins/net_api_plugin/index.md) loaded.
|
||||
|
||||
## Examples
|
||||
|
||||
@@ -27,7 +27,7 @@ Make sure you meet the following requirements:
|
||||
|
||||
* Install the currently supported version of `cleos`.
|
||||
[[info | Note]]
|
||||
| `cleos` is bundled with the EOSIO software. [Installing EOSIO](../../../00_install/index.md) will also install the `cleos` and `keosd` command line tools.
|
||||
| `cleos` is bundled with the Antelope software. [Installing Antelope](../../../00_install/index.md) will also install the `cleos` and `keosd` command line tools.
|
||||
* You have access to a producing node instance with the [`net_api_plugin`](../../../01_nodeos/03_plugins/net_api_plugin/index.md) loaded.
|
||||
|
||||
## Examples
|
||||
|
||||
@@ -30,7 +30,7 @@ Make sure you meet the following requirements:
|
||||
|
||||
* Install the currently supported version of `cleos`.
|
||||
[[info | Note]]
|
||||
| `cleos` is bundled with the EOSIO software. [Installing EOSIO](../../../00_install/index.md) will also install the `cleos` and `keosd` command line tools.
|
||||
| `cleos` is bundled with the Antelope software. [Installing Antelope](../../../00_install/index.md) will also install the `cleos` and `keosd` command line tools.
|
||||
* You have access to a producing node instance with the [`net_api_plugin`](../../../01_nodeos/03_plugins/net_api_plugin/index.md) loaded.
|
||||
|
||||
## Examples
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
set parameters dealing with account permissions
|
||||
|
||||
[[info | JSON input]]
|
||||
| This command involves specifying JSON input which depends on underlying class definitions. Therefore, such JSON input is subject to change in future versions of the EOSIO software.
|
||||
| This command involves specifying JSON input which depends on underlying class definitions. Therefore, such JSON input is subject to change in future versions of the Antelope software.
|
||||
|
||||
## Positionals
|
||||
- `account` _TEXT_ - The account to set/delete a permission authority for
|
||||
|
||||
@@ -20,4 +20,4 @@ Replace API_ENDPOINT and PORT with your remote `nodeos` API endpoint detail
|
||||
|
||||
## "Missing Authorizations"
|
||||
|
||||
That means you are not using the required authorizations. Most likely you are not using correct EOSIO account or permission level to sign the transaction
|
||||
That means you are not using the required authorizations. Most likely you are not using correct Antelope account or permission level to sign the transaction
|
||||
|
||||
@@ -4,11 +4,11 @@ content_title: Cleos
|
||||
|
||||
## Introduction
|
||||
|
||||
`cleos` is a command line tool that interfaces with the REST API exposed by `nodeos`. Developers can also use `cleos` to deploy and test EOSIO smart contracts.
|
||||
`cleos` is a command line tool that interfaces with the REST API exposed by `nodeos`. Developers can also use `cleos` to deploy and test Antelope smart contracts.
|
||||
|
||||
## Installation
|
||||
|
||||
`cleos` is distributed as part of the [EOSIO software suite](https://github.com/eosnetworkfoundation/mandel). To install `cleos` just visit the [EOSIO Software Installation](../00_install/index.md) section.
|
||||
`cleos` is distributed as part of the [Antelope software suite](https://github.com/AntelopeIO/leap). To install `cleos` just visit the [Antelope Software Installation](../00_install/index.md) section.
|
||||
|
||||
## Using Cleos
|
||||
|
||||
@@ -23,7 +23,7 @@ cleos --help
|
||||
```
|
||||
|
||||
```console
|
||||
Command Line Interface to EOSIO Client
|
||||
Command Line Interface to Antelope Client
|
||||
Usage: cleos [OPTIONS] SUBCOMMAND
|
||||
|
||||
Options:
|
||||
|
||||
@@ -91,6 +91,11 @@ Config Options for eosio::wallet_plugin:
|
||||
number of seconds of inactivity.
|
||||
Activity is defined as any wallet
|
||||
command e.g. list-wallets.
|
||||
--yubihsm-url URL Override default URL of
|
||||
http://localhost:12345 for connecting
|
||||
to yubihsm-connector
|
||||
--yubihsm-authkey key_num Enables YubiHSM support using given
|
||||
Authkey
|
||||
|
||||
Application Config Options:
|
||||
--plugin arg Plugin(s) to enable, may be specified
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
---
|
||||
content_title: How To Attach a YubiHSM Hard Wallet
|
||||
link_text: How To Attach a YubiHSM Hard Wallet
|
||||
---
|
||||
|
||||
## Goal
|
||||
|
||||
Attach a YubiHSM as a hard wallet
|
||||
|
||||
## Before you begin
|
||||
|
||||
* Install the currently supported version of `keosd`
|
||||
|
||||
* Install YubiHSM2 Software Toolkit (YubiHSM2 SDK)
|
||||
|
||||
* Create an AuthKey with at least the following Capabilities:
|
||||
|
||||
* sign-ecdsa
|
||||
* generate-asymmetric-key
|
||||
* export-wrapped
|
||||
|
||||
* **Delete the default AuthKey**
|
||||
|
||||
[[warning | Security]]
|
||||
| It is extremely important to create a new AuthKey and remove the default AuthKey before proceed to the following steps.
|
||||
|
||||
## Steps
|
||||
|
||||
### Configure `keosd`
|
||||
|
||||
There are two options to connect `keosd` to YubiHSM:
|
||||
|
||||
#### Using a YubiHSM connector
|
||||
|
||||
By default, `keosd` will connect to the YubiHSM connector on the default host and port. If a non-default URL is used, set the `--yubihsm-url` option or `yubihsm-url` in `config.ini` with the correct connector URL
|
||||
|
||||
#### Directly connect via USB
|
||||
|
||||
`keosd` also can directly connect to YubiHSM via USB protocol
|
||||
|
||||
If this option is used, set `keosd` startup option as the below:
|
||||
|
||||
```sh
|
||||
--yubihsm-url=ysb://
|
||||
```
|
||||
|
||||
### Start `keosd` with AuthKey:
|
||||
|
||||
```sh
|
||||
--yubihsm-authkey Your_AuthKey_Object_Number
|
||||
```
|
||||
|
||||
if a YubiHSM connector is used, check the YubiHSM connector is up and running by visiting YubiHSM URL:
|
||||
http://YubiHSM_HOST:YubiHSM_PORT/connector/status ((Default HOST and Port: http://127.0.0.1:12345)
|
||||
|
||||
You should see something like this:
|
||||
|
||||
```console
|
||||
status=OK
|
||||
serial=*
|
||||
version=2.0.0
|
||||
pid=666
|
||||
address=localhost
|
||||
port=12345
|
||||
```
|
||||
|
||||
### Unlock YubiHSM wallet with the password of AuthKey using the following option:
|
||||
|
||||
```sh
|
||||
cleos wallet unlock -n YubiHSM --password YOUR_AUTHKEY_PASSWORD
|
||||
```
|
||||
|
||||
After unlocking the wallet, you can use `cleos wallet` commands as usual. Beware as a part of security mechanism, some wallet subcommands, such as retrieve private keys, or remove a key, are not supported when a YubiHSM is used
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
content_title: Keosd How-to Guides
|
||||
---
|
||||
|
||||
* [How to attach a YubiHSM hard wallet](how-to-attach-a-yubihsm-hard-wallet.md)
|
||||
@@ -8,11 +8,11 @@ content_title: Keosd
|
||||
|
||||
## Installation
|
||||
|
||||
`keosd` is distributed as part of the [EOSIO software suite](https://github.com/eosnetworkfoundation/mandel). To install `keosd` just visit the [EOSIO Software Installation](../00_install/index.md) section.
|
||||
`keosd` is distributed as part of the [Antelope software suite](https://github.com/AntelopeIO/leap). To install `keosd` just visit the [Antelope Software Installation](../00_install/index.md) section.
|
||||
|
||||
## Operation
|
||||
|
||||
When a wallet is unlocked with the corresponding password, `cleos` can request `keosd` to sign a transaction with the appropriate private keys. Also, `keosd` provides support for hardware-based wallets such as Secure Encalve and YubiHSM.
|
||||
|
||||
[[info | Audience]]
|
||||
| `keosd` is intended to be used by EOSIO developers only.
|
||||
| `keosd` is intended to be used by Antelope developers only.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
content_title: EOSIO Utilities
|
||||
link_text: EOSIO Utilities
|
||||
content_title: Antelope Utilities
|
||||
link_text: Antelope Utilities
|
||||
---
|
||||
|
||||
This section contains documentation for additional utilities that complement or extend `nodeos` and potentially other EOSIO software:
|
||||
This section contains documentation for additional utilities that complement or extend `nodeos` and potentially other Antelope software:
|
||||
|
||||
* [eosio-blocklog](eosio-blocklog.md) - Low-level utility for node operators to interact with block log files.
|
||||
* [trace_api_util](trace_api_util.md) - Low-level utility for performing tasks associated with the [Trace API](../01_nodeos/03_plugins/trace_api_plugin/index.md).
|
||||
|
||||
+9
-9
@@ -1,23 +1,23 @@
|
||||
---
|
||||
content_title: EOSIO Overview
|
||||
content_title: Antelope Overview
|
||||
---
|
||||
|
||||
EOSIO is the next-generation blockchain platform for creating and deploying smart contracts and distributed applications. EOSIO comes with a number of programs. The primary ones included in EOSIO are the following:
|
||||
Antelope is the next-generation blockchain platform for creating and deploying smart contracts and distributed applications. Antelope comes with a number of programs. The primary ones included in Antelope are the following:
|
||||
|
||||
* [Nodeos](01_nodeos/index.md) - Core service daemon that runs a node for block production, API endpoints, or local development.
|
||||
* [Cleos](02_cleos/index.md) - Command line interface to interact with the blockchain (via `nodeos`) and manage wallets (via `keosd`).
|
||||
* [Keosd](03_keosd/index.md) - Component that manages EOSIO keys in wallets and provides a secure enclave for digital signing.
|
||||
* [Keosd](03_keosd/index.md) - Component that manages Antelope keys in wallets and provides a secure enclave for digital signing.
|
||||
|
||||
The basic relationship between these components is illustrated in the diagram below.
|
||||
|
||||

|
||||

|
||||
|
||||
Additional EOSIO Resources:
|
||||
* [EOSIO Utilities](10_utilities/index.md) - Utilities that complement the EOSIO software.
|
||||
Additional Antelope Resources:
|
||||
* [Antelope Utilities](10_utilities/index.md) - Utilities that complement the Antelope software.
|
||||
|
||||
[//]: # (THIS IS A COMMENT REMOVING BROKEN LINKS)
|
||||
[//]: # (Upgrade-Guide-20_upgrade-guide/index.md-EOSIO-version/protocol-upgrade-guide.)
|
||||
[//]: # (Release Notes 30_release-notes/index.md - All release notes for this EOSIO version.)
|
||||
[//]: # (Upgrade-Guide-20_upgrade-guide/index.md-antelope-version/protocol-upgrade-guide.)
|
||||
[//]: # (Release Notes 30_release-notes/index.md - All release notes for this Antelope version.)
|
||||
|
||||
[[info | What's Next?]]
|
||||
| [Install the EOSIO Software](00_install/index.md) before exploring the sections above.
|
||||
| [Install the Antelope Software](00_install/index.md) before exploring the sections above.
|
||||
|
||||
@@ -4,15 +4,10 @@ set(APPBASE_INSTALL_COMPONENT "dev")
|
||||
set(SOFTFLOAT_INSTALL_COMPONENT "dev")
|
||||
set(EOSVM_INSTALL_COMPONENT "dev")
|
||||
|
||||
add_subdirectory( fc )
|
||||
add_subdirectory( libfc )
|
||||
add_subdirectory( builtins )
|
||||
|
||||
# Suppress warnings on 3rdParty Library
|
||||
add_definitions( -w )
|
||||
add_subdirectory( softfloat )
|
||||
add_subdirectory( wasm-jit )
|
||||
remove_definitions( -w )
|
||||
|
||||
add_subdirectory( chainbase )
|
||||
set(APPBASE_ENABLE_AUTO_VERSION OFF CACHE BOOL "enable automatic discovery of version via 'git describe'")
|
||||
add_subdirectory( appbase )
|
||||
@@ -20,6 +15,7 @@ add_subdirectory( chain )
|
||||
add_subdirectory( testing )
|
||||
add_subdirectory( version )
|
||||
add_subdirectory( state_history )
|
||||
add_subdirectory( cli11 )
|
||||
|
||||
set(USE_EXISTING_SOFTFLOAT ON CACHE BOOL "use pre-exisiting softfloat lib")
|
||||
set(ENABLE_TOOLS OFF CACHE BOOL "Build tools")
|
||||
@@ -30,3 +26,25 @@ set(ENABLE_PROFILE OFF CACHE BOOL "Enable for profile builds")
|
||||
if(eos-vm IN_LIST EOSIO_WASM_RUNTIMES OR eos-vm-jit IN_LIST EOSIO_WASM_RUNTIMES)
|
||||
add_subdirectory( eos-vm )
|
||||
endif()
|
||||
|
||||
#yubihsm's openssl discovery is via pkg-config instead of find_package. Help it out on macOS otherwise openssl's pkgconfig
|
||||
# files may not be found down in the /opt/homebrew/opt directory
|
||||
if(APPLE)
|
||||
get_filename_component(OPENSSL_LIB_PATH "${OPENSSL_CRYPTO_LIBRARY}" DIRECTORY)
|
||||
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${OPENSSL_LIB_PATH}/pkgconfig")
|
||||
endif()
|
||||
set(ENABLE_STATIC ON)
|
||||
set(CMAKE_MACOSX_RPATH OFF)
|
||||
set(BUILD_ONLY_LIB ON CACHE BOOL "Library only build")
|
||||
message(STATUS "Starting yubihsm configuration...")
|
||||
add_subdirectory( yubihsm EXCLUDE_FROM_ALL )
|
||||
target_compile_options(yubihsm_static PRIVATE -fno-lto -fcommon)
|
||||
message(STATUS "yubihsm configuration complete")
|
||||
|
||||
get_property(_CTEST_CUSTOM_TESTS_IGNORE GLOBAL PROPERTY CTEST_CUSTOM_TESTS_IGNORE)
|
||||
set_property(GLOBAL PROPERTY CTEST_CUSTOM_TESTS_IGNORE
|
||||
"change_authkey import_ed decrypt_ec decrypt_rsa ssh logs generate_rsa import_ec echo\
|
||||
yubico_otp wrap_data wrap info import_rsa import_authkey generate_hmac generate_ec\
|
||||
attest pbkdf2 parsing ${_CTEST_CUSTOM_TESTS_IGNORE}")
|
||||
|
||||
add_subdirectory(prometheus)
|
||||
@@ -72,6 +72,9 @@ set(CHAIN_WEBASSEMBLY_SOURCES
|
||||
webassembly/transaction.cpp
|
||||
)
|
||||
|
||||
add_library(eosio_rapidjson INTERFACE)
|
||||
target_include_directories(eosio_rapidjson INTERFACE ../rapidjson/include)
|
||||
|
||||
## SORT .cpp by most likely to change / break compile
|
||||
add_library( eosio_chain
|
||||
merkle.cpp
|
||||
@@ -125,7 +128,7 @@ add_library( eosio_chain
|
||||
${HEADERS}
|
||||
)
|
||||
|
||||
target_link_libraries( eosio_chain PUBLIC fc chainbase Logging IR WAST WASM Runtime
|
||||
target_link_libraries( eosio_chain PUBLIC fc chainbase eosio_rapidjson Logging IR WAST WASM Runtime
|
||||
softfloat builtins ${CHAIN_EOSVM_LIBRARIES} ${LLVM_LIBS} ${CHAIN_RT_LINKAGE}
|
||||
)
|
||||
target_include_directories( eosio_chain
|
||||
|
||||
@@ -56,7 +56,6 @@ void apply_context::exec_one()
|
||||
|
||||
digest_type act_digest;
|
||||
|
||||
const auto& cfg = control.get_global_properties().configuration;
|
||||
const account_metadata_object* receiver_account = nullptr;
|
||||
|
||||
auto handle_exception = [&](const auto& e)
|
||||
|
||||
@@ -1088,11 +1088,12 @@ struct controller_impl {
|
||||
active_permission.id,
|
||||
active_producers_authority,
|
||||
genesis.initial_timestamp );
|
||||
const auto& minority_permission = authorization.create_permission( config::producers_account_name,
|
||||
authorization.create_permission( config::producers_account_name,
|
||||
config::minority_producers_permission_name,
|
||||
majority_permission.id,
|
||||
active_producers_authority,
|
||||
genesis.initial_timestamp );
|
||||
|
||||
}
|
||||
|
||||
// The returned scoped_exit should not exceed the lifetime of the pending which existed when make_block_restore_point was called.
|
||||
@@ -1481,7 +1482,7 @@ struct controller_impl {
|
||||
fc::microseconds max_transaction_time,
|
||||
uint32_t billed_cpu_time_us,
|
||||
bool explicit_billed_cpu_time,
|
||||
uint32_t subjective_cpu_bill_us )
|
||||
int64_t subjective_cpu_bill_us )
|
||||
{
|
||||
EOS_ASSERT(block_deadline != fc::time_point(), transaction_exception, "deadline cannot be uninitialized");
|
||||
|
||||
@@ -1527,7 +1528,7 @@ struct controller_impl {
|
||||
trx_context.init_for_implicit_trx();
|
||||
trx_context.enforce_whiteblacklist = false;
|
||||
} else {
|
||||
bool skip_recording = replay_head_time && (time_point(trn.expiration) <= *replay_head_time);
|
||||
bool skip_recording = replay_head_time && (time_point(trn.expiration) < *replay_head_time);
|
||||
trx_context.init_for_input_trx( trx->packed_trx()->get_unprunable_size(),
|
||||
trx->packed_trx()->get_prunable_size(),
|
||||
skip_recording);
|
||||
@@ -2403,7 +2404,8 @@ struct controller_impl {
|
||||
break;
|
||||
}
|
||||
}
|
||||
dlog("removed ${n} expired transactions of the ${t} input dedup list", ("n", num_removed)("t", total));
|
||||
dlog("removed ${n} expired transactions of the ${t} input dedup list, pending block time ${pt}",
|
||||
("n", num_removed)("t", total)("pt", now));
|
||||
}
|
||||
|
||||
bool sender_avoids_whitelist_blacklist_enforcement( account_name sender )const {
|
||||
@@ -2879,7 +2881,7 @@ void controller::push_block( controller::block_report& br,
|
||||
transaction_trace_ptr controller::push_transaction( const transaction_metadata_ptr& trx,
|
||||
fc::time_point block_deadline, fc::microseconds max_transaction_time,
|
||||
uint32_t billed_cpu_time_us, bool explicit_billed_cpu_time,
|
||||
uint32_t subjective_cpu_bill_us ) {
|
||||
int64_t subjective_cpu_bill_us ) {
|
||||
validate_db_available_size();
|
||||
EOS_ASSERT( get_read_mode() != db_read_mode::IRREVERSIBLE, transaction_type_exception, "push transaction not allowed in irreversible mode" );
|
||||
EOS_ASSERT( trx && !trx->implicit && !trx->scheduled, transaction_type_exception, "Implicit/Scheduled transaction not allowed" );
|
||||
|
||||
@@ -93,7 +93,7 @@ void apply_eosio_newaccount(apply_context& context) {
|
||||
"Cannot create account named ${name}, as that name is already taken",
|
||||
("name", create.name));
|
||||
|
||||
const auto& new_account = db.create<account_object>([&](auto& a) {
|
||||
db.create<account_object>([&](auto& a) {
|
||||
a.name = create.name;
|
||||
a.creation_date = context.control.pending_block_time();
|
||||
});
|
||||
@@ -127,8 +127,6 @@ void apply_eosio_newaccount(apply_context& context) {
|
||||
} FC_CAPTURE_AND_RETHROW( (create) ) }
|
||||
|
||||
void apply_eosio_setcode(apply_context& context) {
|
||||
const auto& cfg = context.control.get_global_properties().configuration;
|
||||
|
||||
auto& db = context.db;
|
||||
auto act = context.get_action().data_as<setcode>();
|
||||
context.require_authorization(act.account);
|
||||
|
||||
@@ -283,8 +283,6 @@ namespace eosio { namespace chain {
|
||||
}
|
||||
|
||||
block_header_state_ptr fork_database::get_block_header( const block_id_type& id )const {
|
||||
const auto& by_id_idx = my->index.get<by_block_id>();
|
||||
|
||||
if( my->root->id == id ) {
|
||||
return my->root;
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
#include <fc/time.hpp>
|
||||
#include <fc/utility.hpp>
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
|
||||
namespace eosio { namespace chain { namespace config {
|
||||
|
||||
typedef __uint128_t uint128_t;
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace eosio { namespace chain {
|
||||
transaction_trace_ptr push_transaction( const transaction_metadata_ptr& trx,
|
||||
fc::time_point deadline, fc::microseconds max_transaction_time,
|
||||
uint32_t billed_cpu_time_us, bool explicit_billed_cpu_time,
|
||||
uint32_t subjective_cpu_bill_us );
|
||||
int64_t subjective_cpu_bill_us );
|
||||
|
||||
/**
|
||||
* Attempt to execute a specific transaction in our deferred trx database
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <fc/variant_object.hpp>
|
||||
#include <boost/core/demangle.hpp>
|
||||
#include <ostream>
|
||||
#include <memory>
|
||||
|
||||
namespace eosio { namespace chain {
|
||||
/**
|
||||
@@ -272,11 +273,6 @@ namespace eosio { namespace chain {
|
||||
read_section(detail::snapshot_section_traits<T>::section_name(), f);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool has_section(const std::string& suffix = std::string()) {
|
||||
return has_section(suffix + detail::snapshot_section_traits<T>::section_name());
|
||||
}
|
||||
|
||||
virtual void validate() const = 0;
|
||||
|
||||
virtual void return_to_header() = 0;
|
||||
@@ -284,7 +280,6 @@ namespace eosio { namespace chain {
|
||||
virtual ~snapshot_reader(){};
|
||||
|
||||
protected:
|
||||
virtual bool has_section( const std::string& section_name ) = 0;
|
||||
virtual void set_section( const std::string& section_name ) = 0;
|
||||
virtual bool read_row( detail::abstract_snapshot_row_reader& row_reader ) = 0;
|
||||
virtual bool empty( ) = 0;
|
||||
@@ -313,7 +308,6 @@ namespace eosio { namespace chain {
|
||||
explicit variant_snapshot_reader(const fc::variant& snapshot);
|
||||
|
||||
void validate() const override;
|
||||
bool has_section( const string& section_name ) override;
|
||||
void set_section( const string& section_name ) override;
|
||||
bool read_row( detail::abstract_snapshot_row_reader& row_reader ) override;
|
||||
bool empty ( ) override;
|
||||
@@ -365,7 +359,6 @@ namespace eosio { namespace chain {
|
||||
explicit istream_snapshot_reader(std::istream& snapshot);
|
||||
|
||||
void validate() const override;
|
||||
bool has_section( const string& section_name ) override;
|
||||
void set_section( const string& section_name ) override;
|
||||
bool read_row( detail::abstract_snapshot_row_reader& row_reader ) override;
|
||||
bool empty ( ) override;
|
||||
@@ -381,6 +374,24 @@ namespace eosio { namespace chain {
|
||||
uint64_t cur_row;
|
||||
};
|
||||
|
||||
class istream_json_snapshot_reader : public snapshot_reader {
|
||||
public:
|
||||
explicit istream_json_snapshot_reader(const fc::path& p);
|
||||
~istream_json_snapshot_reader();
|
||||
|
||||
void validate() const override;
|
||||
void set_section( const string& section_name ) override;
|
||||
bool read_row( detail::abstract_snapshot_row_reader& row_reader ) override;
|
||||
bool empty ( ) override;
|
||||
void clear_section() override;
|
||||
void return_to_header() override;
|
||||
|
||||
private:
|
||||
bool validate_section() const;
|
||||
|
||||
std::unique_ptr<struct istream_json_snapshot_reader_impl> impl;
|
||||
};
|
||||
|
||||
class integrity_hash_snapshot_writer : public snapshot_writer {
|
||||
public:
|
||||
explicit integrity_hash_snapshot_writer(fc::sha256::encoder& enc);
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace eosio { namespace chain {
|
||||
fc::time_point block_deadline = fc::time_point::maximum();
|
||||
fc::microseconds leeway = fc::microseconds( config::default_subjective_cpu_leeway_us );
|
||||
int64_t billed_cpu_time_us = 0;
|
||||
uint32_t subjective_cpu_bill_us = 0;
|
||||
int64_t subjective_cpu_bill_us = 0;
|
||||
bool explicit_billed_cpu_time = false;
|
||||
|
||||
transaction_checktime_timer transaction_timer;
|
||||
|
||||
@@ -32,12 +32,12 @@ using next_func_t = std::function<void(const std::variant<fc::exception_ptr, tra
|
||||
|
||||
struct unapplied_transaction {
|
||||
const transaction_metadata_ptr trx_meta;
|
||||
const fc::time_point expiry;
|
||||
trx_enum_type trx_type = trx_enum_type::unknown;
|
||||
bool return_failure_trace = false;
|
||||
next_func_t next;
|
||||
|
||||
const transaction_id_type& id()const { return trx_meta->id(); }
|
||||
fc::time_point_sec expiration()const { return trx_meta->packed_trx()->expiration(); }
|
||||
|
||||
unapplied_transaction(const unapplied_transaction&) = delete;
|
||||
unapplied_transaction() = delete;
|
||||
@@ -61,7 +61,7 @@ private:
|
||||
const_mem_fun<unapplied_transaction, const transaction_id_type&, &unapplied_transaction::id>
|
||||
>,
|
||||
ordered_non_unique< tag<by_type>, member<unapplied_transaction, trx_enum_type, &unapplied_transaction::trx_type> >,
|
||||
ordered_non_unique< tag<by_expiry>, member<unapplied_transaction, const fc::time_point, &unapplied_transaction::expiry> >
|
||||
ordered_non_unique< tag<by_expiry>, const_mem_fun<unapplied_transaction, fc::time_point_sec, &unapplied_transaction::expiration> >
|
||||
>
|
||||
> unapplied_trx_queue_type;
|
||||
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
auto& persisted_by_expiry = queue.get<by_expiry>();
|
||||
while( !persisted_by_expiry.empty() ) {
|
||||
const auto& itr = persisted_by_expiry.begin();
|
||||
if( itr->expiry > pending_block_time ) {
|
||||
if( itr->expiration() > pending_block_time ) {
|
||||
break;
|
||||
}
|
||||
if( deadline <= fc::time_point::now() ) {
|
||||
@@ -146,8 +146,7 @@ public:
|
||||
const block_state_ptr& bsptr = *ritr;
|
||||
for( auto itr = bsptr->trxs_metas().begin(), end = bsptr->trxs_metas().end(); itr != end; ++itr ) {
|
||||
const auto& trx = *itr;
|
||||
fc::time_point expiry = trx->packed_trx()->expiration();
|
||||
auto insert_itr = queue.insert( { trx, expiry, trx_enum_type::forked } );
|
||||
auto insert_itr = queue.insert( { trx, trx_enum_type::forked } );
|
||||
if( insert_itr.second ) added( insert_itr.first );
|
||||
}
|
||||
}
|
||||
@@ -155,8 +154,7 @@ public:
|
||||
|
||||
void add_aborted( deque<transaction_metadata_ptr> aborted_trxs ) {
|
||||
for( auto& trx : aborted_trxs ) {
|
||||
fc::time_point expiry = trx->packed_trx()->expiration();
|
||||
auto insert_itr = queue.insert( { std::move( trx ), expiry, trx_enum_type::aborted } );
|
||||
auto insert_itr = queue.insert( { std::move( trx ), trx_enum_type::aborted } );
|
||||
if( insert_itr.second ) added( insert_itr.first );
|
||||
}
|
||||
}
|
||||
@@ -164,8 +162,7 @@ public:
|
||||
void add_persisted( const transaction_metadata_ptr& trx ) {
|
||||
auto itr = queue.get<by_trx_id>().find( trx->id() );
|
||||
if( itr == queue.get<by_trx_id>().end() ) {
|
||||
fc::time_point expiry = trx->packed_trx()->expiration();
|
||||
auto insert_itr = queue.insert( { trx, expiry, trx_enum_type::persisted } );
|
||||
auto insert_itr = queue.insert( { trx, trx_enum_type::persisted } );
|
||||
if( insert_itr.second ) added( insert_itr.first );
|
||||
} else if( itr->trx_type != trx_enum_type::persisted ) {
|
||||
if (itr->trx_type == trx_enum_type::incoming || itr->trx_type == trx_enum_type::incoming_persisted)
|
||||
@@ -180,9 +177,8 @@ public:
|
||||
void add_incoming( const transaction_metadata_ptr& trx, bool persist_until_expired, bool return_failure_trace, next_func_t next ) {
|
||||
auto itr = queue.get<by_trx_id>().find( trx->id() );
|
||||
if( itr == queue.get<by_trx_id>().end() ) {
|
||||
fc::time_point expiry = trx->packed_trx()->expiration();
|
||||
auto insert_itr = queue.insert(
|
||||
{ trx, expiry, persist_until_expired ? trx_enum_type::incoming_persisted : trx_enum_type::incoming, return_failure_trace, std::move( next ) } );
|
||||
{ trx, persist_until_expired ? trx_enum_type::incoming_persisted : trx_enum_type::incoming, return_failure_trace, std::move( next ) } );
|
||||
if( insert_itr.second ) added( insert_itr.first );
|
||||
} else {
|
||||
if( itr->trx_meta == trx ) return; // same trx meta pointer
|
||||
@@ -208,6 +204,12 @@ public:
|
||||
iterator incoming_begin() { return queue.get<by_type>().lower_bound( trx_enum_type::incoming_persisted ); }
|
||||
iterator incoming_end() { return queue.get<by_type>().end(); } // if changed to upper_bound, verify usage performance
|
||||
|
||||
iterator lower_bound( const transaction_id_type& id ) {
|
||||
auto itr = queue.get<by_trx_id>().find( id );
|
||||
if( itr == queue.get<by_trx_id>().end() ) return queue.get<by_type>().end();
|
||||
return queue.project<by_type>(itr);
|
||||
}
|
||||
|
||||
/// caller's responsibility to call next() if applicable
|
||||
iterator erase( iterator itr ) {
|
||||
removed( itr );
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
#define RAPIDJSON_NAMESPACE eosio_rapidjson // This is ABSOLUTELY necessary anywhere that is using eosio_rapidjson
|
||||
|
||||
#include <eosio/chain/snapshot.hpp>
|
||||
#include <eosio/chain/exceptions.hpp>
|
||||
#include <fc/scoped_exit.hpp>
|
||||
#include <fc/io/json.hpp>
|
||||
|
||||
#include <rapidjson/document.h>
|
||||
#include <rapidjson/filereadstream.h>
|
||||
#include <rapidjson/stringbuffer.h>
|
||||
#include <rapidjson/writer.h>
|
||||
|
||||
using namespace eosio_rapidjson;
|
||||
|
||||
namespace eosio { namespace chain {
|
||||
|
||||
variant_snapshot_writer::variant_snapshot_writer(fc::mutable_variant_object& snapshot)
|
||||
@@ -77,17 +86,6 @@ void variant_snapshot_reader::validate() const {
|
||||
}
|
||||
}
|
||||
|
||||
bool variant_snapshot_reader::has_section( const string& section_name ) {
|
||||
const auto& sections = snapshot["sections"].get_array();
|
||||
for( const auto& section: sections ) {
|
||||
if (section["name"].as_string() == section_name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void variant_snapshot_reader::set_section( const string& section_name ) {
|
||||
const auto& sections = snapshot["sections"].get_array();
|
||||
for( const auto& section: sections ) {
|
||||
@@ -208,19 +206,19 @@ ostream_json_snapshot_writer::ostream_json_snapshot_writer(std::ostream& snapsho
|
||||
void ostream_json_snapshot_writer::write_start_section( const std::string& section_name )
|
||||
{
|
||||
row_count = 0;
|
||||
snapshot.inner << "," << fc::json::to_string(section_name, fc::time_point::maximum()) << ":{\n";
|
||||
snapshot.inner << "," << fc::json::to_string(section_name, fc::time_point::maximum()) << ":{\n\"rows\":[\n";
|
||||
}
|
||||
|
||||
void ostream_json_snapshot_writer::write_row( const detail::abstract_snapshot_row_writer& row_writer ) {
|
||||
const auto yield = [&](size_t s) {};
|
||||
|
||||
if(row_count != 0) snapshot.inner << ",";
|
||||
snapshot.inner << "\"row_" << row_count << "\":" << fc::json::to_string(row_writer.to_variant(), yield) << "\n";
|
||||
snapshot.inner << fc::json::to_string(row_writer.to_variant(), yield) << "\n";
|
||||
++row_count;
|
||||
}
|
||||
|
||||
void ostream_json_snapshot_writer::write_end_section( ) {
|
||||
snapshot.inner << "}\n";
|
||||
snapshot.inner << "],\n\"num_rows\":" << row_count << "\n}\n";
|
||||
row_count = 0;
|
||||
}
|
||||
|
||||
@@ -286,44 +284,6 @@ bool istream_snapshot_reader::validate_section() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool istream_snapshot_reader::has_section( const string& section_name ) {
|
||||
auto restore_pos = fc::make_scoped_exit([this,pos=snapshot.tellg()](){
|
||||
snapshot.seekg(pos);
|
||||
});
|
||||
|
||||
const std::streamoff header_size = sizeof(ostream_snapshot_writer::magic_number) + sizeof(current_snapshot_version);
|
||||
|
||||
auto next_section_pos = header_pos + header_size;
|
||||
|
||||
while (true) {
|
||||
snapshot.seekg(next_section_pos);
|
||||
uint64_t section_size = 0;
|
||||
snapshot.read((char*)§ion_size,sizeof(section_size));
|
||||
if (section_size == std::numeric_limits<uint64_t>::max()) {
|
||||
break;
|
||||
}
|
||||
|
||||
next_section_pos = snapshot.tellg() + std::streamoff(section_size);
|
||||
|
||||
uint64_t ignore = 0;
|
||||
snapshot.read((char*)&ignore,sizeof(ignore));
|
||||
|
||||
bool match = true;
|
||||
for(auto c : section_name) {
|
||||
if(snapshot.get() != c) {
|
||||
match = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (match && snapshot.get() == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void istream_snapshot_reader::set_section( const string& section_name ) {
|
||||
auto restore_pos = fc::make_scoped_exit([this,pos=snapshot.tellg()](){
|
||||
snapshot.seekg(pos);
|
||||
@@ -386,6 +346,91 @@ void istream_snapshot_reader::return_to_header() {
|
||||
clear_section();
|
||||
}
|
||||
|
||||
struct istream_json_snapshot_reader_impl {
|
||||
uint64_t num_rows;
|
||||
uint64_t cur_row;
|
||||
eosio_rapidjson::Document doc;
|
||||
std::string sec_name;
|
||||
};
|
||||
|
||||
istream_json_snapshot_reader::~istream_json_snapshot_reader() = default;
|
||||
|
||||
istream_json_snapshot_reader::istream_json_snapshot_reader(const fc::path& p)
|
||||
: impl{new istream_json_snapshot_reader_impl{0, 0, {}, {}}}
|
||||
{
|
||||
FILE* fp = fopen(p.string().c_str(), "rb");
|
||||
EOS_ASSERT(fp, snapshot_exception, "Failed to open JSON snapshot: ${file}", ("file", p));
|
||||
auto close = fc::make_scoped_exit( [&fp]() { fclose( fp ); } );
|
||||
char readBuffer[65536];
|
||||
eosio_rapidjson::FileReadStream is(fp, readBuffer, sizeof(readBuffer));
|
||||
impl->doc.ParseStream(is);
|
||||
}
|
||||
|
||||
void istream_json_snapshot_reader::validate() const {
|
||||
try {
|
||||
// validate totem
|
||||
auto expected_totem = ostream_json_snapshot_writer::magic_number;
|
||||
EOS_ASSERT(impl->doc.HasMember("magic_number"), snapshot_exception, "magic_number section not found" );
|
||||
auto actual_totem = impl->doc["magic_number"].GetUint();
|
||||
EOS_ASSERT( actual_totem == expected_totem, snapshot_exception, "JSON snapshot has unexpected magic number" );
|
||||
|
||||
// validate version
|
||||
auto expected_version = current_snapshot_version;
|
||||
EOS_ASSERT(impl->doc.HasMember("version"), snapshot_exception, "version section not found" );
|
||||
auto actual_version = impl->doc["version"].GetUint();
|
||||
EOS_ASSERT( actual_version == expected_version, snapshot_exception,
|
||||
"JSON snapshot is an unsupported version. Expected : ${expected}, Got: ${actual}",
|
||||
("expected", expected_version)( "actual", actual_version ) );
|
||||
|
||||
} catch( const std::exception& e ) { \
|
||||
snapshot_exception fce(FC_LOG_MESSAGE( warn, "JSON snapshot validation threw IO exception (${what})",("what",e.what())));
|
||||
throw fce;
|
||||
}
|
||||
}
|
||||
|
||||
bool istream_json_snapshot_reader::validate_section() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void istream_json_snapshot_reader::set_section( const string& section_name ) {
|
||||
EOS_ASSERT( impl->doc.HasMember( section_name.c_str() ), snapshot_exception, "JSON snapshot has no section ${sec}", ("sec", section_name) );
|
||||
EOS_ASSERT( impl->doc[section_name.c_str()].HasMember( "num_rows" ), snapshot_exception, "JSON snapshot ${sec} num_rows not found", ("sec", section_name) );
|
||||
EOS_ASSERT( impl->doc[section_name.c_str()].HasMember( "rows" ), snapshot_exception, "JSON snapshot ${sec} rows not found", ("sec", section_name) );
|
||||
EOS_ASSERT( impl->doc[section_name.c_str()]["rows"].IsArray(), snapshot_exception, "JSON snapshot ${sec} rows is not an array", ("sec_name", section_name) );
|
||||
|
||||
impl->sec_name = section_name;
|
||||
impl->num_rows = impl->doc[section_name.c_str()]["num_rows"].GetInt();
|
||||
ilog( "reading ${section_name}, num_rows: ${num_rows}", ("section_name", section_name)( "num_rows", impl->num_rows ) );
|
||||
}
|
||||
|
||||
bool istream_json_snapshot_reader::read_row( detail::abstract_snapshot_row_reader& row_reader ) {
|
||||
EOS_ASSERT( impl->cur_row < impl->num_rows, snapshot_exception, "JSON snapshot ${sect}'s cur_row ${cur_row} >= num_rows ${num_rows}",
|
||||
("sect_name", impl->sec_name)( "cur_row", impl->cur_row )( "num_rows", impl->num_rows ) );
|
||||
|
||||
const eosio_rapidjson::Value& rows = impl->doc[impl->sec_name.c_str()]["rows"];
|
||||
eosio_rapidjson::StringBuffer buffer;
|
||||
eosio_rapidjson::Writer<eosio_rapidjson::StringBuffer> writer( buffer );
|
||||
rows[impl->cur_row].Accept( writer );
|
||||
|
||||
const auto& row = fc::json::from_string( buffer.GetString() );
|
||||
row_reader.provide( row );
|
||||
return ++impl->cur_row < impl->num_rows;
|
||||
}
|
||||
|
||||
bool istream_json_snapshot_reader::empty ( ) {
|
||||
return impl->num_rows == 0;
|
||||
}
|
||||
|
||||
void istream_json_snapshot_reader::clear_section() {
|
||||
impl->num_rows = 0;
|
||||
impl->cur_row = 0;
|
||||
impl->sec_name = "";
|
||||
}
|
||||
|
||||
void istream_json_snapshot_reader::return_to_header() {
|
||||
clear_section();
|
||||
}
|
||||
|
||||
integrity_hash_snapshot_writer::integrity_hash_snapshot_writer(fc::sha256::encoder& enc)
|
||||
:enc(enc)
|
||||
{
|
||||
|
||||
@@ -276,7 +276,6 @@ namespace eosio { namespace chain { namespace webassembly {
|
||||
float64_t ret;
|
||||
int e = a.v >> 52 & 0x7FF;
|
||||
float64_t y;
|
||||
double de = 1/DBL_EPSILON;
|
||||
if ( a.v == 0x8000000000000000) {
|
||||
return af;
|
||||
}
|
||||
|
||||
+1
-1
Submodule libraries/chainbase updated: dcd2a34391...62d3f99059
@@ -0,0 +1,2 @@
|
||||
add_library(leap-cli11 INTERFACE)
|
||||
target_include_directories(leap-cli11 INTERFACE include)
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
## instructions for building custom leap-cli11 library
|
||||
|
||||
leap-cli11 interface only library created in order to simplify integration of modified version of command line parsing library cli11
|
||||
|
||||
to update included in this library include/cli11/CLI11.hpp file it needs to be (re)geenerated from repository containing forked/modified version of it, in particular:
|
||||
|
||||
|
||||
```bash
|
||||
git clone https://github.com/AntelopeIO/CLI11.git
|
||||
cd CLI11
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCLI11_SINGLE_FILE=ON ..
|
||||
make -j
|
||||
```
|
||||
|
||||
Resulting single-header will be located in:
|
||||
|
||||
```cpp
|
||||
build/include/CLI11.hpp
|
||||
```
|
||||
|
||||
And is ready to be copied to include/cli11/CLI11.hpp of leap-cli11 library
|
||||
|
||||
Automated CLI11 subproject build / import of CLI11.hpp header will be added in future versions.
|
||||
@@ -0,0 +1,26 @@
|
||||
#/usr/bin/env bash
|
||||
|
||||
_cleos_complete()
|
||||
{
|
||||
# Get cmdline while ignoring the last word
|
||||
cmdline=${COMP_LINE}
|
||||
if [[ "${cmdline:(-1)}" != " " ]]; then
|
||||
cmdline=${COMP_WORDS[@]:0:${COMP_CWORD}}
|
||||
fi
|
||||
|
||||
# Get complete candidates
|
||||
words=$(${cmdline} --_autocomplete "${COMP_WORDS[${COMP_CWORD}]}")
|
||||
|
||||
# Remove candidates that begins with `-` if `-` is not passed as the first character
|
||||
# TODO: move this logic inside CLI11? including the compgen?
|
||||
if [[ ! ${COMP_WORDS[${COMP_CWORD}]} = -* ]]; then
|
||||
words=(${words})
|
||||
for index in "${!words[@]}" ; do [[ ${words[$index]} =~ ^- ]] && unset -v 'words[$index]' ; done
|
||||
words="${words[@]}"
|
||||
fi
|
||||
|
||||
# Get matches
|
||||
COMPREPLY=($(compgen -W "${words}" -- "${COMP_WORDS[${COMP_CWORD}]}"))
|
||||
}
|
||||
|
||||
complete -F _cleos_complete cleos
|
||||
@@ -0,0 +1,26 @@
|
||||
#/usr/bin/env bash
|
||||
|
||||
_leap_complete()
|
||||
{
|
||||
# Get cmdline while ignoring the last word
|
||||
cmdline=${COMP_LINE}
|
||||
if [[ "${cmdline:(-1)}" != " " ]]; then
|
||||
cmdline=${COMP_WORDS[@]:0:${COMP_CWORD}}
|
||||
fi
|
||||
|
||||
# Get complete candidates
|
||||
words=$(${cmdline} --_autocomplete "${COMP_WORDS[${COMP_CWORD}]}")
|
||||
|
||||
# Remove candidates that begins with `-` if `-` is not passed as the first character
|
||||
# TODO: move this logic inside CLI11? including the compgen?
|
||||
if [[ ! ${COMP_WORDS[${COMP_CWORD}]} = -* ]]; then
|
||||
words=(${words})
|
||||
for index in "${!words[@]}" ; do [[ ${words[$index]} =~ ^- ]] && unset -v 'words[$index]' ; done
|
||||
words="${words[@]}"
|
||||
fi
|
||||
|
||||
# Get matches
|
||||
COMPREPLY=($(compgen -W "${words}" -- "${COMP_WORDS[${COMP_CWORD}]}"))
|
||||
}
|
||||
|
||||
complete -F _leap_complete leap-util
|
||||
File diff suppressed because it is too large
Load Diff
-1
Submodule libraries/fc deleted from 6f9fc55105
@@ -0,0 +1,155 @@
|
||||
add_subdirectory( secp256k1 )
|
||||
|
||||
set( WITH_PROCPS OFF CACHE BOOL "" FORCE)
|
||||
set( CURVE "ALT_BN128" CACHE STRING "" FORCE)
|
||||
set( USE_ASM OFF CACHE BOOL "" FORCE)
|
||||
set( IS_LIBFF_PARENT OFF CACHE BOOL "" FORCE)
|
||||
set( FF_INSTALL_COMPONENT "${FC_INSTALL_COMPONENT}")
|
||||
add_subdirectory( libraries/ff )
|
||||
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
||||
find_package(Threads)
|
||||
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
||||
set( fc_sources
|
||||
src/uint128.cpp
|
||||
src/real128.cpp
|
||||
src/variant.cpp
|
||||
src/exception.cpp
|
||||
src/variant_object.cpp
|
||||
src/string.cpp
|
||||
src/time.cpp
|
||||
src/mock_time.cpp
|
||||
src/utf8.cpp
|
||||
src/io/datastream.cpp
|
||||
src/io/json.cpp
|
||||
src/io/varint.cpp
|
||||
src/io/fstream.cpp
|
||||
src/io/console.cpp
|
||||
src/filesystem.cpp
|
||||
src/interprocess/file_mapping.cpp
|
||||
src/interprocess/mmap_struct.cpp
|
||||
src/log/log_message.cpp
|
||||
src/log/logger.cpp
|
||||
src/log/appender.cpp
|
||||
src/log/console_appender.cpp
|
||||
src/log/dmlog_appender.cpp
|
||||
src/log/logger_config.cpp
|
||||
src/crypto/_digest_common.cpp
|
||||
src/crypto/aes.cpp
|
||||
src/crypto/crc.cpp
|
||||
src/crypto/city.cpp
|
||||
# src/crypto/base32.cpp
|
||||
src/crypto/base36.cpp
|
||||
src/crypto/base58.cpp
|
||||
src/crypto/base64.cpp
|
||||
src/crypto/bigint.cpp
|
||||
src/crypto/hex.cpp
|
||||
src/crypto/sha1.cpp
|
||||
src/crypto/sha3.cpp
|
||||
src/crypto/ripemd160.cpp
|
||||
src/crypto/sha256.cpp
|
||||
src/crypto/sha224.cpp
|
||||
src/crypto/sha512.cpp
|
||||
src/crypto/dh.cpp
|
||||
src/crypto/blowfish.cpp
|
||||
src/crypto/elliptic_common.cpp
|
||||
src/crypto/elliptic_impl_priv.cpp
|
||||
src/crypto/elliptic_secp256k1.cpp
|
||||
src/crypto/elliptic_r1.cpp
|
||||
src/crypto/elliptic_webauthn.cpp
|
||||
src/crypto/rand.cpp
|
||||
src/crypto/public_key.cpp
|
||||
src/crypto/private_key.cpp
|
||||
src/crypto/signature.cpp
|
||||
src/crypto/alt_bn128.cpp
|
||||
src/crypto/modular_arithmetic.cpp
|
||||
src/crypto/blake2.cpp
|
||||
src/crypto/k1_recover.cpp
|
||||
src/network/ip.cpp
|
||||
src/network/platform_root_ca.cpp
|
||||
src/network/resolve.cpp
|
||||
src/network/udp_socket.cpp
|
||||
src/network/url.cpp
|
||||
src/network/http/http_client.cpp
|
||||
src/compress/smaz.cpp
|
||||
src/compress/zlib.cpp
|
||||
src/log/gelf_appender.cpp
|
||||
src/log/zipkin.cpp
|
||||
)
|
||||
|
||||
file( GLOB_RECURSE fc_headers ${CMAKE_CURRENT_SOURCE_DIR} *.hpp *.h )
|
||||
|
||||
add_library(fc ${fc_sources} ${fc_headers})
|
||||
|
||||
function(detect_thread_name)
|
||||
include(CheckSymbolExists)
|
||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES "-pthread")
|
||||
check_symbol_exists(pthread_setname_np pthread.h HAVE_PTHREAD_SETNAME_NP)
|
||||
if(HAVE_PTHREAD_SETNAME_NP)
|
||||
set_source_files_properties(src/log/logger_config.cpp PROPERTIES COMPILE_DEFINITIONS FC_USE_PTHREAD_NAME_NP)
|
||||
endif()
|
||||
endfunction()
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
detect_thread_name()
|
||||
endif()
|
||||
|
||||
# Yuck: newer CMake files from boost iostreams will effectively target_link_libraries(Boost::iostreams z;bz2;lzma;zstd)
|
||||
# without first "finding" those libraries. This resolves to simple -lz -lbz2 etc: it'll look for those libraries in the linker's
|
||||
# library search path. This is most problematic on macOS where something like libzstd isn't in the standard search path. Historically
|
||||
# fc would just "-L/usr/local/lib" as a heavy handed way to make sure something like -lzstd can be found in brew's library path. But
|
||||
# that isn't sufficient for something like ARM homebrew. Let's just "null" these libraries out since we're already linking to zlib
|
||||
# explicitly anyways via a proper find_package(ZLIB) below.
|
||||
if(APPLE)
|
||||
add_library(z INTERFACE)
|
||||
add_library(bz2 INTERFACE)
|
||||
add_library(lzma INTERFACE)
|
||||
add_library(zstd INTERFACE)
|
||||
endif()
|
||||
|
||||
find_package(Boost 1.66 REQUIRED COMPONENTS
|
||||
date_time
|
||||
filesystem
|
||||
chrono
|
||||
unit_test_framework
|
||||
iostreams)
|
||||
|
||||
# fc picks up a dependency on zlib via Boost::iostreams, however in some versions of cmake/boost (depending on if CMake config
|
||||
# files are used) the Boost::iostreams target does not have a dependency on zlib itself so add it explicitly
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
target_include_directories(fc PUBLIC include)
|
||||
|
||||
# try and make this very clear that this json parser is intended only for webauthn parsing..
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.11.0)
|
||||
set_source_files_properties(src/crypto/elliptic_webauthn.cpp PROPERTIES INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/include/fc/crypto/webauthn_json/include")
|
||||
else()
|
||||
set_source_files_properties(src/crypto/elliptic_webauthn.cpp PROPERTIES COMPILE_FLAGS "-I${CMAKE_CURRENT_SOURCE_DIR}/include/fc/crypto/webauthn_json/include")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries( fc PUBLIC ws2_32 mswsock userenv )
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
find_library(security_framework Security)
|
||||
find_library(corefoundation_framework CoreFoundation)
|
||||
endif()
|
||||
target_link_libraries( fc PUBLIC ff
|
||||
Boost::date_time Boost::filesystem Boost::chrono Boost::iostreams Threads::Threads
|
||||
OpenSSL::Crypto OpenSSL::SSL ZLIB::ZLIB ${PLATFORM_SPECIFIC_LIBS} ${CMAKE_DL_LIBS} secp256k1 ${security_framework} ${corefoundation_framework} )
|
||||
|
||||
# Critically, this ensures that OpenSSL 1.1 & 3.0 both have a variant of BN_zero() with void return value. But it also allows access
|
||||
# to some obsoleted AES functions in 3.0 too, since 3.0's API_COMPAT is effectively 3.0 by default
|
||||
target_compile_definitions(fc PUBLIC "OPENSSL_API_COMPAT=0x10100000L" "OPENSSL_NO_DEPRECATED")
|
||||
|
||||
add_subdirectory( test )
|
||||
|
||||
install(TARGETS fc
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} COMPONENT dev EXCLUDE_FROM_ALL
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} COMPONENT dev EXCLUDE_FROM_ALL)
|
||||
install(DIRECTORY include/fc DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR} COMPONENT dev EXCLUDE_FROM_ALL)
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
#pragma once
|
||||
#include <fc/api.hpp>
|
||||
#include <fc/thread/thread.hpp>
|
||||
|
||||
namespace fc {
|
||||
|
||||
namespace detail {
|
||||
struct actor_member {
|
||||
#if 1 // BOOST_NO_VARIADIC_TEMPLATES
|
||||
#define RPC_MEMBER_FUNCTOR(z,n,IS_CONST) \
|
||||
template<typename R, typename C, typename P BOOST_PP_ENUM_TRAILING_PARAMS( n, typename A)> \
|
||||
static std::function<fc::future<R>( BOOST_PP_ENUM_PARAMS(n,A) ) > \
|
||||
functor( P p, R (C::*mem_func)(BOOST_PP_ENUM_PARAMS(n,A)) IS_CONST, fc::thread* c = 0) { \
|
||||
return [=](BOOST_PP_ENUM_BINARY_PARAMS(n,A,a))->fc::future<R>{ \
|
||||
return c->async( [=](){ return (p->*mem_func)(BOOST_PP_ENUM_PARAMS(n,a)); } ); }; \
|
||||
}
|
||||
BOOST_PP_REPEAT( 8, RPC_MEMBER_FUNCTOR, const )
|
||||
BOOST_PP_REPEAT( 8, RPC_MEMBER_FUNCTOR, BOOST_PP_EMPTY() )
|
||||
#undef RPC_MEMBER_FUNCTOR
|
||||
|
||||
#else // g++ has a bug that prevents lambdas and varidic templates from working together (G++ Bug 41933)
|
||||
|
||||
template<typename R, typename C, typename P, typename... Args>
|
||||
static std::function<fc::future<R>(Args...)> functor( P&& p, R (C::*mem_func)(Args...), fc::thread* c ) {
|
||||
return [=](Args... args)->fc::future<R>{ c->async( [=]()->R { return p->*mem_func( fc::forward<Args>(args)... ); } ) };
|
||||
}
|
||||
template<typename R, typename C, typename P, typename... Args>
|
||||
static std::function<fc::future<R>(Args...)> functor( P&& p, R (C::*mem_func)(Args...)const, fc::thread* c ){
|
||||
return [=](Args... args)->fc::future<R>{ c->async( [=]()->R { return p->*mem_func( fc::forward<Args>(args)... ); } ) };
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename ThisPtr>
|
||||
struct actor_vtable_visitor {
|
||||
template<typename U>
|
||||
actor_vtable_visitor( fc::thread* t, U&& u ):_thread(t),_this( fc::forward<U>(u) ){}
|
||||
|
||||
template<typename Function, typename MemberPtr>
|
||||
void operator()( const char* name, Function& memb, MemberPtr m )const {
|
||||
memb = actor_member::functor( _this, m, _thread );
|
||||
}
|
||||
fc::thread* _thread;
|
||||
ThisPtr _this;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Posts all method calls to another thread and
|
||||
* returns a future.
|
||||
*/
|
||||
template<typename Interface>
|
||||
class actor : public api<Interface, detail::actor_member> {
|
||||
public:
|
||||
actor(){}
|
||||
|
||||
template<typename InterfaceType>
|
||||
actor( InterfaceType* p, fc::thread* t = &fc::thread::current() )
|
||||
{
|
||||
this->_vtable.reset(new detail::vtable<Interface,detail::actor_member>() );
|
||||
this->_vtable->template visit<InterfaceType>( detail::actor_vtable_visitor<InterfaceType*>(t, p) );
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace fc
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
namespace fc {
|
||||
|
||||
template<unsigned int S, typename T=double>
|
||||
struct aligned {
|
||||
union {
|
||||
T _align;
|
||||
char _data[S];
|
||||
} _store;
|
||||
operator char*() { return _store._data; }
|
||||
operator const char*()const { return _store._data; }
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
#include <boost/any.hpp>
|
||||
|
||||
namespace fc {
|
||||
// TODO: define this without using boost
|
||||
typedef boost::any any;
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
#pragma once
|
||||
#include <fc/thread/future.hpp>
|
||||
#include <fc/any.hpp>
|
||||
#include <functional>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
// ms visual c++ (as of 2013) doesn't accept the standard syntax for calling a
|
||||
// templated member function (foo->template bar();)
|
||||
#ifdef _MSC_VER
|
||||
# define FC_CALL_MEMBER_TEMPLATE_KEYWORD
|
||||
#else
|
||||
# define FC_CALL_MEMBER_TEMPLATE_KEYWORD template
|
||||
#endif
|
||||
|
||||
namespace fc {
|
||||
struct identity_member {
|
||||
template<typename R, typename C, typename P, typename... Args>
|
||||
static std::function<R(Args...)> functor( P&& p, R (C::*mem_func)(Args...) );
|
||||
template<typename R, typename C, typename P, typename... Args>
|
||||
static std::function<R(Args...)> functor( P&& p, R (C::*mem_func)(Args...)const );
|
||||
};
|
||||
|
||||
template< typename Interface, typename Transform >
|
||||
struct vtable : public std::enable_shared_from_this<vtable<Interface,Transform>>
|
||||
{ private: vtable(); };
|
||||
|
||||
template<typename OtherType>
|
||||
struct vtable_copy_visitor {
|
||||
typedef OtherType other_type;
|
||||
|
||||
vtable_copy_visitor( OtherType& s):_source( s ){}
|
||||
|
||||
template<typename R, typename MemberPtr, typename... Args>
|
||||
void operator()( const char* name, std::function<R(Args...)>& memb, MemberPtr m )const {
|
||||
OtherType* src = &_source;
|
||||
memb = [src,m]( Args... args ){ return (src->*m)(args...); };
|
||||
}
|
||||
OtherType& _source;
|
||||
};
|
||||
|
||||
template<typename Interface, typename Transform >
|
||||
class api;
|
||||
|
||||
class api_connection;
|
||||
|
||||
typedef uint32_t api_id_type;
|
||||
|
||||
class api_base
|
||||
{
|
||||
public:
|
||||
api_base() {}
|
||||
virtual ~api_base() {}
|
||||
|
||||
virtual uint64_t get_handle()const = 0;
|
||||
|
||||
virtual api_id_type register_api( api_connection& conn )const = 0;
|
||||
|
||||
// defined in api_connection.hpp
|
||||
template< typename T >
|
||||
api<T, identity_member> as();
|
||||
};
|
||||
typedef std::shared_ptr< api_base > api_ptr;
|
||||
|
||||
class api_connection;
|
||||
|
||||
template<typename Interface, typename Transform = identity_member >
|
||||
class api : public api_base {
|
||||
public:
|
||||
typedef vtable<Interface,Transform> vtable_type;
|
||||
|
||||
api():_vtable( std::make_shared<vtable_type>() ) {}
|
||||
|
||||
/** T is anything with pointer semantics */
|
||||
template<typename T >
|
||||
api( const T& p )
|
||||
:_vtable( std::make_shared<vtable_type>() )
|
||||
{
|
||||
_data = std::make_shared<fc::any>(p);
|
||||
T& ptr = boost::any_cast<T&>(*_data);
|
||||
auto& pointed_at = *ptr;
|
||||
typedef typename std::remove_reference<decltype(pointed_at)>::type source_vtable_type;
|
||||
_vtable->FC_CALL_MEMBER_TEMPLATE_KEYWORD visit_other( vtable_copy_visitor<source_vtable_type>(pointed_at) );
|
||||
}
|
||||
|
||||
api( const api& cpy ):_vtable(cpy._vtable),_data(cpy._data) {}
|
||||
virtual ~api() {}
|
||||
|
||||
friend bool operator == ( const api& a, const api& b ) { return a._data == b._data && a._vtable == b._vtable; }
|
||||
friend bool operator != ( const api& a, const api& b ) { return !(a._data == b._data && a._vtable == b._vtable); }
|
||||
virtual uint64_t get_handle()const override { return uint64_t(_data.get()); }
|
||||
virtual api_id_type register_api( api_connection& conn )const override; // defined in api_connection.hpp
|
||||
|
||||
vtable_type& operator*()const { FC_ASSERT( _vtable ); return *_vtable; }
|
||||
vtable_type* operator->()const { FC_ASSERT( _vtable ); return _vtable.get(); }
|
||||
|
||||
protected:
|
||||
std::shared_ptr<vtable_type> _vtable;
|
||||
std::shared_ptr<fc::any> _data;
|
||||
};
|
||||
|
||||
} // namespace fc
|
||||
|
||||
#include <boost/preprocessor/repeat.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
#include <boost/preprocessor/seq/for_each.hpp>
|
||||
#include <boost/preprocessor/stringize.hpp>
|
||||
|
||||
#define FC_API_VTABLE_DEFINE_MEMBER( r, data, elem ) \
|
||||
decltype(Transform::functor( (data*)nullptr, &data::elem)) elem;
|
||||
#define FC_API_VTABLE_DEFINE_VISIT_OTHER( r, data, elem ) \
|
||||
{ typedef typename Visitor::other_type OtherType; \
|
||||
v( BOOST_PP_STRINGIZE(elem), elem, &OtherType::elem ); }
|
||||
#define FC_API_VTABLE_DEFINE_VISIT( r, data, elem ) \
|
||||
v( BOOST_PP_STRINGIZE(elem), elem );
|
||||
|
||||
#define FC_API( CLASS, METHODS ) \
|
||||
namespace fc { \
|
||||
template<typename Transform> \
|
||||
struct vtable<CLASS,Transform> : public std::enable_shared_from_this<vtable<CLASS,Transform>> { \
|
||||
BOOST_PP_SEQ_FOR_EACH( FC_API_VTABLE_DEFINE_MEMBER, CLASS, METHODS ) \
|
||||
template<typename Visitor> \
|
||||
void visit_other( Visitor&& v ){ \
|
||||
BOOST_PP_SEQ_FOR_EACH( FC_API_VTABLE_DEFINE_VISIT_OTHER, CLASS, METHODS ) \
|
||||
} \
|
||||
template<typename Visitor> \
|
||||
void visit( Visitor&& v ){ \
|
||||
BOOST_PP_SEQ_FOR_EACH( FC_API_VTABLE_DEFINE_VISIT, CLASS, METHODS ) \
|
||||
} \
|
||||
}; \
|
||||
}
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
#pragma once
|
||||
#include <fc/crypto/base64.hpp>
|
||||
#include <fc/variant.hpp>
|
||||
#include <fc/reflect/reflect.hpp>
|
||||
#include <fc/exception/exception.hpp>
|
||||
|
||||
namespace fc {
|
||||
|
||||
/**
|
||||
* Provides a fixed size array that is easier for templates to specialize
|
||||
* against or overload than T[N].
|
||||
*/
|
||||
template<typename T, size_t N>
|
||||
class array {
|
||||
public:
|
||||
/**
|
||||
* Checked indexing (when in debug build) that also simplifies dereferencing
|
||||
* when you have an array<T,N>*.
|
||||
*/
|
||||
///@{
|
||||
T& at( size_t pos ) { FC_ASSERT( pos < N, "array out-of-bounds" ); return data[pos]; }
|
||||
const T& at( size_t pos )const { FC_ASSERT( pos < N, "array out-of-bounds" ); return data[pos]; }
|
||||
///@}
|
||||
|
||||
T& operator[]( size_t pos ) { FC_ASSERT( pos < N, "array out-of-bounds" ); return data[pos]; }
|
||||
const T& operator[]( size_t pos )const { FC_ASSERT( pos < N, "array out-of-bounds" ); return data[pos]; }
|
||||
|
||||
|
||||
const T* begin()const { return &data[0]; }
|
||||
const T* end()const { return &data[N]; }
|
||||
|
||||
T* begin() { return &data[0]; }
|
||||
T* end() { return &data[N]; }
|
||||
|
||||
size_t size()const { return N; }
|
||||
|
||||
T data[N];
|
||||
};
|
||||
|
||||
/** provided for default 0 init */
|
||||
template<size_t N>
|
||||
class array<unsigned char,N>
|
||||
{
|
||||
public:
|
||||
typedef unsigned char T;
|
||||
array(){ memset( data, 0, sizeof(data) ); }
|
||||
/**
|
||||
* Checked indexing (when in debug build) that also simplifies dereferencing
|
||||
* when you have an array<T,N>*.
|
||||
*/
|
||||
///@{
|
||||
T& at( size_t pos ) { FC_ASSERT( pos < N, "array out-of-bounds" ); return data[pos]; }
|
||||
const T& at( size_t pos )const { FC_ASSERT( pos < N, "array out-of-bounds" ); return data[pos]; }
|
||||
///@}
|
||||
|
||||
T* begin() { return &data[0]; }
|
||||
const T* begin()const { return &data[0]; }
|
||||
const T* end()const { return &data[N]; }
|
||||
|
||||
size_t size()const { return N; }
|
||||
|
||||
T data[N];
|
||||
};
|
||||
|
||||
/** provided for default 0 init */
|
||||
template<size_t N>
|
||||
class array<char,N>
|
||||
{
|
||||
public:
|
||||
typedef char T;
|
||||
array(){ memset( data, 0, sizeof(data) ); }
|
||||
/**
|
||||
* Checked indexing (when in debug build) that also simplifies dereferencing
|
||||
* when you have an array<T,N>*.
|
||||
*/
|
||||
///@{
|
||||
T& at( size_t pos ) { FC_ASSERT( pos < N, "array out-of-bounds" ); return data[pos]; }
|
||||
const T& at( size_t pos )const { FC_ASSERT( pos < N, "array out-of-bounds" ); return data[pos]; }
|
||||
///@}
|
||||
|
||||
T* begin() { return &data[0]; }
|
||||
const T* begin()const { return &data[0]; }
|
||||
const T* end()const { return &data[N]; }
|
||||
|
||||
size_t size()const { return N; }
|
||||
|
||||
T data[N];
|
||||
};
|
||||
|
||||
template<typename T, size_t N>
|
||||
bool operator == ( const array<T,N>& a, const array<T,N>& b )
|
||||
{ return 0 == memcmp( a.data, b.data, N*sizeof(T) ); }
|
||||
template<typename T, size_t N>
|
||||
bool operator < ( const array<T,N>& a, const array<T,N>& b )
|
||||
{ return memcmp( a.data, b.data, N*sizeof(T) ) < 0 ; }
|
||||
|
||||
template<typename T, size_t N>
|
||||
bool operator > ( const array<T,N>& a, const array<T,N>& b )
|
||||
{ return memcmp( a.data, b.data, N*sizeof(T) ) > 0 ; }
|
||||
|
||||
template<typename T, size_t N>
|
||||
bool operator != ( const array<T,N>& a, const array<T,N>& b )
|
||||
{ return 0 != memcmp( a.data, b.data, N*sizeof(T) ); }
|
||||
|
||||
template<typename T, size_t N>
|
||||
void to_variant( const array<T,N>& bi, variant& v )
|
||||
{
|
||||
v = std::vector<char>( (const char*)&bi, ((const char*)&bi) + sizeof(bi) );
|
||||
}
|
||||
template<typename T, size_t N>
|
||||
void from_variant( const variant& v, array<T,N>& bi )
|
||||
{
|
||||
std::vector<char> ve = v.as< std::vector<char> >();
|
||||
if( ve.size() )
|
||||
{
|
||||
memcpy(bi.begin(), ve.data(), fc::min<size_t>(ve.size(),sizeof(bi)) );
|
||||
}
|
||||
else
|
||||
memset( bi.begin(), char(0), sizeof(bi) );
|
||||
}
|
||||
|
||||
|
||||
template<typename T,size_t N> struct get_typename< fc::array<T,N> >
|
||||
{
|
||||
static const char* name()
|
||||
{
|
||||
static std::string _name = std::string("fc::array<")+std::string(fc::get_typename<T>::name())+","+ fc::to_string(N) + ">";
|
||||
return _name.c_str();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#include <unordered_map>
|
||||
#include <fc/crypto/city.hpp>
|
||||
namespace std
|
||||
{
|
||||
template<typename T, size_t N>
|
||||
struct hash<fc::array<T,N> >
|
||||
{
|
||||
size_t operator()( const fc::array<T,N>& e )const
|
||||
{
|
||||
return fc::city_hash_size_t( (char*)&e, sizeof(e) );
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
namespace fc {
|
||||
|
||||
inline uint64_t endian_reverse_u64( uint64_t x )
|
||||
{
|
||||
return (((x >> 0x38) & 0xFF) )
|
||||
| (((x >> 0x30) & 0xFF) << 0x08)
|
||||
| (((x >> 0x28) & 0xFF) << 0x10)
|
||||
| (((x >> 0x20) & 0xFF) << 0x18)
|
||||
| (((x >> 0x18) & 0xFF) << 0x20)
|
||||
| (((x >> 0x10) & 0xFF) << 0x28)
|
||||
| (((x >> 0x08) & 0xFF) << 0x30)
|
||||
| (((x ) & 0xFF) << 0x38)
|
||||
;
|
||||
}
|
||||
|
||||
inline uint32_t endian_reverse_u32( uint32_t x )
|
||||
{
|
||||
return (((x >> 0x18) & 0xFF) )
|
||||
| (((x >> 0x10) & 0xFF) << 0x08)
|
||||
| (((x >> 0x08) & 0xFF) << 0x10)
|
||||
| (((x ) & 0xFF) << 0x18)
|
||||
;
|
||||
}
|
||||
|
||||
} // namespace fc
|
||||
@@ -0,0 +1,621 @@
|
||||
#pragma once
|
||||
|
||||
/*
|
||||
*********************************************************************
|
||||
* *
|
||||
* Open Bloom Filter *
|
||||
* *
|
||||
* Author: Arash Partow - 2000 *
|
||||
* URL: http://www.partow.net *
|
||||
* URL: http://www.partow.net/programming/hashfunctions/index.html *
|
||||
* *
|
||||
* Copyright notice: *
|
||||
* Free use of the Open Bloom Filter Library is permitted under the *
|
||||
* guidelines and in accordance with the most current version of the *
|
||||
* Common Public License. *
|
||||
* http://www.opensource.org/licenses/cpl1.0.php *
|
||||
* *
|
||||
*********************************************************************
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <fc/reflect/reflect.hpp>
|
||||
|
||||
namespace fc {
|
||||
|
||||
|
||||
static const std::size_t bits_per_char = 0x08; // 8 bits in 1 char(unsigned)
|
||||
static const unsigned char bit_mask[bits_per_char] = {
|
||||
0x01, //00000001
|
||||
0x02, //00000010
|
||||
0x04, //00000100
|
||||
0x08, //00001000
|
||||
0x10, //00010000
|
||||
0x20, //00100000
|
||||
0x40, //01000000
|
||||
0x80 //10000000
|
||||
};
|
||||
|
||||
class bloom_parameters
|
||||
{
|
||||
public:
|
||||
|
||||
bloom_parameters()
|
||||
: minimum_size(1),
|
||||
maximum_size(std::numeric_limits<unsigned long long int>::max()),
|
||||
minimum_number_of_hashes(1),
|
||||
maximum_number_of_hashes(std::numeric_limits<unsigned int>::max()),
|
||||
projected_element_count(10000),
|
||||
false_positive_probability(1.0 / projected_element_count),
|
||||
random_seed(0xA5A5A5A55A5A5A5AULL)
|
||||
{}
|
||||
|
||||
virtual ~bloom_parameters()
|
||||
{}
|
||||
|
||||
inline bool operator!()
|
||||
{
|
||||
return (minimum_size > maximum_size) ||
|
||||
(minimum_number_of_hashes > maximum_number_of_hashes) ||
|
||||
(minimum_number_of_hashes < 1) ||
|
||||
(0 == maximum_number_of_hashes) ||
|
||||
(0 == projected_element_count) ||
|
||||
(false_positive_probability < 0.0) ||
|
||||
(std::numeric_limits<double>::infinity() == std::abs(false_positive_probability)) ||
|
||||
(0 == random_seed) ||
|
||||
(0xFFFFFFFFFFFFFFFFULL == random_seed);
|
||||
}
|
||||
|
||||
//Allowed min/max size of the bloom filter in bits
|
||||
unsigned long long int minimum_size;
|
||||
unsigned long long int maximum_size;
|
||||
|
||||
//Allowed min/max number of hash functions
|
||||
unsigned int minimum_number_of_hashes;
|
||||
unsigned int maximum_number_of_hashes;
|
||||
|
||||
//The approximate number of elements to be inserted
|
||||
//into the bloom filter, should be within one order
|
||||
//of magnitude. The default is 10000.
|
||||
unsigned long long int projected_element_count;
|
||||
|
||||
//The approximate false positive probability expected
|
||||
//from the bloom filter. The default is the reciprocal
|
||||
//of the projected_element_count.
|
||||
double false_positive_probability;
|
||||
|
||||
unsigned long long int random_seed;
|
||||
|
||||
struct optimal_parameters_t
|
||||
{
|
||||
optimal_parameters_t()
|
||||
: number_of_hashes(0),
|
||||
table_size(0)
|
||||
{}
|
||||
|
||||
unsigned int number_of_hashes;
|
||||
unsigned long long int table_size;
|
||||
};
|
||||
|
||||
optimal_parameters_t optimal_parameters;
|
||||
|
||||
virtual bool compute_optimal_parameters()
|
||||
{
|
||||
/*
|
||||
Note:
|
||||
The following will attempt to find the number of hash functions
|
||||
and minimum amount of storage bits required to construct a bloom
|
||||
filter consistent with the user defined false positive probability
|
||||
and estimated element insertion count.
|
||||
*/
|
||||
|
||||
if (!(*this))
|
||||
return false;
|
||||
|
||||
double min_m = std::numeric_limits<double>::infinity();
|
||||
double min_k = 0.0;
|
||||
double curr_m = 0.0;
|
||||
double k = 1.0;
|
||||
|
||||
while (k < 1000.0)
|
||||
{
|
||||
double numerator = (- k * projected_element_count);
|
||||
double denominator = std::log(1.0 - std::pow(false_positive_probability, 1.0 / k));
|
||||
curr_m = numerator / denominator;
|
||||
if (curr_m < min_m)
|
||||
{
|
||||
min_m = curr_m;
|
||||
min_k = k;
|
||||
}
|
||||
k += 1.0;
|
||||
}
|
||||
|
||||
optimal_parameters_t& optp = optimal_parameters;
|
||||
|
||||
optp.number_of_hashes = static_cast<unsigned int>(min_k);
|
||||
optp.table_size = static_cast<unsigned long long int>(min_m);
|
||||
optp.table_size += (((optp.table_size % bits_per_char) != 0) ? (bits_per_char - (optp.table_size % bits_per_char)) : 0);
|
||||
|
||||
if (optp.number_of_hashes < minimum_number_of_hashes)
|
||||
optp.number_of_hashes = minimum_number_of_hashes;
|
||||
else if (optp.number_of_hashes > maximum_number_of_hashes)
|
||||
optp.number_of_hashes = maximum_number_of_hashes;
|
||||
|
||||
if (optp.table_size < minimum_size)
|
||||
optp.table_size = minimum_size;
|
||||
else if (optp.table_size > maximum_size)
|
||||
optp.table_size = maximum_size;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class bloom_filter
|
||||
{
|
||||
protected:
|
||||
|
||||
typedef unsigned int bloom_type;
|
||||
typedef unsigned char cell_type;
|
||||
|
||||
public:
|
||||
|
||||
bloom_filter()
|
||||
: salt_count_(0),
|
||||
table_size_(0),
|
||||
raw_table_size_(0),
|
||||
projected_element_count_(0),
|
||||
inserted_element_count_(0),
|
||||
random_seed_(0),
|
||||
desired_false_positive_probability_(0.0)
|
||||
{}
|
||||
|
||||
bloom_filter(const bloom_parameters& p)
|
||||
: projected_element_count_(p.projected_element_count),
|
||||
inserted_element_count_(0),
|
||||
random_seed_((p.random_seed * 0xA5A5A5A5) + 1),
|
||||
desired_false_positive_probability_(p.false_positive_probability)
|
||||
{
|
||||
salt_count_ = p.optimal_parameters.number_of_hashes;
|
||||
table_size_ = p.optimal_parameters.table_size;
|
||||
generate_unique_salt();
|
||||
raw_table_size_ = table_size_ / bits_per_char;
|
||||
|
||||
bit_table_.resize( static_cast<std::size_t>(raw_table_size_) );
|
||||
//bit_table_ = new cell_type[static_cast<std::size_t>(raw_table_size_)];
|
||||
std::fill_n(bit_table_.data(),raw_table_size_,0x00);
|
||||
}
|
||||
|
||||
bloom_filter(const bloom_filter& filter)
|
||||
{
|
||||
this->operator=(filter);
|
||||
}
|
||||
|
||||
inline bool operator == (const bloom_filter& f) const
|
||||
{
|
||||
if (this != &f)
|
||||
{
|
||||
return
|
||||
(salt_count_ == f.salt_count_) &&
|
||||
(table_size_ == f.table_size_) &&
|
||||
(raw_table_size_ == f.raw_table_size_) &&
|
||||
(projected_element_count_ == f.projected_element_count_) &&
|
||||
(inserted_element_count_ == f.inserted_element_count_) &&
|
||||
(random_seed_ == f.random_seed_) &&
|
||||
(desired_false_positive_probability_ == f.desired_false_positive_probability_) &&
|
||||
(salt_ == f.salt_) &&
|
||||
std::equal(f.bit_table_.data(),f.bit_table_.data() + raw_table_size_,bit_table_.data());
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool operator != (const bloom_filter& f) const
|
||||
{
|
||||
return !operator==(f);
|
||||
}
|
||||
|
||||
inline bloom_filter& operator = (const bloom_filter& f)
|
||||
{
|
||||
if (this != &f)
|
||||
{
|
||||
salt_count_ = f.salt_count_;
|
||||
table_size_ = f.table_size_;
|
||||
raw_table_size_ = f.raw_table_size_;
|
||||
projected_element_count_ = f.projected_element_count_;
|
||||
inserted_element_count_ = f.inserted_element_count_;
|
||||
random_seed_ = f.random_seed_;
|
||||
desired_false_positive_probability_ = f.desired_false_positive_probability_;
|
||||
bit_table_.resize( raw_table_size_ );
|
||||
std::copy(f.bit_table_.data(),f.bit_table_.data() + raw_table_size_,bit_table_.data());
|
||||
salt_ = f.salt_;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual ~bloom_filter()
|
||||
{
|
||||
}
|
||||
|
||||
inline bool operator!() const
|
||||
{
|
||||
return (0 == table_size_);
|
||||
}
|
||||
|
||||
inline void clear()
|
||||
{
|
||||
std::fill_n(bit_table_.data(),raw_table_size_,0x00);
|
||||
inserted_element_count_ = 0;
|
||||
}
|
||||
|
||||
inline void insert(const unsigned char* key_begin, const std::size_t& length)
|
||||
{
|
||||
std::size_t bit_index = 0;
|
||||
std::size_t bit = 0;
|
||||
for (std::size_t i = 0; i < salt_.size(); ++i)
|
||||
{
|
||||
compute_indices(hash_ap(key_begin,length,salt_[i]),bit_index,bit);
|
||||
bit_table_[bit_index / bits_per_char] |= bit_mask[bit];
|
||||
}
|
||||
++inserted_element_count_;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void insert(const T& t)
|
||||
{
|
||||
// Note: T must be a C++ POD type.
|
||||
insert(reinterpret_cast<const unsigned char*>(&t),sizeof(T));
|
||||
}
|
||||
|
||||
inline void insert(const std::string& key)
|
||||
{
|
||||
insert(reinterpret_cast<const unsigned char*>(key.c_str()),key.size());
|
||||
}
|
||||
|
||||
inline void insert(const char* data, const std::size_t& length)
|
||||
{
|
||||
insert(reinterpret_cast<const unsigned char*>(data),length);
|
||||
}
|
||||
|
||||
template<typename InputIterator>
|
||||
inline void insert(const InputIterator begin, const InputIterator end)
|
||||
{
|
||||
InputIterator itr = begin;
|
||||
while (end != itr)
|
||||
{
|
||||
insert(*(itr++));
|
||||
}
|
||||
}
|
||||
|
||||
inline virtual bool contains(const unsigned char* key_begin, const std::size_t length) const
|
||||
{
|
||||
std::size_t bit_index = 0;
|
||||
std::size_t bit = 0;
|
||||
for (std::size_t i = 0; i < salt_.size(); ++i)
|
||||
{
|
||||
compute_indices(hash_ap(key_begin,length,salt_[i]),bit_index,bit);
|
||||
if ((bit_table_[bit_index / bits_per_char] & bit_mask[bit]) != bit_mask[bit])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline bool contains(const T& t) const
|
||||
{
|
||||
return contains(reinterpret_cast<const unsigned char*>(&t),static_cast<std::size_t>(sizeof(T)));
|
||||
}
|
||||
|
||||
inline bool contains(const std::string& key) const
|
||||
{
|
||||
return contains(reinterpret_cast<const unsigned char*>(key.c_str()),key.size());
|
||||
}
|
||||
|
||||
inline bool contains(const char* data, const std::size_t& length) const
|
||||
{
|
||||
return contains(reinterpret_cast<const unsigned char*>(data),length);
|
||||
}
|
||||
|
||||
template<typename InputIterator>
|
||||
inline InputIterator contains_all(const InputIterator begin, const InputIterator end) const
|
||||
{
|
||||
InputIterator itr = begin;
|
||||
while (end != itr)
|
||||
{
|
||||
if (!contains(*itr))
|
||||
{
|
||||
return itr;
|
||||
}
|
||||
++itr;
|
||||
}
|
||||
return end;
|
||||
}
|
||||
|
||||
template<typename InputIterator>
|
||||
inline InputIterator contains_none(const InputIterator begin, const InputIterator end) const
|
||||
{
|
||||
InputIterator itr = begin;
|
||||
while (end != itr)
|
||||
{
|
||||
if (contains(*itr))
|
||||
{
|
||||
return itr;
|
||||
}
|
||||
++itr;
|
||||
}
|
||||
return end;
|
||||
}
|
||||
|
||||
inline virtual unsigned long long int size() const
|
||||
{
|
||||
return table_size_;
|
||||
}
|
||||
|
||||
inline std::size_t element_count() const
|
||||
{
|
||||
return inserted_element_count_;
|
||||
}
|
||||
|
||||
inline double effective_fpp() const
|
||||
{
|
||||
/*
|
||||
Note:
|
||||
The effective false positive probability is calculated using the
|
||||
designated table size and hash function count in conjunction with
|
||||
the current number of inserted elements - not the user defined
|
||||
predicated/expected number of inserted elements.
|
||||
*/
|
||||
return std::pow(1.0 - std::exp(-1.0 * salt_.size() * inserted_element_count_ / size()), 1.0 * salt_.size());
|
||||
}
|
||||
|
||||
inline bloom_filter& operator &= (const bloom_filter& f)
|
||||
{
|
||||
/* intersection */
|
||||
if (
|
||||
(salt_count_ == f.salt_count_) &&
|
||||
(table_size_ == f.table_size_) &&
|
||||
(random_seed_ == f.random_seed_)
|
||||
)
|
||||
{
|
||||
for (std::size_t i = 0; i < raw_table_size_; ++i)
|
||||
{
|
||||
bit_table_[i] &= f.bit_table_[i];
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline bloom_filter& operator |= (const bloom_filter& f)
|
||||
{
|
||||
/* union */
|
||||
if (
|
||||
(salt_count_ == f.salt_count_) &&
|
||||
(table_size_ == f.table_size_) &&
|
||||
(random_seed_ == f.random_seed_)
|
||||
)
|
||||
{
|
||||
for (std::size_t i = 0; i < raw_table_size_; ++i)
|
||||
{
|
||||
bit_table_[i] |= f.bit_table_[i];
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline bloom_filter& operator ^= (const bloom_filter& f)
|
||||
{
|
||||
/* difference */
|
||||
if (
|
||||
(salt_count_ == f.salt_count_) &&
|
||||
(table_size_ == f.table_size_) &&
|
||||
(random_seed_ == f.random_seed_)
|
||||
)
|
||||
{
|
||||
for (std::size_t i = 0; i < raw_table_size_; ++i)
|
||||
{
|
||||
bit_table_[i] ^= f.bit_table_[i];
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline const cell_type* table() const
|
||||
{
|
||||
return bit_table_.data();
|
||||
}
|
||||
|
||||
inline std::size_t hash_count()
|
||||
{
|
||||
return salt_.size();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
inline virtual void compute_indices(const bloom_type& hash, std::size_t& bit_index, std::size_t& bit) const
|
||||
{
|
||||
bit_index = hash % table_size_;
|
||||
bit = bit_index % bits_per_char;
|
||||
}
|
||||
|
||||
void generate_unique_salt()
|
||||
{
|
||||
/*
|
||||
Note:
|
||||
A distinct hash function need not be implementation-wise
|
||||
distinct. In the current implementation "seeding" a common
|
||||
hash function with different values seems to be adequate.
|
||||
*/
|
||||
const unsigned int predef_salt_count = 128;
|
||||
static const bloom_type predef_salt[predef_salt_count] =
|
||||
{
|
||||
0xAAAAAAAA, 0x55555555, 0x33333333, 0xCCCCCCCC,
|
||||
0x66666666, 0x99999999, 0xB5B5B5B5, 0x4B4B4B4B,
|
||||
0xAA55AA55, 0x55335533, 0x33CC33CC, 0xCC66CC66,
|
||||
0x66996699, 0x99B599B5, 0xB54BB54B, 0x4BAA4BAA,
|
||||
0xAA33AA33, 0x55CC55CC, 0x33663366, 0xCC99CC99,
|
||||
0x66B566B5, 0x994B994B, 0xB5AAB5AA, 0xAAAAAA33,
|
||||
0x555555CC, 0x33333366, 0xCCCCCC99, 0x666666B5,
|
||||
0x9999994B, 0xB5B5B5AA, 0xFFFFFFFF, 0xFFFF0000,
|
||||
0xB823D5EB, 0xC1191CDF, 0xF623AEB3, 0xDB58499F,
|
||||
0xC8D42E70, 0xB173F616, 0xA91A5967, 0xDA427D63,
|
||||
0xB1E8A2EA, 0xF6C0D155, 0x4909FEA3, 0xA68CC6A7,
|
||||
0xC395E782, 0xA26057EB, 0x0CD5DA28, 0x467C5492,
|
||||
0xF15E6982, 0x61C6FAD3, 0x9615E352, 0x6E9E355A,
|
||||
0x689B563E, 0x0C9831A8, 0x6753C18B, 0xA622689B,
|
||||
0x8CA63C47, 0x42CC2884, 0x8E89919B, 0x6EDBD7D3,
|
||||
0x15B6796C, 0x1D6FDFE4, 0x63FF9092, 0xE7401432,
|
||||
0xEFFE9412, 0xAEAEDF79, 0x9F245A31, 0x83C136FC,
|
||||
0xC3DA4A8C, 0xA5112C8C, 0x5271F491, 0x9A948DAB,
|
||||
0xCEE59A8D, 0xB5F525AB, 0x59D13217, 0x24E7C331,
|
||||
0x697C2103, 0x84B0A460, 0x86156DA9, 0xAEF2AC68,
|
||||
0x23243DA5, 0x3F649643, 0x5FA495A8, 0x67710DF8,
|
||||
0x9A6C499E, 0xDCFB0227, 0x46A43433, 0x1832B07A,
|
||||
0xC46AFF3C, 0xB9C8FFF0, 0xC9500467, 0x34431BDF,
|
||||
0xB652432B, 0xE367F12B, 0x427F4C1B, 0x224C006E,
|
||||
0x2E7E5A89, 0x96F99AA5, 0x0BEB452A, 0x2FD87C39,
|
||||
0x74B2E1FB, 0x222EFD24, 0xF357F60C, 0x440FCB1E,
|
||||
0x8BBE030F, 0x6704DC29, 0x1144D12F, 0x948B1355,
|
||||
0x6D8FD7E9, 0x1C11A014, 0xADD1592F, 0xFB3C712E,
|
||||
0xFC77642F, 0xF9C4CE8C, 0x31312FB9, 0x08B0DD79,
|
||||
0x318FA6E7, 0xC040D23D, 0xC0589AA7, 0x0CA5C075,
|
||||
0xF874B172, 0x0CF914D5, 0x784D3280, 0x4E8CFEBC,
|
||||
0xC569F575, 0xCDB2A091, 0x2CC016B4, 0x5C5F4421
|
||||
};
|
||||
|
||||
if (salt_count_ <= predef_salt_count)
|
||||
{
|
||||
std::copy(predef_salt,
|
||||
predef_salt + salt_count_,
|
||||
std::back_inserter(salt_));
|
||||
for (unsigned int i = 0; i < salt_.size(); ++i)
|
||||
{
|
||||
/*
|
||||
Note:
|
||||
This is done to integrate the user defined random seed,
|
||||
so as to allow for the generation of unique bloom filter
|
||||
instances.
|
||||
*/
|
||||
salt_[i] = salt_[i] * salt_[(i + 3) % salt_.size()] + static_cast<bloom_type>(random_seed_);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::copy(predef_salt,predef_salt + predef_salt_count,std::back_inserter(salt_));
|
||||
srand(static_cast<unsigned int>(random_seed_));
|
||||
while (salt_.size() < salt_count_)
|
||||
{
|
||||
bloom_type current_salt = static_cast<bloom_type>(rand()) * static_cast<bloom_type>(rand());
|
||||
if (0 == current_salt) continue;
|
||||
if (salt_.end() == std::find(salt_.begin(), salt_.end(), current_salt))
|
||||
{
|
||||
salt_.push_back(current_salt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline bloom_type hash_ap(const unsigned char* begin, std::size_t remaining_length, bloom_type hash) const
|
||||
{
|
||||
const unsigned char* itr = begin;
|
||||
unsigned int loop = 0;
|
||||
while (remaining_length >= 8)
|
||||
{
|
||||
const unsigned int& i1 = *(reinterpret_cast<const unsigned int*>(itr)); itr += sizeof(unsigned int);
|
||||
const unsigned int& i2 = *(reinterpret_cast<const unsigned int*>(itr)); itr += sizeof(unsigned int);
|
||||
hash ^= (hash << 7) ^ i1 * (hash >> 3) ^
|
||||
(~((hash << 11) + (i2 ^ (hash >> 5))));
|
||||
remaining_length -= 8;
|
||||
}
|
||||
if (remaining_length)
|
||||
{
|
||||
if (remaining_length >= 4)
|
||||
{
|
||||
const unsigned int& i = *(reinterpret_cast<const unsigned int*>(itr));
|
||||
if (loop & 0x01)
|
||||
hash ^= (hash << 7) ^ i * (hash >> 3);
|
||||
else
|
||||
hash ^= (~((hash << 11) + (i ^ (hash >> 5))));
|
||||
++loop;
|
||||
remaining_length -= 4;
|
||||
itr += sizeof(unsigned int);
|
||||
}
|
||||
if (remaining_length >= 2)
|
||||
{
|
||||
const unsigned short& i = *(reinterpret_cast<const unsigned short*>(itr));
|
||||
if (loop & 0x01)
|
||||
hash ^= (hash << 7) ^ i * (hash >> 3);
|
||||
else
|
||||
hash ^= (~((hash << 11) + (i ^ (hash >> 5))));
|
||||
++loop;
|
||||
remaining_length -= 2;
|
||||
itr += sizeof(unsigned short);
|
||||
}
|
||||
if (remaining_length)
|
||||
{
|
||||
hash += ((*itr) ^ (hash * 0xA5A5A5A5)) + loop;
|
||||
}
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
public:
|
||||
std::vector<bloom_type> salt_;
|
||||
std::vector<unsigned char> bit_table_;
|
||||
unsigned int salt_count_;
|
||||
unsigned long long int table_size_;
|
||||
unsigned long long int raw_table_size_;
|
||||
unsigned long long int projected_element_count_;
|
||||
unsigned int inserted_element_count_;
|
||||
unsigned long long int random_seed_;
|
||||
double desired_false_positive_probability_;
|
||||
};
|
||||
|
||||
inline bloom_filter operator & (const bloom_filter& a, const bloom_filter& b)
|
||||
{
|
||||
bloom_filter result = a;
|
||||
result &= b;
|
||||
return result;
|
||||
}
|
||||
|
||||
inline bloom_filter operator | (const bloom_filter& a, const bloom_filter& b)
|
||||
{
|
||||
bloom_filter result = a;
|
||||
result |= b;
|
||||
return result;
|
||||
}
|
||||
|
||||
inline bloom_filter operator ^ (const bloom_filter& a, const bloom_filter& b)
|
||||
{
|
||||
bloom_filter result = a;
|
||||
result ^= b;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
} // namespace fc
|
||||
|
||||
|
||||
FC_REFLECT( fc::bloom_filter, (salt_)(bit_table_)(salt_count_)(table_size_)(raw_table_size_)(projected_element_count_)(inserted_element_count_)(random_seed_)(desired_false_positive_probability_) )
|
||||
FC_REFLECT( fc::bloom_parameters::optimal_parameters_t, (number_of_hashes)(table_size) )
|
||||
FC_REFLECT( fc::bloom_parameters, (minimum_size)(maximum_size)(minimum_number_of_hashes)(maximum_number_of_hashes)(projected_element_count)(false_positive_probability)(random_seed)(optimal_parameters) )
|
||||
|
||||
/*
|
||||
Note 1:
|
||||
If it can be guaranteed that bits_per_char will be of the form 2^n then
|
||||
the following optimization can be used:
|
||||
|
||||
hash_table[bit_index >> n] |= bit_mask[bit_index & (bits_per_char - 1)];
|
||||
|
||||
Note 2:
|
||||
For performance reasons where possible when allocating memory it should
|
||||
be aligned (aligned_alloc) according to the architecture being used.
|
||||
*/
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
namespace fc {
|
||||
|
||||
std::string smaz_compress( const std::string& in );
|
||||
std::string smaz_decompress( const std::string& compressed );
|
||||
|
||||
} // namespace fc
|
||||
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <fc/string.hpp>
|
||||
|
||||
namespace fc
|
||||
{
|
||||
|
||||
string zlib_compress(const string& in);
|
||||
|
||||
} // namespace fc
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user