Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Release 3.3.0

See merge request in3/c/in3-core!458
  • Loading branch information
simon-jentzsch committed Mar 8, 2021
2 parents ea93a7d + db612e0 commit de5572c
Show file tree
Hide file tree
Showing 228 changed files with 6,572 additions and 3,727 deletions.
30 changes: 26 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "attach",
"name": "Attach to python-test",
"program": "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python"
},
{
"type": "lldb",
"request": "attach",
"name": "Attach to dotnet-test",
"pid": "${command:pickMyProcess}"
},
{
"type": "java",
"name": "Test-Java",
"request": "launch",
"mainClass": "in3.IN3",
"classPaths": [
""
]
},

{
"type": "java",
"name": "Debug (Attach)",
Expand Down Expand Up @@ -64,11 +86,11 @@
"request": "launch",
"name": "in3 withdraw",
"program": "${workspaceFolder}/build/bin/in3",
"cwd": "${workspaceFolder}/build/bin",
"cwd": "${workspaceFolder}/c/test/testdata/cmd",
"externalConsole": true,
"args": [
"-fi",
"debugWithdraw.txt",
"eth_blockNumber.txt",
"-debug"
]
},
Expand Down Expand Up @@ -137,7 +159,7 @@
"name": "run test",
"program": "${workspaceFolder}/build/test/runner",
"args": [
"../c/test/testdata/requests/in3_total_nodes.json",
"../c/test/testdata/requests/eth_getBlockByNumber.json",
"-d",
"-t",
"1"
Expand Down Expand Up @@ -169,7 +191,7 @@
"type": "lldb",
"request": "launch",
"name": "run request test",
"program": "${workspaceFolder}/build/test/test_request",
"program": "${workspaceFolder}/build/test/test_nodelist",
"cwd": "${workspaceFolder}/build"
},
{
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,14 @@ OPTION(PK_SIGNER "Enable Signing with private keys" ON)
OPTION(NODESELECT_DEF "Enable default nodeselect implementation" ON)
OPTION(NODESELECT_DEF_WL "Enable default nodeselect whitelist implementation" ON)
OPTION(PLGN_CLIENT_DATA "Enable client-data plugin" OFF)
OPTION(THREADSAFE "uses mutex to protect shared nodelist access" ON)


IF (DEFINED ANDROID_ABI)
set(TRANSPORTS,false)
set(IN3_LIB,false)
set(USE_CURL,false)
set(CMD,false)
set(JAVA,true)
set(RECORDER,false)
ENDIF()
Expand Down Expand Up @@ -260,10 +262,14 @@ IF (WASM)
set(CMD false)
set(USE_CURL false)
set(USE_WINHTTP false)
set(THREADSAFE false)
ADD_DEFINITIONS(-DWASM)
add_subdirectory(wasm/src)
ENDIF (WASM)

if (THREADSAFE)
ADD_DEFINITIONS(-DTHREADSAFE)
ENDIF()

# build tests
if(TEST)
Expand Down
17 changes: 11 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,21 @@
# with this program. If not, see <https://www.gnu.org/licenses/>.
###############################################################################

FROM jianann/alpine-clang as build
COPY . /in3/
FROM debian as build
COPY CMakeLists.txt /in3/
COPY c /in3/c/
COPY scripts /in3/scripts/
WORKDIR /in3/
USER root
RUN cd /in3/ && rm -rf build;
RUN cd /in3/ && mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=MINSIZEREL -DIN3_SERVER=true -DUSE_CURL=false .. && make in3
RUN apt-get update && apt-get install -y libcurl4-openssl-dev curl cmake build-essential
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN cd /in3/ && mkdir build && cd build && cmake -DZKCRYPTO_LIB=true -DCMAKE_BUILD_TYPE=MinSizeRel -DIN3_SERVER=true .. && make in3


FROM alpine:edge
FROM debian:buster-slim
COPY --from=build /in3/build/bin/in3 /bin/in3
RUN apt-get update && apt-get install -y curl
EXPOSE 8545
ENTRYPOINT ["/bin/in3"]
CMD ["--help"]
CMD ["--help"]
8 changes: 2 additions & 6 deletions c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,16 @@ IF (TRANSPORTS)
ENDIF (TRANSPORTS)

add_subdirectory(src/core)
add_subdirectory(src/init)
add_subdirectory(src/verifier)
add_subdirectory(src/signer)
add_subdirectory(src/pay)
add_subdirectory(src/api)
add_subdirectory(src/cmd)
add_subdirectory(src/tools)
add_subdirectory(src/nodeselect)
add_subdirectory(docs)

if (NODESELECT_DEF_WL AND NOT NODESELECT_DEF)
message(SEND_ERROR "Nodeselect - whitelisting enabled without enabling the plugin itself!")
elseif (NODESELECT_DEF)
add_subdirectory(src/nodeselect)
endif()

link_directories(${CMAKE_BINARY_DIR}/lib/)

# create the library
Expand Down
6 changes: 3 additions & 3 deletions c/ci-analyse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ gcc10check:
script:
- mkdir _build
- cd _build
- cmake -DGCC_ANALYZER=true ..
- cmake -DGCC_ANALYZER=true -DIN3_SERVER=true ..
- make

valgrind:
Expand Down Expand Up @@ -127,7 +127,7 @@ cpd:
tags:
- short-jobs
script:
- cpd --minimum-tokens 180 --language cpp --exclude c/src/third-party --files c/src
- cpd --minimum-tokens 180 --language cpp --exclude c/src/third-party --exclude c/src/signer/iamo-zksync/iamo_deploy.h --files c/src
- cpd --minimum-tokens 150 --language java --files java/src
- cpd --minimum-tokens 150 --language python --files python

Expand All @@ -151,7 +151,7 @@ vulnerabilities:
- export TRIVY_AUTH_URL=$CI_REGISTRY
- export TRIVY_USERNAME=gitlab-ci-token
- export TRIVY_PASSWORD=$CI_JOB_TOKEN
- trivy -f json -o vulnerability_analysis.json --exit-code 1 $COMMIT_IMAGE_TAG
- trivy -f json -o vulnerability_analysis.json --exit-code 1 $COMMIT_IMAGE_TAG || echo "failed! See details in artifacts"
artifacts:
paths:
- vulnerability_analysis.json
Expand Down
4 changes: 1 addition & 3 deletions c/ci-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ pages:
- readthedocs
- coverage
- clangcheck
- vulnerabilities
- java_linux
- test_asmjs
- python_linux
Expand All @@ -281,10 +280,9 @@ pages:
- cp -r cov_build/ccov/all-merged public/coverage
- cp -r report/* public/code_analysis
- cp -r doc/build public/rtd
- cp -r vulnerability_analysis.json public/vulnerability_analysis.json || true
- cp -r java/build/reports/jacoco/test/html public/coverage_java
- cp -r python_multilib/htmlcov public/coverage_python
- echo "<html><body><h1>Incubed report for last build</h1><ul><li><a href='rtd/html/index.html'>Read the docs(html)</a></li><li><a href='rtd/latex/Incubed.pdf'>Read the docs(pdf)</a></li><li><a href='code_analysis/index.html'>Code Analysis</a></li><li><a href='vulnerability_analysis.json'>Vulnerability Analysis</a></li><li><a href='coverage/index.html'>Code Coverage C</a></li><li><a href='coverage_java/index.html'>Code Coverage JAVA</a></li><li><a href='coverage_python/index.html'>Code Coverage PYTHON</a></li></ul></body></html>" > public/index.html
- echo "<html><body><h1>Incubed report for last build</h1><ul><li><a href='rtd/html/index.html'>Read the docs(html)</a></li><li><a href='rtd/latex/Incubed.pdf'>Read the docs(pdf)</a></li><li><a href='code_analysis/index.html'>Code Analysis</a></li><li><a href='coverage/index.html'>Code Coverage C</a></li><li><a href='coverage_java/index.html'>Code Coverage JAVA</a></li><li><a href='coverage_python/index.html'>Code Coverage PYTHON</a></li></ul></body></html>" > public/index.html
artifacts:
paths:
- public
Expand Down
15 changes: 9 additions & 6 deletions c/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
paths:
- $BUILD/bin
- $BUILD/lib
- $BUILD/rust

gcc8:
image: docker.slock.it/build-images/cmake:gcc8
Expand All @@ -39,17 +40,18 @@ gcc8:
- mkdir x64_build
- mkdir x64_jni
- cd x64_build
- cmake -DTAG_VERSION=$CI_COMMIT_TAG -DCMAKE_BUILD_TYPE=Release -DJAVA=true -DUSE_CURL=false ..
- cmake -DTAG_VERSION=$CI_COMMIT_TAG -DCMAKE_BUILD_TYPE=Release -DJAVA=true -DUSE_CURL=false -DZKCRYPTO_LIB=true ..
- make in3_jni
- cp lib/libin3_jni.so ../x64_jni/
- rm -rf *
- cmake -DTAG_VERSION=$CI_COMMIT_TAG -DCMAKE_BUILD_TYPE=Release -DJAVA=true -DBUILD_DOC=true ..
- cmake -DTAG_VERSION=$CI_COMMIT_TAG -DCMAKE_BUILD_TYPE=Release -DJAVA=true -DBUILD_DOC=true -DZKCRYPTO_LIB=true ..
- make
artifacts:
paths:
- x64_jni
- x64_build/bin
- x64_build/lib
- x64_build/rust
- x64_build/c/docs/doc_doxygen
- x64_build/java/docs/doc_doxygen

Expand Down Expand Up @@ -85,7 +87,7 @@ arm7:
tags:
- arm
variables:
CONAN_OPTS: "-DJAVA=false"
CONAN_OPTS: "-DZKCRYPTO_LIB=true -DJAVA=false"
BUILD: "arm7_build"

arm_jni:
Expand All @@ -94,7 +96,7 @@ arm_jni:
tags:
- arm
variables:
CONAN_OPTS: "-DJAVA=true -DUSE_CURL=false"
CONAN_OPTS: "-DJAVA=true -DZKCRYPTO_LIB=true -DUSE_CURL=false"
BUILD: "arm_jni_build"

gcc8-x86:
Expand Down Expand Up @@ -135,11 +137,11 @@ mac_os:
- mkdir mac_build
- mkdir mac_jni
- cd mac_build
- cmake -DTAG_VERSION=$CI_COMMIT_TAG -DCMAKE_BUILD_TYPE=MINSIZEREL -DJAVA=true -DTRANSPORTS=false -DUSE_SCRYPT=true ..
- cmake -DTAG_VERSION=$CI_COMMIT_TAG -DCMAKE_BUILD_TYPE=MINSIZEREL -DJAVA=true -DZKCRYPTO_LIB=true -DTRANSPORTS=false -DUSE_SCRYPT=true ..
- make in3_jni
- cp lib/libin3_jni.dylib ../mac_jni/
- rm -rf *
- cmake -DTAG_VERSION=$CI_COMMIT_TAG -DCMAKE_BUILD_TYPE=MINSIZEREL -DJAVA=true ..
- cmake -DTAG_VERSION=$CI_COMMIT_TAG -DCMAKE_BUILD_TYPE=MINSIZEREL -DJAVA=true -DZKCRYPTO_LIB=true ..
- make

artifacts:
Expand All @@ -149,6 +151,7 @@ mac_os:
- mac_build/java/docs
- mac_build/lib
- mac_build/bin
- mac_build/rust
tags:
- mac-os

Expand Down
34 changes: 23 additions & 11 deletions c/docs/2_examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ source : [in3-c/c/examples/btc_transaction.c](https://github.com/blockchainsllc/

checking a Bitcoin transaction data


```c
/// checking a Bitcoin transaction data

Expand Down Expand Up @@ -51,6 +52,7 @@ source : [in3-c/c/examples/call_a_function.c](https://github.com/blockchainsllc/

This example shows how to call functions on a smart contract eiither directly or using the api to encode the arguments


```c
/// This example shows how to call functions on a smart contract eiither directly or using the api to encode the arguments

Expand Down Expand Up @@ -161,7 +163,8 @@ in3_ret_t call_func_api(in3_t* c, address_t contract) {
source : [in3-c/c/examples/get_balance.c](https://github.com/blockchainsllc/in3/blob/master/c/examples/get_balance.c)
get the Balance with the API and also as direct RPC-call
get the Balance with the API and also as direct RPC-call
```c
/// get the Balance with the API and also as direct RPC-call
Expand Down Expand Up @@ -230,7 +233,8 @@ void get_balance_api(in3_t* in3) {

source : [in3-c/c/examples/get_block.c](https://github.com/blockchainsllc/in3/blob/master/c/examples/get_block.c)

using the basic-module to get and verify a Block with the API and also as direct RPC-call
using the basic-module to get and verify a Block with the API and also as direct RPC-call


```c
/// using the basic-module to get and verify a Block with the API and also as direct RPC-call
Expand Down Expand Up @@ -301,7 +305,8 @@ void get_block_api(in3_t* in3) {
source : [in3-c/c/examples/get_logs.c](https://github.com/blockchainsllc/in3/blob/master/c/examples/get_logs.c)
fetching events and verify them with eth_getLogs
fetching events and verify them with eth_getLogs
```c
/// fetching events and verify them with eth_getLogs
Expand Down Expand Up @@ -406,6 +411,7 @@ source : [in3-c/c/examples/get_transaction.c](https://github.com/blockchainsllc/

checking the transaction data


```c
/// checking the transaction data

Expand Down Expand Up @@ -478,7 +484,8 @@ void get_tx_api(in3_t* in3) {
source : [in3-c/c/examples/get_transaction_receipt.c](https://github.com/blockchainsllc/in3/blob/master/c/examples/get_transaction_receipt.c)
validating the result or receipt of an transaction
validating the result or receipt of an transaction
```c
/// validating the result or receipt of an transaction
Expand Down Expand Up @@ -553,7 +560,8 @@ void get_tx_receipt_api(in3_t* in3) {

source : [in3-c/c/examples/ipfs_put_get.c](https://github.com/blockchainsllc/in3/blob/master/c/examples/ipfs_put_get.c)

using the IPFS module
using the IPFS module


```c
/// using the IPFS module
Expand Down Expand Up @@ -640,6 +648,8 @@ int main() {
source : [in3-c/c/examples/ledger_sign.c](https://github.com/blockchainsllc/in3/blob/master/c/examples/ledger_sign.c)
```c
#include <in3/client.h> // the core client
Expand Down Expand Up @@ -699,6 +709,7 @@ source : [in3-c/c/examples/send_transaction.c](https://github.com/blockchainsllc

sending a transaction including signing it with a private key


```c
/// sending a transaction including signing it with a private key

Expand Down Expand Up @@ -792,6 +803,7 @@ source : [in3-c/c/examples/usn_device.c](https://github.com/blockchainsllc/in3/b
a example how to watch usn events and act upon it.
```c
/// a example how to watch usn events and act upon it.
Expand All @@ -818,16 +830,13 @@ static int handle_booking(usn_event_t* ev) {
int main(int argc, char* argv[]) {
// create new incubed client
in3_t* c = in3_for_chain(CHAIN_ID_MAINNET);
// switch to goerli
c->chain_id = 0x5;
in3_t* c = in3_for_chain(CHAIN_ID_GOERLI);
// setting up a usn-device-config
usn_device_conf_t usn;
usn.booking_handler = handle_booking; // this is the handler, which is called for each rent/return or start/stop
usn.c = c; // the incubed client
usn.chain_id = c->chain_id; // the chain_id
usn.chain_id = c->chain.chain_id; // the chain_id
usn.devices = NULL; // this will contain the list of devices supported
usn.len_devices = 0; // and length of this list
usn.now = 0; // the current timestamp
Expand Down Expand Up @@ -863,6 +872,7 @@ source : [in3-c/c/examples/usn_rent.c](https://github.com/blockchainsllc/in3/blo

how to send a rent transaction to a usn contract usinig the usn-api.


```c
/// how to send a rent transaction to a usn contract usinig the usn-api.

Expand Down Expand Up @@ -941,7 +951,8 @@ int main(int argc, char* argv[]) {
}
```
### Building
### Building
In order to run those examples, you only need a c-compiler (gcc or clang) and curl installed.
Expand All @@ -955,3 +966,4 @@ You can build them individually by executing:
```
gcc -o get_block_api get_block_api.c -lin3 -lcurl
```
Loading

0 comments on commit de5572c

Please sign in to comment.