Jon Cinque 9a366281d3
sdk: Make PubKey::create_program_address available in program unit tests (#11745)
* sdk: Make PubKey::create_program_address available in program unit tests

This finishes the work started in #11604 to have
`create_program_address` available when `target_arch` is not `bpf` and
`program` is enabled.  Otherwise, there is an undefined reference error
to `sol_create_program_address`, which is only defined in `bpf`.

A small test to simply call the function has been added in order to catch
the problem in the future.

The default dependency to `solana-sdk/default` doesn't cause a problem with
existing programs since `build.sh` always specifies
`--no-default-features`, and programs in `solana-program-library` all
use it too.

* Add `default-features = false` for inter-program dependencies

Fix the build error found during CI.  The `--no-default-features` flag
only applies to the top-level package, and not to dependencies.  A program that
depends on another program, i.e. `128bit` which depends on `128bit_dep`,
must specify `default-features = false` when including that package,
otherwise the `bpf` build will try to pull in default packages, which
includes `std`.
2020-08-24 19:28:36 +02:00
2020-07-14 11:49:25 -07:00
2020-08-05 12:04:15 -06:00
2020-08-05 12:04:15 -06:00
2020-08-05 12:04:15 -06:00
2020-08-05 12:04:15 -06:00
2020-08-19 16:36:03 +00:00
2020-08-05 12:04:15 -06:00
2020-08-05 12:04:15 -06:00
2020-08-22 09:22:01 -07:00
2020-08-05 12:04:15 -06:00
2020-08-14 12:32:45 -07:00
2020-08-05 12:04:15 -06:00
2020-08-05 12:04:15 -06:00
2020-08-05 12:04:15 -06:00
2020-08-05 12:04:15 -06:00
2020-08-05 12:04:15 -06:00
2020-08-05 12:04:15 -06:00
2020-08-21 21:48:37 -07:00
2020-08-05 12:04:15 -06:00
2020-08-05 12:04:15 -06:00
2020-08-05 12:04:15 -06:00
2020-08-05 12:04:15 -06:00
2020-08-05 12:04:15 -06:00
2020-08-05 12:04:15 -06:00
2020-08-05 12:04:15 -06:00
2020-08-05 12:04:15 -06:00
2020-08-05 12:04:15 -06:00
2020-08-18 17:24:25 +00:00
2020-08-05 12:04:15 -06:00
2020-08-05 12:04:15 -06:00
2020-08-05 12:04:15 -06:00
2020-08-05 12:04:15 -06:00
2020-08-04 10:51:25 -07:00
2020-08-04 16:34:45 -07:00
2020-08-07 08:45:17 -06:00
2020-08-20 18:02:36 +00:00
2020-04-18 15:11:55 -07:00

Solana

Solana crate Solana documentation Build status codecov

Building

1. Install rustc, cargo and rustfmt.

$ curl https://sh.rustup.rs -sSf | sh
$ source $HOME/.cargo/env
$ rustup component add rustfmt

If your rustc version is lower than 1.39.0, please update it:

$ rustup update

On Linux systems you may need to install libssl-dev, pkg-config, zlib1g-dev, etc. On Ubuntu:

$ sudo apt-get update
$ sudo apt-get install libssl-dev libudev-dev pkg-config zlib1g-dev llvm clang

2. Download the source code.

$ git clone https://github.com/solana-labs/solana.git
$ cd solana

3. Build.

$ cargo build

4. Run a minimal local cluster.

$ ./run.sh

Testing

Run the test suite:

$ cargo test

Starting a local testnet

Start your own testnet locally, instructions are in the online docs.

Accessing the remote testnet

  • testnet - public stable testnet accessible via devnet.solana.com. Runs 24/7

Benchmarking

First install the nightly build of rustc. cargo bench requires use of the unstable features only available in the nightly build.

$ rustup install nightly

Run the benchmarks:

$ cargo +nightly bench

Release Process

The release process for this project is described here.

Code coverage

To generate code coverage statistics:

$ scripts/coverage.sh
$ open target/cov/lcov-local/index.html

Why coverage? While most see coverage as a code quality metric, we see it primarily as a developer productivity metric. When a developer makes a change to the codebase, presumably it's a solution to some problem. Our unit-test suite is how we encode the set of problems the codebase solves. Running the test suite should indicate that your change didn't infringe on anyone else's solutions. Adding a test protects your solution from future changes. Say you don't understand why a line of code exists, try deleting it and running the unit-tests. The nearest test failure should tell you what problem was solved by that code. If no test fails, go ahead and submit a Pull Request that asks, "what problem is solved by this code?" On the other hand, if a test does fail and you can think of a better way to solve the same problem, a Pull Request with your solution would most certainly be welcome! Likewise, if rewriting a test can better communicate what code it's protecting, please send us that patch!

Disclaimer

All claims, content, designs, algorithms, estimates, roadmaps, specifications, and performance measurements described in this project are done with the author's best effort. It is up to the reader to check and validate their accuracy and truthfulness. Furthermore nothing in this project constitutes a solicitation for investment.

Description
Web-Scale Blockchain for fast, secure, scalable, decentralized apps and marketplaces.
Readme 514 MiB
Languages
Rust 87.7%
TypeScript 8%
Shell 2.6%
SCSS 0.7%
C 0.6%
Other 0.2%