Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into stdevAlDen_t34_h…
Browse files Browse the repository at this point in the history
…ardware-wallet_tests

Conflicts:
	lib/cgo/tests/check_cipher.address.common.c
	lib/cgo/tests/check_cipher.crypto.c
	lib/cgo/tests/check_cipher.hash.c
	lib/cgo/tests/testutils/libsky_assert.c
	lib/cgo/tests/testutils/libsky_testutil.c
ref skycoin#34
  • Loading branch information
Alvaro Denis committed Aug 19, 2019
2 parents e2a5b2d + 99358b3 commit f91833c
Show file tree
Hide file tree
Showing 1,162 changed files with 380,137 additions and 21,960 deletions.
19 changes: 12 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
jobs:
orangepi-plus2:
docker:
- image: docker:18.06.0-ce-git
- image: circleci/golang:1.12
working_directory: $GOPATH/src/github.com/skycoin/libskycoin
environment:
QEMU_PLATFORM: orangepi-plus2
Expand All @@ -12,11 +12,12 @@ jobs:
- checkout
- setup_remote_docker:
version: 18.06.0-ce
docker_layer_caching: true
- run: docker build --build-arg QEMU_PLATFORM --build-arg QEMU_OS=debian --file $GOPATH/src/github.com/skycoin/libskycoin/docker/images/test-arm/Dockerfile $GOPATH/src/github.com/skycoin/libskycoin -t skydev-test

raspberrypi3:
docker:
- image: docker:18.06.0-ce-git
- image: circleci/golang:1.12
working_directory: $GOPATH/src/github.com/skycoin/libskycoin
environment:
QEMU_PLATFORM: raspberrypi3
Expand All @@ -26,11 +27,12 @@ jobs:
- checkout
- setup_remote_docker:
version: 18.06.0-ce
docker_layer_caching: true
- run: docker build --build-arg QEMU_PLATFORM --build-arg QEMU_OS=debian --file $GOPATH/src/github.com/skycoin/libskycoin/docker/images/test-arm/Dockerfile $GOPATH/src/github.com/skycoin/libskycoin -t skydev-test

raspberrypi2:
docker:
- image: docker:18.06.0-ce-git
- image: circleci/golang:1.12
working_directory: $GOPATH/src/github.com/skycoin/libskycoin
environment:
QEMU_PLATFORM: raspberry-pi2
Expand All @@ -40,11 +42,12 @@ jobs:
- checkout
- setup_remote_docker:
version: 18.06.0-ce
docker_layer_caching: true
- run: docker build --build-arg QEMU_PLATFORM --build-arg QEMU_OS=debian --file $GOPATH/src/github.com/skycoin/libskycoin/docker/images/test-arm/Dockerfile $GOPATH/src/github.com/skycoin/libskycoin -t skydev-test

bananapi_m1_plus:
docker:
- image: docker:18.06.0-ce-git
- image: circleci/golang:1.12
working_directory: $GOPATH/src/github.com/skycoin/libskycoin
environment:
QEMU_PLATFORM: bananapi-m1-plus
Expand All @@ -54,18 +57,20 @@ jobs:
- checkout
- setup_remote_docker:
version: 18.06.0-ce
docker_layer_caching: true
- run: docker build --build-arg QEMU_PLATFORM --build-arg QEMU_OS=debian --file $GOPATH/src/github.com/skycoin/libskycoin/docker/images/test-arm/Dockerfile $GOPATH/src/github.com/skycoin/libskycoin -t skydev-test

publish-github-release_32:
docker:
- image: docker:18.06.0-ce-git
- image: circleci/golang:1.12
working_directory: $GOPATH/src/github.com/skycoin/libskycoin
steps:
- run: mkdir -p $GOPATH/src/github.com/ $GOPATH/src/github.com/skycoin
- checkout
- setup_remote_docker:
version: 18.06.0-ce
- run: if [[ $CIRCLE_TAG ]]; then docker build --build-arg SHA1=$CIRCLE_SHA1 --build-arg GITHUB_OAUTH_TOKEN --build-arg PROJECT_USERNAME=$CIRCLE_PROJECT_USERNAME --build-arg PROJECT_REPONAME=$CIRCLE_PROJECT_REPONAME --build-arg QEMU_PLATFORM=raspberrypi3 --build-arg VERSION --file $GOPATH/src/github.com/skycoin/libskycoin/docker/images/deploy-arm/Dockerfile $GOPATH/src/github.com/skycoin/libskycoin -t skydev-deploy ; fi
docker_layer_caching: true
- run: cd $GOPATH/src/github.com/skycoin/libskycoin/ci-scripts && bash deploy-arm.sh

workflows:
version: 2
Expand Down
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ install:
- make install-deps-libc
- make install-deps-skyapi
script:
- make build-skyapi
- make build
- make lint
- make test-libc
- make test
- make lint-libc
- make test-skyapi

before_deploy:
- export VERSION="$(git describe --tags --exact-match HEAD 2> /dev/null)"
Expand Down
53 changes: 49 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,65 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
## Unreleased

### Added
- Added swagger specification for `Skycoin REST API` to v0.27.0

### Fixed
### Changed
- Update `lib/curl` to v0.27.0

## [0.26.0] - 2019-07-12

### Added
- Added datatype `api__TransactionInput`
- Added datatype `transaction__UxBalance`
- Added function `SKY_transaction_NewUxBalances`,
- Added function `SKY_transaction_DistributeCoinHoursProportional`, `SKY_transaction_DistributeSpendHours`
- Added funcion `SKY_coin_VerifyInputSignatures`
- Added funcion `SKY_coin_BlockHeader_SetTime`
- Added funcion `SKY_coin_BlockHeader_SetBkSeq`
- Added funcion `SKY_coin_BlockHeader_SetFee`
- Added funcion `SKY_coin_BlockHeader_SetVersion`
- Added funcion `SKY_coin_BlockHeader_Version`
- Added funcion `SKY_coin_BlockHeader_PrevHash`
- Support for this new functions in `skyapi`:
- Add POST /api/v2/wallet/transaction/sign to sign an unsigned transaction with a wallet
- Add POST /api/v2/transaction to create an unsigned transaction from addresses or unspent outputs without a wallet
- Add /api/v2/data APIs for transaction notes and generic key-value storage.
- Update /metrics endpoint to add metrics from /health: unspent_outputs, unconfirmed_txns, time_since_last_block_seconds, open_connections, outgoing_connections, incoming_connections, start_at, uptime_seconds, last_block_seq.

### Changed
- Support for this changed functions in `skyapi`:
- Add /api/v1/resendUnconfirmedTxns to the WALLET API set
- In POST /api/v1/wallet/transaction, moved wallet parameters to the top level of the object
- POST /api/v2/wallet/seed/verify returns an error if the seed's checksum is invalid
- Increase the detail of error messages for invalid seeds sent to POST /api/v2/wallet/seed/verify

### Removed

## [0.25.1] - 2019-05-24
- Removed symbolic links from vendor
- Removed function `SKY_webrpc_NewClient`, `SKY_webrpc_Client_CSRF`, `SKY_webrpc_Client_InjectTransaction`, `SKY_webrpc_Client_GetStatus`,`SKY_webrpc_Client_GetTransactionByID`, `SKY_webrpc_Client_GetAddressUxOuts`, `SKY_webrpc_Client_GetBlocksInRange`, `SKY_webrpc_Client_GetBlocksBySeq` and `SKY_webrpc_Client_GetLastBlocks`.
- Removed datatype `wallet__UxBalance`
- Removed fuction `SKY_cipher_VerifySignedHash`
- Removed fuction `SKY_bip39_MnemonicToByteArray`
- Removed fuction `SKY_api_Client_Spend`, `SKY_api_Client_AddressTransactions`
- Removed fuction `SKY_coin_Block_PreHashHeader`, `SKY_coin_Block_String` and `SKY_coin_BlockHeader_String`.
- Removed functions exported for `coin.math`
- Removed function `SKY_coin_Transaction_TxID`
- Removed function `SKY_wallet_DistributeSpendHours`
- Removed function `SKY_wallet_DistributeCoinHoursProportional`
- Removed function `SKY_wallet_NewUxBalances`
- Removed support for next functions in `skyapi`:
- /api/v1/explorer/address endpoint (use GET /api/v1/transactions?verbose=1 instead). See https://github.com/skycoin/skycoin/blob/develop/src/api/README.md#migrating-from--api-v1-explorer-address
- The unversioned REST API (the -enable-unversioned-api is removed, prefix your API requests with /api/v1 if they don't have an /api/vx prefix already). See https://github.com/skycoin/skycoin/blob/develop/src/api/README.md#migrating-from-the-unversioned-api
- /api/v1/wallet/spend endpoint (use POST /api/v1/wallet/transaction followed by POST /api/v1/injectTransaction instead). See https://github.com/skycoin/skycoin/blob/develop/src/api/README.md#migrating-from--api-v1-spend


## [0.25.1] - 2019-06-30

### Added

- Be able to set a build type for lib curl.
- Export functions in Skycoin 0.25.1 core API's
- `skyapi` C client for Skycoin node REST at `lib/curl`.
- Support for building `libskycoin` on ARM and 32 / 64 bits.
Expand Down
33 changes: 26 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DEFAULT_GOAL := help
.PHONY: test-libc test-lint build-libc check build build-skyapi test-skyapi
.PHONY: install-linters format clean-libc format-libc lint-libc docs
.PHONY: build-skyhwd test-skyhwd

COIN ?= skycoin

Expand All @@ -24,15 +25,21 @@ SKYVENDOR_REL_PATH = $(SKYSRC_REL_PATH)/vendor
BUILD_DIR = build
BUILDLIB_DIR = $(BUILD_DIR)/libskycoin
BUILDLIBSKYAPI_DIR = $(BUILD_DIR)/libskyapi
BUILDLIBSKYHWD_DIR = $(BUILD_DIR)/libskyhwd
LIBNAME_Linux = libskyapi.so
LIBHWDNAME_Linux = libskyhwd.so
LIBNAME_Darwin = libskyapi.dylib
LIBHWDNAME_Darwin = libskyhwd.dylib
LIBNAME_Static = libskyapiStatic.a
LIBHWDNAME_Static = libskyhwdStatic.a
LIB_DIR = lib
BIN_DIR = bin
DOC_DIR = docs
INCLUDE_DIR = include
LIBSRC_DIR = lib/cgo
LIBSKYDOC_DIR = $(DOC_DIR)/libc
LIBCURLDOC_DIR = $(DOC_DIR)/curl
LIBSKYHWDDOC_DIR = $(DOC_DIR)/skyhwd
SWAGGER_SPEC_DIR = lib/swagger
SWAGGER_CLIENT_DIR = lib/curl

Expand Down Expand Up @@ -82,9 +89,6 @@ configure-build:
## Update links to dependency packages
dep:
git submodule update --init --recursive
ln -nsf ../$(LIBSRC_VENDORREL_PATH)/$(SKYVENDOR_REL_PATH)/golang.org $(LIBVENDOR_REL_PATH)/golang.org
ln -nsf ../$(LIBSRC_VENDORREL_PATH)/$(SKYVENDOR_REL_PATH)/gopkg.in $(LIBVENDOR_REL_PATH)/gopkg.in
ls -1 $(SKYVENDOR_REL_PATH)/github.com | grep -v '^skycoin$$' | xargs -I NAME ln -nsf ../$(LIBSRC_VENDORREL_PATH)/$(SKYVENDOR_REL_PATH)/github.com/NAME $(LIBVENDOR_REL_PATH)/github.com/NAME

$(BUILDLIB_DIR)/libskycoin.so: $(LIB_FILES) $(SRC_FILES) $(HEADER_FILES)
rm -Rf $(BUILDLIB_DIR)/libskycoin.so
Expand All @@ -106,8 +110,15 @@ build-skyapi: ## Build skyapi(libcurl based) library
(cd lib/curl && bash ./install_lib_curl.sh)
mkdir -p ./build/libskyapi
cp lib/curl/build/$(LIBNAME_$(UNAME_S)) ./build/libskyapi
cp lib/curl/build/$(LIBNAME_Static) ./build/libskyapi

build: build-libc build-skyapi ## Build libraries
build-skyhwd: ## Build skyhwd(libcurl based) library
(cd lib/skyhwd && bash ./install_lib_curl.sh)
mkdir -p ./build/libskyhwd
cp lib/skyhwd/build/$(LIBHWDNAME_$(UNAME_S)) ./build/libskyhwd
cp lib/skyhwd/build/$(LIBHWDNAME_Static) ./build/libskyhwd

build: build-libc build-skyapi build-skyhwd ## Build libraries

## Build libskycoin C client library and executable C test suites
## with debug symbols. Use this target to debug the source code
Expand All @@ -126,16 +137,21 @@ test-libc: build-libc ## Run tests for libskycoin C client library

test-skyapi: build-skyapi ## Run test for skyapi(libcurl based) library

test: test-libc test-skyapi ## Run all test for libskycoin
test-skyhwd: build-skyhwd ## Run test for Hardware Wallet Daemon(libcurl based) library

test: test-libc test-skyapi test-skyhwd ## Run all test for libskycoin

docs-skyapi: ## Generate SkyApi (libcurl) documentation
openapi-generator generate -g html2 -i lib/swagger/skycoin.v0.25.1.openapi.v2.yml -o $(LIBCURLDOC_DIR)

docs-skyhwd: ## Generate SkyHWD (libcurl) documentation
openapi-generator generate -g html2 -i lib/swagger/hardware-wallet-daemon.v0.1.0.yaml -o $(LIBSKYHWDDOC_DIR)

docs-libc: ## Generate libskycoin documentation
doxygen ./.Doxyfile
moxygen -o $(LIBSKYDOC_DIR)/API.md $(LIBSKYDOC_DIR)/xml/

docs: docs-libc docs-skyapi ## Generate documentation for all libraries
docs: docs-libc docs-skyapi docs-skyhwd ## Generate documentation for all libraries

lint: ## Run linters. Use make install-linters first.
vendorcheck ./...
Expand Down Expand Up @@ -218,7 +234,10 @@ clean-libc: ## Clean files generated by libc
clean-skyapi: ## Clean files generated by skyapi
rm -rfv $(BUILDLIBSKYAPI_DIR)

clean: clean-libc clean-skyapi ## Clean all files generated by libraries
clean-skyhwd: ## Clean files generated by skyhwd
rm -rfv $(BUILDLIBSKYHWD_DIR)

clean: clean-libc clean-skyapi clean-skyhwd ## Clean all files generated by libraries

format-libc:
$(PKG_CLANG_FORMAT) -sort-includes -i -assume-filename=.clang-format lib/cgo/tests/*.c
Expand Down
41 changes: 39 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Skycoin C library

[![Build Status](https://travis-ci.org/skycoin/libskycoin.svg)](https://travis-ci.org/skycoin/libskycoin)
[![Build Status](https://travis-ci.com/skycoin/libskycoin.svg)](https://travis-ci.com/skycoin/libskycoin)

Skycoin C library (a.k.a `libskycoin`) exports the Skycoin API to DApps using the C programming language.
It is also the foundation to build client libraries for other programming languages.
Expand Down Expand Up @@ -88,7 +88,7 @@ $ make test-libc
0. Make a PR merging the release branch into `master`
0. Review the PR and merge it
0. Tag the `master` branch with the version number. Version tags start with `v`, e.g. `v0.20.0`. Sign the tag. If you have your GPG key in github, creating a release on the Github website will automatically tag the release. It can be tagged from the command line with `git tag -as v0.20.0 $COMMIT_ID`, but Github will not recognize it as a "release".
0. Release builds are created and uploaded by travis. To do it manually, checkout the master branch and follow the [create release builds instructions](#creating-release-builds).
0. Release builds are created and uploaded by travis. To do it manually, checkout the master branch and make release.
0. Merge changes in `master` back into `develop` branch to start working towards next stable version.

#### Pre-release testing
Expand All @@ -98,6 +98,43 @@ Perform these actions before releasing:
```sh
make check
```
#### Release signing

Releases are signed with this PGP key:

`0x5801631BD27C7874`

The fingerprint for this key is:

```
pub ed25519 2017-09-01 [SC] [expires: 2023-03-18]
10A7 22B7 6F2F FE7B D238 0222 5801 631B D27C 7874
uid GZ-C SKYCOIN <token@protonmail.com>
sub cv25519 2017-09-01 [E] [expires: 2023-03-18]
```

Keybase.io account: https://keybase.io/gzc

##### Alternative signing keys:

Keybase.io account: https://keybase.io/olemis

The fingerprint for this key is:

```
pub rsa4096 2019-01-17 [SC] [expires: 2024-01-16]
uid Olemis Lang <olemis@simelo.tech>
sub rsa4096 2019-01-17 [E] [expires: 2024-01-16]
```

Follow the [Tor Project's instructions for verifying signatures](https://www.torproject.org/docs/verifying-signatures.html.en).

If you can't or don't want to import the keys from a keyserver, the signing key is available in the repo: [gz-c.asc](gz-c.asc).

Releases and their signatures can be found on the [releases page](https://github.com/skycoin/skycoin/releases).

Instructions for generating a PGP key, publishing it, signing the tags and binaries:
https://gist.github.com/gz-c/de3f9c43343b2f1a27c640fe529b067c

## Development

Expand Down
12 changes: 12 additions & 0 deletions ci-scripts/deploy-arm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -x

git --version

export VERSION="$(git describe --tags --exact-match HEAD)"

if [[ "$VERSION" ]]; then
docker build --build-arg SHA1=$CIRCLE_SHA1 --build-arg GITHUB_OAUTH_TOKEN --build-arg PROJECT_USERNAME=$CIRCLE_PROJECT_USERNAME --build-arg PROJECT_REPONAME=$CIRCLE_PROJECT_REPONAME --build-arg QEMU_PLATFORM=armv7hf --build-arg VERSION --file $GOPATH/src/github.com/skycoin/libskycoin/docker/images/deploy-arm/Dockerfile $GOPATH/src/github.com/skycoin/libskycoin -t skydev-deploy
docker build --build-arg SHA1=$CIRCLE_SHA1 --build-arg GITHUB_OAUTH_TOKEN --build-arg PROJECT_USERNAME=$CIRCLE_PROJECT_USERNAME --build-arg PROJECT_REPONAME=$CIRCLE_PROJECT_REPONAME --build-arg QEMU_PLATFORM=aarch64 --build-arg VERSION --file $GOPATH/src/github.com/skycoin/libskycoin/docker/images/deploy-arm/Dockerfile $GOPATH/src/github.com/skycoin/libskycoin -t skydev-deploy
fi
8 changes: 6 additions & 2 deletions ci-scripts/docker_install_debian.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#!/usr/bin/env bash

apt-get update
apt-get install gcc-6 g++-6 curl wget -y
apt-get install gcc g++ wget cmake libcurl3-gnutls -y

wget -c https://github.com/libcheck/check/releases/download/0.12.0/check-0.12.0.tar.gz
tar -xzf check-0.12.0.tar.gz
cd check-0.12.0 && ./configure --prefix=/usr --disable-static && make && sudo make install
cd check-0.12.0 && ./configure --prefix=/usr --disable-static && make && sudo make install

wget -c http://curl.haxx.se/download/curl-7.58.0.tar.gz
tar -xvf curl-7.58.0.tar.gz
cd curl-7.58.0/ && make && sudo make install
6 changes: 5 additions & 1 deletion ci-scripts/docker_install_ubuntu.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#!/usr/bin/env bash

apt-get update
apt-get install gcc-6 g++-6 curl wget -y
apt-get install gcc-6 g++-6 curl wget cmake libcurl3-gnutls -y

sudo apt-get remove curl -y
(cd deps && wget http://curl.haxx.se/download/curl-7.58.0.tar.gz && tar -xvf curl-7.58.0.tar.gz && cd curl-7.58.0/ && ./configure && make && sudo make install)
(cd deps && git clone https://github.com/uncrustify/uncrustify.git && cd uncrustify && mkdir build && cd build && cmake .. && make && sudo make install)

wget -c https://github.com/libcheck/check/releases/download/0.12.0/check-0.12.0.tar.gz
tar -xzf check-0.12.0.tar.gz
Expand Down
14 changes: 7 additions & 7 deletions docker/images/deploy-arm/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
ARG QEMU_PLATFORM
FROM balenalib/${QEMU_PLATFORM}-debian-golang

ARG QEMU_PLATFORM
ARG GITHUB_OAUTH_TOKEN
ARG PROJECT_USERNAME
ARG PROJECT_REPONAME
ARG SHA1
ARG VERSION
ADD . $GOPATH/src/github.com/skycoin/libskycoin/

RUN [ "cross-build-start" ]
Expand All @@ -15,12 +16,11 @@ RUN make -C $GOPATH/src/github.com/skycoin/libskycoin dep
RUN go get github.com/gz-c/gox
RUN go get -t ./...
ENV CGO_ENABLED=1
RUN export VERSION="$(git describe --tags --exact-match HEAD 2> /dev/null)"
RUN export ARCH="$(uname -m)"
RUN export OS="$(uname -s)"
ENV ARCH=${QEMU_PLATFORM}
ENV OS="Linux"
RUN make -C $GOPATH/src/github.com/skycoin/libskycoin build
RUN tar -c -z -f libskycoin-${VERSION}-${OS}-${ARCH}.tar.gz -C $GOPATH/src/github.com/skycoin/libskycoin/build $GOPATH/src/github.com/skycoin/libskycoin/build/*
RUN tar -czf libskycoin-${VERSION}-${OS}-${ARCH}.tar.gz -C $GOPATH/src/github.com/skycoin/libskycoin/build $GOPATH/src/github.com/skycoin/libskycoin/build/*
RUN go get github.com/tcnksm/ghr
RUN ghr -t ${GITHUB_OAUTH_TOKEN} -u ${PROJECT_USERNAME} -r ${PROJECT_REPONAME} -c ${SHA1} -delete ${VERSION} libskycoin-${VERSION}-${OS}-${ARCH}.tar.gz
RUN ghr -t ${GITHUB_OAUTH_TOKEN} -u ${PROJECT_USERNAME} -r ${PROJECT_REPONAME} -c ${SHA1} -replace -draft ${VERSION} libskycoin-${VERSION}-${OS}-${ARCH}.tar.gz

RUN [ "cross-build-end" ]
RUN [ "cross-build-end" ]
2 changes: 1 addition & 1 deletion docker/images/test-arm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ RUN make -C $GOPATH/src/github.com/skycoin/libskycoin test-libc
RUN [ "cross-build-end" ]

WORKDIR $GOPATH/src/github.com/skycoin
VOLUME $GOPATH/src/
VOLUME $GOPATH/src/
Loading

0 comments on commit f91833c

Please sign in to comment.