Coder Social home page Coder Social logo

libskycoin's Introduction

Skycoin C library

Build Status

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.

Links

Subprojects

The Skycoin C library is made of the following components

  • lib/cgo : C wrappers for the Skycoin core API
  • lib/swig : SWIG interfaces to generate wrappers around the Skycoin core API for other programming languages
  • lib/swagger : Swagger specifications for generating REST API clients
  • lib/curl : C REST client for the Skycoin HTTP API. Generated by openapi-generator. Powered by libcurl.

Consult respective README files for further details.

Make Rules

All these make rules require skycoin to be a git submodule of libskycoin

Target Help
build-libc-static Build libskycoin C static library
build-libc-shared Build libskycoin C shared library
build Build all C libraries
build-libc Build libskycoin C client libraries
build-skyapi Build skyapi(libcurl based) library
test Run all test for libskycoin
test-libc Run tests for libskycoin C client library
test-skyapi Run test for skyapi(libcurl based) library
docs Generate documentation for all libraries
docs-libc Generate libskycoin documentation
docs-skyapi Generate SkyApi (libcurl) documentation
lint Run linters. Use make install-linters first.
check Run tests and linters
install-deps Install deps for libc and skyapi
install-deps-libc Install deps for libc
install-deps-skyapi Install skyapi(libcurl based) library.
install-linters Install linters
format Formats the code. Must have goimports installed (use make install-linters).
clean Clean all files generated by libraries(libcurl based and libc)
clean-libc Clean files generated by libc
clean-skyapi Clean files generated by skyapi

Development setup

Running tests

$ make test-libc

Releases

Update the version

  1. If the master branch has commits that are not in develop (e.g. due to a hotfix applied to master), merge master into develop (and fix any build or test failures)
  2. Switch to a new release branch named release-X.Y.Z for preparing the release.
  3. If the release process needs modifications, edit these steps before moving forward
  4. Ensure that the submodule at vendor/github.com/skycoin/skycoin is in sync with respect to the corresponding tag in https://github.com/skycoin/skycoin repository.
  5. Update CHANGELOG.md: move the "unreleased" changes to the version and add the date.
  6. Run make docs to regenerate documentation for all libraries and ensure they ar up-to-date.
  7. Follow the steps in pre-release testing
  8. Make a PR merging the release branch into master
  9. Review the PR and merge it
  10. 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".
  11. Release builds are created and uploaded by travis. To do it manually, checkout the master branch and make release.
  12. Merge changes in master back into develop branch to start working towards next stable version.

Pre-release testing

Perform these actions before releasing:

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 <[email protected]>
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 <[email protected]>
sub   rsa4096 2019-01-17 [E] [expires: 2024-01-16]

Follow the Tor Project's instructions for verifying signatures.

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.

Releases and their signatures can be found on the releases page.

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

Development

We have two branches: master and develop.

  • develop is the default branch and will always have the latest code. The submodule at gopath/src/github.com/skycoin/skycoin has to be in sync with skycoin/skycoin develop branch.
  • master will always be equal to the current stable release on the website, and should correspond with the latest release tag. The submodule at gopath/src/github.com/skycoin/skycoin has to be in sync with skycoin/skycoin master branch.

Separate stable development branches will be created to work on releases for supporting the most recent stable version of Skycoin. The name of these branches should be the Skycoin major and minor version numbers followed by dev suffix e.g. 0.25dev. These branches may be forked out of either master or develop branches, and the submodule at gopath/src/github.com/skycoin/skycoin has to be in sync with the corresponding tag of skycoin/skycoin official repository.

Stable development branches are created most of the time for the following reasons:

  • A Skycoin release increasing patch version number.
  • Enhanced support and bug fixes for a version of the library compiled against an stable version of Skycoin
  • Backporting useful features added in develop.

General development guidelines

The following rules are enforced

  • Contributions must comply to the development guidelines documented in the Skycoin wiki.
  • C / C++ code must comply to the Bitcoin C coding style (enforced by clang-format).

SkyApi libcurl client for Skycoin REST API

This wrapper is auto-generated by openapi-generator directly from Skycoin REST API code.

For further instructions see Autogenerated documentation.

Doxygen comment syntax

If you want to continue with the doxygen way(we recommend it) of coding and document functions, structs, and functions, you should follow the specifications found in the Doxygen official site.

An example of documentation using doxygen is the next:

/**
 * Addresses of Bitcoin accounts
 */
typedef struct {
    GoUint8_ Version;      ///< Address version identifier.
                           ///< Used to differentiate testnet
                           ///< vs mainnet addresses, for instance.
    cipher__Ripemd160 Key; ///< Address hash identifier.
} cipher__BitcoinAddress;

This code example can be found at include/cipher.bitcoin.go.h.

Inside /* */ we found struct documentation, meanwhile //< symbol is used to describe fields of the struct.

After that, run make docs for a new docs generation. You can found the api documentation at docs/libc folder.

libskycoin's People

Contributors

bigookie avatar gz-c avatar hanyh2004 avatar iketheadore avatar karlob avatar ljesparis avatar mahansky avatar montycrypto avatar morphium avatar nakulpandey avatar olemis avatar polarislee1984 avatar samuelvisscher avatar senyoret1 avatar skycoin-main avatar spurserh avatar stdevalden avatar stdevedu avatar stdevmac avatar stdevmauricio avatar stdevnorge avatar stdevpavelmc avatar stdevstark avatar stdevyuniers avatar stgleb avatar therealssj avatar vavilen avatar zgordan-vv avatar zhiyuan2007 avatar zsm5j avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

libskycoin's Issues

Add openapi spec for Skycoin REST API v0.26.0

Feature description
Add openapi spec for Skycoin REST API in version 0.26.0

  • Add in lib/swagger openapi spec
  • Generate client C wrapper for skycoin REST API
  • Mention in CHANGELOG
  • Run basic Swagger tests in Travis

Track all the required changes for autogenerated files

Feature description

After generating some files it required to make some changes, improve/fix.

Is your feature request related to a problem? Please describe.
The generator is not perfect, if you want to customize or fix some this, this changes could be lose after a regeneration.

Describe the solution you'd like
A check list in the README to track the required changes after regenerating files.

Additional context
This is an example of a required change:

Possible implementation
A new section in README and reference it from the "release instructions" section.

Relevant changes so far now:

C API wrapper for the Skycoin node API

Expected Behavior

Access to the Skycoin node REST API implemented in C code .

Actual Behavior

Right now this is only possible using code generated by SWIG , which requires memory handles

Specifications

  • Version: 0.25.0
  • Platform: all
  • Subsystem: all exported API sets

Possible Solution

Generate it from Swagger specs . Beware of CSRF .

  • Use Skycoin node Swagger spec to generate initial C REST API client
  • Add make target to automate generation in ./build
  • Aforementioned target should copy / merge relevant files into source code tree
  • README explaining the process
  • Mention in CHANGELOG
  • Patch the result Swagger-gen REST client to support specifying node address
  • Update package metadata
  • Run basic Swagger tests in Travis
  • Unify test code in case multiple test suites are used after generation
  • Beware of CSRF auth

CHANGELOG for v0.25.1

Filter out CHANGELOG entries that do not belong in libskycoin releases . Add blank issue template .

Project README

Feature description

Missing project README

Describe the solution you'd like
Project README including:

  • Build status
  • Library sub projects

Implement client for the hardware wallet daemon REST API

Feature description

Implement client for the hardware wallet daemon REST API

Is your feature request related to a problem? Please describe.
skycoin/hardware-wallet-daemon#8 adds a swagger.yml spec defining HTTP REST API for interacting with hardware wallets .

Describe the solution you'd like
Generate C client powered by libcurl

Describe alternatives you've considered
There might be other choices but Skycoin nodes REST API is generated with libcurl already.

Possible implementation

  • Grab the YAML OpenAPI spec from github project in make configure
  • Move Skycoin node REST API client to lib/curl/skycoin
  • Generate library at lib/curl/skywallet
  • Remove intermediate output files in make clean

Changes in SWIG for multiple return languages

Describe the bug
In the case of multiple return languages, Handle and uint64 cause byte losses in their conversion.

Environment information:

  • Platform: ARM and 32 bits
  • Go environment:
# Output of goenv e.g.
$ go env
GOARCH="386"
GOBIN="/go/bin"
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="386"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_386"
GCCGO="gccgo"
GO386="sse2"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m32 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build027231592=/tmp/go-build -gno-record-gcc-switches"

Include certain missing skycoin cipher lib test vectors

Feature description

Describe the feature
The tests are possibly missing some important test vectors for the cipher libs

This is the test case that must be imported:
https://github.com/skycoin/skycoin/blob/develop/src/cipher/secp256k1-go/secp256_test.go#L654-L738

Is your feature request related to a problem? Please describe.
Testing/sanity checking

Describe the solution you'd like
Add the test vectors to the test suite

Describe alternatives you've considered
No alternatives

Additional context
I've discovered some historically important test vectors in underlying secp256k1 libraries that may not have been included in the libskycoin test suite because it is in a deeper library than top-level cipher. The initial discussion of them is here piotrnar/gocoin#15

Possible implementation
Preliminary ideas to get this done.
If you have all details in mind then provide a checklist

  • Translate the test case
  • Confirm that they pass. If they don't pass, then there is a problem with the libskycoin cipher library

Add some tests to the harware-wallet suite.

Feature description

Make the following tests working for hardware-wallet crypto API

  • TestPubKeyToAddress2
  • TestAddressRoundtrip
  • TestAddressString
  • TestAddressBulk
  • TestDecodeBase58Address
  • TestAddressFromSecKey
  • TestSumSHA256

Describe the solution you'd like
These tests should run from hardware wallet project too.

Additional context
Related to this https://github.com/skycoin/hardware-wallet/issues/84

Possible implementation
Just move them to the *common files and make sure that they are working from hw.

Release Libskycoin 0.25.1

  • Sync 0.25.dev and master branches
  • Create release branch release-0.25.1
  • Update release process docs
  • Skycoin submodule checkout at v0.25.1
  • Update CHANGELOG.md
  • Ensure libc and skyapi docs are up-to-date
  • PR from release-0.25.1 to master
  • Review release PR
  • Tag master with v0.25.1 . This will deploy binaries for different architectures to Github releases .
  • Add docs sync in release procedure (if missing)
  • Move docker/images/circle/ => docker/images/deploy-arm

Implement Circle CI

Feature description

Continuous integration on Circle CI

Is your feature request related to a problem? Please describe.
Running a complex matrix build blocks other projects

Describe the solution you'd like
Run matrix builds on Circle CI . Focus on release since Travis will stil be used for day to day development .

Describe alternatives you've considered
Travis is not an option . There are all sorts of Github Apps for CI .

Additional context
Related to #44 .

Possible implementation

  • Translate .travis.yml rules into CircleCI script format
  • Enable deployment (needs build matrix)

SkyApi make targets

Add new targets:

  • install-deps-skyapi to install cmake, libcurl, ...
  • Remove install-lib-curl after merging rules into install-deps-skyapi
  • install-deps to install deps for both libc and skyapi
  • build-skyapi to build Swagger-based library (depends on install-skyapi-deps)
  • build to trigger both build-libc as well as build-skyapi
  • platform-specific targets that might be needed for all of the above
  • use Travis apt addon to install modern cmake for CI
  • Document make targets in README.md

Document release procedure

Feature description

Release procedure

Describe the solution you'd like
The steps should mention deliverable artifacts. Process should be similar to PySkycoin's .

Reduce the number of builds in a travis build

The travis config is doing too many builds, which take a very long time (over 30 minutes) and block all other builds for our github organization (since travis limits us to 5 or 6 concurrent builds for the entire org).

C bindings for Skycoin hardware wallet .

Feature description

C bindings for Skycoin hardware wallet .

Describe the solution you'd like
Add methods to invoke in-process the commands defined in skycoin/hardware-wallet-go .

Describe alternatives you've considered
Maybe there is a similar C library for Trezor but using it leads to duplicated maintenance efforts

Additional context
This belongs in separate library

Possible implementation

  • skycoin/hardware-wallet submodule
  • cgo wrappers
  • Makefile targets
  • SWIG typemaps and interfaces
  • C test code

The curl library should be build in release mode for release versions

Describe the bug
The build type is hard coded.

Environment information:

  • Any

Steps to Reproduce
Just look at the code https://github.com/simelo/libskycoin/blob/3cb637dbd49eb3073d18b25205cc58e2519a28c7/lib/curl/CMakeLists.txt#L9

Actual behavior
The curl library is build in debug as unique option.

Expected behavior
Be able to set a predefined value via command line.

Additional context
It's very important to move on this if you regenerate the CMakeLists.txt file.

Modify structure of Swagger specs

Feature description

Add models definitions sections in Swagger spec.

Is your feature request related to a problem? Please describe.
Swagger spec for Skycoin node only defines inline responses. This leads to generation errors , e.g. in qt ( simelo/libskycoin-cpp#1 ) and tizen ( simelo/libskycoin-cpp#2 ) client libraries.

Describe the solution you'd like
All models in models definitions section. Add type field for operation items . Use $ref for array types links for type definition.

Describe alternatives you've considered
The inline response body does not work quite well for generators relying on some language / framework combinations .

Additional context
The structure is inspired on Pet app Swagger spec's models section . This layout works fine with many generators.

Enforce code styles with linters

Feature description

Normalize code style for clean PR diffs

Is your feature request related to a problem? Please describe.
After analyzing some PR's the corresponding patches sometimes differ on whitespace only.

Describe the solution you'd like
Diffs could have been smaller if code would have been normalized and rules enforced by a linter

Possible implementation

  • Choose code style = Bitcoin's
  • Find linters able to enforce that style = clang-format
  • Explain in README
  • Implement clang-format in make lint target
  • Run make lint in Travis

Device build matrix

Feature description

Travis builds for supported Skywire devices .

Describe the solution you'd like

  • hardware : orangepi-plus2, raspberry-pi2, raspberrypi3, beaglebone-black, Tinkerboard, bananapi-m1-plus, odroid-xu4, stem-x86-32
  • distro : debian , fedora , alpine , ubuntu

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Possible implementation
Run tests on Travis with Docker

C library for STM32 with emgo

Feature description

C library for STM32 MCU

Is your feature request related to a problem? Please describe.
It is not possible to run the library in lib/cgo on MCU .

Describe the solution you'd like

Use emgo to transpile skycoin/skycoin library code to C , then link binaries for STM32 platform

Describe alternatives you've considered
All other alternatives for compiling with go for MCU in the end rely on Firmata, which does not fit in our use case scenario.

Additional context
Ideally this could be used to upgrade the cipher library used in skycoin/hardware-wallet. Priority consists in support for STM32F4 series.

Possible implementation

  • Transpile skycoin/skycoin library code to C using emgo .
  • Link against library for STM32
  • Parameterize the test suite (if needed) so as to test multiple implementations
  • Execute the current test suite by calling the binaries obtained in aforementioned steps

Windows test in travis-ci

Feature description
Test libskycoin against travis-ci for windows

Describe the solution you'd like
Set in travis-ci matrix a build for windows

Possible implementation

  • set travis.yml matrix to use windows

Do not initialize GoString's memory in tests

Describe the bug
The functions that receive a GoString as an output parameter initialize the string memory internally

Environment information:

  • Platform: Any

  • Go environment: Any

  • Compiler info: Any

Steps to Reproduce
Steps to reproduce the behavior:

  1. Go to TestAddressString

Actual behavior
Initializing the string's memory in the test.

Expected behavior
The memory will be initialized in SKY_cipher_Address_String, and is required to register this memory in the cleanUp register.

Additional context

  • This change will affect the hardware-wallet tests, please notify the team about the change.
  • Find all the instances of this problem across the project, this is a single example.

Add openapi spec for Skycoin REST API v0.27.0

Feature description
Add openapi spec for Skycoin REST API in version 0.27.0

  • Add in lib/swagger openapi spec for this version
  • Generate client C wrapper for skycoin REST API
  • Mention in CHANGELOG
  • Run basic Swagger tests in Travis

Update libc for changes introduced in Skycoin==0.27.0

Feature description

Prepare libc for 0.27.0 release

Is your feature request related to a problem? Please describe.
Skycoin cipher API changed from 0.26.0 to 0.27.0

Additional context
Additional changes in SWIG interfaces might be needed.

Possible implementation

  • Review diff from Skycoin 0.26.0 to Skycoin 0.27.0
  • Take note of functions that were added, changed, or removed
  • Implement changes in lib/cgo
  • Take note of test cases that were added, changed, or removed
  • Implement changes in lib/cgo/tests

Run tests against hardware-wallet/skycoin-api

Feature description
Refactor tests

Describe the feature

It's desired to run this tests battery against hardware-wallet/skycoin-api, as hardware-wallet/skycoin-api have a subset of the libskycoin features it's required to refactor the tests to run all against libskycoin as it' currently and a test subset against hardware-wallet/skycoin-api.

Describe the solution you'd like
Just refactor tests without changing them.

Describe alternatives you've considered
Modifing the library it's not al alternative as this code is auto generated.

Additional context
https://github.com/skycoin/hardware-wallet/issues/84

Possible implementation
This is just about a refactorization, please do not change any thing

Distribute a version of the curl library for developers

Feature description
Distribute a version of the curl library for developers

Is your feature request related to a problem? Please describe.
May be desired for some develover be able to get a ready to use libcurl-dev.

Describe the solution you'd like
Create instructions to install the required files like:

Additional context
Do not miss to create a uninstall instruction.

Describe alternatives you've considered
Just use a install rule from command line or make part of the release some installers.

Possible implementation
As libcurl is using cmake you can consider using cpack, with this tool you can create script based installers, debian, windows, osx...

README should document `make docs`

Feature description

Document make docs

Is your feature request related to a problem? Please describe.
No mention to make docs target in project README .

Describe the solution you'd like

  • List all make targets
  • Add a section about Doxygen comment syntax , per the style guidelines
  • Mention devdocs generation in development section
  • Implement make docs-skyapi and integrate it with make docs

Support compilation of libskycoin for ARM 32 bit architectures

On Raspberry Pi 3B+ the following command

$ go get github.com/skycoin/skycoin/...

... fails at this statetemnt in skytypes.h

typedef char _check_for_64_bit_pointer_matchingGoInt[sizeof(void*)==64/8 ? 1:-1];

Further details can be found in the Telegram thread started with this message .
Refs:

  • t.me/skycoinsupport/14629
  • t.me/skycoinsupport/14634
  • t.me/skycoinsupport/14697
  • t.me/skycoinsupport/14739
  • t.me/skycoinsupport/14740

Bug in TestDecodeBase58Address.

Describe the bug
Invalid use of SKY_base58_Hex2Base58 for binary data.

Environment information:

  • Platform: Any

  • Go environment: Any

  • Compiler info: Any

Steps to Reproduce
Steps to reproduce the behavior: Look at the following lines of code.

1.
2.
3.

Actual behavior
SKY_base58_Hex2Base58 is receiving binary data.

Expected behavior
SKY_base58_Hex2Base58 should receive a hex buffer.

Tests for the C REST API wrappers

Expected Behavior

Same tests run for SKY_api_* functions shall be used for C API wrappers .

Actual Behavior

... see #3

Specifications

  • Version: 0.25.0
  • Platform: all
  • Subsystem: all exported API sets

Possible Solution

Reuse existing API test code and parameterize the invocation .

Update libc for changes introduced in Skycoin==0.26.0

Feature description

Prepare libc for 0.26.0 release

Is your feature request related to a problem? Please describe.
Skycoin cipher API changed from 0.25.1 to 0.26.0

Additional context

Additional changes in SWIG interfaces might be needed.

Possible implementation

  • Review diff from Skycoin 0.25.1 to Skycoin 0.26.0
  • Take note of functions that were added, changed, or removed
  • Implement changes in lib/cgo
  • Take note of test cases that were added, changed, or removed
  • Implement changes in lib/cgo/tests

Bug in test sort transactions.

Describe the bug
Bug in tests after fixing isSHA256Eq

Environment information:

  • Platform: Linux 4.19.0-1-amd64 x86_64
  • Go environment:
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/adacosta/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/usr/share/gocode"
GOPROXY=""
GORACE=""
GOROOT="/opt/go"
GOTMPDIR=""
GOTOOLDIR="/opt/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build114971256=/tmp/go-build -gno-record-gcc-switches"
  • Compiler info:
gcc (Debian 8.3.0-6) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Steps to Reproduce
Steps to reproduce the behavior:

  1. Fix this error.
  2. make test-libc
  3. See error

Actual behavior
Tests fail

lib/cgo/tests/check_coin.transactions.c:983:F:coin.transaction:TestSortTransactions:0: Failed SortTransactions test "invalid fee multiplication is capped"

Expected behavior
Tests should pass

Additional context
#34

Possible implementation:

PD: The "Possible implementation:" just try to make you follow some possible relevant paths than can be relevant in order to find the bug.

Ensure that all functions in Skycoin=0.26.0 exported in libskycoin=0.26.0

Describe the bug
libskycoin=0.26.0 API completeness

Environment information:

All platforms

Actual behavior

Some Skycoin core functions defined nowhere

$ grep -nr VerifyInputSignatures lib/

Expected behavior
All functions in cipher, coin, and other namespaces have to be included in libskycoin=0.26.0 public API .

Additional context
Discovered after #80 , see a391478 .

Possible implementation
Ensure that all functions in Skycoin=0.26.0 have a corresponding wrapper in libskycoin=0.26.0.

  • Add coin.Transaction.VerifyInputSignatures()
  • Document all new functions in CHANGELOG

Travis doesn't work for check_coin.transactions in some cases

Describe the bug
In some cases, when a run in travis-ci is made, the build fail, you rerun the test and everything is ok.

Steps to Reproduce
Is impossible to reproduce this bug, because sometimes work and other not work.

Actual behavior
Explain the failure modes and effects, everything indicating the existence of the bug.
If applicable, add screenshots to help explain your problem.

This is the test that is failing:

lib/cgo/tests/check_coin.transactions.c:284:F:coin.transaction:TestTransactionUpdateHeader:0: Assertion '!isU8Eq(ptx->InnerHash, nullHash, sizeof(cipher__SHA256))' failed

Getting a lot of warnings from the compiler

Describe the bug
There are a lot of warnings from the compiler

Environment information:

  • Platform: Linux 4.19.0-1-amd64 #1 SMP Debian 4.19.12-1 (2018-12-22) x86_64
  • Go environment: go version go1.11.6 linux/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/myuser/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/usr/share/gocode"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build305345991=/tmp/go-build -gno-record-gcc-switches"
  • Compiler info: gcc (Debian 8.3.0-6) 8.3.0

Steps to Reproduce
Steps to reproduce the behavior:

  1. Go to the source project root dir
  2. Run make test-libc

Actual behavior

Getting a lot of warnings:

lib/cgo/tests/check_cipher.crypto.c: In function ‘TestSecKeyFromHex’:
lib/cgo/tests/check_cipher.crypto.c:269:27: warning: passing argument 2 of ‘SKY_cipher_RandByte’ from incompatible pointer type [-Wincompatible-pointer-types]
   SKY_cipher_RandByte(32, &b);
                           ^~
In file included from lib/cgo/tests/check_cipher.crypto.c:5:
cgo-gcc-export-header-prolog:330:62: note: expected ‘coin__UxArray *’ {aka ‘struct <anonymous> *’} but argument is of type ‘GoSlice *’ {aka ‘struct <anonymous> *’}
In file included from lib/cgo/tests/check_cipher.hash.c:4:
lib/cgo/tests/check_cipher.hash.c: In function ‘TestSHA256Hex’:
lib/cgo/tests/check_cipher.hash.c:137:15: warning: implicit declaration of function ‘isGoStringEq’; did you mean ‘isGoSliceEq’? [-Wimplicit-function-declaration]
     ck_assert(isGoStringEq(s, s2));
               ^~~~~~~~~~~~
lib/cgo/tests/check_params.distribution.c: In function ‘TestDistributionAddressArrays’:
lib/cgo/tests/check_params.distribution.c:33:22: warning: assignment to ‘GoString *’ {aka ‘struct <anonymous> *’} from incompatible pointer type ‘GoString_ *’ {aka ‘struct <anonymous> *’} [-Wincompatible-pointer-types]
     for (i = 0, iStr = (GoString_ *)all.data; i < all.len; ++i, ++iStr)
                      ^
lib/cgo/tests/check_params.distribution.c:42:22: warning: assignment to ‘GoString *’ {aka ‘struct <anonymous> *’} from incompatible pointer type ‘GoString_ *’ {aka ‘struct <anonymous> *’} [-Wincompatible-pointer-types]
     for (i = 0, iStr = (GoString_ *)unlocked.data; i < unlocked.len; ++i, ++iStr)
                      ^
lib/cgo/tests/check_params.distribution.c:51:40: warning: assignment to ‘GoString *’ {aka ‘struct <anonymous> *’} from incompatible pointer type ‘GoString_ *’ {aka ‘struct <anonymous> *’} [-Wincompatible-pointer-types]
         for (k = 0, notfound = 1, kStr = (GoString_ *)all.data; notfound && (k < all.len); ++k, ++kStr)
                                        ^
lib/cgo/tests/check_params.distribution.c:58:22: warning: assignment to ‘GoString *’ {aka ‘struct <anonymous> *’} from incompatible pointer type ‘GoString_ *’ {aka ‘struct <anonymous> *’} [-Wincompatible-pointer-types]
     for (i = 0, iStr = (GoString_ *)locked.data; i < locked.len; ++i, ++iStr)
                      ^
lib/cgo/tests/check_params.distribution.c:67:40: warning: assignment to ‘GoString *’ {aka ‘struct <anonymous> *’} from incompatible pointer type ‘GoString_ *’ {aka ‘struct <anonymous> *’} [-Wincompatible-pointer-types]
         for (k = 0, notfound = 1, kStr = (GoString_ *)all.data; notfound && k < all.len; ++k, ++kStr)
                                        ^
lib/cgo/tests/check_params.distribution.c:75:40: warning: assignment to ‘GoString *’ {aka ‘struct <anonymous> *’} from incompatible pointer type ‘GoString_ *’ {aka ‘struct <anonymous> *’} [-Wincompatible-pointer-types]
         for (k = 0, notfound = 1, kStr = (GoString_ *)unlocked.data; notfound && k < unlocked.len; ++k, ++kStr)
.
.
.

Expected behavior
No warning at all

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.