Compare commits

...

1785 Commits
v0.11 ... v0.13

Author SHA1 Message Date
94e06342ac Revert "Initialize stopNetwork var"
This reverts commit ecfe655ba3.
2019-04-26 21:28:11 -07:00
ecfe655ba3 Initialize stopNetwork var 2019-04-26 21:11:06 -07:00
f8ea80850e Move validators from testnet-beta to testnet 2019-04-26 09:01:44 -07:00
657d9ad215 Move testnet influxdb datasource to influxcloud 2019-04-26 08:44:33 -07:00
963ce0bbc3 v0.13.3 2019-04-26 07:36:32 -07:00
1e0cd6549b Update testnet-participation.md 2019-04-25 21:07:50 -07:00
395a7ec96e Rename in-tree program_ids to be base-58 human readable (#4004)
automerge
2019-04-25 17:53:27 -07:00
42ee738646 Move testnet buildkite env variables back into the tree (#3989) 2019-04-25 11:45:21 -07:00
515ab21f07 Fix tar version check 2019-04-25 11:26:54 -07:00
7c5e5a06f3 Add getClusterNodes/getSlotLeader RPC API (#3980)
automerge
2019-04-24 17:49:14 -07:00
7c0c7da72d Increment Cargo.toml version to 0.13.2 2019-04-24 02:37:58 +00:00
b328e5f6ec Add genesis blockhashes to blobs (#3955)
* Add genesis blockhashes to blobs

* Update golden
2019-04-23 17:41:21 -07:00
0a4b6cedc7 Fix inserting bogus is_last blobs into blocktree (#3934) 2019-04-22 19:27:06 -07:00
d9a53eb9d4 verify that blobs match a known leader for the slot (#3927) (#3930)
* validate that blobs match a known leader for the slot

* clippy
2019-04-22 18:07:50 -07:00
a5b8ee645f Revert "Fix receiving bogus is_last blobs"
This reverts commit 1cbd1c42df.
2019-04-22 15:52:16 -07:00
1cbd1c42df Fix receiving bogus is_last blobs 2019-04-22 15:45:43 -07:00
b380bdd54f Flag vote account as configured once it has been configured 2019-04-18 19:12:32 -07:00
cb194eaee7 Ack on empty Gossip Pull Responses and keep Entrypoint around (#3881) (#3891)
* Ack on empty Gossip Pull Responses and keep Entrypoint around

* Address comments and fix test

* Update core/src/cluster_info.rs

Co-Authored-By: sagar-solana <sagar@solana.com>

* Update core/src/cluster_info.rs

Co-Authored-By: sagar-solana <sagar@solana.com>
2019-04-18 17:45:05 -07:00
ff3f810284 Reconfigure voting account on ledger restart 2019-04-18 14:33:53 -07:00
7e7e9603c9 Add packages and fix publish script (#3839) (#3880)
* Add packages and fix publish script

* Fixup
2019-04-18 14:46:46 -06:00
4c0e29cd2a Correct ./net.sh sanity argument order 2019-04-17 18:09:40 -07:00
065cf51a3f Disable testnet-sanity ledger verification, too slow 2019-04-17 15:20:57 -07:00
d4ec81fe61 Bump Cargo.toml versions to 0.13.1 (#3842) 2019-04-17 16:01:00 -06:00
e2508e5d12 Add --keypair to avoid writing a new one to ~ in CI 2019-04-17 10:13:52 -07:00
c7fea37964 testnet-beta sanity no longer tries to check inactive zones (#3822) 2019-04-17 09:38:48 -07:00
b197edea84 Add show-vote-account command (#3814) (#3820) 2019-04-17 08:30:44 -07:00
11f99faf0a Minor doc fixes++ 2019-04-16 17:45:26 -07:00
728314c96f Minor doc fixes 2019-04-16 17:44:12 -07:00
2530448474 net/ testnet nodes now stake more lamports (#3809)
* Add --bootstrap-leader-lamports

* Generalize --no-stake into --stake NUM

* Use a large stake for net/ fullnodes

* Setup vote account before starting fullnode to avoid mixed log output
2019-04-16 17:43:22 -07:00
49ad5e0b69 Preserve extra dependency annotations (optional=,features=) during version bump (#3811) 2019-04-16 15:12:03 -07:00
3c49d48666 Selectively deploy beta testnet to GCE/AWS or both clouds (#3805) (#3806) 2019-04-16 11:58:12 -07:00
2fe93101cc Remove stake from ./net sanity ephemeral validator (#3799) 2019-04-15 22:36:29 -07:00
e90d97e244 Revert "Revert "disable staking of blockstreamer node""
This reverts commit 03da63b41b.
2019-04-15 20:11:29 -07:00
819a0c5c7e Update testnet automation script to reflect changes in metrics (#3779) 2019-04-15 18:56:04 -07:00
7afd8644b3 Clarify release instructions (#3792) 2019-04-15 19:05:15 -06:00
68fc303b9b Rework Accounts for fast squash, hashing state and checkpoint recovery. (#3613)
* accounts rewrite

* ignore grow tests

* skip duplicate roots

* allow for a root race

* logger

* accounts_index tests

* tests

* tests
2019-04-15 17:15:50 -07:00
2bbed7727f Wait a bit for the funding transactions to go through (#3788) 2019-04-15 16:30:00 -07:00
63b1fd3675 Correctly fill out IP address for rpc ports (#3791) 2019-04-15 16:21:06 -07:00
3fcf03ff3e Refactor LocalCluster and add support for listener nodes (#3790) 2019-04-15 15:27:45 -07:00
80f3568062 Upgrade to Rust 1.34.0 (#3781)
* Upgrade to Rust 1.34.0

* Remove redundant closures

Thanks Clippy!
2019-04-15 15:56:08 -06:00
3e1214a871 Don't add reviewers to draft PRs (#3780) 2019-04-15 15:03:44 -06:00
149d809e86 Minor cli help cleanup (#3786) 2019-04-15 13:36:14 -07:00
784dbb00ab Bump reqwest from 0.9.14 to 0.9.15 (#3785)
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.9.14 to 0.9.15.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.9.14...v0.9.15)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-04-15 13:31:33 -07:00
87aef92e71 Fix up bash array handling (#3771) 2019-04-15 13:25:44 -07:00
d026ebb83a Use tvu_peers() since validators no longer run an RPC port by default (#3784) 2019-04-15 13:25:09 -07:00
64c6f05da2 persist set_root() and use it in blocktree_processor to limit squashes (#3782)
* rename locktower's slot to epoch

* persist set_root() and use it in blocktree_processor to limit squashes
2019-04-15 13:12:28 -07:00
8963500aa8 Bump generic-array from 0.12.0 to 0.13.0
Bumps [generic-array](https://github.com/fizyk20/generic-array) from 0.12.0 to 0.13.0.
- [Release notes](https://github.com/fizyk20/generic-array/releases)
- [Changelog](https://github.com/fizyk20/generic-array/blob/master/CHANGELOG.md)
- [Commits](https://github.com/fizyk20/generic-array/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-04-15 12:35:06 -06:00
175c0090de Bump hashbrown from 0.2.0 to 0.2.1
Bumps [hashbrown](https://github.com/Amanieu/hashbrown) from 0.2.0 to 0.2.1.
- [Release notes](https://github.com/Amanieu/hashbrown/releases)
- [Changelog](https://github.com/Amanieu/hashbrown/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Amanieu/hashbrown/compare/v0.2.0...v0.2.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-04-15 12:18:44 -06:00
5c4689a326 rename locktower's slot to epoch (#3776) 2019-04-15 10:46:14 -07:00
5e2831f09e Disable cluster restart attempt 2019-04-15 09:59:53 -07:00
666882fbbd -r does not require an argument 2019-04-15 09:40:34 -07:00
6c9fba058b Reenable validator sanity check for testnet-{beta,edge} 2019-04-15 08:58:29 -07:00
0767c0c07f Add DNS resolution to cli tools 2019-04-14 21:25:46 -07:00
6859907df9 more rigorous erasure constants, comments (#3766)
* more rigorous erasure constants, comments

* new header size means new golden
2019-04-14 21:10:09 -07:00
de52747950 remove max_tick_height replicode (#3765) 2019-04-14 19:15:31 -07:00
bd1db51e07 delete db_window.rs, move contents to window_service, clean up process_blobs (#3746) 2019-04-14 18:52:05 -07:00
dd005fb50e fix broadcast to *always* call erasure generation, simplify generator, test slot reset better (#3764) 2019-04-14 18:12:37 -07:00
542bafeb71 groom packet.rs, add blob.data alignment (#3763) 2019-04-14 17:30:08 -07:00
e57a0ab05d test some bits (#3762) 2019-04-14 17:10:30 -07:00
2c745ce108 Shorten recv wait when there are buffered packets in banking stage (#3757)
- packets are buffered on leader rotation, when the next leader is
  unknown
- shortening the wait allows the banking stage to poll for next
  leader more frequently
2019-04-14 12:34:07 -07:00
f6aa90e193 Add fullnode --dynamic-port-range option 2019-04-14 07:08:29 -07:00
c7a7d6db84 Use |solana-keygen pubkey| instead of |solana-wallet address|
Same end result but solana-keygen is a smaller program that builds
faster
2019-04-14 07:08:29 -07:00
2277a39dd2 Default solana-gossip log-level to 'info' 2019-04-14 07:07:15 -07:00
ee35ed5250 Refactored buffered packet forwarding code (#3750)
- Added unit tests
- Don't consume packets if bank is not known
2019-04-13 23:19:54 -07:00
92b5e131fe Name sigverify threads 2019-04-13 11:24:36 -07:00
1f35779821 Add solana-install usage info 2019-04-12 17:08:18 -07:00
5b438d917d Create fullnode-x.sh wrapper script for use with |solana-install run ...| 2019-04-12 17:08:18 -07:00
bf4d5745c9 Symlink the entire release to preserve relative paths from bin/ 2019-04-12 17:08:18 -07:00
1e8f83a74a Use a better name for new api 2019-04-12 14:58:22 -07:00
1db80d79fc Update get recent blockhashes to return confirmed blockhashes only 2019-04-12 14:58:22 -07:00
1dac4c33b8 Change sigverify counter from entries to packets
batch or entries kind of useless since it can have some
variable number of packets
2019-04-12 13:19:46 -07:00
656b3139e3 see perf-libs all the time (#3748) 2019-04-12 08:38:14 -07:00
8b08fe265a AppendVec PR with using "/tmp" as the default directory and a random file (#3743)
* AppendVec with raw pointers
* fixed test target directory
2019-04-12 04:30:17 -07:00
29dc139a22 shellcheck 2019-04-11 17:39:04 -07:00
44ebfa736a Don't forward buffered packet to the same node (#3712)
- instead, process the packets
2019-04-11 17:23:45 -07:00
b001685e7b Added missing feature flag for erasure (#3741) 2019-04-11 15:25:32 -07:00
ca6290b117 remove wallet stuff, bootstrap node is already staked (#3744) 2019-04-11 15:16:38 -07:00
767e0a201e stak*->vote (#3740) 2019-04-11 14:52:56 -07:00
877ec08280 Send recent votes in Vote Transactions (#3734) 2019-04-11 14:48:36 -07:00
485013b7ce Revert "AppendVecs that can return references and read/append without locks (#3713)"
This reverts commit f669ae5868.
2019-04-11 14:47:30 -07:00
efd19b07e7 implement erasure-based recovery inside blocktree (#3739)
* implement recover in blocktree

* erasures metric

* erasure metrics only

* fixup
2019-04-11 14:14:57 -07:00
d31989f878 CustomError from Vec->u32 2019-04-11 13:59:48 -07:00
f669ae5868 AppendVecs that can return references and read/append without locks (#3713)
* AppendVec with raw pointers

* appendvecs

* imports

* review

* review comments

* clippy
2019-04-11 13:16:56 -07:00
a28c3b0e9a Consume Bank in BankClient
This will allow BankClient to spin up a thread to use the Bank.
It'll also ease the transaction from BankClient to ThinClient since
it won't let you depend on Bank.

Drawback, you the transition from Bank to BankClient will be harder
because the Bank methods are inaccessible.
2019-04-11 12:16:33 -07:00
0aa05158c9 Adjust noop/failure program names to be consistent with all other programs 2019-04-11 11:59:56 -07:00
787dc5748a Fixed DuplicateSigs (#3727)
* Fixed DuplicateSigs by not recording errors in signature cache of bank
2019-04-11 11:51:34 -07:00
8ada4bfd1f Remove test now covered by Vote crate 2019-04-11 10:53:11 -07:00
5d4624e75f Use Bank::add_instruction_processor to bypass manual build step 2019-04-11 10:53:11 -07:00
2f1b0bf4f5 Add solana-install deployments to the testnets 2019-04-11 10:03:35 -07:00
e1d5bb1a26 add redundant broadcast (#3724)
* add redundant broadcast

* crank up to full redundancy

* Update broadcast_stage.rs

* Update broadcast_stage.rs

* Update broadcast_stage.rs

* Update broadcast_stage.rs
2019-04-11 09:15:17 -07:00
d0f46d6a8a Cleanup client traits and create super trait (#3728) 2019-04-11 00:25:14 -07:00
4b6c0198ad reset coding generator on slot boundaries (#3726) 2019-04-10 18:18:55 -07:00
f1e7237c09 vote_api cleanup (#3710)
* vote_api cleanup

* fixups

* fixup

* remove unused code

* revert removal of serialize and deserialize

* ...

* increase coverage, bootstrap staking

* Sagar's STAKE to my VOTE
2019-04-10 17:52:47 -07:00
1b5845ac3e Fix getting votes from gossip (#3723) 2019-04-10 17:16:08 -07:00
58a049ebe5 pick up logs as artifacts (#3721) 2019-04-10 17:05:39 -07:00
c0808d01f8 Add tests 2019-04-10 15:51:00 -07:00
7fd5e51168 Make sure bank 0 is votable and correctly designate signer 2019-04-10 15:51:00 -07:00
d2ea782372 Always use bootstrap vote account for leader 2019-04-10 15:51:00 -07:00
e6f02d1a10 Use latest release for testnet doc (#3711)
* Use latest release for testnet doc

* Clean up markdown
2019-04-10 15:01:37 -07:00
894135a084 Less pub in PohRecorder 2019-04-10 12:50:45 -07:00
df9cf92782 testnet-participation.md is now /implemented/ 2019-04-10 12:26:47 -07:00
f243a96e01 Remove testnet/metrics server debug info from book 2019-04-10 12:26:47 -07:00
842d146b0d Limit USE_INSTALL scope 2019-04-10 11:50:23 -07:00
81d43c57a2 Add missing feature flags to gossip (#3708) 2019-04-10 06:52:46 -07:00
7da4142d33 Process votes from gossip only in leader node (#3707) 2019-04-09 22:06:32 -07:00
88e5b14afc Exit faster on sanity failures 2019-04-09 17:16:15 -07:00
0b95a5c121 Include blockstreamer node in sanity 2019-04-09 16:52:57 -07:00
62c28a8592 Bump reqwest from 0.9.13 to 0.9.14
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.9.13 to 0.9.14.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.9.13...v0.9.14)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-04-09 16:22:17 -07:00
b80c6840da Metrics dashboard publish script updates for influx cloud 2019-04-09 15:44:01 -07:00
003fd6545c Logging for unexpected validator errors (#3697) 2019-04-09 15:05:43 -07:00
393ed978d1 Update testnet monitor to use influx cloud end point (#3700) 2019-04-09 14:56:21 -07:00
2c93062f54 Improve banking_stage performance messages
Use transaction count instead of batch count,
and set the recv_start from when we finished processing
the previous batch to get a more accurate number.
2019-04-09 14:54:12 -07:00
7b2abf2087 Update count for the right store (#3683) 2019-04-09 13:48:13 -07:00
a5254a3f7a Add TESTNET_TAG Env var to buildkite (#3692)
* Add TESTNET_TAG Env var to buildkite
2019-04-09 13:00:45 -07:00
dc6c34da5d Fast-track vote signature verification and processing (#3695) 2019-04-09 12:57:12 -07:00
d4eebcc2aa Check for frozen in confirm_forks (#3678) 2019-04-09 11:45:38 -07:00
4f232cbc27 Make MAX_RECENT_BLOCKHASHES <= MAX_HASH_AGE_IN_SECONDS (#3679)
* Make MAX_RECENT_BLOCKHASHES == MAX_HASH_AGE_IN_SECONDS
2019-04-09 11:45:25 -07:00
76e524ae48 Remove check for 0 additional nodes
Network with 1 leader is valid.
2019-04-09 11:16:55 -07:00
6ac919c71a Set warn log level only for perf testnets 2019-04-09 11:09:16 -07:00
1ba4806f8c Document recent -z and -x command-line arg changes 2019-04-09 10:39:55 -07:00
20a2c59b70 Reduce udp read/write buffer sizes
With 18.04, these large values cause packet errors and mess up the system.
2019-04-08 15:21:45 -07:00
6540fa9121 Add sleep for check_signature 2019-04-08 15:09:02 -07:00
21287ba554 Bump clap from 2.32.0 to 2.33.0
Bumps [clap](https://github.com/clap-rs/clap) from 2.32.0 to 2.33.0.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-04-08 12:56:44 -07:00
7295a84d69 Bump bincode from 1.1.2 to 1.1.3 (#3672)
Bumps [bincode](https://github.com/TyOverby/bincode) from 1.1.2 to 1.1.3.
- [Release notes](https://github.com/TyOverby/bincode/releases)
- [Commits](https://github.com/TyOverby/bincode/compare/v1.1.2...v1.1.3)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-04-08 12:55:18 -07:00
483cc2fa4e Support old repair strategy for reparing slots in a range for supporting replicators (#3665) 2019-04-08 12:46:23 -07:00
e551f6b552 Support settable drone lamport cap (#3675) 2019-04-08 12:37:01 -07:00
44b391096d Configurable local cluster native processors (#3676) 2019-04-08 11:15:58 -07:00
d45d8e9670 s/credit/read/ 2019-04-08 08:39:59 -07:00
88bda58836 remove unused (#3674) 2019-04-08 04:50:42 -07:00
79bf3cf70d add rewards math (#3673)
* add rewards math

* fixup
2019-04-07 21:45:28 -07:00
72b7419e1c Define list of valid cloud regions for GCE and AWS (#3670) 2019-04-07 14:29:09 -07:00
7baff0920c Propagate cloud env variables to buildkite job 2019-04-07 11:48:25 -07:00
d9ecc278b4 Configure cloud zones and nodes from buildkite for beta testnet (#3666) 2019-04-07 08:25:34 -07:00
0904df327d Parallelize cloud node deployment commands in case of multiple zones (#3657) 2019-04-07 08:13:48 -07:00
444e87f888 Fix metric (#3664) 2019-04-06 21:57:01 -07:00
20aa4434e2 Fix repair (#3581)
Add DetachedHeads repair protocol

Add DetachedHeads repair test

Repair starting from root
2019-04-06 19:41:22 -07:00
03da63b41b Revert "disable staking of blockstreamer node"
This reverts commit 42d8a7d9e7.
2019-04-06 08:57:06 -07:00
878a842611 Move append_vec bench to the crate with append_vec (#3650)
* Move append_vec bench to the crate with append_vec

* Use black_box to tell the compiler not to optimize away test data

```
pub fn black_box<T>(dummy: T) -> T {
    unsafe {
        let ret = std::ptr::read_volatile(&dummy);
        std::mem::forget(dummy);
        ret
    }
}
```

* Revert "Use black_box to tell the compiler not to optimize away test data"

This reverts commit 5610b8ee95.

* Use black_box to tell the compiler not to optimize away test data

* Create bench directories
2019-04-06 07:18:56 -06:00
f3eda38b65 Fix broken lockout doubling 2019-04-05 23:15:46 -07:00
68e21911eb Remove redundant transfer_signed 2019-04-05 22:04:32 -07:00
95cc36af96 Impl SyncClient and AsyncClient for ThinClient 2019-04-05 22:04:32 -07:00
d3c4e4f7b3 Update docs 2019-04-05 22:09:29 -06:00
4068612300 Remove RpcSignatureStatus 2019-04-05 22:09:29 -06:00
f349c1f0dc Get everything off RpcSignatureStatus 2019-04-05 22:09:29 -06:00
90c1300bb6 Plumb TransactionError through Rpc 2019-04-05 22:09:29 -06:00
569a289a6f Cargo.lock, serde_derive 2019-04-05 22:09:29 -06:00
89efe67e73 Fix the ordering of beta testnet zones 2019-04-05 17:53:31 -07:00
c3654b0f65 Add sdk benches to ci
And add `-a` to `tee` for more reliable copypasta.
2019-04-05 17:58:11 -06:00
f5f4434e0a Remove unnecessary lock in sigverify 2019-04-05 16:57:45 -07:00
d30049b8eb test for debit of TX fees on full process_transaction() (#3643)
* fix double debit of TX fees

* add test that fails when removing that line

* put that line back in

* comments
2019-04-05 16:55:58 -07:00
42d8a7d9e7 disable staking of blockstreamer node
- this will stop it from entering leader rotation schedule
2019-04-05 16:48:52 -07:00
adcda3c715 Remove airdrop dependency from replicators 2019-04-05 16:11:39 -07:00
a5b5248a09 move vote_accounts up (#3647) 2019-04-05 14:23:00 -07:00
3fcca5bc0a Suppress shellcheck array expansion warnings 2019-04-05 13:25:14 -07:00
9d4c6f6aaa Appease shellcheck 2019-04-05 13:25:14 -07:00
d570b08134 Clean up array expansion 2019-04-05 13:25:14 -07:00
8b6d7129f3 Fix option flag lettering 2019-04-05 13:25:14 -07:00
50444181c5 Fix arg array ordering and rename network-name option 2019-04-05 13:25:14 -07:00
0c51f156ae Reverse order of zone arg array building 2019-04-05 13:25:14 -07:00
fe2fb40d88 Add multi-region deploy functionality 2019-04-05 13:25:14 -07:00
9ba0439593 Add multi-region deploy functionality 2019-04-05 13:25:14 -07:00
b33a1fa019 Fix clippy errors 2019-04-05 12:22:10 -07:00
63fd4222aa Fix testnet sanity check for beta testnet 2019-04-05 12:22:10 -07:00
ef5df6f3fe Add server specification 2019-04-05 11:44:57 -07:00
2f90f9fbd4 Version all jsonrpc crates, in core too 2019-04-05 11:44:57 -07:00
12b099ea78 Bump jsonrpc-core from 10.1.0 to 11.0.0
Bumps [jsonrpc-core](https://github.com/paritytech/jsonrpc) from 10.1.0 to 11.0.0.
- [Release notes](https://github.com/paritytech/jsonrpc/releases)
- [Commits](https://github.com/paritytech/jsonrpc/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-04-05 11:44:57 -07:00
9f046a023e move transaction_count up (#3618)
* move transaction_count up

* fixup
2019-04-05 10:42:25 -07:00
46e6911ec1 Add get_signature_status() to SyncClient
And move bank::Result to transaction module.
2019-04-05 10:22:05 -07:00
d3844ef32a Add AsyncClient 2019-04-05 10:22:05 -07:00
4507dca342 Boot exchange_transaction. No tests depend on it. 2019-04-05 11:10:57 -06:00
c2fdd1362a bump release version in testnet participation document 2019-04-05 08:30:42 -07:00
4ea19b90a4 Fix update_ancestor_stakes in locktower (#3631)
* Fix update_ancestor_stakes in locktower

* Add test for vote threshold
2019-04-05 03:05:31 -07:00
9cd555cad5 AWS script change for additional zones and regions 2019-04-04 15:59:59 -07:00
ed78c8d3bb Fix beta testnet launch script 2019-04-04 15:16:01 -07:00
0b23af324b Refactor Storage Program (#3622)
* Refactor Storage Program

* Replace KeyedAccount trait with StorageAccount struct

* Implement State for Account, not StorageAccount

* Make State trait more generic

* Move validation check into function
2019-04-04 12:01:09 -07:00
1598a02a7a Wrap all client errors with TransportError 2019-04-04 12:00:19 -06:00
167f5bdc58 Add get_balance() and get_account_data() to SyncClient
Migrate tests to use them.
2019-04-04 12:00:19 -06:00
5cd7bccdf3 Add SyncClient and use from BankClient 2019-04-04 12:00:19 -06:00
acbc261891 Add gossip to build script, and fix bash strings 2019-04-04 00:18:48 -07:00
f97f0c4758 Bump serde_derive from 1.0.89 to 1.0.90
Bumps [serde_derive](https://github.com/serde-rs/serde) from 1.0.89 to 1.0.90.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.89...v1.0.90)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-04-03 19:54:50 -07:00
e6ac5bc546 Bump serde from 1.0.89 to 1.0.90
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.89 to 1.0.90.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.89...v1.0.90)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-04-03 20:26:48 -06:00
ef1e5db0ee Force delete all beta testnet nodes before restarting them 2019-04-03 17:58:54 -07:00
5cdfd79e96 Replace print with debug 2019-04-03 16:23:02 -07:00
b441bac7b2 Add separate Struct for Replicator submissions 2019-04-03 16:23:02 -07:00
00cb52c444 Update Storage Program to support multiple accounts 2019-04-03 16:23:02 -07:00
9323a3e257 Use keyed_account index names (#3555) 2019-04-03 15:57:26 -07:00
35298e01a8 Remove Instruction wrapper structs and name functions after enum fields 2019-04-03 13:34:27 -07:00
867f6f107b Rename SystemInstruction::Move to SystemInstruction::Transfer 2019-04-03 08:35:57 -06:00
43bb813cbe Rename 'new_account' to 'new_user_account'
And 'new_program_account' to 'new_account'
2019-04-02 21:24:42 -06:00
7b82e96467 Bump libc from 0.2.50 to 0.2.51 (#3554)
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.50 to 0.2.51.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.50...0.2.51)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-04-02 20:32:35 -05:00
978ff87b76 Fix potential storage bug
The previous code was assuming the instruction index and the
program_id index were the same. That's always true for
single-instruction transactions, but not for multiples.
2019-04-02 19:00:35 -06:00
4c0bc1fd88 Add program_ids() methods
Added CompiledInstruction::program_id() so that we don't need to pass
around instruction indexes just for Message::program_id().

Also added Message.program_ids() that returns a slice so that we
can move those pubkeys into Message::account_keys.
2019-04-02 19:00:35 -06:00
025b4f90de Pre-populate tokens (#3605) 2019-04-02 16:50:53 -07:00
20189c5d45 Bump hashbrown to 0.2.0 2019-04-02 16:37:21 -06:00
2e4acba579 Remove second block streamer from testnet beta 2019-04-02 15:15:11 -07:00
d90b8c331d Refactor blocktree storage abstraction (#3588) 2019-04-02 16:58:07 -05:00
efbb49d579 Don't use external node ssh key if one is not configured 2019-04-02 14:20:00 -07:00
f0079cd7b3 Bump hashbrown from 0.1.8 to 0.2.0
Bumps [hashbrown](https://github.com/Amanieu/hashbrown) from 0.1.8 to 0.2.0.
- [Release notes](https://github.com/Amanieu/hashbrown/releases)
- [Changelog](https://github.com/Amanieu/hashbrown/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Amanieu/hashbrown/compare/v0.1.8...v0.2.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-04-02 13:45:49 -06:00
a0041cec97 Rename Runtime to MessageProcessor 2019-04-02 12:49:26 -06:00
77bb9e7ffc Fix the release number in testnet participation document 2019-04-02 11:26:54 -07:00
f441177840 Deploy beta testnet with 100 nodes across AWS and GCP 2019-04-02 11:21:57 -07:00
cd634801a2 Re-enable test but remove replicators from config 2019-04-02 10:38:30 -07:00
5f10a87dec Ignore Flaky Local Cluster test 2019-04-02 10:56:29 -06:00
fa1c1e3734 Rename native programs to native instruction processors 2019-04-02 10:36:19 -06:00
947cdd8748 Rename system_program to system_instrution_processor 2019-04-02 10:36:19 -06:00
0a9f063d3e Rename native_program.rs to instruction_processor_utils.rs
Prefer the term "instruction processor" over "program". Reserve
the term "native" for the loader and shared object it loads.
Compiling an instruction processor to BPF shouldn't imply changing
to a non-native entrypoint.
2019-04-02 10:36:19 -06:00
dd4c512954 Rename Wallet's id to keypair 2019-04-02 07:38:28 -06:00
d228b6467c Implement finalizer so that all locked accounts are dropped (#3585)
* Implement finalizer so that all locked accounts are dropped when finalizer goes out of scope

* Add test for tx error with lock conflict

* Fix double unlock from destructor running after a call to unlock
2019-04-02 03:55:42 -07:00
92c66a411b Remove bench-tps converge-only 2019-04-01 23:05:25 -06:00
af97ad3d68 Add solana-gossip module 2019-04-01 23:05:25 -06:00
6ff2a0a75e Rework discover to handle additional parameters, and be unit-testable 2019-04-01 23:05:25 -06:00
5b7d5e2e02 Bump reqwest from 0.9.12 to 0.9.13
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.9.12 to 0.9.13.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.9.12...v0.9.13)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-04-01 20:34:08 -06:00
97bd7a00f1 Support for configuring testnet nodes across multiple cloud services 2019-04-01 17:11:41 -07:00
25a2f08f8d add passive staking and rewards (#3579)
* add stake stuff

* more generic

* test decode bail cases

* favor early returns
2019-04-01 16:45:53 -07:00
3152090a66 update with review comments 2019-04-01 15:54:53 -06:00
9a0f9b910e add bench tests for squash operations 2019-04-01 15:54:53 -06:00
f853c39169 remove unused member 2019-04-01 15:54:53 -06:00
75ad1305c0 Cache vote accounts and optimize squash 2019-04-01 15:54:53 -06:00
cb3adea94f Increase node count in beta testnet 2019-04-01 11:06:24 -07:00
fcef54d062 Add a constructor to generate random pubkeys 2019-03-31 16:23:18 -06:00
32683cac7c Move markdown into book 2019-03-31 16:23:06 -06:00
15947b8642 Congestion stats, take 3 2019-03-31 16:23:06 -06:00
4e0316f792 Apply review feedback 2019-03-31 16:23:06 -06:00
9594b7fdce Use stake-weighted congestion statistics 2019-03-31 16:23:06 -06:00
1adf8355f2 Add design proposal for deterministic transaction fees 2019-03-31 16:23:06 -06:00
8660c3581e Add squashing metrics (#3573) 2019-03-29 21:21:59 -07:00
f886b3b12b Fix resetting PohRecorder to wrong bank (#3553)
* Check whether future slot already has transmission
2019-03-29 20:00:36 -07:00
5646daa820 Delete lots of fee parameters
So many zeros!
2019-03-29 19:21:51 -06:00
7896e8288d Replace Transaction::fee with a FeeCalculator 2019-03-29 19:21:51 -06:00
9369ea86ea Track detached slots in blocktree (#3536)
* Add contains_all_parents flag to SlotMeta to prep for tracking detached heads

* Add new DetachedHeads column family

* Remove has_complete_parents

* Fix test
2019-03-29 16:07:24 -07:00
dee5ede16d Get rid of unnecessary frozen banks (#3572) 2019-03-29 16:06:48 -07:00
3b516c0710 Fix build 2019-03-29 14:56:29 -06:00
0887832b00 Early exit if buffered packets is empty 2019-03-29 13:40:07 -07:00
8e04fadb05 Cleanup magic numbers
Rename `num_signatures` to `num_required_signatures` to
disambiguate it from `tx.signatures.len()`.
2019-03-29 13:03:29 -07:00
31f8b6d352 Integrate Message into Transaction 2019-03-29 13:03:29 -07:00
98d60e6124 Expose a method for getting the Message from a Transaction
This currently constructs the message, but when message
is integrated, it can return a `&Message`.
2019-03-29 13:03:29 -07:00
fc678f53ba Send metrics data to the correct/configured database host 2019-03-29 12:14:15 -07:00
8e25c39564 fix formatting of numbered list 2019-03-29 11:46:21 -07:00
78ab79c322 fix build failure 2019-03-29 11:46:21 -07:00
052fc9b74f Information on how to debug testnet issues 2019-03-29 11:46:21 -07:00
f482c9ab61 Functionalize tx serialization; make testing more explicit 2019-03-29 11:31:46 -06:00
75dcd97f5f Update test to deserialize txs 2019-03-29 11:31:46 -06:00
4776dc36ab Map entry txs to serialized txs in blockstream 2019-03-29 11:31:46 -06:00
10239c3b3c Replace recursive status cache with a single global fast status cache (#3541)
Fast Status Cache
2019-03-29 10:03:55 -07:00
753d0dcabe Fix the cuda build
And add a test to check the condition that the cuda tests are
exercising.
2019-03-29 08:25:56 -06:00
b708998d9d Fix chacha build 2019-03-29 08:25:56 -06:00
3759b0d2a5 Fix Blockstreamer test 2019-03-29 08:25:56 -06:00
c4bc710d3a Use Serde's with attribute to shorten length encodings in Transaction 2019-03-29 08:25:56 -06:00
857dc2ba47 Remove custom serialization 2019-03-29 08:25:56 -06:00
981e057363 Just test features in core 2019-03-28 21:40:52 -07:00
37494c67d0 Add pubkey read/write tools
Co-authored-by: Tyera Eulberg <tyera@solana.com>
Co-authored-by: Tristan Debrunner <tristan@solana.com>
2019-03-28 20:04:32 -06:00
7a81f327ce Add sigverify tests 2019-03-28 19:42:11 -06:00
845ddc3496 Fixup wallet-sanity to match new balance string 2019-03-28 16:56:27 -07:00
c61bb16fdf Fix manifest path for cargo commands (#3549) 2019-03-28 15:56:08 -07:00
15b945a652 Fix EC2 scripts for blockstream startup 2019-03-28 15:37:23 -07:00
1d48c4dd45 enable leader rotation in beta testnet 2019-03-28 13:44:44 -07:00
2ab50cbae8 Move untested code out of SDK
verify_signature() was only used in a test that was testing
binary layout. It only worked because the test transaction only
had one signature.

from() was only used by verify_signature() and that's something
we'd typically called `pubkey()`.

hash() didn't return the hash of the Transaction, as you might
guess. It's only used for PoH, so move it into Entry.
2019-03-28 14:24:59 -06:00
0482f153d0 Lower a bunch of debug
Can't afford to be printing on every transaction error, it will slow
the system down.
2019-03-28 12:24:47 -07:00
92e1c4c531 Report which account is in use (#3539) 2019-03-28 08:17:49 -07:00
4bca60861e Specialize GenericInstruction 2019-03-28 05:45:46 -06:00
50b0a5ae83 Blocktree+Erasure tests of basic erasure functionality (#3535)
* Remove WindowSlot; add Blocktree based tests to erasure
2019-03-28 01:55:51 -05:00
c30eb6185c Enable logging in exchange program (#3538) 2019-03-27 23:02:05 -07:00
a94bc80383 fix clippy errors 2019-03-27 18:05:17 -07:00
586b6fc3d7 review comments 2019-03-27 18:05:17 -07:00
a14c202d60 fix the ip address that's stored in the config file 2019-03-27 18:05:17 -07:00
ed48c495a3 fix shell-check errors 2019-03-27 18:05:17 -07:00
f0abd06a46 Added support for multi-region cloud testnet 2019-03-27 18:05:17 -07:00
7d0ff8e713 Re-enable Replicator test (#3534) 2019-03-27 17:21:49 -07:00
e8cc566b2b Storage Account setup for replicators and validators (#3516)
* Setup Storage Accounts for replicators

* Setup Storage Accounts for validators

* Add Replicator Info to Local Cluster and Add test
2019-03-27 15:54:09 -07:00
e45f7afd85 use the right id for delegate id 2019-03-27 15:04:09 -07:00
054ae3a3e3 Document current transaction size awkwardness 2019-03-27 14:27:20 -06:00
36ea088387 Fix Storage Stage not receiving entries when node is leader (#3528) 2019-03-27 13:10:33 -07:00
47b6707c07 Don't use a loader to test Storage instruction processor 2019-03-27 11:02:41 -06:00
0346b9cb5c hang out on progress until fork is confirmed 2019-03-27 08:41:41 -07:00
6bfe497ab5 remove leader confirmaiton 2019-03-27 08:41:41 -07:00
6956bf635e validator confirmaiton 2019-03-27 08:41:41 -07:00
e27d6d0988 validator confirmation 2019-03-27 08:41:41 -07:00
3fc09fb23f Remove keypairs from BankClient
Bring its interface closer to the other clients.
2019-03-27 09:37:19 -06:00
cecdb7061e Remove blockhash parameter from Bank::transfer
That parameter is an artifact from the Loom days, when I thought
Bank should implement the same interace as ThinClient.
2019-03-27 08:51:10 -06:00
0ac865f08c Remove BankClient::process_instructions 2019-03-27 08:51:10 -06:00
55115d0eeb Add process_message() to BankClient 2019-03-27 08:51:10 -06:00
16ff4ac1a8 Simplify storage interface in blocktree (#3522) 2019-03-27 01:36:39 -05:00
5ce31168ef Remove Transaction::new_signed 2019-03-26 19:51:16 -07:00
b9ff70c8ab pub Transaction::new_unsigned
Offer an incremental path off Transaction::new_unsigned_instructions().
2019-03-26 20:06:05 -06:00
77498c6efe Expose Message via the new default Transaction constructor 2019-03-26 20:06:05 -06:00
8c69c40834 Make space for a new Transaction::new 2019-03-26 20:06:05 -06:00
d497b99abb use solana_entrypoint directly (#3518) 2019-03-26 16:40:34 -07:00
ca2ac1e5ea Remove a mostly unused Transaction constructor 2019-03-26 15:46:58 -07:00
c09e0eb536 propagate TESTNET_DB_HOST env variable to next step in buildkite 2019-03-26 14:40:18 -07:00
0d90dfae1a Add provisions to specify a database server in testnet manager buildkite 2019-03-26 14:40:18 -07:00
bf61321cab fix metrics 2019-03-26 14:30:25 -07:00
591653981b fix metrics 2019-03-26 14:30:25 -07:00
e651510805 Instructions on how to boot metrics server 2019-03-26 14:02:41 -07:00
9d73fbb84a also check the delegate_id 2019-03-26 12:03:22 -07:00
215b07c1a9 remove status_cache.freeze (#3506) 2019-03-26 11:56:25 -07:00
420cbc45cd Record the current nodes locktower votes from the bank (#3502)
* observed_locktower_stats

* fixup! observed_locktower_stats
2019-03-26 11:06:31 -07:00
df333e8b6e Move new_move_many to SystemInstruction 2019-03-26 09:22:29 -07:00
9759ac2961 Mark book's javascript library as binary
highlight.js has a big dictionary of words. When git-grep includes
one of those words, it floods the screen with the whole dictionary.

Mark it as binary so that it'll now just report one line:

     Binary file book/theme/highlight.js matches
2019-03-26 07:39:34 -07:00
af9b173dfd fix link 2019-03-26 05:43:02 -07:00
b61aed7250 Minor cleanup 2019-03-25 20:31:13 -07:00
e1c0425c2b Remove rewards crate from publishing script 2019-03-25 20:19:58 -07:00
615472b52c Initailize locktower with heaviest bank (#3489) 2019-03-25 20:00:11 -07:00
4d34102d9c Move stragglers into the book
The stuff added between the time we switched to proposals/ and the git-revert
2019-03-25 19:39:22 -07:00
3e22ce4154 Added stats for locktower in testnet dashboard 2019-03-25 18:49:15 -07:00
215f33680b Fix the filename in testnet pariticpation instructions 2019-03-25 17:33:41 -07:00
a5420f19da Update testnet-participation.md
add instructions for finding metrics
2019-03-25 17:12:00 -07:00
4bc3f70150 Boot VoteTransaction 2019-03-25 17:11:57 -07:00
e8814b1297 Add support for influx cloud 2019-03-25 17:10:38 -07:00
46ab0e6449 Update testnet-participation.md
multinode-demo/validator-x.sh uses cargo run unless USE_INSTALL==1
2019-03-25 16:30:56 -07:00
59b4f40f4e fixup! fixup! keep track of locktower slots and stakes 2019-03-25 16:05:28 -07:00
93c57934cb fixup! keep track of locktower slots and stakes 2019-03-25 16:05:28 -07:00
e8e1d6b8ce keep track of locktower slots and stakes 2019-03-25 16:05:28 -07:00
4916cd8da5 bench-tps in a cargo test 2019-03-25 15:05:56 -07:00
573dec63da Fix runtime benches 2019-03-25 14:32:01 -06:00
34c051f183 add hash_fromstr (#3476) 2019-03-25 12:23:19 -07:00
51004881f8 filter out banks that have an older epoch (#3472) 2019-03-25 11:09:39 -07:00
5c536e423c Inline InstructionCompiler
The object-oriented paradigm isn't helpful here; go functional.
2019-03-25 12:08:27 -06:00
4efa144916 Generate a Message instead of a Transaction 2019-03-25 12:08:27 -06:00
f3936c21a3 Add message 2019-03-25 12:08:27 -06:00
caff603497 Less code 2019-03-24 21:44:04 -07:00
aefa9891c0 Delete unused code 2019-03-24 21:44:04 -07:00
6286947697 Inline payment_plan
This module predates Accounts. That was a separate module because
it used to be part of Bank and those types could be sent to any
smart contract. Now each instruction processor defines for itself
what instructions it accepts.
2019-03-24 14:52:06 -06:00
33972ef89e Boot BudgetTransaction 2019-03-24 14:52:06 -06:00
b53cbdd9e6 Punt on the Script abstraction
Low ROI
2019-03-24 14:52:06 -06:00
c49e84c75b Boot StorageTransaction 2019-03-24 13:51:02 -07:00
dcf2337e58 Add StorageInstruction constructors 2019-03-24 13:51:02 -07:00
5a65c3f72e Test-drive StorageContract 2019-03-24 13:51:02 -07:00
8ff1987d2d Reorg Storage program to look more like the others 2019-03-24 13:51:02 -07:00
acedf4ca5a Move Instruction into its own module 2019-03-23 20:31:55 -07:00
68c35bfde6 Restart node test (#3459) (#3465)
* Restart node test (#3459)

* Add test to local_cluster for restarting a node

* fix so that we don't hit end of epoch - leader not found before trying to transfer

* Do not look for confirmations, b/c nobody is voting on empty transmissions in this single node test
2019-03-23 19:19:55 -07:00
e1a3708844 Ensure accounts are unlocked (#3458) 2019-03-23 13:30:56 -07:00
46ecac3310 Update leader slot in poh recorder if we skipped it (#3452)
* reset poh recorder with the original start slot
2019-03-23 13:07:09 -07:00
028b9da0da Revert "Move the design proposals to a separate book"
This reverts commit 4ca18d6b9a.
2019-03-23 14:04:34 -06:00
74cea2748c Revert "Publish design proposals"
This reverts commit fb44e2bf48.
2019-03-23 14:04:34 -06:00
a478b2a05a Bump assert_cmd from 0.11.0 to 0.11.1
Bumps [assert_cmd](https://github.com/assert-rs/assert_cmd) from 0.11.0 to 0.11.1.
- [Release notes](https://github.com/assert-rs/assert_cmd/releases)
- [Changelog](https://github.com/assert-rs/assert_cmd/blob/master/CHANGELOG.md)
- [Commits](https://github.com/assert-rs/assert_cmd/compare/v0.11.0...v0.11.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-03-23 13:18:51 -06:00
41a52dbfea Document solana-install-init.sh 2019-03-23 09:01:08 -07:00
4923f889c4 Add trick to ensure the entire script is downloaded 2019-03-23 09:01:08 -07:00
31b8743052 delay freeze of status_cache until squash (#3453) 2019-03-22 22:14:56 -07:00
6505221629 Add exchange program (#3444) 2019-03-22 21:07:36 -07:00
de2b6bc9fc Bump tokio from 0.1.17 to 0.1.18
Bumps [tokio](https://github.com/tokio-rs/tokio) from 0.1.17 to 0.1.18.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-0.1.17...tokio-0.1.18)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-03-22 19:54:18 -06:00
f565292852 Update testnet-participation.md 2019-03-22 17:58:58 -07:00
90f17e8fd4 Update testnet-participation.md 2019-03-22 17:18:27 -07:00
d6da7dc1b6 Initial testnet participation doc 2019-03-22 17:11:47 -07:00
7e2aad2590 Refrain from trying to configure a staking account that was previously configured 2019-03-22 17:00:09 -07:00
f09b8d3921 Demote log level 2019-03-22 17:00:09 -07:00
52f6c33ff9 Make sure banking stage is recording with the same bank that it read (#3447)
* make sure banking stage is recording with the same bank that it read with
2019-03-22 14:17:39 -07:00
60dfb35924 Why do I need to see raw bytes from the drone? 2019-03-22 14:07:44 -07:00
5f41909098 Stop using VoteTransaction in Vote processor 2019-03-22 14:07:00 -06:00
a28f7db950 Retry more for a new blockhash 2019-03-22 11:14:03 -07:00
38fdbbba3f Reduce remaining program crates to boilerplate crates 2019-03-22 06:46:44 -07:00
0a5b6154e8 Use same gossip port for all testnet nodes 2019-03-22 00:16:58 -07:00
4542a7042a Add --poll-for-new-genesis-block flag 2019-03-22 00:15:19 -07:00
6113b64fee Include multinode-demo scripts in release tarball 2019-03-21 22:09:44 -07:00
f777ed76a3 Use installed binaries if not within the cargo workspace 2019-03-21 22:09:44 -07:00
e6b9babf53 Run a drone on blockstreamer nodes 2019-03-21 22:09:44 -07:00
ed8bada439 Kill all node processes (blockexplorer) 2019-03-21 22:09:44 -07:00
06b0c98c75 Remove accounts when the fork is removed (#3384)
* Fix test

* Cleanup accounts when the fork is removed

* Update test to check for deleted accounts
2019-03-21 17:36:10 -07:00
dbb145c266 Fixup ledger path 2019-03-21 17:06:57 -07:00
437481853b Ensure genesis ledger directory is populated on all validator nodes
This allows all nodes to serve the genesis ledger over rsync instead of
just the bootstrap leader
2019-03-21 16:35:40 -07:00
3b5a9f512c Get client-id.json out of the genesis ledger directory 2019-03-21 16:35:40 -07:00
045af04784 Reduce budget_program and config_program into boilerplate crates 2019-03-21 16:53:08 -06:00
d0761f57e8 Add _program suffix to directories of crates with _program suffix 2019-03-21 16:24:06 -06:00
4bb88619fd Move entrypoint boilerplate into a macro 2019-03-21 15:27:49 -06:00
412ebfcaf2 ReplayStage::new is too long
break into more functions
2019-03-21 14:08:11 -07:00
3a7647f611 Add curl-able install script 2019-03-21 13:45:54 -07:00
d4cc48f99d Check from account balance and exit cleanly if 0 2019-03-21 13:00:46 -07:00
852fcbd700 Automatically update PATH for the user 2019-03-21 13:00:46 -07:00
8ab4b8e6ac Support local networks for easy testing 2019-03-21 13:00:46 -07:00
a8095e204f Cleanup SystemTransaction 2019-03-21 12:41:39 -07:00
98979c7d53 Cargo.lock 2019-03-21 11:24:10 -07:00
c18fcde385 Move installer to the implemented section 2019-03-21 11:24:10 -07:00
f286bbac99 Initial commands implementation 2019-03-21 11:24:10 -07:00
4e029d81a2 Setup staking 2019-03-21 11:12:35 -07:00
2b00a42b06 Boot Rewards program 2019-03-21 12:07:20 -06:00
07d55d0092 Downgrade 'No next leader found' to warning 2019-03-21 11:18:49 -06:00
fb44e2bf48 Publish design proposals 2019-03-21 10:54:59 -06:00
9b0bf5ad66 Add tests for table mappers; Bugfix on-disk mapper (#3408)
add tests to `kvstore::mapper::{disk, memory}` modules

fix bug in disk mapper uncovered by tests

use `tempdir` crate for unit test-directories
2019-03-21 11:38:29 -05:00
4247fa946e Add solana-wallet balance <PUBKEY> 2019-03-21 09:51:27 -06:00
071b1d8b77 Cargo.lock 2019-03-21 08:47:58 -07:00
63aadc4905 Turn top-level Cargo.toml into a virtual manifest 2019-03-21 08:47:58 -07:00
d2415613de Migrate loader tests to BankClient 2019-03-21 09:19:24 -06:00
58f071b7a0 Migrate loader to high-level instructions 2019-03-21 09:19:24 -06:00
148e08a8a5 Enable cluster tests (#3372)
* Cluster tests

* stable!

* fixup! stable!

* fixup! fixup! stable!

* fixup! fixup! fixup! stable!

* fixup! fixup! fixup! fixup! stable!

* fixed space

* add getNumBlocksSinceSignatureConfirmation entry for the json rpc docs

* Check in upcoming epochs for potential leadership slots in next_leader_slot()
2019-03-21 07:43:21 -07:00
402a733cd7 Upload tarball as a github release asset 2019-03-20 21:39:35 -07:00
78be3652de Add script to upload github release assets 2019-03-20 21:39:35 -07:00
b03d9884a3 Ensure current crate versions match the tag before publishing to crates.io 2019-03-20 20:51:58 -07:00
799085a105 Remove dead code 2019-03-20 20:51:58 -07:00
7812b67471 deduplicate some test code (#3401) 2019-03-20 19:35:25 -05:00
4033fa031b Add convenience script for testnet deployments 2019-03-20 16:57:55 -07:00
b41737259a Add GITHUB_TOKEN 2019-03-20 16:57:55 -07:00
7c8a4bf6a4 use ticks per slot to check if the current tick is in the leader slot 2019-03-20 16:55:01 -07:00
71314d79a7 address review comments 2019-03-20 16:55:01 -07:00
d7ff6645a9 change pubkey to ref 2019-03-20 16:55:01 -07:00
1824e09d0a find next leader slot before resetting working bank in Poh recorder 2019-03-20 16:55:01 -07:00
205907d3d7 Check if poh recorder has over stepped the leader slot 2019-03-20 16:55:01 -07:00
d4bcc4d474 🐳 2019-03-20 16:21:47 -07:00
bcb190a12a Remove erroneous comment 2019-03-20 16:15:25 -07:00
63e8496473 Cleanup pubkey parsing copypasta 2019-03-20 16:08:03 -07:00
4107d70e93 Bump reqwest from 0.9.11 to 0.9.12
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.9.11 to 0.9.12.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-03-20 16:26:31 -06:00
4fb0782892 Rename blocktree SlotMeta::is_rooted to is_connected
is_rooted is now is_connected and (still) indicates the set of connected
completed slots. 'rooted' slot terminology is used for a different
meaning in bank_forks and replay_stage.
2019-03-20 14:43:39 -07:00
9b7c1d5650 Relocate *-help.sh to their respective packages 2019-03-20 14:34:57 -07:00
985592cf40 Fix cp args 2019-03-20 14:29:30 -07:00
2694654a98 Change fixed 8050 port to one from bind_in_range. 2019-03-20 14:17:21 -07:00
4126461f87 Fix dupe port on cluster_info
and remove unintended grow file
2019-03-20 14:17:21 -07:00
791ead6053 Include TARGET in release URL to make room for future targets 2019-03-20 13:54:32 -07:00
3048de18bb add doc that should have been copy-pasta'd from bench (#3389) 2019-03-20 11:10:42 -07:00
df9fd2bc0b stop copying Blooms (#3379)
* stop copying Blooms

* fixup

* clippy
2019-03-20 11:06:39 -07:00
13c9d3d4e1 Kvstore: use bincode serialization (#3385)
* use bincode for SSTable serialization; add tests

* Fix bug uncovered in merge algorithm by unit tests

* use bincode in write-ahead-log serialization

* Add helper `Fill` trait for zeroing buffers
2019-03-20 09:55:44 -05:00
0dc364c17a Relocate transaction reference verification to join the other validity checks 2019-03-20 07:46:01 -07:00
b3cdf58e4b Add WriteBatch to KvStore (#3364)
* implement write-batch in kvstore

* Add tests to writebatch, and in-memory table
2019-03-20 06:55:39 -05:00
61f950a60c Sign Gossip Vote Messages 2019-03-19 19:56:17 -07:00
da77789881 Revert "Drop 'unchecked' from get_subset_mut()"
This reverts commit 70b21b3795.
2019-03-19 17:52:02 -07:00
61af87972e allow empty ancestors 2019-03-19 17:51:01 -07:00
fe9e771b9b Clear progress map on squash (#3377) 2019-03-19 17:30:36 -07:00
94b5835738 Make AccountMeta a traditional struct instead of a tuple struct 2019-03-19 17:22:39 -06:00
a4652a9aaf Label tuple with AccountMeta 2019-03-19 17:22:39 -06:00
7246d72f03 fix is_locked_out logic 2019-03-19 16:21:46 -07:00
70b21b3795 Drop 'unchecked' from get_subset_mut() 2019-03-19 16:12:53 -07:00
682b1b89b3 Adjust for vector of entries in blobs. 2019-03-19 13:49:48 -07:00
f1802e592a Review comments: node creation functions for replicators
And rework download loop.
2019-03-19 13:49:48 -07:00
ee58c1f960 Add test for replicator ledger download
Add an interface to query the storage slot a
  replicator is holding on storage_addr port.
Fix logic to poll blocktree for all slots
  replicated being filled.
Add test logic to ask replicator what slot it
  is replicating and then download an entry in
  the slot.
2019-03-19 13:49:48 -07:00
07f4dd385d Cleanup replicator sockets
Add optional UdpSocket for storage interface.
Add new_localhost_replicator to create a new replicator local node.
2019-03-19 13:49:48 -07:00
1be7ee51be Fix potential crash in banking stage 2019-03-19 12:06:42 -07:00
56fcc93ef5 Schedule node for consecutive slots as leader (#3353)
* Also tweak epoch and slot duration

* new test for leader schedule
2019-03-19 06:36:45 -07:00
c70412d7bb move core tests to core (#3355)
* move core tests to core

* remove window

* fix up flaky tests

* test_entryfication needs a singly-threaded banking_stage

* move core benches to core

* remove unnecessary dependencies

* remove core as a member for now, test it like runtime

* stop running tests twice

* remove duplicate runs of tests in perf
2019-03-18 22:08:21 -07:00
5e21268ca0 PR comments 2019-03-18 20:46:11 -07:00
b38e3bef01 Modify bank_forks to support squashing/filtering new root and also don't remove parents from bank_forks when inserting, otherwise we lose potential fork points when querying blocktree for child slots 2019-03-18 20:46:11 -07:00
89cc82c71b Update cli interface 2019-03-18 18:34:08 -07:00
1d0f6a5d85 Add scripts/install-help.sh 2019-03-18 18:34:08 -07:00
d0292b1cf1 store transaction no longer takes the transaction fee from the config account 2019-03-18 18:34:08 -07:00
15aed9f320 Self 2019-03-18 18:34:08 -07:00
5a67362b8e update passive staking proposal (#3335)
* update passive staking proposal

* fixup
2019-03-18 18:25:29 -07:00
5d73ab299b Clean up locks in KvStore (#3358)
* Lift all shared mutable state into Kvstore

commit is now an AtomicUsize

In-memory table and write-log are now struct members behind individual RwLocks
2019-03-18 19:04:31 -05:00
ef111dcbe1 Decendent is not a word 2019-03-18 15:58:27 -07:00
da7e49c880 Fix broken build
- build breaks if Cuda feature is used
2019-03-18 15:29:51 -07:00
f16f88873d Add multiple signer support to BankClient 2019-03-18 16:07:45 -06:00
211c81f2a2 bank fork rpc (#3351) 2019-03-18 14:18:43 -07:00
efc39ffdde Report how many grace ticks were afforded to previous leader (#3350) 2019-03-18 13:24:07 -07:00
61a4b998fa Implement locktower voting (#3251)
* locktower components and tests

* integrate locktower into replay stage

* track locktower duration

* make sure threshold is checked after simulating the vote

* check vote lockouts using the VoteState program

* duplicate vote test

* epoch stakes

* disable impossible to verify tests
2019-03-18 12:12:33 -07:00
cedff2fca1 Cleanup sockets test 2019-03-18 11:56:18 -07:00
8d032aba9d Merge InstructionError and ProgramError
From the user's perspective, it's just an instruction error.
For program-specific errors, we still have
InstructionError::CustomError.
2019-03-18 10:39:20 -06:00
607b368fe3 Add back in test to check the account program id 2019-03-18 08:22:54 -07:00
a54854abc7 Do Budget verification in BudgetScript 2019-03-18 08:22:54 -07:00
ce6257a069 Delete misplaced unit-tests
These tests were from back in the day when Bank(then-called Accountant)
would call `verify_plan()` on all transactions. Nowadays `verify_plan`
is only useful to the client. At can be used to ensure a transaction
won't trigger runtime errors.
2019-03-18 08:22:54 -07:00
7b28d3a231 Move Budget's verify_plan() into tests
This functionality is supposed to be the the interpreter
2019-03-18 08:22:54 -07:00
ea01ff2aab Add pubkey to BudgetExpr::new_cancelable_future_payment for wallet 2019-03-18 08:22:54 -07:00
3369019943 Add BudgetExpr::new_cancelable_authorized_payment 2019-03-18 08:22:54 -07:00
dbd4176b97 Move script constructors into a separate module 2019-03-18 08:22:54 -07:00
122c7bc2ef Rename TransactionCompiler to Script and use it to replace the type alias 2019-03-18 08:22:54 -07:00
99671472d1 Migrate config tests to Bank 2019-03-18 08:22:54 -07:00
0c0716abfb Move Bank-based tests into unit-tests 2019-03-18 08:22:54 -07:00
c09accb685 Rename StaticEntrypoint to ProcessInstruction 2019-03-18 08:22:54 -07:00
ae4d14a2ad Introducing Scripts
A sequence of instructions. A client compiles the script and then uses
the compiled script to construction a transaction. Then it adds a
adds a blockhash, signs the transaction, and sends it off for
processing.
2019-03-18 08:22:54 -07:00
55cdbedb52 Allow tests to add instruction processors
Make runtime a private module again.
2019-03-18 08:22:54 -07:00
ee39f31d81 Add Runtime object. Allow any number of static loaders. 2019-03-18 08:22:54 -07:00
70b45de012 Get access to runtime errors in Budget unit-tests 2019-03-18 08:22:54 -07:00
60437a8dcb Multiple entries per blob (#3337)
* Pack multiple entries into blob

* fix tests

* Add test for deserializing multi-entry blobs in blocktree

* more test fixes
2019-03-17 18:48:23 -07:00
a35ebe1186 Avoid RpcRequest 2019-03-17 01:34:58 -07:00
c498775a3d Move generic rpc_client functions from wallet/ to client/ 2019-03-17 01:34:58 -07:00
3ad019a176 Increment stable timeout 2019-03-16 23:56:35 -07:00
9632136cda Clean up stray retry_get_balance() function 2019-03-16 23:56:35 -07:00
42cea7a785 Remove metrics dependency 2019-03-16 23:56:35 -07:00
4c9d852b08 Remove ThinClient::transfer() 2019-03-16 23:56:35 -07:00
9566a5cc68 Organize accounts on a per fork basis (#3336)
* Organize accounts by fork

* Keep track of vote accounts in account info

* update comments
2019-03-16 23:42:32 -07:00
ac03c59b41 client/: get_transaction_count() now returns a Result 2019-03-16 23:27:23 -07:00
73ceaf07b1 client/: move RpcClient from rpc_request.rs to rpc_client.rs 2019-03-16 23:27:23 -07:00
7b314f47f7 Factor RPC request mechanism out of RpcClient into *RpcClientRequest 2019-03-16 23:27:23 -07:00
23337e08eb client/: Merge client.rs into thin_client.rs 2019-03-16 22:48:26 -07:00
97e73311c5 Move mock request_airdrop_transaction into drone/, closer to the real impl 2019-03-16 22:14:09 -07:00
e2c24481e4 wallet/ now only dev-depends on core/ 2019-03-16 21:40:39 -07:00
ad252fe4c5 Remove unnecessary Option from get_account_data 2019-03-16 11:32:01 -07:00
4b04bc8612 Move thin_client RPC requests into rpc_request; de-mut thin_client 2019-03-16 11:32:01 -07:00
bcc34b906c Relieve the caller of having to care about the rpc request id 2019-03-16 11:32:01 -07:00
c2b1010f18 Clarify url vs addr 2019-03-16 11:32:01 -07:00
e3ef4f25d3 Update Dockerfile
install mscgen (for book art)
2019-03-15 20:44:35 -07:00
ad12b0efce Bump kvstore version to 0.13.0 to match all other solana crates (#3334) 2019-03-15 19:05:24 -05:00
00f005af25 Fix leader rotation counter 2019-03-15 17:01:18 -07:00
656fb173f9 Extract kvstore into separate crate (#3327)
* extract kvstore into new crate

* add kvstore crate to CI publishing list
2019-03-15 18:42:47 -05:00
5f58e9cd6e Config program - useful for storing/updating simple config items on chain 2019-03-15 16:39:45 -07:00
1d876df8b3 Add command plumbing 2019-03-15 16:30:31 -07:00
c8bbca08f8 Install the install program 2019-03-15 16:30:31 -07:00
971da7325d Reduce log level for periodic debug messages 2019-03-15 15:41:26 -07:00
ca4f874f52 Remove ci/run-local.sh 2019-03-15 15:09:25 -07:00
a88b36d718 Rename TransactionBuilder to TransactionCompiler 2019-03-15 14:46:44 -06:00
24d9138067 Abandon Builder pattern 2019-03-15 14:46:44 -06:00
aca739b800 Boot fees from TransactionBuilder 2019-03-15 14:46:44 -06:00
e091aa87ea More precise constructor names 2019-03-15 14:46:44 -06:00
968022a1b0 Instruction name swap
* Instruction -> GenericInstruction
* Instruction<u8, u8> -> CompiledInstruction
* Instruction<Pubkey, (Pubkey, bool)> -> Instruction
2019-03-15 14:46:44 -06:00
66fb1bbb2e Give last leader some grace ticks to catch up (#3299)
* Wait for last leader for some ticks

* New tests and fixed existing tests
2019-03-15 13:22:16 -07:00
fa3e1fa7c9 Add error correction to write-log (#3323) 2019-03-15 15:04:34 -05:00
36763d0802 Cleanup entry.rs packing code (#3303) 2019-03-15 12:48:32 -07:00
be5f800390 Use the Mining Proof's Signature as storage keys (#3321) 2019-03-15 11:44:10 -07:00
ca69b7b75b Add CRC Reader and Writer I/O wrappers (#3322)
* add CRC Reader and Writer I/O wrappers

* typo fix and variable rename
2019-03-15 13:17:49 -05:00
a15927f8d0 make KvStore Send+Sync (#3317) 2019-03-15 13:01:34 -05:00
4ba4ad9878 Update README.md 2019-03-15 11:53:37 -06:00
be1511a7ff delete accidental file (#3316) 2019-03-15 11:28:08 -05:00
41b98c603b Upgrade rust stable to 1.33.0 2019-03-15 09:25:28 -07:00
5430dd28b6 Update docker-rust to 1.33 2019-03-15 09:25:28 -07:00
e9d687329b Only push newly built container 2019-03-15 09:25:28 -07:00
d72cac6e97 Fix chacha test 2019-03-15 09:06:54 -06:00
4e51a444f4 Simplify TransactionBuilder::new_with_instructions 2019-03-15 09:06:54 -06:00
48d86683e2 Abuse KeypairUtil 2019-03-15 09:06:54 -06:00
42d5dde5b1 new_singleton -> new_with_instruction 2019-03-15 09:06:54 -06:00
142eeffe5d Add BankClient to minimize copypasta 2019-03-15 09:06:54 -06:00
6a68df3ebd Don't resign airdrop requests with the keypair asking for an airdrop
The correct thing to do here is retry until you get a
BlockhashNotFound error, and then send another request
to the drone for a new signed transaction.

Also, this test is an integration test masquerading as a unit-test..
2019-03-15 09:06:54 -06:00
8306c1841c Fix build 2019-03-15 09:06:54 -06:00
73bd396dfb Rewrite system integration test
Create Client helpers instead of Bank helpers.
2019-03-15 09:06:54 -06:00
36fb0a0aef Add new preferred transaction constructors 2019-03-15 09:06:54 -06:00
4d53be8350 Make it unappealing to build and sign transactions at the same time
Use a client to sign transactions. It'll need that keypair anyway
to resign new blockhashes on retries.
2019-03-15 09:06:54 -06:00
f8bf9ca218 Make safe transaction signing the default 2019-03-15 09:06:54 -06:00
7b4568b9bf Migrate to sign_checked() 2019-03-15 09:06:54 -06:00
bd8502e87e Implement Transaction::new_unsigned with TransactionBuilder 2019-03-15 09:06:54 -06:00
21815f26d5 Implement signed transaction using unsigned transaction 2019-03-15 09:06:54 -06:00
8ef5195037 Don't test a transaction with a duplicate key 2019-03-15 09:06:54 -06:00
57606c6bf8 Bump log level for better CI logs 2019-03-15 07:48:23 -07:00
0465abf75b move (#2738) 2019-03-15 06:58:45 -07:00
8a142966be Avoid stray '' when rust version is not specified 2019-03-14 21:30:24 -07:00
7498488f5f cloud_DeleteInstances() now waits for the instances to be terminated 2019-03-14 21:15:00 -07:00
ede99d5913 Revert "Block until instances are confirmed to be deleted"
This reverts commit 47ddbbe53b.
2019-03-14 20:53:10 -07:00
3ced91319f Upgrade nightly rust version 2019-03-14 20:22:46 -07:00
3d1413e619 Preserve original nightly name 2019-03-14 20:22:46 -07:00
8f25548781 Overhaul cargo/rustc version management 2019-03-14 20:22:46 -07:00
47ddbbe53b Block until instances are confirmed to be deleted 2019-03-14 16:20:18 -07:00
5741400713 add support for finding the next slot a node will be leader (#3298) 2019-03-14 16:06:56 -07:00
9f02a8d3d0 remove ticks_per_slot from blocktree (#3297) 2019-03-14 15:18:37 -07:00
c208f4dbb5 Add option of replicators to local cluster test 2019-03-14 13:55:11 -07:00
a17843c8f6 solana-install design proposal 2019-03-14 13:21:00 -07:00
3f2fc21bb3 Rename hash_queue and fix boundary condition (#3289) 2019-03-14 11:56:36 -07:00
9fac3b26ee Move the design proposals to a separate book
Fixes #3262
2019-03-14 10:08:43 -07:00
c1eec0290e Rename userdata to data (#3282)
* Rename userdata to data

Instead of saying "userdata", which is ambiguous and imprecise,
say "instruction data" or "account data".

Also, add `ProgramError::InvalidInstructionData`

Fixes #2761
2019-03-14 10:48:27 -06:00
de13082347 add economic design mvp to summary and overview 2019-03-14 09:42:19 -06:00
48b5d666d0 some economic mvp features 2019-03-14 09:42:19 -06:00
70bb49a46d some economic mvp features 2019-03-14 09:42:19 -06:00
105fc7029e create mvp section 2019-03-14 09:42:19 -06:00
77a7ffe543 Bump hex-literal from 0.1.3 to 0.1.4
Bumps [hex-literal](https://github.com/RustCrypto/utils) from 0.1.3 to 0.1.4.
- [Release notes](https://github.com/RustCrypto/utils/releases)
- [Commits](https://github.com/RustCrypto/utils/compare/hex-literal-v0.1.3...hex-literal-v0.1.4)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-03-14 07:21:32 -06:00
7d593e6c61 Exit gracefully when no subcommand is specified 2019-03-14 00:35:34 -05:00
bb420cb995 Use crate_description and crate_name Clap macros 2019-03-14 00:35:34 -05:00
e58220282a Move TransactionError into the SDK 2019-03-13 21:26:57 -06:00
4ca4038d54 Rename BankError to TransactionError 2019-03-13 21:26:57 -06:00
150cd31ec0 Blur the line between Bank and Runtime 2019-03-13 21:26:57 -06:00
6fd0d4dcf5 Boot error piggybacking on BankError 2019-03-13 21:26:57 -06:00
296415945a Generalize error codes 2019-03-13 21:26:57 -06:00
1de5ae1ef0 Remove SystemError from ProgramError 2019-03-13 21:26:57 -06:00
6a89c68a1d Add utility function to help get System error out of ProgramError 2019-03-13 21:26:57 -06:00
c14cce4c85 Add InstructionError for runtime instruction errors 2019-03-13 21:26:57 -06:00
959961b596 Modified test 2019-03-13 18:18:27 -07:00
6f76c2da6c Fix confirmation test 2019-03-13 17:50:53 -07:00
8d2bd2b30f Reduce ticks per second
- It's improving TPS. Temp fix for beacons timeframe
2019-03-13 17:50:53 -07:00
34a8d591fa Switch version file from .txt to .yaml; add target tuple to version.yml 2019-03-13 16:30:07 -07:00
d94ff4bf4a Bump tokio from 0.1.15 to 0.1.17
Bumps [tokio](https://github.com/tokio-rs/tokio) from 0.1.15 to 0.1.17.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Changelog](https://github.com/tokio-rs/tokio/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-0.1.15...tokio-0.1.17)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-03-13 15:45:33 -06:00
af03df38b9 Don't vote for empty leader transmissions (#3248)
* Don't vote for empty leader transmissions

* Add is_delta flag to bank to detect empty leader transmissions

* Plumb new is_votable flag through replay stage

* Fix PohRecorder tests

* Change is_delta to AtomicBool to avoid making Bank references mutable

* Reset start slot in poh_recorder when working bank is cleared, so that connsecutive TPU's will start from the correct place

* Use proper max tick height calculation

* Test for not voting on empty transmission

* tests for is_votable
2019-03-13 14:06:12 -07:00
242bcf44db Replace stale --no-signer usage with --no-voting 2019-03-13 13:50:30 -07:00
ebd540972d Remove duplicate --rpc-drone-address 2019-03-13 13:24:02 -07:00
a17be9f8bd Revert "Add case for --rpc-drone-address"
This reverts commit 42ad297778.
2019-03-13 13:23:54 -07:00
42ad297778 Add case for --rpc-drone-address 2019-03-13 13:04:44 -07:00
0568d7238e Add implemented design proposals section 2019-03-13 13:20:37 -06:00
9bc05313a2 Update TPU ASCII art 2019-03-13 13:14:15 -06:00
fedbae6f8c Enable rpc for all testnet nodes 2019-03-13 10:49:40 -07:00
64de639817 Fixes to replicator
Move functionality into more functions.
Break down the current test and just test creation/joining the network.
2019-03-13 10:15:03 -07:00
ec9e13d1f4 Add repair slot range
Use default impl RepairSlotRange
2019-03-13 10:15:03 -07:00
5d27f221f7 Drop socat for iptables 2019-03-13 12:03:56 -05:00
61db74d98e Run socat in the background 2019-03-13 08:15:58 -07:00
1d689e84f1 Move and rename cluster_client 2019-03-12 22:05:38 -06:00
b7f420412b Update publish script 2019-03-12 22:05:38 -06:00
e3ac9e9679 Move thin client tests to integration test suite 2019-03-12 22:05:38 -06:00
12fde77ecd Update crate references 2019-03-12 22:05:38 -06:00
3fc96c4a18 Add solana-client crate 2019-03-12 22:05:38 -06:00
cb3eeace56 Replay Stage start_leader() can use wrong parent fork() (#3238)
*  Make sure start_leader starts on the last voted block, not necessarily the biggest indexed bank in frozen_slots()

* Fix tvu test
2019-03-12 17:42:53 -07:00
76feb2098e Use same VM type for validators as leader, if CUDA is enabled (#3253)
- Since all nodes are created equal
2019-03-12 17:42:47 -07:00
06cb266cfe remove unused code (#3252) 2019-03-12 16:46:41 -07:00
866d3f467f Fix flag to disable leader-rotation (#3243) 2019-03-12 16:35:13 -07:00
c1e726da87 Remove comment 2019-03-12 15:32:41 -07:00
7d7528eb18 Fix test_bank_storage 2019-03-12 15:32:41 -07:00
9f916f9d47 remove Option<> wrapper for accounts 2019-03-12 15:03:26 -07:00
a7d8bfdf8b Adjust crate list 2019-03-12 14:02:51 -07:00
abdd4f371b Adjust readme path 2019-03-12 14:02:51 -07:00
13adee332e Add retry transfer logic to kill_entry_and_spend_and_verify_rest to account for dead forks (#3239) 2019-03-12 13:48:02 -07:00
a799f8f4b1 tell blockexplorer to run on port 8080 (#3237)
* tell blockexplorer to run on port 8080

* forward port 80 to 5000 for a blockexplorer node
2019-03-12 13:39:09 -07:00
1ee43a7633 Remove non-essential programs from runtime/ 2019-03-12 15:11:59 -05:00
3d2b7dd1ef Move programs/system into runtime/ 2019-03-12 11:30:58 -05:00
7b35114c0f Filter vote accounts with no delegate from being selected in Rotation (#3224) 2019-03-11 17:58:21 -07:00
b418525464 Update current leader information in metrics and dashboard 2019-03-11 17:43:59 -07:00
8bba11367e Provide drone's host address while setting up staking account 2019-03-11 17:11:34 -07:00
9eb7e63819 Add staking rewards design proposal for delegation (#3148)
* proposal for single vote many delegators
2019-03-11 16:35:42 -07:00
092501039c Cargo.lock 2019-03-11 16:27:22 -07:00
6899bd7099 0.13.0 2019-03-11 16:21:19 -07:00
5a0416b925 Keep stable dashboard on stable channel at all times 2019-03-11 16:19:16 -07:00
ba2cdd0bf6 Move testnet/testnet-perf to the stable channel 2019-03-11 16:14:16 -07:00
fe1676bc3a Review comments 2019-03-11 16:58:43 -06:00
1a9ef37251 Update programs using simple error mapping to use CustomError 2019-03-11 16:58:43 -06:00
db5370c5df Add helper macro to implement bincode serialization of program-specific errors 2019-03-11 16:58:43 -06:00
804378e8f7 Add ProgramError::CustomError and truncate value to 32 bytes 2019-03-11 16:58:43 -06:00
56b0ba2601 KvStore - A data-store to support BlockTree (#2897)
* Mostly implement key-value store and add integration points

Essential key-value store functionality is implemented, needs more work to be integrated, tested, and activated.

Behind the `kvstore` feature.
2019-03-11 17:53:14 -05:00
3073ebb20d reduce pub 2019-03-11 17:09:21 -05:00
f8e07ef5a3 banking_stage_entryfication fails when run as cargo test
Add some retry for getting entries from the channel.
2019-03-11 14:13:32 -07:00
a4b6d181a2 rename forwarder ports to tpu_via_blobs 2019-03-11 14:07:17 -07:00
0b8c5d807d code cleanup 2019-03-11 14:07:17 -07:00
e201136eee more review comments 2019-03-11 14:07:17 -07:00
55f660d5f9 address review comments 2019-03-11 14:07:17 -07:00
a4acc631ee Refactor packing packets into blobs into separate packets_to_blob() function in packets.rs 2019-03-11 14:07:17 -07:00
3ddf4b6c24 PR fixes 2019-03-11 14:07:17 -07:00
ccd1173a83 Add local cluster test for forwarding 2019-03-11 14:07:17 -07:00
cd1a9faacd Batch packet forwarding in banking stage 2019-03-11 14:07:17 -07:00
b60b8ec5ae Add logic for deserialzing packets embedded in blobs 2019-03-11 14:07:17 -07:00
536c8accf8 Add separate sockets for tpu forwarder and run different protocol for those sockets 2019-03-11 14:07:17 -07:00
7beefb3f81 Add forwarder sockets and address to contact info and sockets structs 2019-03-11 14:07:17 -07:00
fe1f67ea9a clippy errors 2019-03-11 14:07:17 -07:00
069ce71256 fix clippy 2019-03-11 14:07:17 -07:00
e3cacb9296 Buffer unprocessed packets if next leader is the current node 2019-03-11 14:07:17 -07:00
0c592c52f6 Wake up replay stage when the poh bank is cleared. (#3211)
* wake up replay stage when the poh bank is cleared

* bump ticks per second

* Increase ticks per slot to match faster tick rate

* Remove check that working bank must be the bank for the greatest slot

* Make start_leader() skip starting TPU for slots we've already been leader for
2019-03-11 13:58:23 -07:00
78bb96ee51 Reduce bootstrap leader stake (#3218) 2019-03-11 13:29:44 -07:00
86e2f35ac4 Only need the TPU and a light client implement Transact 2019-03-10 23:20:10 -06:00
7696a64891 Add design doc for testing programs 2019-03-10 23:20:10 -06:00
799ed24113 Integrate bank-forks proposal into the book 2019-03-10 20:13:36 -06:00
63477dabcd Attempt to clarify bank forks 2019-03-10 20:13:36 -06:00
cd0bc1dea5 updates to reflect new_from_parent() (#3076)
* design draft

* update

* section on updating root forks

* updates to reflect new_from_parent()

* fixup

* Grammar check
2019-03-10 13:59:16 -07:00
195a880576 pass Pubkeys as refs, copy only where values needed (#3213)
* pass Pubkeys as refs, copy only where values needed

* Pubkey is pervasive

* fixup
2019-03-09 19:28:43 -08:00
ac226c3e14 Remove superfluous set_leader() usage 2019-03-08 19:59:54 -08:00
4d5b832775 Remove commented out and clearly broken test 2019-03-08 19:59:54 -08:00
79b2542ca4 Remove CrdsValue::LeaderId 2019-03-08 19:41:51 -08:00
17921c9fae Delete NodeInfo type 2019-03-08 18:37:36 -08:00
5de38852d2 Add cluster test framework doc. (#3189) 2019-03-08 19:29:41 -07:00
0acdbc0d03 plumb staking_account and voting_keypair from multinode-demo to Vote (#3199)
* plumb staking_account and voting_keypair from bash to Vote
2019-03-08 19:29:08 -07:00
c8c85ff93b Fix propagation of incorrectly signed messages in Gossip (#3201) 2019-03-08 18:08:24 -08:00
31cbb52654 Rename new_entry_point as new_gossip_entry_point to clarify usage 2019-03-08 17:42:25 -08:00
cd88f81817 bench-tps no longer uses an invalid ContactInfo for RPC 2019-03-08 17:42:25 -08:00
6de24ff0be s/account/program in info msgs 2019-03-08 16:30:29 -07:00
de4d14ddc0 set_leader() now remains local and doesn't emit a LeaderId gossip message 2019-03-08 15:10:19 -08:00
5b386ec30a Delete cluster_info::get_gossip_top_leader() 2019-03-08 12:10:34 -08:00
8f0aa956a3 bench-tps no longer cares who the leader is 2019-03-08 11:43:07 -08:00
e04148ff44 Reduce leader_id visiblity 2019-03-08 11:42:06 -08:00
d5d853838c RPC now sends transactions at the local TPU
The local TPU will forward the transactions as needed if it's not
currently the leader
2019-03-08 11:42:06 -08:00
e18673953c Remove poll_gossip_for_leader() 2019-03-08 11:14:47 -08:00
12f3fd75e8 StorageStage now sends transactions at the local TPU 2019-03-08 11:03:49 -08:00
7bd0929157 Remove process_block() 2019-03-08 09:36:30 -08:00
19488ba42a Speling 2019-03-08 09:36:30 -08:00
f0dc10c67b Hide close(), the user is supposed to drop instead 2019-03-08 09:36:30 -08:00
f55103498f Remove commented test code 2019-03-07 19:18:53 -07:00
639cb49356 Fix wallet integration tests 2019-03-07 19:18:53 -07:00
c5e9c6fdb6 Get chacha off Budget 2019-03-07 19:18:53 -07:00
7a4ccc8719 Fix Budget's payment_with_fee test
Fee is now independent of the contract.
2019-03-07 19:18:53 -07:00
125a345c90 Fix pubsub test 2019-03-07 19:18:53 -07:00
3dc22e7323 Simulate auto-creation of system accounts 2019-03-07 19:18:53 -07:00
17dcd1f62a Resurrect the tests 2019-03-07 19:18:53 -07:00
a277f3e816 Migrate to TransactionBuilder
This code wasn't updated after we started batching instructions.
The current code does allocations instead of using CreateAccount.
The runtime shouldn't allow that, so getting this code out of the
way before we lock down the runtime.
2019-03-07 19:18:53 -07:00
10b16753af Remove 'new' constructor 2019-03-07 19:18:53 -07:00
4625aed3a5 Make hypen/underscore consistent 2019-03-07 16:51:25 -08:00
259c820f15 Review comments 2019-03-07 17:21:32 -07:00
e888c90ecf Add program notifications to JSON RPC documentation 2019-03-07 17:21:32 -07:00
b053bc2790 Load accounts by program owner for program subscriptions 2019-03-07 17:21:32 -07:00
6a81f9e443 Add program subscriptions to rpc 2019-03-07 17:21:32 -07:00
0ef1fa7c76 Replace RemoteVoteSigner with a user-supplied keypair
Vote program currently offers no path to vote with the
authorized voter. There should be a
VoteInstruction::new_authorized_vote() that accepts the
keypair of the authorized voter and the pubkey of the vote
account. The only option in current code is
VoteInstruction::new_vote() that accepts the voter's keypair
and assumes that pubkey is the vote account.
2019-03-07 17:15:36 -07:00
02eb234399 Fix TVU and PoH Recorder going out of sync (#3164)
* Fix broadcast_stage error

* Account for very fast ticks in tick verification
2019-03-07 15:49:07 -08:00
8d80da6b46 Fix picking account store paths
Store the set of accounts paths in AccountsDB and choose with an rng
when we need to create a new one. Remove path from AccountStorageEntry object.
2019-03-07 14:58:52 -08:00
22855def27 Fix race condition in store.
Multiple threads can enter the read lock and
all store the new empty set to account_maps.
Check again after taking write lock to make sure
only one thread actually inserts the new entry.
2019-03-07 14:58:52 -08:00
0be59cad4e Remove dead code 2019-03-07 13:05:42 -08:00
5edbd6a7fb gossip_service::discover() now reports the leader 2019-03-07 13:05:42 -08:00
54ff9b3ac2 Shutdown gossip on failure 2019-03-07 13:05:42 -08:00
5463226184 Give spy nodes a proper keypair 2019-03-07 13:05:42 -08:00
b96bccd71f Use Self 2019-03-07 13:05:42 -08:00
07a948a0d0 Replicator now uses its keypair for gossip 2019-03-07 13:05:42 -08:00
8f034280dc Increase polling frequency to report convergence quicker 2019-03-07 13:05:42 -08:00
83f551d9b9 Use poll_gossip_for_leader() 2019-03-07 13:05:42 -08:00
f83a64d17f poll_gossip_for_leader: simplify timeout arg 2019-03-07 13:05:42 -08:00
8bc7d5a172 Remove spy_node duplication 2019-03-07 13:05:42 -08:00
96c0222b30 Employ gossip_service::discover() 2019-03-07 13:05:42 -08:00
679a718cbf poll_gossip_for_leader() code cleanup 2019-03-07 13:05:42 -08:00
b083e4db48 Resolve TODO 2019-03-07 13:05:42 -08:00
a3cab470d3 Rename ClusterInfo::new_with_keypair() to ClusterInfo::new() 2019-03-07 13:05:42 -08:00
bb93504965 Rename ClusterInfo::new() to ClusterInfo::new_with_invalid_keypair() 2019-03-07 13:05:42 -08:00
4d58bf4b28 Don't use solana_entrypoint in static libraries 2019-03-07 12:42:13 -07:00
505f77b108 Move a more generic process_transaction to runtime.rs 2019-03-07 12:42:13 -07:00
5b672f8921 Generalize Budget tests to work on multi-ix txs 2019-03-07 12:42:13 -07:00
9e9c0785e7 groom broadcast (#3170) 2019-03-07 09:43:42 -08:00
94882418ab Simplify TransactionBuilder
A stepping stone to replacing all Transaction constructors with
TransactionBuilders.
2019-03-07 08:11:03 -07:00
c6cb3bb0bc Bump env_logger from 0.6.0 to 0.6.1
Bumps [env_logger](https://github.com/sebasmagri/env_logger) from 0.6.0 to 0.6.1.
- [Release notes](https://github.com/sebasmagri/env_logger/releases)
- [Commits](https://github.com/sebasmagri/env_logger/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-03-06 22:29:44 -07:00
9fedc9513b Use generics for add/remove subscriptions 2019-03-06 20:50:48 -08:00
0badc90058 Wallet new tests 2019-03-06 20:46:18 -08:00
61fbea3ee4 Cleanup AccountStorage apis
Remove duplicate code
2019-03-06 18:30:36 -08:00
a4a3995a84 Add staking commands to wallet 2019-03-06 17:50:15 -08:00
01fb76f4bd add epoch warmup (#3166)
add epoch warmup
2019-03-06 16:32:23 -08:00
d09639f7d2 Move the design out of the proposals section 2019-03-06 17:24:17 -07:00
946ee8a354 Add description of vote and rewards programs 2019-03-06 17:24:17 -07:00
e63b899ca5 Boot staker setup from fullnode 2019-03-06 16:50:27 -07:00
63a4ed74a4 consolidate logic for epoch and slot_index into Bank (#3144) 2019-03-06 14:44:21 -08:00
a3782d699d Bump bytes from 0.4.11 to 0.4.12
Bumps [bytes](https://github.com/carllerche/bytes) from 0.4.11 to 0.4.12.
- [Release notes](https://github.com/carllerche/bytes/releases)
- [Changelog](https://github.com/carllerche/bytes/blob/v0.4.x/CHANGELOG.md)
- [Commits](https://github.com/carllerche/bytes/compare/v0.4.11...v0.4.12)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-03-06 15:05:01 -07:00
97f2c96a7e Add a transaction and instruction 2019-03-06 15:04:15 -07:00
5979627258 Add authorized voter 2019-03-06 15:04:15 -07:00
9d580e363a Fix hostname part of queries in dashboard 2019-03-06 13:26:15 -08:00
9163e5b004 Fix sorting order of stakes in confirmation time calculations 2019-03-06 13:11:04 -08:00
0252bf2f46 fix fmt 2019-03-06 12:25:28 -08:00
283bb84134 Create UDP socket once per process_loop for forwarding transactions 2019-03-06 12:25:28 -08:00
0a4f909566 requestAirdrop RPC API is now optional 2019-03-06 10:23:57 -08:00
516aa44aad Don't fetch the working_bank twice 2019-03-06 10:23:57 -08:00
b1763f9187 Remove dead code 2019-03-06 10:23:57 -08:00
b03fd782de Make room for more fields in JsonRpcConfig 2019-03-06 10:23:57 -08:00
b850f3c1dd Remove unnecessary cleanup_paths
drop handles it
2019-03-06 11:17:37 -07:00
789a9df9f6 s/id/hash in block events 2019-03-06 08:51:10 -08:00
bd39ab9365 Clean up exit signal handling 2019-03-05 19:20:29 -08:00
1c0cfb17a3 Start leader based on Poh tick height. (#3084)
* Start leader based on poh and test

* Equalize validator and leader stakes in LocalCluster

* Clear WorkingBank on poh_recorder reset
2019-03-05 17:56:51 -08:00
9491999a95 Remove remaining erc20 references 2019-03-05 17:56:44 -08:00
e2d30db7e1 Rename tokens to lamports 2019-03-05 17:56:44 -08:00
3129e299e4 Rename tokens to lamports in programs/ 2019-03-05 17:56:44 -08:00
0604bbb473 Rename tokens to lamports in wallet/ 2019-03-05 17:56:44 -08:00
545feab6db Misc token to lamport renaming 2019-03-05 17:56:44 -08:00
3794048c91 Rename tokens to lamports in book/ 2019-03-05 17:56:44 -08:00
beb45f44ac solana-genesis: rename tokens to lamports 2019-03-05 17:28:06 -08:00
f1d1852691 Rename tokens to lamports in core/ 2019-03-05 17:28:06 -08:00
53f09c44f3 Rename tokens to lamports in sdk/ 2019-03-05 17:28:06 -08:00
bd237a2d6f Add transaction to test harness to set the delegate for validator vote accounts 2019-03-05 16:51:47 -07:00
76a7038335 Update test harness to set a delegate on validator vote accounts 2019-03-05 16:51:47 -07:00
c24d95c885 Remove bench-tps, upload-perf, and bench-streamer from code coverage report 2019-03-05 15:35:31 -08:00
cb0560df92 remove dead code 2019-03-05 15:35:24 -08:00
ec034a5cb9 Fix invalid Barrier transactions (#3139) 2019-03-05 15:16:36 -08:00
ca99ebaaf4 Add way to create account with delegate in 1 tx 2019-03-05 16:14:57 -07:00
b9e878ee80 slot_height considered harmful (#3135)
* slot_height considered harmful
* fix test_tick_slot_epoch_indexes
2019-03-05 14:18:29 -08:00
33c4c7e511 Split up long test 2019-03-05 15:16:51 -07:00
b67ac22336 Replace superfluous integration tests with needed one 2019-03-05 15:16:51 -07:00
6ff2572ebe Refactor system entrypoint to use helper fns; add unit tests 2019-03-05 15:16:51 -07:00
a539c9ad67 Restore print ban, and widen the net 2019-03-05 14:09:40 -08:00
1997640094 Remove prints 2019-03-05 14:09:40 -08:00
e7eafbd24e Adapt to recent programs/ shuffle 2019-03-05 13:14:07 -08:00
378a0f511e Stop looking for solana-fullnode-config 2019-03-05 12:44:27 -08:00
9349f90a59 Inherit transaction count from parent (#3134) 2019-03-05 12:34:21 -08:00
0f1d6c6271 Check for no entries left in blocktree in a given slot
There may not be ENTRIES_PER_SEGMENT entries a slot, if so
then we will hang waiting for more.
2019-03-05 11:53:40 -08:00
8e70f5bf84 Same fix, different location
What's this doing way up here?
2019-03-05 12:46:18 -07:00
52fc974cdf The funder is not a staker 2019-03-05 12:46:18 -07:00
6e9d803091 Remove usage of unsafe for Accounts 2019-03-05 10:13:03 -08:00
fc8489a04d Stop using LocalVoteSigner 2019-03-05 09:34:54 -07:00
e248efce06 Add programs/system explicitly to CI test suite 2019-03-05 09:33:27 -07:00
b4084c6298 Fix random comment typo 2019-03-05 09:33:27 -07:00
2fdfa98d55 Fix process_pay SystemTransaction type 2019-03-05 09:33:27 -07:00
f506b0a224 Fix test: Prevent SystemInstruction CreateAccount from overwriting accounts in use 2019-03-05 09:33:27 -07:00
202adb1bf1 Create failing test 2019-03-05 09:33:27 -07:00
885eeec3ed Boot storage program from the SDK 2019-03-05 07:16:33 -07:00
5e9f802d7d Boot token_program from the SDK 2019-03-05 07:16:33 -07:00
e4be57c3b6 Bump libc from 0.2.49 to 0.2.50
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.49 to 0.2.50.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.49...0.2.50)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-03-05 07:14:51 -07:00
6ab6e6cb9b Clean up exit flag handing across TVU 2019-03-04 21:26:50 -08:00
2a849ae268 Inline LeaderServices 2019-03-04 21:26:50 -08:00
4808f6a9f8 Clean up exit flag handing in TPU 2019-03-04 21:26:50 -08:00
96bfe92334 Clean up fullnode/tpu/tvu/fetch_stage exit signal 2019-03-04 21:26:50 -08:00
e7cde846cb Clean up gossip service exit flag handling 2019-03-04 21:26:50 -08:00
eb90d8d463 Clean up Rpc exit signal 2019-03-04 21:26:50 -08:00
6a8a97f644 Remove dead code 2019-03-04 20:05:14 -08:00
3fc846d789 Try to use the RPC exit API to cleanly exit nodes 2019-03-04 19:58:37 -08:00
0f77531f09 Simplify pass-through arg handling 2019-03-04 19:58:37 -08:00
20b831264e Properly plumb exit flag to PubSubService 2019-03-04 19:58:37 -08:00
43bab23651 remove duplicate child creation (#3100)
* remove duplicate child creation
* resurrect test for partial slot
* simplify blocktree_processor some more (no tick_height, yay!)
* ensure frozen
2019-03-04 19:22:23 -08:00
906df5e20e Exit signal cleanup: pass in references, make the receiver clone as needed 2019-03-04 18:43:21 -08:00
794e961328 use Bank's notion of leader_id where possible (#3119) 2019-03-04 18:40:47 -08:00
a481822321 Fix signatureUnsubscribe documentation (#3118) 2019-03-04 18:07:16 -08:00
dc42c12f2b Revert to more consistent naming (#3114) 2019-03-04 17:50:19 -08:00
6d82123125 rename bank_id to bank_slot 2019-03-04 17:10:27 -08:00
4f6d7702c5 Add a way to build unsigned transactions 2019-03-04 17:47:46 -07:00
97274030b9 Add test with transaction with no signatures
Add checks for no signature
2019-03-04 16:42:52 -08:00
9ce2bc94bf Add flag to enable the JSON RPC fullnodeExit API 2019-03-04 15:49:02 -08:00
51502537b1 Remove extra reference 2019-03-04 15:49:02 -08:00
7b49c9f09c Delete fullnode-config/ 2019-03-04 15:49:02 -08:00
4714dc3a5c De-pub 2019-03-04 15:49:02 -08:00
44013855d8 Book nits (#3096)
* Book nits

* nits
2019-03-04 15:44:54 -07:00
846fdd3b2d Bump reqwest from 0.9.10 to 0.9.11
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.9.10 to 0.9.11.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.9.10...v0.9.11)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-03-04 13:47:37 -07:00
03d6c9a552 Defeature bpf_loader; bpf_{c,rust} features now confined to programs/bpf 2019-03-04 11:02:37 -08:00
d0be16b49a Remove duplicated code 2019-03-04 11:02:37 -08:00
3a4018cd03 review comments; rename Unsafe to TestOnlyAllowRpcFullnodeExit 2019-03-04 10:18:17 -08:00
5aaaa7f45c fixup! 2019-03-04 10:18:17 -08:00
c299dd390e Fullnode rpc to exit with unsafe config 2019-03-04 10:18:17 -08:00
a3016aebaf Put accounts test data files in target directory
And gitignore it so those aren't added accidentally.
2019-03-04 10:17:02 -08:00
fb55d1c3d4 Design for leader to leader transition between slots (#2715) 2019-03-04 10:10:52 -08:00
9c44c173df Remove ipv6 feature 2019-03-04 09:56:58 -08:00
d708982f27 Remove unstable and test feature flags 2019-03-04 09:30:00 -08:00
bb774173bb Add PohRecorder reset tests (#3083)
* tests for reset

* fixup!
2019-03-04 08:08:22 -07:00
3906b1af6a deadcode (#3081) 2019-03-03 21:16:59 -08:00
de1d7ce312 Cleanup staking utils to divide functionality between delegate and normal node utitliites. Also replaces vote_states() with more generalized vote_accounts() in Bank. (#3070) 2019-03-03 18:04:13 -08:00
1654199b23 Use PohRecorder to synchronize instead of rotate. (#3080) 2019-03-03 16:44:06 -08:00
2ec9bc9f05 Revive payments via Budget 2019-03-03 17:29:13 -07:00
e8ae603a01 Add failing test for a Budget payment 2019-03-03 17:29:13 -07:00
e4dba03e12 accounts shedding (#3078)
* accounts shedding

* fixup
2019-03-03 16:04:04 -08:00
8ec10d4de9 Simplify Budget's serialize 2019-03-03 14:24:53 -08:00
baca3e6b6b Cleanup Budget
* BudgetProgram -> BudgetState
* Instruction -> BudgetInstruction
* Move BudgetState into its own module
* BudgetInstruction::NewBudget -> BudgetInstruction::InitializeAccount
* BudgetInstruction::new_budget -> BudgetInstruction::new_initialize_account
2019-03-03 14:49:35 -07:00
fc5fcd6cd4 Move native_loader into solana_runtime 2019-03-03 10:59:08 -07:00
33496ffea2 Adjust paths 2019-03-02 22:11:48 -08:00
b8b7de5522 Script can now be run from any directory 2019-03-02 22:11:48 -08:00
109101c2dc Cleanup features and fix build errors 2019-03-02 22:11:48 -08:00
534619f72f Update manifest-path 2019-03-02 22:11:48 -08:00
44322124c8 Update paths 2019-03-02 22:11:48 -08:00
9923c543e8 Fix ci scripts 2019-03-02 22:11:48 -08:00
41b5899856 Move programs/Cargo.toml into bpf/ 2019-03-02 22:11:48 -08:00
b830449f23 Move top-level native program tests to their respective crates 2019-03-02 22:11:48 -08:00
037fcf6b3d Bump all native programs up a level
Don't categorize programs by a single backend.
2019-03-02 22:11:48 -08:00
e1a1296b9b Fix cleanup_paths
Add back remove of parent in Accounts::drop, but
remove that in the cleanup_paths helper
for the account tests which do not use
make_default_dir.
2019-03-02 20:24:57 -08:00
3f4ff3f7b5 Delete duplicate file 2019-03-02 18:57:11 -07:00
cd4bccfd12 Remove snap support 2019-03-02 17:41:09 -08:00
9c3e7e40cf Less pub 2019-03-02 17:36:51 -08:00
a9a7fc56eb Purge MAX_RECENT_TICK_HASHES 2019-03-02 17:04:42 -08:00
398b78dd97 Delete duplicate file 2019-03-02 16:44:36 -08:00
1edf6c361e Move Vote program out of the SDK 2019-03-02 16:44:36 -08:00
b99e3eafdd Fix stakes not being setup correctly 2019-03-02 16:44:36 -08:00
e6486b2824 Move Budget out of the SDK 2019-03-02 16:44:36 -08:00
d22a13257e Refactor bank get vote accounts (#3052) 2019-03-02 16:44:36 -08:00
f4c5b9ccb0 remove remove_dir_all() of paths' parents (which we didn't make to begin with) 2019-03-02 12:36:41 -08:00
a94880574b block_hash => blockhash 2019-03-02 12:13:30 -07:00
0f1582c196 cargo fmt 2019-03-02 12:13:30 -07:00
85159a0eb4 Rename JSON RPC getLastId to getRecentBlockHash 2019-03-02 12:13:30 -07:00
258cf21416 Purge remaining last_id (now called block_hash) 2019-03-02 12:13:30 -07:00
2bfad87a5f Rename Bank.last_id() to Bank.last_block_hash() 2019-03-02 12:13:30 -07:00
95cbb8a5c0 Switch to recent_block_hash 2019-03-02 12:13:30 -07:00
ce1b72809a Rename get_last_id() to get_recent_block_hash() 2019-03-02 12:13:30 -07:00
4f3e149a98 Remove stale/wrong comments 2019-03-02 12:13:30 -07:00
642d3d903f Rename get_storage_mining_entry_height to get_storage_entry_height for consistency 2019-03-02 12:13:30 -07:00
81cd461591 Rename storage_last_id to storage_block_hash 2019-03-02 12:13:30 -07:00
ea110efabd Rename AdvertiseStorageLastId to AdvertiseStorageRecentBlockHash 2019-03-02 12:13:30 -07:00
0743f54dfe Rename LastIdNotFound to BlockHashNotFound 2019-03-02 12:13:30 -07:00
176d5e0d37 Rename Transaction last_id field to recent_block_hash 2019-03-02 12:13:30 -07:00
16b71a6be0 Cleanup fork id generation
Accounts could end up with id collision depending on how
banks are created, this shouldn't happen.
2019-03-02 10:34:41 -08:00
13ee8efd42 Move build.rs into core/ 2019-03-02 09:52:18 -08:00
5f5d779ee1 Move src/ into core/src. Top-level crate is now called solana-workspace 2019-03-02 09:52:18 -08:00
7b849b042c Split rewards_program.rs 2019-03-02 10:11:37 -07:00
d32f5b6cca Use process_blocktree to verify the ledger 2019-03-02 08:47:31 -08:00
fcbcf000c4 Use a valid last_id 2019-03-02 08:47:31 -08:00
2bc939f535 Adapt to slower moving last_ids 2019-03-02 08:47:31 -08:00
d5de5bec4f Register a new last_id once per slot 2019-03-02 08:47:31 -08:00
61beb42797 Decouple tick counting from hash queue 2019-03-02 08:47:31 -08:00
e5be3e1dca HashQueue no longer hard codes max_entries 2019-03-02 08:47:31 -08:00
986c54de58 Comment out test that's not actually testing anything
@sakridge, fyi
2019-03-02 07:50:32 -07:00
49b7e67585 Return program error from process_transaction()
Our unit-test helper `process_transaction()` wasn't returning
program errors, which made testing programs tedious and
counter-intuitive.
2019-03-02 07:50:32 -07:00
db825b6e26 Fix vote program bugs
Also:

* Add an assertion to the transaction builder if not enough
keypairs were provided for all keys that require signatures.
* Expose bugs in the runtime.
2019-03-02 07:50:32 -07:00
8e273caf7d Brush up data-plane-fanout to read less like a proposal 2019-03-01 22:50:42 -07:00
b1a648113f simple replay stage 2019-03-01 20:56:29 -08:00
2782922f7a Rename BroadcastService back to BroadcastStage 2019-03-01 21:10:53 -07:00
041a06b432 kill multinode (#3038) 2019-03-01 20:09:13 -08:00
269a82f796 Bump serde_derive from 1.0.88 to 1.0.89
Bumps [serde_derive](https://github.com/serde-rs/serde) from 1.0.88 to 1.0.89.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.88...v1.0.89)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-03-01 20:15:49 -07:00
6b83ce4937 address review comments 2019-03-01 17:58:05 -08:00
ae557104a5 Create vote account and fund it in local cluster test harness 2019-03-01 17:58:05 -08:00
6a34b11dd0 Sum up all stakes for a delegate when calculating stake (#3045) 2019-03-01 17:31:59 -08:00
54417acfba changed vote_states to vote_accounts, more useable (#3047) 2019-03-01 17:22:49 -08:00
29d12d9ff1 remove new_bank_from_parent_with_id() (#3039) 2019-03-01 16:39:23 -08:00
4ee857ab7d More vote account fixes
vote_index not being maintained correctly during a squash.
The tokens==0 shielding accounts were being inserted with
owner=default Pubkey so they didn't know they are vote accounts
and should update the vote accounts set.
2019-03-01 16:25:14 -08:00
771a88665c Bump serde from 1.0.88 to 1.0.89
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.88 to 1.0.89.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.88...v1.0.89)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-03-01 15:51:11 -07:00
a7c18cc0b4 Fnbool_to_FnOptionT 2019-03-01 14:12:50 -08:00
e30e4cc603 Remove get_confirmation_timestamp() from HashQueue 2019-03-01 13:38:17 -08:00
fdc31e99df Clean up type casts 2019-03-01 13:38:17 -08:00
a72325dbc2 entry_id -> entry 2019-03-01 13:38:17 -08:00
67b6be66c8 Rename MAX_ENTRY_IDS 2019-03-01 13:38:17 -08:00
8ec13d557f Generalize tick_height to hash_height 2019-03-01 13:38:17 -08:00
31f570a9f4 Remove unused functions 2019-03-01 13:38:17 -08:00
46b7b795bf Fix Typo in Fullnode Diagram (#3036) 2019-03-01 11:58:09 -08:00
38273427ad have banks save vote_state by epoch to support stable leader schedules (#3019)
have banks save vote_state by epoch to support stable leader schedules
2019-03-01 11:54:28 -08:00
46fb0b1b94 Rename last_id to last_hash within HashQueue 2019-03-01 11:48:09 -08:00
224b705f8d Rename genesis_block.last_id() to genesis_block.hash() 2019-03-01 11:48:09 -08:00
028f41eb51 Move secure vote signing out of proposals 2019-03-01 12:16:28 -07:00
c27726e065 Add a black box local cluster harness (#3028)
Integration test harness for the network.
2019-03-01 10:36:52 -08:00
a57fb00584 Rename last_id_queue.rs to hash_queue.rs 2019-03-01 09:50:51 -08:00
360055ad70 Rename LastIdQueue to HashQueue 2019-03-01 09:50:51 -08:00
558f10c862 Rename PohEntry.id to PohEntry.hash 2019-03-01 09:50:51 -08:00
c53c351759 Rename erc20 to token-program
Everything it uses already had that name, just the crate was never
renamed.
2019-03-01 10:47:38 -07:00
7c4473e0aa Rename Entry.id to Entry.hash 2019-03-01 09:31:49 -08:00
7e7b79ef34 Rename prev_id to prev_hash 2019-03-01 09:31:49 -08:00
e993d511e3 Rename last_entry_id variables to last_entry_hash 2019-03-01 09:01:59 -08:00
251b0957f1 Ignore flaky test_dropped_handoff_recovery 2019-03-01 09:01:28 -08:00
b9524217fe Update rust example to use BPF enabled infrastructure (#2974) 2019-02-28 22:05:11 -08:00
6b228df3df Remove last_entry_id/next_blob_index from TvuRotationInfo 2019-02-28 21:57:17 -08:00
6cf6a1ccc3 process_blocktree() now halts forks at the first partial slot 2019-02-28 21:57:17 -08:00
d889e77fba Add reset_slot_consumed() 2019-02-28 21:57:17 -08:00
93d65aa9cc Use your words 2019-02-28 21:02:29 -08:00
f216a7179a Ignore test_full_leader_validator_network 2019-02-28 21:01:10 -08:00
434b8a8970 Fix another PR race 2019-02-28 20:11:50 -08:00
cc9191f1b0 Update blocktree API's (#3025) 2019-02-28 19:49:22 -08:00
567bbecca0 use bank.id() where we want 'slot'; bank.slot_height() is not slot (#3014) 2019-02-28 19:07:47 -08:00
07e4f9a611 Fix PR race 2019-02-28 18:44:07 -08:00
b41286919d Rename bank.id to bank.slot (#3018) 2019-02-28 18:02:45 -08:00
564057c812 Bump rust-bpf-sysroot to pull in liballoc 2019-02-28 17:25:28 -08:00
20e4edec61 Refactor Vote Program Account setup (#2992) 2019-02-28 17:08:45 -08:00
d5f0e49535 Refactor fullnode rotation test (#3015) 2019-02-28 15:53:09 -08:00
30bccc0c68 Fix slot index used while calculating leader schedule
- slot_leader_at() was using absolute slot number instead of index in the epoch
2019-02-28 15:41:01 -08:00
1c44b738fe Fix vote_accounts test 2019-02-28 15:22:47 -08:00
217f30f9c3 Add get_supermajority_slot() function (#2976)
* Moved supermajority functions into new module, staking_utils

* Move staking functions out of bank, and into staking_utils, change get_supermajority_slot to only use state from epoch boundary

* Move bank slot height in staked_nodes_at_slot() to be bank id
2019-02-28 13:15:25 -08:00
fec867539d More SlotMeta docs (#3011) 2019-02-28 12:18:11 -07:00
d123d86d84 remove forks.working_bank() where possible (#3010) 2019-02-28 10:57:58 -08:00
485ccd20e4 Use TransactionBuilder in the Rewards transaction 2019-02-28 10:53:26 -08:00
8d004ee947 Clarify is_full 2019-02-28 11:06:06 -07:00
4704aa1f80 Rename SlotMeta::is_trunk to SlotMeta::is_rooted 2019-02-28 10:39:56 -07:00
271115a6be Switch blockstream_service to create_new_tmp_ledger! 2019-02-28 07:59:17 -08:00
a79caf7795 Test transaction with a fee 2019-02-28 08:56:55 -07:00
404aa63147 Add TransactionBuilder 2019-02-28 08:56:55 -07:00
4610706d9f Generalize instruction
For serialization: Instruction<u8, u8>
For users:         Instruction<Pubkey, (Pubkey, bool)>
For programs:      Instruction<Pubkey, (Pubkey, bool, Account)>
2019-02-28 08:56:55 -07:00
8e4cd6fcc3 Delete leader scheduler artifact 2019-02-28 07:47:37 -08:00
6eb09a6901 Trigger blockstream on full-slot notification (clean up superfluous stuff) 2019-02-28 07:20:16 -07:00
e04d2379df Remove bank dependency from forward_entries 2019-02-28 07:20:16 -07:00
5b72a984a3 Bump serde_json from 1.0.38 to 1.0.39
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.38 to 1.0.39.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.38...v1.0.39)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-02-28 06:57:17 -07:00
cf545e64b8 xargo requiress sysroot as source to build dependent crates 2019-02-28 00:49:06 -08:00
ac1e266588 Bump rust-bpf to pull in built-in target bpfel-unknown-unknown (#3001) 2019-02-28 00:26:50 -08:00
0f2226901d Fix transaction count after squash 2019-02-27 23:21:49 -08:00
dad1511484 test_bank_squash: validate transaction_count() before/after squashing 2019-02-27 23:21:49 -08:00
05646d72b8 Remove unnecessary fetching of a new last_id 2019-02-27 22:58:59 -08:00
7ccd601100 Remove incorrect file description 2019-02-27 22:36:18 -08:00
d23f8a3e99 increase accounts coverage (#2993) 2019-02-27 21:42:14 -08:00
0dc5af62ff Standardize on 'use log::*' for easy access to all log level macros 2019-02-27 21:16:23 -08:00
855f1823a4 Include solana-logger for use by tests 2019-02-27 21:16:23 -08:00
7fd40f1eb9 add failing test for #2994 (#2995) 2019-02-27 20:46:26 -08:00
95f2f05f45 Refactor account serialize in appendvec
Remove dupe code and see how this compares to bincode.
Add benchmarks to justify custom serialize and also experiment with
safe solutions.
2019-02-27 19:57:50 -08:00
cd976a8082 s/tx/transaction/ for function names 2019-02-27 17:00:10 -08:00
163ed40efb Send program write transactions concurrently 2019-02-27 17:00:10 -08:00
32aaa5fd06 Derive retry timeout from slot duration 2019-02-27 17:00:10 -08:00
163874d4da remove purge parameter to accounts (#2990) 2019-02-27 16:06:06 -08:00
873007bae1 Fix tests and move bank dependency slightly 2019-02-27 15:31:23 -08:00
a67a88c8ef Hoist EntrySender in ReplayStage 2019-02-27 15:31:23 -08:00
6d1b43f1b1 Make leader_schedule a utitlity module named leader_schedule_utils (#2988) 2019-02-27 14:41:46 -08:00
3a20a20807 Reintroduce leader_id to blobs (#2986) 2019-02-27 13:37:08 -08:00
e45559a1a7 Add slot 3 back to ASCII art (#2979)
* Add slot 3 back to ASCII art

* New slot-oriented diagrams

When 1-block-per-slotm, slots are drawn vertically. That's the ideal
case. Abandoning a block is what should look like something forking
off to the side.
2019-02-27 14:27:58 -07:00
140954a53c Remove Tpu::is_leader(), fullnode doesn't need it anymore 2019-02-27 11:55:21 -08:00
b5d7ac3ce3 Set delay based on ticks_per_slot to ensure the test makes it to a new block 2019-02-27 11:13:29 -08:00
b5d714eec7 Derive retry timeout from slot duration 2019-02-27 11:13:29 -08:00
36cdaffe25 Fix indent 2019-02-27 11:11:24 -08:00
16e2443f61 Remove unnecessary if 2019-02-27 11:06:38 -08:00
9adbc1dd60 nit: always pass &Arc<Bank>, clone() only where consumed 2019-02-27 10:55:43 -08:00
b6ccb475f1 Clarify FIXME source 2019-02-27 10:37:48 -08:00
ca0f16ccc0 Fix test failure 2019-02-27 08:22:52 -08:00
c241a56fb0 Remove extraneous print. 2019-02-27 08:22:52 -08:00
4149f7fd1c Fix review comments 2019-02-27 08:22:52 -08:00
cc68ecdacf Use default if previous values do not exist 2019-02-27 08:22:52 -08:00
96b349dcbb Performance optimizations 2019-02-27 08:22:52 -08:00
5216952691 Change benchmark path to target/ or OUT_DIR
Also reduce some code duplication with cleanup_dirs fn.
2019-02-27 08:22:52 -08:00
c46b2541fe - Fix lock/unlock of accounts
- Fix format check warnings
2019-02-27 08:22:52 -08:00
2158ba5863 tx count per fork 2019-02-27 08:22:52 -08:00
180d297df8 Rebase and panic with no accounts
Add Accounts::has_accounts function for hash_internal_state calculation.
2019-02-27 08:22:52 -08:00
c276375a0e Persistent account storage across directories 2019-02-27 08:22:52 -08:00
130563cd4c AppendVec 2019-02-27 08:22:52 -08:00
9e2a7921c8 Recover from rebase 2019-02-26 22:08:17 -08:00
9539154a4a Remove test_name arg 2019-02-26 22:08:17 -08:00
84bd9296cd Centralize unwrap() within create_new_tmp_ledger! 2019-02-26 22:08:17 -08:00
88ecce12a2 No longer need to give new_fullnode() a random string 2019-02-26 22:08:17 -08:00
5a7b99ecc2 Add/employ create_new_tmp_ledger!() 2019-02-26 22:08:17 -08:00
55a76ed4b0 Populate test ledgers with a full slots to reduce test boilerplate 2019-02-26 22:08:17 -08:00
033a04129a Add lockouts to vote program (#2944)
* Add lockouts to vote program

* Rename MAX_VOTE_HISTORY TO MAX_LOCKOUT_HISTORY, change process_vote() to only pop votes after MAX_LOCKOUT_HISTORY + 1 votes have arrived

* Correctly calculate serialized size of an Option, rename root_block to root_slot
2019-02-26 22:19:31 -07:00
789fff2ae2 Replace LeaderScheduler with LeaderScheduler1 (#2962)
* Migrate to LeaderScheduler1 (and added some missing methods)
* Delete LeaderScheduler
* Rename LeaderScheduler1 to LeaderScheduler
2019-02-26 22:16:18 -07:00
9750488200 Update rust-bpf-sysroot to pull in latest core,stdsimd (#2972) 2019-02-26 19:55:28 -08:00
46ec5cf765 Bump dirs from 1.0.4 to 1.0.5
Bumps [dirs](https://github.com/soc/dirs-rs) from 1.0.4 to 1.0.5.
- [Release notes](https://github.com/soc/dirs-rs/releases)
- [Commits](https://github.com/soc/dirs-rs/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-02-26 20:04:36 -07:00
ee16cc77a3 Move last_ids to a simple Hash, unwrap from Arc<RwLock>> 2019-02-26 18:19:26 -08:00
a669241cb1 Add/use get_tmp_ledger_path!() and tmp_copy_blocktree!() 2019-02-26 17:50:43 -08:00
0174945853 Program tests now check signature status (#2965) 2019-02-26 17:09:57 -08:00
ea0837973e blocktree_processor to use slots as bank ids, and squash 2019-02-26 17:35:22 -07:00
85819983d7 Bump lazy_static from 1.2.0 to 1.3.0
Bumps [lazy_static](https://github.com/rust-lang-nursery/lazy-static.rs) from 1.2.0 to 1.3.0.
- [Release notes](https://github.com/rust-lang-nursery/lazy-static.rs/releases)
- [Commits](https://github.com/rust-lang-nursery/lazy-static.rs/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-02-26 17:31:19 -07:00
78841532f7 Add Rust helpers (#2959) 2019-02-26 15:17:38 -08:00
72214b2b68 Squash test to test parent bank after squash 2019-02-26 15:15:34 -08:00
ee83a2ac29 Make stake sorting more deterministic for data plane 2019-02-26 14:11:08 -08:00
82c759b6cb Add whitespace, comment cleanup 2019-02-26 14:07:39 -08:00
6de5354b8e Update the RPC bank on fullnode rotation 2019-02-26 14:07:39 -08:00
87281f6ed5 ensure at Accounts level that tokens == 0 means None (#2960) 2019-02-26 13:51:39 -08:00
a8cd66ffa2 Pull Rust enabled LLVM (#2957) 2019-02-26 13:03:57 -08:00
d1e1258f97 Revert "Ignore flaky test_active_set_refresh_with_bank"
This reverts commit 10ad536e09.
2019-02-26 12:04:58 -08:00
4d73bbe48f Fix flaky gossip weighted tests 2019-02-26 11:58:03 -08:00
10ad536e09 Ignore flaky test_active_set_refresh_with_bank 2019-02-26 11:56:47 -08:00
bc2d4c7681 Clean up test_boot_validator_from_file() 2019-02-26 11:12:05 -08:00
a7f200847f Clean up test_leader_restart_validator_start_from_old_ledger 2019-02-26 11:12:05 -08:00
411f154827 Reduce log spam 2019-02-26 11:12:05 -08:00
6dcb97af9e Move PohService and PohRecorder out of banking_stage and into fullnode (#2852)
* Move PohService out of banking_stage and into fullnode.

* 10 second slots
2019-02-26 10:48:18 -08:00
9420ba52e9 Squash the new working bank to ensure zero-balance accounts get purged 2019-02-26 10:09:31 -08:00
ec35c1fc79 Fix leader scheduling in replay stage 2019-02-26 09:51:12 -07:00
b752511f41 Attempt to pull the completed replication work into the book 2019-02-26 09:23:12 -07:00
af206111e2 Hoist new leader scheduler up to protocol level
Attempt to feel similar to LeaderScheduler to easy migration.
2019-02-26 08:23:01 -08:00
ba50e1ac81 Move data plane fanout chapter out of proposals 2019-02-26 09:20:09 -07:00
f9f493ee7a Tighten up storage_stage changes 2019-02-26 09:05:00 -07:00
137233b4a1 Add EntryMeta wrapper 2019-02-26 09:05:00 -07:00
3897b66270 Let the bank creator decide where to send transaction fees 2019-02-26 08:06:08 -07:00
feefdca969 Minor cleanup to Bank and LastIdQueue 2019-02-26 06:46:38 -08:00
25690ff078 merge_parents() => squash() (#2943) 2019-02-25 20:34:05 -08:00
897279eddb Encapsulate log::Level so counter macro users don't need to use it 2019-02-25 20:01:30 -08:00
5f5725a4ea Re-add leader scheduler 2019-02-25 19:28:24 -08:00
6a61f25735 Only install rust-bpf if rust-bpf version changes (#2939) 2019-02-25 19:09:16 -08:00
454c66f988 fixup! 2019-02-25 18:17:36 -08:00
3e893ffddc Remove max_tick_height, leader_scheduler from broadcast_service 2019-02-25 18:17:36 -08:00
58eebd7f6c Remove tick counting from broadast service 2019-02-25 18:17:36 -08:00
ba5077701d Avoid possible simplified lowering of passed struct (#2938) 2019-02-25 17:05:59 -08:00
2f44555437 Fix fullnode test 2019-02-25 16:55:22 -08:00
299b642803 Cleanup fullnode rotate integration test, and unignore two tests 2019-02-25 16:55:22 -08:00
a2bf59cbba Ignore rust toolchain and sysroot 2019-02-25 16:40:35 -08:00
329382f016 Pull BPF enabled rustc and sysroot into SDK (#2936) 2019-02-25 15:35:45 -08:00
67c9bbc6b2 * drop parents once merged (#2930)
* add bank.id() which can be used by BankForks, blocktree_processor
* add bank.hash(), make hash_internal_state() private
* add bank.freeze()/is_frozen(), also useful for blocktree_processor, eventual freeze()ing in replay
2019-02-25 14:05:02 -08:00
6088b3bfc8 Replace DEFAULT_SLOT_HEIGHT with 0 2019-02-25 13:09:13 -08:00
2be7896157 Pull in latest rBPF that includes Rust dependent changes (#2929) 2019-02-25 12:42:48 -08:00
0b37f530ae Start replay stage from the slot-relative blob index, not the global entry height 2019-02-25 11:38:46 -08:00
c13ae10d31 Fix replay_stage to 1) skip leader slots, 2) create/set working banks properly 2019-02-25 11:38:46 -08:00
1e15e6375a Check for entry height in the unchanging bank_forks_info instead of a racy check to blocktree 2019-02-25 11:38:46 -08:00
ed684c5ec6 Build docker image with rust 1.32 2019-02-25 09:16:11 -08:00
2fbdec59cb Generalize access to staked nodes 2019-02-25 08:49:43 -08:00
710f88edda Handle edge cases earlier
We have lots of tests that work off genesis block.  Also, one
might want to generate a future leader schedule under the assumption
the stakers stay the same.
2019-02-25 08:49:43 -08:00
db899a2813 Inline LeaderSchedule::new_from_bank()
Breaks circular dependency and offers more flexibility in bank's
usage.
2019-02-25 08:49:43 -08:00
aad0d90fdd Use epoch_height to generate schedule instead of last_id
I had suggested the last_id, but that puts an unnecessary dependency
on LastIdsQueue. Using epoch height is pretty interesting in that
given the same set of stakers, you simply increment the seed once
per epoch.

Also, tighten up the LeaderSchedule code.
2019-02-25 08:49:43 -08:00
72b4834446 Add Bank::prev_slot_leader() and Bank::next_slot_leader() 2019-02-25 08:49:43 -08:00
ec48c58df1 Award tx fees to validators in new leader schedule
Also, generalize the leader_schedule functions a bit to allow for
prev_slot_leader and next_slot_leader, should they be needed.
2019-02-25 08:49:43 -08:00
0947ec59c9 Expose the new leader schedule functionality from the bank. 2019-02-25 08:49:43 -08:00
d67211305c Ignore slow benchmarks 2019-02-24 23:15:05 -07:00
c65046e1a2 Use PohRecorder as the Poh synchronization point. (#2926)
Cleanup poh_recorder and poh_service.

* ticks are sent only if poh.tick_height > WorkingBank::min_tick_height and <= WorkingBank::max_tick_height
* entries are recorded only if poh.tick_height >= WorkingBank::min_tick_height and < WorkingBank::max_tick_height
2019-02-24 08:59:49 -08:00
ba7d121724 Switch to Bank::staked_nodes(); want node_id, not staker_id
Also, update LeaderScheduler's code to use node_id as well.
Unfortuntely, no unit tests for this, because there's currently
only one way to set staker_id/node_id, and they are both set
to the same value.
2019-02-24 07:52:44 -07:00
a1070e9572 Split ActiveStakers over Bank and LeaderScheduler 2019-02-24 07:52:44 -07:00
f89e83ae49 Delete redundant code 2019-02-23 16:09:00 -08:00
264f502ed7 Query the bank for the current slot leader 2019-02-23 15:51:37 -07:00
c5876ddca9 Make LeaderScheduler::new_with_window_len private
It's useful for unit-testing, but generally isn't a variable
validators should be modifying. Blockstream and BlockstreamService
were the only ones using it. Switching them from a hard-coded 10
to the default didn't cause any test failures, so running with it.
2019-02-23 14:48:27 -07:00
fdf6cae6fb Use bank for leader scheduler's config
This ensures GenesisBlock is always configured with the same
ticks_per_slot as LeaderScheduler. This will make it easier
to migrate to bank-generated schedules.
2019-02-23 14:48:27 -07:00
d26f836212 tmp_copy_ledger -> tmp_copy_blocktree 2019-02-23 08:32:05 -07:00
da98982732 Deprecate tmp_copy_ledger
This should allow us to get rid of all the manual routing of
ticks_per_slot in the test suite.
2019-02-23 07:57:45 -07:00
cc10e84ab7 sample_ledger -> sample_blocktree 2019-02-23 07:08:11 -07:00
6cd91cd7ec Hold slots_per_epoch, not ticks_per_epoch
Same as bank and less invariants to check
2019-02-22 22:02:23 -07:00
e19dbdc527 Use Bank for ticks_per_slot 2019-02-22 22:02:23 -07:00
0b8809da6e Fix duplicated path to fullnode
Fixes flaky tests.
2019-02-22 16:35:40 -08:00
35aefdf1db Reduce test noise (#2907) 2019-02-22 16:27:19 -08:00
66891d9d4e Don't use global storage account
Other accounts would not be able to modify the system accounts userdata.
2019-02-22 15:59:55 -08:00
6bca577d6d Bump libc from 0.2.48 to 0.2.49
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.48 to 0.2.49.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-02-22 16:45:14 -07:00
f5400ccefc Ignore storage test
@sakridge is working on a fix.
2019-02-22 16:18:10 -07:00
a56d717ea8 Add a check that shows why the storage program is failing 2019-02-22 16:18:10 -07:00
11c7aab023 Add some unit-tests 2019-02-22 16:18:10 -07:00
5541eedcc4 Reject modifications to userdata if not owned by the program 2019-02-22 16:18:10 -07:00
77ea4cd285 Reapply dependency Band-aid to make CI happy 2019-02-22 15:56:07 -07:00
8353b420d1 Move blocktree-oriented diagram out of proposals 2019-02-22 15:24:36 -07:00
71602fe04b Fix root package dependencies (#2899) 2019-02-22 14:08:25 -08:00
054c12ea0f Bump hex-literal from 0.1.2 to 0.1.3
Bumps [hex-literal](https://github.com/RustCrypto/utils) from 0.1.2 to 0.1.3.
- [Release notes](https://github.com/RustCrypto/utils/releases)
- [Commits](https://github.com/RustCrypto/utils/compare/hex-literal-v0.1.2...hex-literal-v0.1.3)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-02-22 13:47:55 -07:00
0003dbf3ba remove unnecessary imports 2019-02-22 12:13:05 -08:00
c07b6c30a1 Remove special casing of ProgramError in blocktree processor
- Also refactor bank.rs and add unit tests
2019-02-22 12:13:05 -08:00
bad48ce83c Split replicator doc into what is implemented and what is not 2019-02-22 13:12:49 -07:00
2d03ae2fae Migrate fullnode to create_tmp_sample_blocktree 2019-02-22 11:18:01 -07:00
3a7008949f Build all deps (#2896) 2019-02-22 09:49:25 -08:00
973ad7554e Remove superfluous GenesisBlock::load() 2019-02-22 08:41:59 -08:00
3be154490d Deprecate create_tmp_sample_ledger 2019-02-22 00:24:46 -07:00
3610768888 Run featurized tests on sub-packages (#2867) 2019-02-21 22:38:36 -08:00
4602d3bf46 Unit-tests can use ordinary keypairs 2019-02-21 22:01:20 -08:00
778583ad08 Inline BlockConfig::ticks_per_slot 2019-02-21 20:37:21 -08:00
fb904e7a29 Enable CUDA persistence mode to reduce surprises 2019-02-21 19:25:17 -08:00
b501090443 Route BankForks into the ReplayStage 2019-02-21 19:25:17 -08:00
f0f55af35b Add scheduler config to genesis
Anything that affects how the ledger is interpreted needs to be
in the genesis block or someplace on the ledger before later
parts of the ledger are interpreted. We currently don't have an
on-chain program for cluster parameters, so that leaves only
the genesis block option.
2019-02-21 17:29:55 -08:00
3e8d96a95b fix failing tests 2019-02-21 16:35:23 -08:00
9713a3ac02 fix clippy warnings 2019-02-21 16:35:23 -08:00
5c9777970d moved fee collection code to runtime 2019-02-21 16:35:23 -08:00
c142a82ae0 Charge transaction fee even in case of ProgramError 2019-02-21 16:35:23 -08:00
18d48f09f8 Plumb blockstreamer name through testnet scripts 2019-02-21 17:24:29 -07:00
deeabb862d Call it blockstreamer 2019-02-21 17:24:29 -07:00
d8f6865338 Rename EntryStream to Blockstream 2019-02-21 17:24:29 -07:00
4a0c759795 Fix misspellings stumbled on 2019-02-21 17:24:29 -07:00
a131c90260 Add doc for api node 2019-02-21 17:24:29 -07:00
fc48062867 Rename active_window_length to active_window_num_slots 2019-02-21 15:48:13 -08:00
f77788447c Debug for Account
Derive prints the full userdata vec which is questionably useful.
2019-02-21 14:57:32 -08:00
d25fc7a649 Stop passing blob_index unnecessarily into ReplayStage 2019-02-21 15:33:01 -07:00
bf3d2bd2ec Update Gossip entry in the book 2019-02-21 15:32:21 -07:00
60a6ff80ee Change votes and associated test/helper functions to vote based on slot height 2019-02-21 15:31:53 -07:00
9e1c5e1ab0 switch vote program to use slot height instead of tick height, change confirmation computation to use slots 2019-02-21 15:31:53 -07:00
20fffd8abf Delete BankForks::finalized_bank() 2019-02-21 13:21:08 -08:00
98ed785711 Cargo.lock 2019-02-21 13:00:19 -08:00
7cb695df12 RetransmitStage now gets a BankForks 2019-02-21 12:56:56 -08:00
c94bc2a0b6 Remove dead code 2019-02-21 12:38:43 -08:00
511085b747 Make trait pub 2019-02-21 13:32:25 -07:00
f76ac94d70 Remove leader_schedule_offset public method
Also,

* Rename the private variable to include units.
* Better doc
2019-02-21 12:28:11 -08:00
32caa55d67 Offer a way to get the leader_schedule from any Bank instance 2019-02-21 12:28:11 -08:00
b69475937f Program tests depend on native/noop (#2873) 2019-02-21 12:22:55 -08:00
f6ff33db8e * add merge_parents(), which means 'eat your parent' (#2851)
* add is_root(), which is false if the bank has a parent
* use is_root() for store_slow and store_accounts to decide whether to purge on zero balance
2019-02-21 12:08:50 -08:00
dcf1200d2a Make Fullnode do less work on rotation, ReplayStage can just pass along more details 2019-02-21 11:13:06 -08:00
40977fa99f More forward-looking test 2019-02-21 10:54:25 -07:00
f4df8ff5b3 Add slot_height() and epoch_height() methods to Bank 2019-02-21 10:54:25 -07:00
080db1c62d Plumb BankForks into GossipService 2019-02-20 22:19:51 -08:00
4d5e2c8a4d Plumb BankForks into RPC subsystem 2019-02-20 21:46:48 -08:00
13d018e3e1 Fix stake selection for the Data Plane (#2863)
* Update data-plane to use stakes instead of a bank directly

* Rename get_stakes to staked_nodes
2019-02-20 21:38:16 -08:00
59ee2b8892 Fullnode now holds a BankForks instead of a Bank 2019-02-20 21:13:04 -08:00
0dde79f42b Push BankForks into Fullnode::new() 2019-02-20 21:13:04 -08:00
a4411ef6a1 Generate a schedule from a bank 2019-02-20 20:33:33 -08:00
3c62e2332e Cleanup stakes for gossip (#2860) 2019-02-20 20:02:47 -08:00
1cd88968cf Remove get_leader_for_next_tick() 2019-02-20 19:33:03 -08:00
28a53959e0 Remove dead types 2019-02-20 18:39:32 -08:00
7c26a4d0a0 Add weighted sampling based on stakes (#2854)
* Add weighted sampling based on stakes
2019-02-20 18:21:08 -08:00
6ed2e4c187 process_blocktree now loads forks 2019-02-20 17:27:02 -08:00
a484c87354 Make gossip selection stake based (#2848) 2019-02-20 17:08:56 -08:00
33c7f92f56 Dial down CI timeouts 2019-02-20 16:43:13 -08:00
b8f6280fe5 Move hash_internal_state tests into runtime
This was intended as a Bank test, but only in blocktree_processor
because of its dependency on Entry, which solana_runtime doesn't
know about.
2019-02-20 16:13:26 -08:00
822bebea46 Allow multiple forks without regenerating the hash 2019-02-20 16:13:26 -08:00
582a7192ec Hold Bank's own parent hash instead of the parent's 2019-02-20 16:13:26 -08:00
5492aad61e Cache ticks until a working bank can pick them up 2019-02-20 14:14:38 -08:00
27f973c923 github review 2019-02-20 14:19:25 -07:00
3357cebcdb Added notes from discussion on discord 2019-02-20 14:19:25 -07:00
7ce9c0a2e9 cleanup runtime chapter 2019-02-20 14:18:43 -07:00
e9daf57d7f Absorb LeaderScheduler's rank_active_set()
Delete overly-complicated tests
2019-02-20 13:13:31 -07:00
1c2169aec7 Use rank_stakes() in LeaderScheduler 2019-02-20 13:13:31 -07:00
cf163a9dab Remove unutilized cuteness 2019-02-20 13:13:31 -07:00
dfcf3f94dc Absorb LeaderScheduler::get_active_set()
No functional changes
2019-02-20 13:13:31 -07:00
b13fb6097f Get rid of the HashSet special case
ActiveSet ranks on construction. get_active_set() is on its way out.
This is a stepping stone.
2019-02-20 13:13:31 -07:00
6e24a4aa50 Less copy pasta 2019-02-20 13:13:31 -07:00
fb1c6cf4da Drop a bunch of dependencies on VotingKeypair
And de-Arc
2019-02-20 13:13:31 -07:00
af1b8f8a26 Absorb vote utilities
But drop dependency on VotingKeypair. Only pass in VotingKeypair
in VotingKeypair tests or integration tests.
2019-02-20 13:13:31 -07:00
88d6db8537 And ranking and simplify 2019-02-20 13:13:31 -07:00
6ce2c06fd6 Add primitive ActiveStakers and LeaderSchedule objects 2019-02-20 13:13:31 -07:00
136f7e4b3b Update test to validate entry height 2019-02-20 11:42:06 -07:00
0a73bb7efd Add tick-height field to entry event payload 2019-02-20 11:42:06 -07:00
2cf00021d9 Update golden hash to account for tick_height removal 2019-02-20 07:47:04 -08:00
8d38c2f800 Remove Entry::tick_height field 2019-02-20 07:47:04 -08:00
9848de6cda Remove special case in Bank::deposit()
And use it to process the genesis block.
2019-02-20 08:12:37 -07:00
19a3606315 Fix broken test, added some tests to calculate tx fee
Some code cleanup
2019-02-20 08:12:37 -07:00
cc2227d943 rename slot_num 2019-02-20 08:12:37 -07:00
a33921ed34 address review comments 2019-02-20 08:12:37 -07:00
2e75ff27ac Fix test 2019-02-20 08:12:37 -07:00
a27cdf55e7 Credit transaction fees to the slot leader 2019-02-20 08:12:37 -07:00
3d00992c95 Remove dependency on Entry::tick_height 2019-02-20 06:57:38 -08:00
77cb70dd80 Remove dependency on Entry::tick_height 2019-02-19 22:40:10 -08:00
8daba3e563 Add test demonstrating that process_blocktree()'s implementation is lacking 2019-02-19 20:37:06 -08:00
94f9ac0332 DRY up GenesisBlock 2019-02-19 20:34:58 -08:00
a17903a89f Tweak process_blocktree() signature to return a BankForks 2019-02-19 20:01:22 -08:00
dda0a1f39b Move storage tests out of Bank 2019-02-19 17:26:33 -07:00
0ef670a865 Move sender out of poh_recorder (#2837) 2019-02-19 16:22:33 -08:00
04f54655c2 Minor cleanup 2019-02-19 15:53:31 -08:00
dc5590f2bf unuse std (#2833) 2019-02-19 15:27:07 -08:00
bc52fce810 Fix the custom programs command in net.sh 2019-02-19 13:53:43 -07:00
b9bb92099e Go object-oriented
Easy to imagine a trait here that's implemented using a Bank or
a testnet.
2019-02-19 10:59:06 -07:00
64dcc31ac7 Migrate Rewards test from runtime to Bank 2019-02-19 10:59:06 -07:00
36546b4c4c Expose a Bank API for adding native programs
Also use it to tighten up the code to add the builtin programs.
2019-02-19 10:20:27 -07:00
dde886f058 Move Bank to its own crate
Also:
* counters.rs to solana_metrics
* genesis_block.rs to solana_sdk
2019-02-19 07:17:04 -07:00
781f7ef570 fix test_repair_empty_slot 2019-02-18 23:38:28 -08:00
3e8bb32ffd Add test for write_entries() 2019-02-18 23:38:28 -08:00
df310641fb Re-enable and add tests 2019-02-18 23:38:28 -08:00
21ef55f205 re-enable repair service tests 2019-02-18 23:38:28 -08:00
ade36566ea i 2019-02-18 21:56:23 -08:00
08d7a0d52d Upgrade to Rust 1.32.0
$ rustup update stable
2019-02-18 21:44:09 -07:00
1fd2885995 Add missing - 2019-02-18 20:09:18 -08:00
d357640fbf Centralize decentralized timing constants 2019-02-18 19:46:58 -08:00
ad9cd23202 Notify subscribers from ReplayStage 2019-02-18 20:04:30 -07:00
5916177dc8 Drop RpcPubSubService's dependency on the Bank
Pass in RpcSubscriptions instead, which let's you choose a
bank fork when it's time to send notifications.
2019-02-18 20:04:30 -07:00
905b1e2775 Add notify_subscribers() 2019-02-18 20:04:30 -07:00
377d45c9dd Pull RpcSubscriptions out of the Bank 2019-02-18 20:04:30 -07:00
a444cac2aa Switch to upstream AMIs for non-CUDA EC2 testnets 2019-02-18 18:59:56 -08:00
1e714eb6b2 Generate ec2 security group programmatically 2019-02-18 18:59:56 -08:00
3f14466965 Limit blockexplorer versions to 1.x.y
Per semver semantics when blockexplorer 2.0.0 is released it will be
incompatible in some way with 1.x.y and thus should be opt in.
2019-02-18 16:48:33 -08:00
e0b8f4202d Use slot height for BankForks ids 2019-02-18 17:27:20 -07:00
11b14bd3ab Bump reqwest from 0.9.9 to 0.9.10
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.9.9 to 0.9.10.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.9.9...v0.9.10)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-02-18 13:28:55 -07:00
90684483e2 Make Bank::hash_internal_state() work with checkpoints 2019-02-18 12:47:10 -07:00
760a82cb08 Add optional deploy of custom programs (#2817)
* Add optional deploy of custom programs

* Review comments
2019-02-18 11:43:36 -07:00
0317583489 Move avalanche logic to ClusterInfo
The simulator doesn't depend on RetransmitStage. It depends on
just one function, which is similar in spirit to many of the
methods in ClusterInfo.
2019-02-18 09:08:18 -08:00
1c3f2bba6d Move avalanche simulator to integration tests 2019-02-18 09:08:18 -08:00
7d62bf9a3d Move crds_gossip simulator to integration tests 2019-02-18 09:55:52 -07:00
7c248cd2ef Move expensive test to integration tests
This test passes consistently when the test suite is run with a
single thread. It fails consistently on MacOS when run as part
of the unit-test suite.

No idea why it passes in CI.
2019-02-18 09:27:23 -07:00
e4119268ca Delete expensive integration test in unit-test suite 2019-02-18 09:27:09 -07:00
fc2760e761 Remove bank dependency from poh_recorder (#2810)
* Remove bank dependency from poh_recorder

* clippy
2019-02-18 06:33:07 -08:00
c57084de36 Ignore test_two_fullnodes_rotate integration tests 2019-02-18 06:19:46 -08:00
907aff3b43 Cleanup Poh code 2019-02-17 21:12:55 -07:00
2793404116 Ensure blockexplorer comes back up when nodes are updated instead of restarted 2019-02-17 20:07:12 -08:00
d850f67979 Remove 'Compute' from name ComputeLeaderConfirmationService
struct names should be a noun
2019-02-17 19:44:09 -08:00
8080063024 nit 2019-02-17 19:30:45 -07:00
f33c6eb95f delete leader rotation signal from banking stage 2019-02-17 19:30:45 -07:00
4e3d71c2c9 Batch joins on entire tpumode struct instead of individual services 2019-02-17 19:30:23 -07:00
a074cb78cd Ensure leader services are closed before starting new ones 2019-02-17 19:30:23 -07:00
0dbc33f781 Finish removing getConfirmationTime 2019-02-17 16:27:50 -08:00
25bbc3bc2a wrong error 2019-02-17 15:43:13 -08:00
5f55a9be84 fmt 2019-02-17 15:43:13 -08:00
300e3d151d remove the signal sender since its superfelous to a recv error 2019-02-17 15:43:13 -08:00
2f7911b62a Boot BankError::MaxHeightReached 2019-02-17 16:30:01 -07:00
54dfe708c1 use ref for new_from_parent; test that transactions don't leak to parent 2019-02-17 15:02:08 -07:00
8166925f04 copy a new bank 2019-02-17 15:02:08 -07:00
64f1d93cc3 Use the accounts list from parents up to finalized bank for Account::load apis.
Borrow checker

query the previous parents accounts

cleanup!

s/tree/parents

Tests!  Last_ids need to be inherited as well otherwise nothing works.

new_from_parent
2019-02-17 15:02:08 -07:00
6d67568037 Delete useless wrappers 2019-02-17 14:10:34 -07:00
5003e97479 Inline private functions
Better code coverage in exchange for calling `create_session()`
2019-02-17 14:10:34 -07:00
858068cdc0 Drop sudo, it's now handled internally by the block explorer 2019-02-17 12:29:53 -08:00
65fb307d0f Avoid '' argument to fullnode.sh 2019-02-17 11:43:41 -08:00
2f1fe726f5 Expand imports
tokio is a heavy dependency. This gives us some visibility into
what we're using.
2019-02-17 12:20:05 -07:00
e9b0e3cb9d Move RpcSignatureStatus into its own module
And fixup some imports from previous commits.
2019-02-17 12:20:05 -07:00
34fceca7ff Fix compiler warnings 2019-02-17 12:20:05 -07:00
c646845cd3 Move RpcService into its own module 2019-02-17 12:20:05 -07:00
eb483bc053 Move RpcPubSubService into its own module 2019-02-17 12:20:05 -07:00
50d3fa7437 Move RpcSubscriptions into its own module 2019-02-17 12:20:05 -07:00
9f7fc5f054 Boot unused trait
Some ambitious unit-testing plans unimplemented?
2019-02-17 12:20:05 -07:00
a27e9cb3c2 Add -u option 2019-02-17 10:45:25 -08:00
10270dcbad Add an API node to non-perf testnets 2019-02-17 10:39:27 -08:00
4ff4fb6c38 Add support for an API node that hosts the block explorer 2019-02-17 10:39:27 -08:00
c8c794e340 Use the accounts and status cache from parents up to finalized bank for calls. (#2798)
* Use the accounts list from parents up to finalized bank for Account::load apis.

* Borrow checker

* query the previous parents accounts

* cleanup!

* s/tree/parents

* Tests!  Last_ids need to be inherited as well otherwise nothing works.
2019-02-17 08:01:31 -08:00
97a1e950ef write entries in blocktree now sets parent slot properly (#2800) 2019-02-17 04:36:49 -08:00
9fa8105ae8 Add a way to make a DAG of checkpointed Banks 2019-02-16 21:49:06 -07:00
d68b6ea7b1 Default entry stream socket to location used by the block explorer 2019-02-16 19:14:19 -08:00
58f4709362 Reduce log severity of entry stream errors 2019-02-16 19:10:00 -08:00
f71cd2c6f3 Status cache runs out of space in the bloom filter (#2796)
The cache is designed for 1m statuses, about 1 second worth of transactions at full capacity. Refresh the cache every 1 second worth of ticks.
2019-02-16 16:41:03 -08:00
8ec1f6ea2e Applied review feedback 2019-02-16 17:15:31 -07:00
d63c8ae1ae Add PR guidelines 2019-02-16 17:15:31 -07:00
e39094ac37 Hoist Slot Leader dependencies up to BankingStage 2019-02-16 15:36:31 -07:00
b539389741 Move all Validator dependencies from Bank to blocktree_processor 2019-02-16 15:01:26 -07:00
ac35fe9ed1 Flip the dependency; Create bank before scheduler 2019-02-16 14:16:48 -07:00
3d70afc578 Boot leader scheduler from the bank
Functional change: the leader scheduler is no longer implicitly
updated by PohRecorder via register_tick(). That's intended to
be a "feature" (crossing fingers).
2019-02-16 14:16:48 -07:00
b919b3e3b2 Bank no longer updates a leader scheduler by default 2019-02-16 14:16:48 -07:00
7a7349f2ff Don't update the leader scheduler in bank's default constructor 2019-02-16 14:16:48 -07:00
07b57735b1 Move leader scheduler test out of bank 2019-02-16 14:16:48 -07:00
e42c95a327 Bump bincode from 1.1.1 to 1.1.2
Bumps [bincode](https://github.com/TyOverby/bincode) from 1.1.1 to 1.1.2.
- [Release notes](https://github.com/TyOverby/bincode/releases)
- [Commits](https://github.com/TyOverby/bincode/compare/v1.1.1...v1.1.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-02-16 13:58:37 -07:00
473af78368 Support --entry-stream argument 2019-02-16 10:40:47 -08:00
ab6c7f6ca3 /it/ti/ 2019-02-16 10:40:47 -08:00
599516473a Add top-level run.sh for easy local cluster startup 2019-02-16 10:40:47 -08:00
83ac075b22 Use full app name for better cli help text 2019-02-16 10:40:47 -08:00
3548c6c43a Add support for locally built programs 2019-02-16 10:40:47 -08:00
3bfe2e75b5 Boot new_with_leader_scheduler_config
Only used in one place. Easy enough to use the one with the shared
leader scheduler.
2019-02-16 10:55:58 -07:00
97c93629a5 Don't use the Bank's LeaderScheduler 2019-02-16 10:55:58 -07:00
643384e1ec Add LeaderScheduler constructor to Bank
By passing a config and not a Arc'ed LeaderScheduler, callers
need to use `Bank::leader_scheduler` to access the scheduler.
By using the new constructor, there should be no incentive to
reach into the bank for that object.
2019-02-16 10:55:58 -07:00
1809277e05 Encapsulate Bank accounts
That way we don't need to TODOs saying "don't forget to iterate
over checkpoints too". It should be assumed that when the bank
references its previous checkpoint all its methods would
acknowledge it.
2019-02-16 08:41:35 -07:00
7981865fd2 Boot unused confirmation-time from Bank
This broken metric is already submitted to influx. Why make it
available via RPC too? If so, why store it in the bank and not
in the RPC service?
2019-02-16 08:11:43 -07:00
4467d5eb4c Extract process_ledger from Bank
Fullnode was the only real consumer of process_ledger and it was
only there to process a Blocktree. Blocktree is a tree, and a
ledger is a sequence, so something's clearly not right here.
Drop all other dependencies on process_ledger (only one test) so
that it can be fixed up in isolation.
2019-02-16 08:07:26 -07:00
38aed0c886 Bump serde_derive from 1.0.87 to 1.0.88
Bumps [serde_derive](https://github.com/serde-rs/serde) from 1.0.87 to 1.0.88.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.87...v1.0.88)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-02-16 04:57:32 -08:00
02801b3e75 Bump serde from 1.0.87 to 1.0.88
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.87 to 1.0.88.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.87...v1.0.88)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-02-16 05:02:10 -07:00
b79d361e6c Add --entry-stream support 2019-02-15 22:52:27 -08:00
9eb8b67b5c Install blockexplorer dependencies 2019-02-15 20:17:46 -08:00
132c664e18 No longer modify external userdata 2019-02-15 18:36:55 -07:00
288645aeb7 Add rewards integration test 2019-02-15 18:36:55 -07:00
55f06f5bad Make vote_program available to reward_program tests
Making `solana_vote_program` is not an option because
then vote_program's entrypoint conflicts with reward_program's
entrypoint.

This unfortunately turns the SDK into a dumping ground for all
things shared between vote_program and other programs. Better
would be to create a solana-vote-api crate similar to the
solana-rewards-api crate.
2019-02-15 18:36:55 -07:00
a2cb18bfe9 Only require voting account to be signed 2019-02-15 18:36:55 -07:00
d35b3754a2 Reorg
Now clients can use all the libraries to create transactions
and disect account data without needing to be constrained about
what can be compiled into a shared object or BPF.

Likewise, program development can move forward without being
concerned with bloating the shared object.
2019-02-15 18:36:55 -07:00
7f3aca15dd Add a library for creating Rewards transactions
And move out of the SDK
2019-02-15 18:36:55 -07:00
2c5cbaff25 Add unit-test for Rewards program 2019-02-15 18:36:55 -07:00
134cd7ab04 Add Rewards program 2019-02-15 18:36:55 -07:00
c74b8b6df3 Add a design for leader schedule rotation and genesis. (#2714)
Leader schedule rotation.
2019-02-15 16:34:34 -08:00
573116e259 Remove count_last_ids API 2019-02-15 11:05:41 -08:00
71ab030ea4 Fiddle with timeouts to make CI happy 2019-02-14 18:40:31 -08:00
c4125b80ec Reduce max_tick_height to speed up CI 2019-02-14 18:40:31 -08:00
626a381ddc Collect and re-forward packets received while TpuForwarder is shutting down 2019-02-14 18:40:31 -08:00
5333bda234 test_3_partitions is unstable, ignore 2019-02-14 17:30:42 -08:00
cceeb8e52d On leader rotation forward any unprocessed transaction packets to the new leader 2019-02-14 14:49:48 -08:00
94a0d10499 Avoid overrunning slot0 2019-02-14 14:49:48 -08:00
3f6aba23dd Add custom BlocktreeConfig for bad tests that break with the default 2019-02-14 14:49:48 -08:00
cd9dac4c7e Use a reasonable max_tick_height 2019-02-14 14:49:48 -08:00
f478894729 Revert "Set DEFAULT_TICKS_PER_SLOT = 32 to stabilize integration tests"
This reverts commit 2d2572d2cb.
2019-02-14 14:49:48 -08:00
97790480c9 Increase poll_for_signature retry timeout 2019-02-14 14:49:48 -08:00
9643c39bf6 Fix slot in block event 2019-02-14 14:25:54 -08:00
0a08d40237 fix repair service to support multinode tests that depend on repairs 2019-02-14 13:37:55 -08:00
d029997aef add parent slot to broadcast 2019-02-14 13:37:55 -08:00
ceb27b431e Add tree test to test multiple chaining children 2019-02-14 13:37:55 -08:00
d3761c2435 Change definitions in book to match current changes 2019-02-14 13:37:55 -08:00
b25d8ce764 Comment out repair service tests, to be fixed in another PR 2019-02-14 13:37:55 -08:00
34da362ee6 fix blocktree tests 2019-02-14 13:37:55 -08:00
de6109c599 replace num_blocks with parent block 2019-02-14 13:37:55 -08:00
736f08815e Add protocol request for requesting the highest blob in a slot (#2759) 2019-02-14 12:47:21 -08:00
106645d9bd add message terminator (newline) to socket writer output to ease client integration 2019-02-14 12:27:53 -08:00
c55ada2f26 Fix wallet test 2019-02-14 13:26:46 -07:00
4e4a1643c4 Boot SystemInstruction::Spawn 2019-02-14 13:26:46 -07:00
e1e84d4465 Don't reassign owner in Spawn 2019-02-14 13:26:46 -07:00
4a0009365e Use Account::owner as loader for executable accounts 2019-02-14 13:26:46 -07:00
3849b8ece4 Bump bincode from 1.0.1 to 1.1.1 (#2709)
* Bump bincode from 1.0.1 to 1.1.1

Bumps [bincode](https://github.com/TyOverby/bincode) from 1.0.1 to 1.1.1.
- [Release notes](https://github.com/TyOverby/bincode/releases)
- [Commits](https://github.com/TyOverby/bincode/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* update autocfg 0.1.1 => 0.1.2
2019-02-14 12:46:22 -06:00
f2ab8f17c8 udpate staking section 2019-02-14 07:45:58 -07:00
48671a1728 Let native_loader own native executable accounts 2019-02-13 20:55:36 -08:00
72b6ec4aa8 Add native program account constructor 2019-02-13 20:55:36 -08:00
8790a92f07 Adjust create_counter to avoid imposing an AtomicUsize import on users 2019-02-13 20:24:04 -08:00
0f8ff07b51 tpu now hangs on to its cluster_info 2019-02-13 16:16:18 -08:00
dca73068c5 address review comments 2019-02-13 15:31:45 -08:00
4094e62ed3 propose architecture change for fullnode 2019-02-13 15:31:45 -08:00
7a0e897960 address review comments 2019-02-13 15:31:45 -08:00
e78fc74e03 Update fullnode diagram to reflect bank, voting and forks changes 2019-02-13 15:31:45 -08:00
5054e74f7f update to edge book 2019-02-13 14:08:19 -07:00
72e6a39172 Fix the link to proposals chapter in the CONTRIBUTING guidelines 2019-02-13 14:08:19 -07:00
be73db13e0 Improve EntryStream trait and struct names 2019-02-13 13:07:30 -08:00
cbaba5cbf3 Review comments 2019-02-13 13:07:30 -08:00
c1447b2695 Add block event logic to EntryStreamStage 2019-02-13 13:07:30 -08:00
e58f08b60f Refactor EntryStream
Co-authored-by: Sunny Gleason <sunny.gleason@gmail.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
2019-02-13 13:07:30 -08:00
662d62f561 Always assert on the main test thread to abort quickly 2019-02-13 12:54:06 -08:00
cf4813a1ec Add tests to transact with a cluster rotating at 1 tick per slot 2019-02-13 12:54:06 -08:00
b03636dc33 Bolster test_fullnode_rotate() checks 2019-02-13 12:54:06 -08:00
6187779d10 Wait for monitor threads to exit before Blocktree destruction 2019-02-13 12:54:06 -08:00
ddc8bfed29 Fix bad window_send_test channel logic
Test could hang if the blobs are not sent in the right order.
2019-02-13 11:23:54 -08:00
f1221d724d Consolidate logic with entry helper function
Creates an entry and updates the hash.
Also cleanup blobs creation in test_replay
2019-02-13 11:23:54 -08:00
aec44e3761 Add design for the leader validator loop (#2650) 2019-02-13 12:00:43 -07:00
aed07f0f48 Bump jsonrpc-derive from 10.0.2 to 10.1.0 (#2748)
* Bump jsonrpc-derive from 10.0.2 to 10.1.0

Bumps [jsonrpc-derive](https://github.com/paritytech/jsonrpc) from 10.0.2 to 10.1.0.
- [Release notes](https://github.com/paritytech/jsonrpc/releases)
- [Commits](https://github.com/paritytech/jsonrpc/compare/v10.0.2...v10.1.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* Bump version for all jsonrpc crates; remove pubsub dependency in vote-signer
2019-02-13 10:44:22 -07:00
c178fc7249 Rewrite get_votes()
Panic if deserialize fails.
2019-02-13 10:05:28 -07:00
41554f433b Fix VoteTransaction::get_votes() 2019-02-13 10:05:28 -07:00
863956d09c Add multinode test for two nodes rotating at 1 tick per slot 2019-02-12 21:17:06 -08:00
7118178e2c Correctly compute max_tick_height when starting up a node 2019-02-12 21:17:06 -08:00
1eabe66c85 setup_leader_validator: remove unnecessary ticks_per_slot parameter 2019-02-12 21:17:06 -08:00
2de0a9e453 Log on bogus blobs 2019-02-12 21:17:06 -08:00
0bb6940c1a Faster exit for storage_stage client
Shorten the timeout and check for exit on every iteration
of fetching a last id.
2019-02-12 20:45:22 -08:00
e341b33f21 Remove ticks_per_slot from Blocktree::write_entries(), it already knows 2019-02-12 15:52:27 -08:00
6abdd6401d clippy: passing BlocktreeConfig by ref is ok 2019-02-12 15:52:27 -08:00
6632c7026d Pass a BlocktreeConfig into all ledger helper functions 2019-02-12 15:52:27 -08:00
c474cf1eef Pass BlocktreeConfig around as a reference 2019-02-12 15:52:27 -08:00
e26cd2eb26 Make Genesis block handle extra tokens for the leader (#2743) 2019-02-12 15:49:23 -08:00
b33becabca rename flag 2019-02-12 15:06:52 -08:00
3c8a8640aa restructure test_broadcast_last_tick test to check for is_last_blob 2019-02-12 15:06:52 -08:00
a1b5ea9cb1 test for is_last_blob at end of broadcast 2019-02-12 15:06:52 -08:00
bc162637a6 Add is_last_blob flag to blob to signal the end of a slot 2019-02-12 15:06:52 -08:00
8f1b7c3fff Enable test_replay (#2741)
* Enable test_replay

* Refactor get_last_id

* Fix test ledger path
2019-02-12 15:03:11 -08:00
be71f49d80 Change write_entries() and create_tmp_ledger() to take ticks_per_slot (#2736)
* Change write_entries() and create_tmp_ledger() to take ticks_per_slot

* PR nits
2019-02-12 13:14:33 -08:00
8b39eb5e4e Replace Blob Ids with Forward property (#2734)
* Replace Blob Id with Blob forwarding

* Update simulation to properly propagate blobs
2019-02-12 10:56:48 -08:00
1173cf7ed4 review comments 2019-02-12 08:41:02 -08:00
b4fd141105 fix broken test 2019-02-12 08:41:02 -08:00
0002b5dd02 Write to ledger in BroadcastService
- Also disconnect the channel between TPU and TVU
2019-02-12 08:41:02 -08:00
709598541f Remove stale TODO comment 2019-02-11 22:13:07 -08:00
aa781811af Add mulitnode tests demonstrating leader rotation at 1 tick per slot 2019-02-11 19:50:33 -08:00
b595bf8f44 Set blob_index correctly when tick_height is at the last tick of a slot 2019-02-11 19:50:33 -08:00
f6979a090e leader_scheduler: reduce the amount of special case handling for tick_height 0 2019-02-11 19:05:14 -08:00
2e1dcd84f9 Add Avalanche Simulation (#2727)
- No packet drops yet
- Optimistic retransmits without leader-id
2019-02-11 16:20:31 -08:00
144d321193 Remove Box for RPC pubsub subscriptions 2019-02-11 15:47:29 -08:00
d41dec9395 Make EntryStreamStage optional 2019-02-11 14:07:24 -08:00
f977327c7b Move EntryStream into its own Tvu stage 2019-02-11 14:07:24 -08:00
aac1a58651 Try harder to keep LeaderSchedulerConfig and BlocktreeConfig in sync 2019-02-11 13:10:12 -08:00
095afdfe47 Merge leader_to_validator/validator_to_leader 2019-02-11 08:57:44 -08:00
4ae1783b97 Remove code duplication between leader_to_validator/validator_to_leader 2019-02-10 17:53:42 -08:00
cd92adb1c6 Stop sending metrics by default
`source scripts/configure-metrics.sh` can be used at any time to easily
activate metrics if desired for local development and test.
2019-02-10 17:24:45 -08:00
7dec40ff05 slot 0 now contains the same number of ticks as all subsequent slots 2019-02-10 16:34:10 -08:00
4b38ecd916 fix tpu tvu bank race (#2707)
* Fix tpu tvu bank race

* Test highlighting race between tvu and tpu banks during leader to leader transitions
2019-02-10 16:28:52 -08:00
02c0098d57 Less --verbose by default 2019-02-10 10:19:16 -08:00
1e58c585d3 Add retry_get_balance function
clients don't need to know about json
2019-02-10 09:08:16 -08:00
ed4e9febe0 Refactor wallet processing
Yuge functions
2019-02-10 09:08:16 -08:00
1c61415cee Remove stale TODO. #1899 was resolved a while ago 2019-02-09 16:57:46 -08:00
c02625f91a Ban Default::default() 2019-02-09 10:12:32 -08:00
da5b777ee7 Purge Default::default() 2019-02-09 10:12:32 -08:00
a6aaca814c Rename enum Config to enum PohServiceConfig 2019-02-09 10:12:32 -08:00
ab3dd2a1b3 Integrate the blocktree proposal into the book (#2704) 2019-02-08 20:27:35 -07:00
7b7a2fc52b Rename Appendix to API Reference
And move before the proposals, since all this stuff is already
implemented.
2019-02-08 18:08:00 -07:00
95b28d4d8c Move now to after super majority time is calculated
'now' could end up being earlier than the supermajority calculated time.
Leading to underflow errors and thread panic.
2019-02-08 15:53:23 -08:00
1278396bd5 Cleanup consecutive entries code from window_service (#2697)
* Remove returning entries from db_ledger on insert

* Fix tests to check for correctness

* Delete generate_repairs and max_repair_entry_height
2019-02-08 14:19:28 -08:00
0e29868e34 add ticks_left_in_block (#2694)
* add ticks_left_in_block

* de-combine tests
2019-02-08 10:30:14 -08:00
0115a1f834 Remove unused SocketAddr 2019-02-08 10:23:39 -08:00
cf103add54 Remove old Tpu leader rotation shutdown mechanism 2019-02-08 09:07:35 -08:00
766af58cd8 Prune unnecessary test imports 2019-02-08 08:43:11 -08:00
5200435bab Strip unused return type 2019-02-08 08:43:11 -08:00
56734dca3b Align Tpu::new() and Tpu::switch_to_leader() arguments 2019-02-07 21:33:49 -08:00
dbaf8e66ab Remove code duplication 2019-02-07 21:33:49 -08:00
6e7c5f205b Rename db_ledger to blocktree (#2698) 2019-02-07 20:52:39 -08:00
e7df3cfe22 thin_client grooming: remove dead code, improve var names and error reporting 2019-02-07 19:41:58 -08:00
0e8540417f Add get_next_last_id 2019-02-07 19:41:58 -08:00
c3ad0eebec Clean up get_last_id() 2019-02-07 19:41:58 -08:00
c82ffaabdc Rename, purge use of term delta
This would be a fine document to introduce the term delta, but
it looks like the content flows just fine without it.
2019-02-07 16:25:23 -07:00
4e6a9b029a finalized -> frozen 2019-02-07 16:25:23 -07:00
3e519faaa8 Move to 80-char lines 2019-02-07 16:25:23 -07:00
e2eb7c1ba7 Render ASCII art 2019-02-07 16:25:23 -07:00
87ba5b865d Fix markdown 2019-02-07 16:25:23 -07:00
992f2790e7 Cleanup 2019-02-07 16:25:23 -07:00
e1a099632e fork design book 2019-02-07 16:25:23 -07:00
fd7db7a954 Support multiple forks in the ledger (#2277)
* Modify db_ledger to support per_slot metadata, add signal for updates, and add chaining to slots in db_ledger

* Modify replay stage to ask db_ledger for updates based on slots

* Add repair send/receive metrics

* Add repair service, remove old repair code

* Fix tmp_copy_ledger and setup for tests to account for multiple slots and tick limits within slots
2019-02-07 15:10:54 -08:00
5bb4ac9873 Cleanup 2019-02-07 16:09:04 -07:00
31b0d14856 wip, initial explanation on vote signer validator and stake owner relationship 2019-02-07 16:09:04 -07:00
952ab2bde5 Runtime fix 2019-02-07 11:30:05 -08:00
3c6af52a71 Fix pay-to-self Accounts bug (#2682)
* Add failing tests

* Fix tests

* Plumb AccountLoadedTwice error

* Fixup budget cancel actions to not depend on duplicate accounts

* Use has_duplicates

* Update budget-based golden
2019-02-07 12:14:10 -07:00
6317bec7aa Avoid empty --features= arg to avoid unnecessary cargo building 2019-02-07 10:42:57 -08:00
eb3ba5ce2d tmi: disable --verbose by default. | export V=1| to request verbosity 2019-02-07 10:42:57 -08:00
1f0b3f954a leader_scheduler: replace older terminology with ticks, slots and epochs 2019-02-07 10:42:57 -08:00
cdb2a7bef3 Move runtime benchmark 2019-02-07 09:46:06 -08:00
f6515b2b6a Remove top-level dependencies on solana-runtime's dependencies 2019-02-07 09:46:06 -08:00
5128d7d6c3 Move runtime.rs into its own crate 2019-02-07 09:46:06 -08:00
731e5e1291 Boot lua loader
Good fun, but unnecessary and I haven't been updating the rlua
dependency. If someone wants this, it can be developed outside
the solana repo.
2019-02-07 10:25:11 -07:00
cedee73548 Temporarily bump DEFAULT_TICKS_PER_SLOT to 64
See solana-labs/solana#2675
2019-02-07 09:16:43 -08:00
8136d52c0b Whitelist the metrics-solana-com buildkite agent from docker container cleanup 2019-02-07 08:33:53 -08:00
d1945c29d7 Don't depend on solana_native_loader for IDs in the SDK 2019-02-07 08:23:44 -08:00
83b40e4f30 Inline assertions from overreaching helper
The assert_counters() helper creates unreadable tests and makes
us have to update every test any time a counter is added. Instead,
we can just assert the values of any particular counters the test
may have affected.
2019-02-07 08:43:52 -07:00
95ac6305bc Remove unnecessary dependencies on fullnode mod 2019-02-06 21:31:48 -08:00
ab4828aae7 Replace role_notifiers tuple with two explicit fields 2019-02-06 21:31:48 -08:00
c506423e70 Remove superfluous imports 2019-02-06 21:31:48 -08:00
f0843fc5f1 NodeServices: de-pub, remove dead code 2019-02-06 21:31:48 -08:00
c87e035302 Remove multinode test dependency on Fullnode internals 2019-02-06 20:38:22 -08:00
abb9a72b27 Reduce Fullnode public API surface 2019-02-06 20:04:51 -08:00
acc6bf1564 Don't over complicate the solution 2019-02-06 19:55:12 -08:00
db688207a5 Add abort signals to tvu/tpu receivers 2019-02-06 19:55:12 -08:00
9681c4d468 Fix resource hogging when waiting for role transition 2019-02-06 19:55:12 -08:00
d9e2b94d7a bank::new_with_leader_scheduler_config() - remove Option<> 2019-02-06 19:47:09 -08:00
f789038baa Consolidate fullnode ledger helpers 2019-02-06 19:47:09 -08:00
2e23b03f94 Remove dead code 2019-02-06 19:47:09 -08:00
5181a2a9b1 Guard against invalid tick heights 2019-02-06 14:23:10 -08:00
2d2572d2cb Set DEFAULT_TICKS_PER_SLOT = 32 to stabilize integration tests 2019-02-06 14:23:10 -08:00
fa553029d5 Temporarily disable test_validator_to_leader_transition 2019-02-06 14:23:10 -08:00
c986a20bcf Disable unstable test: test_multi_node_dynamic_network 2019-02-06 14:23:10 -08:00
c5a74ada05 leader_scheduler: remove bootstrap_height 2019-02-06 14:23:10 -08:00
73979d8f5a Remove sleep, fund the vote account faster 2019-02-06 14:23:10 -08:00
f90d96367d Add Fullnode::run() to optionally manage node role transitions automatically 2019-02-06 14:23:10 -08:00
5f565c92c9 cargo incremental builds breaks Rust BPF, locally disable it (#2674) 2019-02-06 13:59:10 -08:00
7452486c72 Kill running docker containers left over from a previous job 2019-02-06 13:57:11 -08:00
afdf0efd31 Disable bpf_rust temporarily 2019-02-06 13:31:35 -08:00
7fc271ef97 Bump stable timeout 2019-02-06 13:31:35 -08:00
582ba4f173 Move economics into the proposed changes
Once this is implemented, we'll move it into the "A Solana Cluster"
section.
2019-02-06 09:29:52 -07:00
0229c97071 Move economics images into img/
And flip the exe bit
2019-02-06 09:29:52 -07:00
c0b398c7c9 Fix markdown and typo 2019-02-06 09:29:52 -07:00
549f9676f1 Allow validators to accumulate credits for voting 2019-02-05 14:24:49 -07:00
6248624ee7 Bump jsonrpc-derive from 10.0.1 to 10.0.2
Bumps [jsonrpc-derive](https://github.com/paritytech/jsonrpc) from 10.0.1 to 10.0.2.
- [Release notes](https://github.com/paritytech/jsonrpc/releases)
- [Commits](https://github.com/paritytech/jsonrpc/compare/v10.0.1...v10.0.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-02-05 08:17:25 -07:00
0025d36880 Move solana proper back to paritytech/jsonrpc 2019-02-04 22:17:23 -07:00
4985b682c3 Move vote_signer back to paritytech/jsonrpc 2019-02-04 22:17:23 -07:00
85333c5d62 Bump serde_derive from 1.0.85 to 1.0.87
Bumps [serde_derive](https://github.com/serde-rs/serde) from 1.0.85 to 1.0.87.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.85...v1.0.87)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-02-04 17:07:01 -07:00
3feda8a315 ReplayStage asking ledger for updates (#2597)
* Modify replay stage to ask db_ledger for updates instead of reading from upstream channel

* Add signal for db_ledger to update listeners about updates

* fix flaky test
2019-02-04 15:33:43 -08:00
5375c420c1 headers style have been adjusted 2019-02-04 14:25:26 -07:00
ac9f6a77c9 Fix compilation errors due to missing "features" section in Cargo.toml
- e.g. breaks in compilations during testnet deployment with Cuda enabled
2019-02-04 11:30:40 -08:00
58f4e0653a Updates to edge testnet dashboard
- Update leader/validator pipeline stage graph, as any node can be
  doing either of the roles
- Update network stats graphs to remove hostname based filtering
2019-02-04 11:08:39 -08:00
03e6a56b3c Add datetime to EntryStream message 2019-02-04 11:03:54 -08:00
32f19c5c19 Bump serde from 1.0.85 to 1.0.87
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.85 to 1.0.87.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.85...v1.0.87)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-02-04 09:08:09 -07:00
98e893c69b Avoid empty --features= arg to avoid unnecessary cargo building 2019-02-02 20:08:49 -08:00
fea480526b Add macOS tip 2019-02-02 20:08:49 -08:00
4aa6695a13 source ulimit-n.sh so it applies to the current shell 2019-02-02 20:08:49 -08:00
a7e5423ede Set ulimit -n 2019-02-02 20:08:49 -08:00
3ff8bbcf65 Cleanup economic design (#2649)
* Remove section numbers
* Fix all hyperlinks
* Add detail on protocol-designated minimum tx fee amount
2019-02-02 18:35:18 -08:00
9d34ded5f3 Update and fix test_broadcast_last_tick (#2644) 2019-02-01 17:13:15 -08:00
511d8275d6 Document current vote program semantics
And add a new 'staker_id' VoteState member variable to offer a path to
work our way out.  Update leader scheduler to use staker_id, but
continue setting it to 'from_id' for the moment.

No functional changes here.
2019-02-01 16:03:46 -08:00
0a9226ec8e Use voting helper 2019-02-01 16:03:46 -08:00
9c07a8c26a VoteProgram -> VoteState 2019-02-01 16:03:46 -08:00
6058bfb687 Simplify voting helpers 2019-02-01 16:03:46 -08:00
7a6d730db3 Skip retransmit when node is leader (#2625)
* Skip retransmit when node is leader

* Fix window test
2019-02-01 14:30:26 -08:00
2985988f0d Re-enable test_broadcast_last_tick (#2639) 2019-02-01 14:23:20 -08:00
d62c9ac309 Create program/ crate avoid / crate dependency on bpfloader
The bpfloader crate was triggering cargo to perform excessive rebuilds
of in-workspace dependencies.  Unclear why exactly, but seems related to
the special dual crate-type employed by bpfloader.
2019-02-01 12:42:46 -08:00
85c8af08b3 Link dangling program cuda features to the src/ crate 2019-02-01 12:42:46 -08:00
21c09073a1 Add help script to easily run all integration tests 2019-02-01 12:42:46 -08:00
40acaee446 Remove unnecessary abstractions and helper functions 2019-02-01 12:42:46 -08:00
d9a22705ce Broadcast Service should handle SendError
- After TVU shuts down, the brroadcast service will get a SendError
  when it tries to send blobs to it
2019-02-01 12:28:00 -08:00
dad0bfe447 Replace transaction traits with structs
Also:
* SystemTransaction::new -> new_account
* SystemTransaction::new_create -> new_program_account
2019-02-01 11:38:25 -08:00
1b3e7f734a Update solana-vote-signer to Rust 2018 2019-02-01 12:12:26 -07:00
0e58023794 Bump serde_json from 1.0.37 to 1.0.38
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.37 to 1.0.38.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.37...v1.0.38)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-02-01 10:06:21 -07:00
4fb9c8a547 Bump timeout 2019-02-01 07:11:17 -08:00
43cce3a8fc speling 2019-02-01 07:11:17 -08:00
344427c1dc Update to rust nightly 2019-01-31 2019-02-01 07:11:17 -08:00
82a2080e45 Rename VoteSignerProxy to VotingKeypair
Works just like a normal Keypair, but will only sign voting
transactions.
2019-02-01 07:11:17 -07:00
9a4abe96c7 Reduce VoteSignerProxy to KeypairUtil 2019-02-01 07:11:17 -07:00
d87c2eb903 Fullnode::new() - provide FullnodeConfig as a ref 2019-01-31 21:12:36 -08:00
65708f234d Remove unused import 2019-01-31 21:12:36 -08:00
b6b179af97 Fix bad merge 2019-01-31 20:15:04 -08:00
37003da854 Fix potential of checking tvu bank for truth when its behind (#2614)
* Fix race between tpu and tvu, where tvu bank is not caught up to tpu bank

* Add test

* Cleanup Fullnode tests
2019-01-31 19:21:02 -08:00
3f323aba1a Search and destroy loitering processes from previous CI runs 2019-01-31 16:17:44 -08:00
29889a90e5 ignore ledger-tool/target (#2624) 2019-01-31 16:09:56 -08:00
ed478675ba Push and query the ClusterInfo for votes. (#2622) 2019-02-01 05:21:29 +05:30
9767468b7f Remove unneeded Option 2019-01-31 13:53:59 -08:00
8ba1d5f426 treat genesis special (#2615)
* treat genesis special

* fix poh_recorder to understand new world order
2019-01-31 13:53:08 -08:00
84567d36cf Leader scheduler groundwork for Blocktree (#2599)
* Groundwork for entry tree, align constants with definitions in the book

* Fix edge case in test, node can keep generating ticks between handle_role_transition and exit() call
2019-01-31 13:44:24 -08:00
32162ef0f1 Connect TPU's broadcast service with TVU's blob fetch stage (#2587)
* Connect TPU's broadcast service with TVU's blob fetch stage

- This is needed since ledger is being written only in TVU now

* fix clippy warnings

* fix failing test

* fix broken tests

* fixed failing tests
2019-01-31 13:43:22 -08:00
2dd20c38b2 fix the test 2019-01-31 12:55:17 -08:00
aa1bd603e6 Fix recvmmsg test for timeout 2019-01-31 12:55:17 -08:00
e104941569 Add design proposal for reliable vote transmission (#2601)
* reliable vote transmission design proposal

* summary

* comments
2019-01-31 07:34:49 -08:00
2754ceec60 StatusDeque split into separate objects with their own root checkpoint strategy (#2613)
Split up StatusDeque into different modules

* LastIdQueue tracks last_ids
* StatusCache keeps track of signature statuses
* StatusCache stores success as a bit in a bloom filter
* Overhead for 1m Ok transactions is 4mb in memory
* Less concurrency between the objects, last_id and status_cache are read and written to at different points in the pipeline
* Each object has its own strategy for merging into the root checkpoint
2019-01-31 06:53:52 -08:00
609e915169 Fix clippy warning
Always pass Arcs by reference. Then you'll only need to clone()
to cross thread boundaries.
2019-01-30 21:59:05 -07:00
11f1c00ca7 Only send pubkey to ReplayStage 2019-01-30 21:59:05 -07:00
a74b24fdf0 Only store the fullnode's pubkey
Only vote_signer is used for signing
2019-01-30 21:59:05 -07:00
e25992a011 Always give Fullnode a vote signer
This will allow us to use the the signer's pubkey as the node id.

Disable voting with a configuration option.
2019-01-30 21:59:05 -07:00
00bb5925e1 use a .gitignore'd file name for transactionCount (#2609) 2019-01-30 20:19:10 -08:00
1b50fbbc90 remove Result<> from Blob accessors, add parent (#2608)
* remove Result<> from Blob accessors, add parent
* update chacha's golden
* fixup benches
2019-01-30 20:18:28 -08:00
a746969995 Don't set socket as blocking in recvmmsg for non Linux targets (#2611)
* Don't set socket as blocking in recvmmsg for non Linux targets

- The user of the function is controling this flag

* added a test
2019-01-30 19:47:53 -08:00
c536a0bf04 Remove mention of BCC 2019-01-30 18:00:04 -07:00
5b8e7bfcf2 s/voter/validator 2019-01-30 15:44:51 -07:00
3cbbceec78 rewarding 2019-01-30 15:44:51 -07:00
e684fafb68 fmt 2019-01-30 15:44:51 -07:00
651342b3db cleanup fork selection 2019-01-30 15:44:51 -07:00
c01290438f Move virtual genesis tick into the ledger proper as entry 0 2019-01-30 14:02:07 -08:00
9e9c82869a create_tmp_sample_ledger() need not return the genesis block 2019-01-30 14:02:07 -08:00
494b143453 Delete create_tmp_genesis 2019-01-30 14:02:07 -08:00
8cc1cde0fe create_tmp_sample_ledger() now returns entry_height and last_id 2019-01-30 14:02:07 -08:00
883fc39c80 Rename EntryTree to Blocktree 2019-01-30 13:29:34 -07:00
1c0758e3bd Accounts refactoring for forking.
* Move last_id and signature dup handling out of Accounts.
* Accounts that handle overlays.
2019-01-30 11:36:49 -08:00
668d353add Inline VoteSigner::new_vote_account
So that we can stop using the validator keypair to fund the
the voting account.
2019-01-30 10:42:42 -07:00
06a1681fdc Remove redundant annotations 2019-01-30 10:42:42 -07:00
a16e41002e reduce gossip nodes in concurrent tests for CI 2019-01-30 10:26:28 -07:00
16e705dc75 Boil away unneeded Fullnode::new_* functions 2019-01-29 20:10:10 -08:00
b52228feb9 Remove assumption that the mint starts with 10_000 tokens 2019-01-29 20:10:10 -08:00
25f25d0f82 new_fullnode: don't return the genesis_block, nobody uses it 2019-01-29 17:51:07 -08:00
85e7046caf Use signer for signing transactions, not constructing them 2019-01-29 18:35:05 -07:00
c741a960b9 Generalize Transaction::new to accept anything that implements KeypairUtil 2019-01-29 18:35:05 -07:00
34c8b2cc2f Remove redundant Arc 2019-01-29 18:35:05 -07:00
278effad49 Implement KeypairUtil for VoteSignerProxy 2019-01-29 18:35:05 -07:00
a0bed5375d remove println!, add check to keep it out (#2585)
* remove debugging prints

* remove println!, add check to keep it out
2019-01-29 16:02:03 -08:00
9eecd549e4 Bump rand from 0.6.4 to 0.6.5 (#2564)
* Bump rand from 0.6.4 to 0.6.5

Bumps [rand](https://github.com/rust-random/rand) from 0.6.4 to 0.6.5.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/0.6.4...0.6.5)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* Update rand_core, rand_jitter, rand_os

fixes compile errors due to type mismatch from differing versions
2019-01-29 17:44:34 -06:00
a2c3369713 storage_state field doesn't actually exist 2019-01-29 12:34:59 -08:00
1f9ab7f58f copy bank for TPU 2019-01-29 12:11:48 -08:00
3e1a926aa6 wip 2019-01-29 12:11:48 -08:00
57f82934f2 Bump hex-literal from 0.1.1 to 0.1.2 (#2565)
Bumps [hex-literal](https://github.com/RustCrypto/utils) from 0.1.1 to 0.1.2.
- [Release notes](https://github.com/RustCrypto/utils/releases)
- [Commits](https://github.com/RustCrypto/utils/compare/opaque-debug_v0.1.1...hex-literal-v0.1.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-29 13:15:49 -06:00
f3a8aec64d Bump tokio from 0.1.14 to 0.1.15 (#2557)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 0.1.14 to 0.1.15.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Changelog](https://github.com/tokio-rs/tokio/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-0.1.14...tokio-0.1.15)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-29 13:12:50 -06:00
e2e5bc65a9 Bump assert_cmd from 0.10.2 to 0.11.0 (#2580)
* Bump assert_cmd from 0.10.2 to 0.11.0

Bumps [assert_cmd](https://github.com/assert-rs/assert_cmd) from 0.10.2 to 0.11.0.
- [Release notes](https://github.com/assert-rs/assert_cmd/releases)
- [Changelog](https://github.com/assert-rs/assert_cmd/blob/master/CHANGELOG.md)
- [Commits](https://github.com/assert-rs/assert_cmd/compare/v0.10.2...v0.11.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>, Mark Sinclair Jr <mark@solana.com>

* Replace use of removed `Command::main_binary`

assert_cmd 11.0 removed this. replaced with
`Command::cargo_bin(env!("CARGO_PKG_NAME"))`
2019-01-29 13:10:48 -06:00
df136578d4 Remove unnecessary FullnodeConfig::rpc_port option 2019-01-29 10:22:39 -08:00
ae7f169027 Add FullnodeConfig struct to Fullnode::new* functions
This avoids having to touch *every* Fullnode::new* call site when
a new fullnode option is added
2019-01-29 09:42:48 -08:00
6da7a784f2 Stream entries (#2582)
* Add entry streaming option

* Fix tests

* Remove obsolete comment

* Move entry stream functionality to struct w/ trait in order to test without i/o
2019-01-29 00:21:27 -08:00
12cddf725e Harmonize Fullnode::new* function arguments 2019-01-28 22:37:56 -08:00
d8861c2a5f Wait until the leader shows up on gossip 2019-01-28 22:37:56 -08:00
145fb3675d check for debugging lint in CI (#2578)
* check for debugging lint in CI
* nit
* add TODO
2019-01-28 18:32:30 -08:00
77e8cb2718 Update nominal() checks for json genesis block 2019-01-28 17:08:59 -08:00
a8ea6471e7 Add ledger-tool tests to CI 2019-01-28 17:08:59 -08:00
bfaf5634a1 .unwrap() in tests instead of assert!()ing .is_ok() for a better failure message 2019-01-28 16:10:32 -08:00
53afa64634 Remove storage_state from the bank
Construct in TVU and pass to RPC and StorageStage instead.
2019-01-28 15:41:41 -08:00
c9bf9ce094 eliminate re-use of a TX here, we're testing for empty account balance (#2576) 2019-01-28 15:21:08 -08:00
a2e29fa71f Alphabetize and make consistent fullnode arguments 2019-01-28 14:32:32 -08:00
637f58364a remove io from the tests 2019-01-28 13:52:13 -08:00
1bd04b26e5 Remove ignore flag from rpc_pubsub tests 2019-01-28 13:52:13 -08:00
29ef9370a6 Remove LeaderSchedulerConfig options 2019-01-28 13:51:01 -08:00
2262f279d5 Reduce boilerplate code with helper function to create
fullnode/bank/genesis
2019-01-28 13:48:58 -08:00
e4f477cf90 Retype num_ticks as u64 to reduce casting 2019-01-28 11:24:50 -08:00
33f921235d Improve message-signing ergonomics 2019-01-26 14:57:22 -07:00
1bae87d4b3 Add unit-test-friendly VoteSignerProxy constructor 2019-01-26 14:56:49 -07:00
1e43fb587e Rename the module that now contains only GenKeys 2019-01-26 06:57:24 -08:00
d65e7b9fcc Speedup rotation (#2468)
Speedup leader to validator transitions
2019-01-26 13:58:08 +05:30
4bb6549895 Genesis block is now a json file 2019-01-25 09:05:15 -08:00
06e3cd3d2a Bump serde_json from 1.0.36 to 1.0.37
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.36 to 1.0.37.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.36...v1.0.37)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-25 03:34:06 -08:00
e9e01557b7 fix leaked threads from unclosed fullnode 2019-01-25 03:02:49 -08:00
e0f046b7a5 Optimize Transaction/Instruction serialization with custom routine (#2515)
* Optimize transaction serialization with custom routine to reduce the serialized size.

* Update serialized_size to accept self as parameter

* Optimize serialize / deserialize operations
2019-01-24 21:14:15 -08:00
9845aec007 Rename data_replicator tests module
replicator name is associated with storage replicators, so
data_replicator sounds like that but it is actually a bunch of gossip
tests.
2019-01-24 15:49:55 -08:00
81c82b5af9 Add test for ignore ProgramErrors in process_entries (#2544) 2019-01-24 13:37:12 -08:00
a9b083e585 Set fetch stage socket non blocking to false while during recv (#2542)
* Set fetch stage socket non blocking to false while during recv

* remove ProgramError changes from this PR
2019-01-24 12:46:40 -08:00
9abc500269 Fix BPF C tests and run as part of CI (#2540) 2019-01-24 12:15:37 -08:00
b9eb7e14e6 Use clap arg conflicts check 2019-01-24 10:47:37 -08:00
b7be5b9a7a Add no-signer argument 2019-01-24 10:47:37 -08:00
ce41760fdd Update definitions of block and slot 2019-01-23 18:22:20 -08:00
a7503050c2 Bump libc from 0.2.47 to 0.2.48
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.47 to 0.2.48.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.47...0.2.48)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-23 18:22:05 -08:00
d4eb69ca14 Bump reqwest from 0.9.8 to 0.9.9
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.9.8 to 0.9.9.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.9.8...v0.9.9)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-23 17:24:48 -08:00
aba9df8457 Remove get_stake placeholder 2019-01-23 17:03:20 -08:00
6aa80e431d increase startup timeout for localnet sanity (#2534) 2019-01-23 15:06:08 -08:00
bae7612f36 Revert "Wait until the node successfully boots"
This reverts commit e84f1f6de7.
2019-01-23 11:27:08 -08:00
a0bc8b8af3 BPF programs can support up to 5 arguments (#2528) 2019-01-23 09:55:08 -08:00
73930b5eac Unfold log on errors 2019-01-23 07:48:59 -08:00
fbeba259b3 Reorg tests 2019-01-23 00:02:30 -08:00
d1bedeae13 Wait for nodes to finish booting before running sanity checks 2019-01-23 00:02:30 -08:00
e84f1f6de7 Wait until the node successfully boots 2019-01-23 00:02:30 -08:00
cc88f9bcd6 Add mechanism to determine when a node has finished booting 2019-01-23 00:02:30 -08:00
f630b50902 Check for new vote account signature explicitly for better error reporting on failures 2019-01-23 00:02:30 -08:00
9a7082d0d5 Report stuck last_id in error message 2019-01-23 00:02:30 -08:00
8dc9089611 Display confirmation time 2019-01-23 00:02:30 -08:00
222d2d7953 Verify transaction count as reported by the bootstrap-leader node is advancing 2019-01-23 00:02:30 -08:00
27c10d4468 cargo fmt 2019-01-22 21:56:04 -08:00
a17467aefd Lower level of message from storage_stage 2019-01-22 21:23:10 -08:00
73b10c196e Disable integration test that fails in CI 2019-01-22 19:24:44 -08:00
965dbbe835 stop enumeration if next entry is disjoint, band-aid (#2518)
* stop enumeration if next entry is disjoint, band-aid, fies #2426
* clippy
2019-01-22 15:50:36 -08:00
e3ae10bacc User-initiated builds now select the correct channel 2019-01-22 14:23:46 -08:00
fcda94b673 Use beta channel for stable dashboard once a beta tag exists 2019-01-22 12:22:57 -08:00
b1109b813e Bump byteorder from 1.3.0 to 1.3.1
Bumps [byteorder](https://github.com/BurntSushi/byteorder) from 1.3.0 to 1.3.1.
- [Release notes](https://github.com/BurntSushi/byteorder/releases)
- [Changelog](https://github.com/BurntSushi/byteorder/blob/master/CHANGELOG.md)
- [Commits](https://github.com/BurntSushi/byteorder/compare/1.3.0...1.3.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-22 09:58:48 -08:00
122a5b2f69 dedup the 2019-01-22 09:47:43 -08:00
dea20248c4 Increase job timeout 2019-01-22 09:35:03 -08:00
ae90ac238c Use unique log file for each additional (-x/-X) fullnodes 2019-01-22 08:27:36 -08:00
3b0ca9f478 Add rolling update test 2019-01-22 08:27:36 -08:00
61e79e6d02 Add -c to resume a previous run 2019-01-22 08:27:36 -08:00
1cdab81a3c Add -R option to restart the cluster incrementally 2019-01-22 08:27:36 -08:00
dca0ba6a5d Use -X for dynamic fullnodes, to ensure keypair remains constant during iterations 2019-01-22 08:27:36 -08:00
d666ebc558 Add tests for vote_program 2019-01-21 18:05:52 -07:00
c84b796e17 remove dead code (#2512) 2019-01-21 16:24:11 -08:00
7204bb40bf Don't fail process_entries with ProgramErrors (#2509) 2019-01-21 15:26:06 -08:00
637d5c6691 Fix rpc port argument name 2019-01-21 16:25:51 -07:00
3c86f41769 Run buildkite iterations in parallel 2019-01-21 14:04:19 -08:00
f37eb533f1 Replicator timeout (#2480)
* Add timeout to Replicator::new; used when polling for leader

* Add timeout functionality to replicator ledger download

Shares the same timeout as polling for leader

Defaults to 30 seconds

* Add docs for Replicator::new
2019-01-21 15:37:41 -06:00
6e8b69fc88 Cleanup leader_addr, it's really entrypoint_addr 2019-01-21 13:06:30 -08:00
cb23070dfe Remove sleeps on fullnode spin-up in integration tests 2019-01-21 13:27:31 -07:00
5d9d83d312 Less clones 2019-01-21 12:56:27 -07:00
823252dd41 Cleanup terminology 2019-01-21 12:56:27 -07:00
35764225ed Remove socket from rpc test and move integration test 2019-01-21 12:29:04 -07:00
c7e5006bcf Remove assert!()s that hide error codes, making failure debug harder 2019-01-21 10:36:56 -08:00
b0149a54d8 Bump serde_derive from 1.0.84 to 1.0.85
Bumps [serde_derive](https://github.com/serde-rs/serde) from 1.0.84 to 1.0.85.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.84...v1.0.85)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-21 11:25:42 -07:00
e6030d66eb split load+execute from commit in bank, insert record between them in TPU code (#2487)
* split load+execute from commit in bank, insert record between them in TPU code
* clippy
* remove clear_signatures() race with commit_transactions()
* add #[test] back
2019-01-21 10:17:04 -08:00
6611188edf Move subscriptions to rpc_pubsub (#2490)
* Move subscriptions to rpc_pubsub

- this helps avoid recreating pubsub_service on node's role change

* fixed tests and addressed review comments

* fix clippy errors

* address review comments
2019-01-21 09:59:09 -08:00
abbb037888 Implement storage contract logic 2019-01-21 08:36:49 -08:00
132d59ca6a new_bank_from_db_ledger need not be public 2019-01-21 08:11:13 -08:00
200d5e62c2 Bump byteorder from 1.2.7 to 1.3.0
Bumps [byteorder](https://github.com/BurntSushi/byteorder) from 1.2.7 to 1.3.0.
- [Release notes](https://github.com/BurntSushi/byteorder/releases)
- [Changelog](https://github.com/BurntSushi/byteorder/blob/master/CHANGELOG.md)
- [Commits](https://github.com/BurntSushi/byteorder/compare/1.2.7...1.3.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-21 09:07:17 -07:00
b748942d6a Bump serde from 1.0.84 to 1.0.85
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.84 to 1.0.85.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.84...v1.0.85)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-21 08:25:24 -07:00
648b6597bf configure ulimit 2019-01-20 10:54:12 -08:00
5b73a8eceb Rework fullnode boot sequence 2019-01-19 21:35:46 -08:00
514bf32b99 Enable ledger verification for non-perf testnets 2019-01-19 20:28:56 -08:00
2073188345 Fullnode no longer fails to process a ledger with ProgramErrors in it 2019-01-18 21:06:50 -08:00
c0b472292b Revert "Entries that result in a ProgramError are still valid entries"
This reverts commit ab23b41998.
2019-01-18 21:06:50 -08:00
1b15fd1da6 Fix build, add new parameter to new_with_bank 2019-01-18 15:07:46 -08:00
6883ea0944 Give the fullnode one million tokens as a #2355 workaround 2019-01-18 13:42:04 -08:00
303289777f rsync/airdrop only if ledger doesn't exist (eg, on first run after setup.sh) 2019-01-18 13:42:04 -08:00
a8bf00fe20 Timeout if a leader is not found within 30 seconds 2019-01-18 13:42:04 -08:00
6282c53fe5 Add iterations with leader rotation enabled and periodic restarts 2019-01-18 13:42:04 -08:00
dac28e0961 Temporarily ignore wallet sanity failures when leader rotation is enabled
This commit should be reverted once https://github.com/solana-labs/solana/issues/2474 is fixed
2019-01-18 13:42:04 -08:00
4f86563352 Entries that result in a ProgramError are still valid entries 2019-01-18 13:42:04 -08:00
818afc68c1 Report number of entries and last_id on successful verification 2019-01-18 13:42:04 -08:00
443d8ce7c4 Add option to restart the cluster during iterations 2019-01-18 13:42:04 -08:00
da5cb0b012 Verify ledger before starting up the fullnode 2019-01-18 13:42:04 -08:00
922ffdfc28 Remove unnecessary ledger/ subdirectory 2019-01-18 13:42:04 -08:00
2f1107ff4f Add randomness to broadcast 2019-01-18 13:05:35 -08:00
1fd7bd7ede Storage fixes
* replicators generate their sample values
* fixes to replicator block height logic
2019-01-18 13:05:35 -08:00
c0c38463c7 Remove hard coded ports 2019-01-17 23:34:21 -08:00
c1e142d1dc Revert "test_rpc_new fails locally, ignore for now"
This reverts commit 0c46f15f94.
2019-01-17 23:34:21 -08:00
6933f2bad1 Remove stale TODO 2019-01-17 23:22:07 -08:00
b03d1d8894 Enable integration test logging for better debug on CI failure 2019-01-17 23:14:18 -08:00
8e4a86e329 Recovery multinode tests 2019-01-17 23:14:18 -08:00
1f87d9ba4a add bloom benchmarking, perf improvement from Fnv ~= 8X (#2477)
* add bloom benchmarking, perf improvement from Fnv ~= 8X
* have a look at bits.set()
* ignore new benches to pacify CI (solana_upload_perf?)
2019-01-17 18:22:21 -08:00
14267e172d Add local drone integration test 2019-01-17 15:06:04 -08:00
95e83cfe3f Add tested process_drone_request method 2019-01-17 15:06:04 -08:00
e74574706e Record Transactions with program errors in the ledger, they paid the fee 2019-01-17 13:55:56 -08:00
b381d9e06d add pngs and formatting 2019-01-17 14:30:20 -07:00
a416b53d11 file permissions 2019-01-17 14:30:20 -07:00
6fd13e3af0 rename files 2019-01-17 14:30:20 -07:00
4b7dc8200c reference reformatting 2019-01-17 14:30:20 -07:00
b83279848a html table to md table 2019-01-17 14:30:20 -07:00
a48b278c10 add economic design sections to TOC 2019-01-17 14:30:20 -07:00
75e19f4f0f Add build script 2019-01-17 12:38:04 -08:00
1a5bf0c689 Remove sleep 2019-01-17 12:38:04 -08:00
3e245f16c0 Add wallet deploy integration test 2019-01-17 12:38:04 -08:00
2698b7614b Add wallet deploy unit tests, incl program test fixture 2019-01-17 12:38:04 -08:00
b296a9a0c7 Rename slice to segment to match book terminology 2019-01-17 10:19:45 -08:00
9c8e853567 Rename --rpc arg to --rpc-port to match wallet cli 2019-01-17 09:04:57 -08:00
825d8ef6c9 Add ability to use the RPC endpoint from a node other than the bootstrap leader 2019-01-17 09:04:57 -08:00
da1201c552 Add --rpc-port option to select a custom RPC port 2019-01-17 09:04:57 -08:00
e0c05bf437 Minor clean up 2019-01-17 09:04:57 -08:00
a84b6bc7e4 Overhaul wallet rpc/drone command-line arguments 2019-01-17 08:36:05 -08:00
00c4c30d72 Fix testnet bootup issue (#2465)
* Fix testnet bootup issue

* address review comments
2019-01-16 19:18:32 -08:00
72c7139d8c Allow chained BudgetExpr via indirection (#2461)
* Allow chained BudgetExpr via indirection

Change `And`, `Or`, and `After` expressions to contain
`Box<BudgetExpr>`s instead of directly holding payments

* run cargo fmt
2019-01-16 18:51:50 -06:00
e287ba1a7e Bump bv from 0.10.0 to 0.11.0
Bumps [bv](https://github.com/tov/bv-rs) from 0.10.0 to 0.11.0.
- [Release notes](https://github.com/tov/bv-rs/releases)
- [Changelog](https://github.com/tov/bv-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tov/bv-rs/compare/0.10.0...0.11.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-16 16:47:35 -08:00
8e67a18551 Add network timeouts and fix tests
test_rpc_send_tx could fail if it didn't succeed on the first try
* add some retries to consistently pass
2019-01-16 15:59:40 -08:00
590b88f718 Bump serde_json from 1.0.35 to 1.0.36
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.35 to 1.0.36.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.35...v1.0.36)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-16 15:57:01 -07:00
00ee8813f7 Add initial build step to getting started (#2455) 2019-01-16 14:46:57 -06:00
e76f2ea89c Add record to runtime pipeline 2019-01-16 13:39:30 -07:00
c9f57c2d96 Review feedback 2019-01-16 13:38:32 -07:00
438d36341d Add note about implications on previous blocks 2019-01-16 13:38:32 -07:00
3ab54b1591 Review feedback 2019-01-16 13:38:32 -07:00
77a2f186ee Add block confirmation proposal 2019-01-16 13:38:32 -07:00
526344c9ac Log signature status uniformly 2019-01-16 12:17:46 -08:00
f8bd19f5db Log the time it look to process the ledger for easier log inspection 2019-01-16 10:45:47 -08:00
e4c6e4bf26 Report full node info before starting/updating network 2019-01-16 10:24:00 -08:00
8783563176 Report full node info before running sanity 2019-01-16 10:24:00 -08:00
6015a0ff15 Add info command 2019-01-16 10:24:00 -08:00
63b76c32f9 80-char lines 2019-01-16 09:40:45 -08:00
c9264ee12c Cleanup fanout docs and ASCII art 2019-01-16 09:40:45 -08:00
0d7b1a84cb Remove unused timeout wallet arg and config field 2019-01-16 09:20:45 -08:00
81e17bad40 Failure to write a datapoint should not be fatal 2019-01-16 09:08:47 -08:00
97d90b99e2 Describe Data-Plane fanout and distribution (#2008) 2019-01-16 21:38:10 +05:30
03d4d1cb36 Store and resend votes if leader's TPU port is unknown (#2438)
* Store and resend votes if leader's TPU port is unknown

* fix build errors

* fix failing tests
2019-01-16 06:14:55 -08:00
3282cb85ae Refactor request_and_confirm_airdrop() to use send_and_confirm_tx() 2019-01-15 19:29:59 -08:00
9354e797b6 Cleanly handle balance underflows 2019-01-15 19:29:59 -08:00
3f9c2bc33b Resend transactions a couple times before giving up 2019-01-15 16:07:32 -08:00
4369c1a113 RPC port is no longer reset on leader-to-validator transition 2019-01-15 16:06:56 -08:00
b1e57e2a30 Retry rpc requests on connection failures
Applied a blanket default retry count of 5, which seems like enough but
not excessive retries.
2019-01-15 15:30:10 -08:00
4d9489aeb1 Use RPC endpoint of the provided network entrypoint rather than searching for the leader 2019-01-15 15:13:57 -08:00
45c247fa5b bloom for forking (#2431)
* bloom for forking
* clippy fixes
* remove bloom_hash_index
2019-01-15 13:56:54 -08:00
4e2663023b Bump nix from 0.12.0 to 0.13.0
Bumps [nix](https://github.com/nix-rust/nix) from 0.12.0 to 0.13.0.
- [Release notes](https://github.com/nix-rust/nix/releases)
- [Changelog](https://github.com/nix-rust/nix/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nix-rust/nix/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-15 14:35:22 -07:00
fa4608a95d Change leader rotation time to a multiple of ticks per block (#2414)
* Change leader rotation time to a multiple of ticks per block

* fix component dependencies

* review comments
2019-01-15 12:07:58 -08:00
fec47a09a9 Add test from drone business logic; remove flaky, mis-placed integration test 2019-01-15 12:53:09 -07:00
022a97da99 revert revert of kill window (#2427)
* remove window code from most places
* window used only for testing
* remove unecessary clippy directives
2019-01-15 10:51:53 -08:00
e9116736cd Bump libc from 0.2.46 to 0.2.47
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.46 to 0.2.47.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.46...0.2.47)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-15 08:56:16 -07:00
2b549e3af6 Bump hashbrown from 0.1.7 to 0.1.8
Bumps [hashbrown](https://github.com/Amanieu/hashbrown) from 0.1.7 to 0.1.8.
- [Release notes](https://github.com/Amanieu/hashbrown/releases)
- [Changelog](https://github.com/Amanieu/hashbrown/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Amanieu/hashbrown/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-15 08:55:24 -07:00
b2afd1ea0b Bump rbpf to 0.1.9 (#2422) 2019-01-15 00:42:30 -08:00
ef8e5b40b6 Use dep files and restore tests 2019-01-14 23:41:07 -08:00
a6773ad442 Specify entrypoint when building rust programs 2019-01-14 20:13:01 -08:00
c2add08efb Move parameter to make flags variable 2019-01-14 20:12:06 -08:00
a33c76a456 Remove JsonRpcRequestProcessor dependency 2019-01-14 17:39:31 -08:00
11b1bd278a Remove unused exit field 2019-01-14 17:39:12 -08:00
e3a96ed3fc Minor new cleanup 2019-01-14 16:04:29 -08:00
447243f994 Revert "remove window code from most places" (#2417)
* Revert "Fix link to book in Local Testnet section (#2416)"

This reverts commit 710c0c9980.

* Revert "Add current leader information to dashboard (#2413)"

This reverts commit f0300c1711.

* Revert "remove window code from most places (#2389)"

This reverts commit e3c0bd5a3f.
2019-01-14 15:11:18 -08:00
710c0c9980 Fix link to book in Local Testnet section (#2416) 2019-01-14 14:57:12 -08:00
f0300c1711 Add current leader information to dashboard (#2413) 2019-01-14 14:20:05 -08:00
e3c0bd5a3f remove window code from most places (#2389)
* remove window code from most places
* window used only for testing
* remove unecessary clippy directives
2019-01-14 12:11:55 -08:00
8af61f561b Improve Wallet coverage (#2385)
* Add trait for RpcRequestHandler trait for RpcClient and add MockRpcClient for unit tests

* Add request_airdrop integration test

* Add timestamp_tx, witness_tx, and cancel_tx to wallet integration tests; add wallet integration tests to test-stable

* Add test cases

* Ignore plentiful sleeps in unit tests
2019-01-14 00:10:03 -07:00
780360834d Iteration testing v0.1 2019-01-13 21:49:09 -08:00
74e503da92 Hold an accounts_db read lock as briefly as possible to avoid deadlocking 2019-01-13 21:49:09 -08:00
d28b643c84 localnet-sanity.sh now supports iterations testing 2019-01-13 21:49:09 -08:00
dc1049a6e7 Bump serde_json from 1.0.34 to 1.0.35
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.34 to 1.0.35.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.34...v1.0.35)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-12 21:26:45 -07:00
f965b3de46 Bump reqwest from 0.9.7 to 0.9.8
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.9.7 to 0.9.8.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-12 12:44:00 -07:00
eb54a4fe91 Update book URL 2019-01-12 11:08:29 -08:00
5d3847d14d Publish book from both the edge and beta channels 2019-01-12 11:08:29 -08:00
5b92286568 Remove channel duplication 2019-01-12 11:08:29 -08:00
094bc59553 refactor: reduce node_info scope 2019-01-12 10:28:38 -07:00
e9a0b3a8f3 Add BPF-to-BPF and PC relative call tests (#2395) 2019-01-11 19:33:08 -08:00
1724430489 Remove clippy override for cyclomatic complexity (#2392)
* Remove clippy override for cyclomatic complexity

* reduce cyclomatic complexity of main function

* fix compilation errors
2019-01-11 16:49:18 -08:00
23c43ed21b Multi-file BPF C builds (#2393) 2019-01-11 15:33:21 -08:00
79b334b7f1 Don't use count_valid_ids in bench 2019-01-11 14:54:17 -07:00
9328ee4f63 Revert "Revert "Delete unused code and its tests""
This reverts commit d6b3991d49.
2019-01-11 14:54:17 -07:00
d7594b19fc Implemented a trait for vote signer service (#2386)
* Implemented a trait for vote signer service

* removes need for RPC in unit tests for vote signing

* fix build errors

* address some review comments
2019-01-11 12:58:31 -08:00
d6b3991d49 Revert "Delete unused code and its tests"
This reverts commit e713ba06f1.
2019-01-11 07:30:28 -08:00
ec63bacdc1 Bump reqwest from 0.9.6 to 0.9.7
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.9.6 to 0.9.7.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.9.6...v0.9.7)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-10 23:23:38 -07:00
e713ba06f1 Delete unused code and its tests 2019-01-10 23:19:38 -07:00
37cb218437 Drop the serialization length 2019-01-10 17:05:03 -08:00
4f79a8a204 Use serialized_size - less fragile 2019-01-10 17:05:03 -08:00
7341298a11 Cleanup tpu forwarder (#2377)
* Use unwrap() on locks

An error there generally indicates a programmer error, not a
runtime error, so a detailed runtime message is not generally useful.

* Only clone Arcs when passing them across thread boundaries

* Cleanup TPU forwarder

By separating the query from the update, all the branches get easier to
test. Also, the update operation gets so simple, that we see it
belongs over in packet.rs.

* Thanks clippy

cute
2019-01-10 13:34:48 -07:00
b9c27e3a9d Bump rocksdb from 0.10.1 to 0.11.0 (#2376)
Bumps [rocksdb](https://github.com/spacejam/rust-rocksdb) from 0.10.1 to 0.11.0.
- [Release notes](https://github.com/spacejam/rust-rocksdb/releases)
- [Changelog](https://github.com/rust-rocksdb/rust-rocksdb/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spacejam/rust-rocksdb/compare/v0.10.1...v0.11.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-10 11:12:06 -08:00
885fe38c01 Move BloomHashIndex into its own module
This trait is for bloom, not crds.

Slightly better would be to put it in the SDK so that the trait
implementations could go into hash and pubkey, but if we don't
want compatibility constraints, this is the next best thing.
2019-01-10 10:22:16 -08:00
2dbe8fc1a9 Refactor vote signer code (#2368)
* Refactor vote signer code

* fixed test compilation errors

* address clippy errors

* fix missing macro_use

* move macro use

* review comments
2019-01-10 09:21:38 -08:00
7122139e12 Rewrite TPU forwarder test (#2344) 2019-01-10 13:50:28 +05:30
4e6c03c9da Avoid holding a read lock during IO 2019-01-10 00:34:50 -07:00
d5f27f9b1e shellcheck 2019-01-09 22:06:58 -07:00
86f19a3ab3 Propagate PS4 to prevent unintentional buildkite log unfolding 2019-01-09 22:02:31 -07:00
be0eefb0af Add timeout to prevent stuck bench-tps when a cluster goes bad 2019-01-09 19:21:53 -07:00
c1cd92bbee Avoid -d arg conflict
-D is now "delete"
-d is now "disk type"
2019-01-09 16:39:24 -08:00
44b7684d56 Fix some instances of ledger to db_ledger 2019-01-09 16:33:37 -08:00
0c90e1eff6 Make entry_sender optional on window_service
window_service in replicator has no need to consume the the produced entries.
2019-01-09 15:15:47 -08:00
491bca5e4b Remove ledger.rs
Split into entry.rs for entry-constructing functions and EntrySlice
trait and db_ledger.rs for ledger helper test functions.
2019-01-09 15:15:47 -08:00
ebd676faaa Rename Block to EntrySlice 2019-01-09 15:15:47 -08:00
045c5e8556 Remove most of the old ledger code
Removes LedgerWriter, read_ledger, LedgerWindow
2019-01-09 15:15:47 -08:00
45b4cf2887 Remove store_ledger_stage which is no longer needed 2019-01-09 15:15:47 -08:00
4b5acc065a Give the bootstrap leader one million tokens as a #2355 workaround 2019-01-09 13:30:20 -08:00
73eca72f14 Switch test to send a repair request to try and download from replicator
Removes need for read_ledger in the test and also tests replicator
download path.
2019-01-09 13:24:12 -08:00
28431ff22c Add configurable RUST_LOG for ./net.sh sanity 2019-01-09 12:12:50 -08:00
639bed2f6d Reorder sanity.
1. Check for presence of nodes
2. Check for functioning RPC API
3. Then try the wallet
2019-01-09 12:05:30 -08:00
77794eebdb Remove |cargo package| sanity step
Unfortunately due to our multi-crate repo, as soon as
|./scripts/increment-cargo-version.sh| is run after a release, |cargo
package| will fail for crates that depend on other in-tree crates, as
the new crate version has not yet been published to crates.io.
For now this means that we need to continue flying blind and be prepared
to deal with minor publishing issues on each new release.
2019-01-09 11:59:24 -08:00
eb37aa2bba Kill monitoring scripts by process group to ensure a full shutdown 2019-01-09 11:59:01 -08:00
048fe371aa set -x for more detailed logs 2019-01-09 11:59:01 -08:00
0b666ad9fd De-dup error messages 2019-01-09 11:59:01 -08:00
87c9af142f Preserve config/ when skipSetup 2019-01-09 11:59:01 -08:00
6b46c22b42 Use restart 2019-01-09 11:59:01 -08:00
94494b64d7 whack commented out, obsolete, superceded test 2019-01-09 11:30:07 -08:00
b648f37b97 encapsulate erasure_cf (#2349) 2019-01-09 10:21:55 -08:00
78d3b83900 Remove vestigial vote account configuration from fullnode-config 2019-01-09 09:56:44 -08:00
56b6ed6730 Rerun build if any file in a directory has changed (#2343) 2019-01-09 09:56:23 -08:00
e0c68bf9ad docs: -z is a common option 2019-01-08 21:11:43 -08:00
64ebd9a194 Add update-to-restart operation. Also try to update before restarting on sanity failures 2019-01-08 21:11:43 -08:00
35fe08b3bc Add update support 2019-01-08 21:11:43 -08:00
aedab3f83f Run sanity when previous ledger/setup is preserved 2019-01-08 21:11:43 -08:00
5c87ddc80e nit: hide echo 2019-01-08 21:11:43 -08:00
f53810fcd2 Remove unused exit variable
The exit variable was only used by a test.
2019-01-08 20:22:31 -08:00
56fa3a09c8 Surface the spy node's id, useful for log analysis 2019-01-08 17:43:41 -08:00
58bca04a3f Couple edits 2019-01-08 17:44:09 -07:00
3c6afe7707 Rename get_blob_bytes to read_blobs_bytes 2019-01-08 16:00:39 -08:00
09296e0d71 Fix two storage tests
* test_encrypt_files_many_keys_multiple_keys passing
  - buffer chunk size unified between single key and multiple key path,
    which shouldn't be necessary but can fix later.
* test_encrypt_file_many_keys_bad_key_length passing
2019-01-08 16:00:39 -08:00
4b3d64ec9f Convert chacha_encrypt_file to work with db_ledger blobs directly 2019-01-08 16:00:39 -08:00
a904e15ecc enscapsulate data_cf (#2336)
* enscapsulate data_cf
2019-01-08 15:53:44 -08:00
a82a5ae184 Delete unused code
The ignored test is still broken, but at least no longer creates a
window for no reason.

Also removed all remaining references to "ncp".
2019-01-08 14:09:50 -08:00
bafd90807d encapsulate meta_cf (#2335) 2019-01-08 11:41:55 -08:00
08924ea36a Bump rand from 0.6.3 to 0.6.4
Bumps [rand](https://github.com/rust-random/rand) from 0.6.3 to 0.6.4.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/0.6.3...0.6.4)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-08 11:09:03 -07:00
0f8ea6872e Add missing error counters and load_account test cases (#2327) 2019-01-08 09:20:25 -08:00
1b7598e351 Add retries to RPC API probe 2019-01-08 08:50:51 -08:00
d2431128c7 Remove WriteStage from TPU/TVU diagrams
Fixes #2312
2019-01-08 08:42:06 -08:00
8e0e12e5c9 Bump reqwest from 0.9.5 to 0.9.6
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.9.5 to 0.9.6.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.9.5...v0.9.6)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-08 09:11:14 -07:00
e883117a7d Add missing description field, required for crate publishing 2019-01-07 23:02:32 -08:00
cd0e08cae5 Add fullnode-config crate 2019-01-07 23:02:32 -08:00
1490c42d9f Use docker rust docker image to avoid rocksdb build errors 2019-01-07 23:02:32 -08:00
789ee9f138 package or publish. Also package on branch builds 2019-01-07 23:02:32 -08:00
2c52e82352 Use retry_make_rpc_request to avoid occasional CI test failures 2019-01-07 21:25:25 -08:00
0a981a6606 Double publish crate timeout 2019-01-07 20:46:21 -08:00
534f8d7a4e Don't turn the build red if channel cannot be figured (eg, building a tag) 2019-01-07 19:56:07 -08:00
c4ca76e39e Only check TRIGGERED_BUILDKITE_TAG 2019-01-07 19:56:01 -08:00
a8b9899dee Add retry, restore ignored tests 2019-01-07 19:30:08 -08:00
d2cb4e003c Re-enable the --lib tests 2019-01-07 15:28:20 -08:00
0a0c62f384 Fixes to CI bench comparison (#2319)
* Fixes to CI bench comparison

- The table columns did not match the header
- The last commit was not identified correctly

* review comments
2019-01-07 14:26:21 -08:00
6000df9779 Optimize has_duplicates() for short slices 2019-01-07 13:20:04 -07:00
24963e547c with_subset() -> get_subset_unchecked_mut()
A simpler, safer, and better documented use of unsafe code
2019-01-07 13:20:04 -07:00
3ad3dee4ef Retry node registration to avoid failing before the local vote signer starts 2019-01-07 11:02:35 -08:00
46d44ca99c Add make_rpc_request retry mechanism 2019-01-07 11:02:35 -08:00
06d1af8b18 Remove stale comment 2019-01-07 09:35:39 -08:00
d34b2c4ffd Bump tokio from 0.1.13 to 0.1.14
Bumps [tokio](https://github.com/tokio-rs/tokio) from 0.1.13 to 0.1.14.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Changelog](https://github.com/tokio-rs/tokio/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-0.1.13...tokio-0.1.14)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-07 08:38:15 -07:00
0c52df7569 Consolidate locks and error handling when loading accounts(#2309) 2019-01-06 22:06:55 -08:00
91bd38504e Use vote signer service in fullnode (#2009)
* Use vote signer service in fullnode

* Use native types for signature and pubkey, and address other review comments

* Start local vote signer if a remote service address is not provided

* Rebased to master

* Fixes after rebase
2019-01-05 12:57:52 -08:00
71a2b794b4 Enable info logging on non-perf clusters to aid debug of failures 2019-01-05 08:28:32 -08:00
373714bf0b Disable publish snap again 2019-01-04 21:20:33 -08:00
ee769171b9 Restore publish snap 2019-01-04 20:46:44 -08:00
6ebadbcca3 Plot testnet-manager events 2019-01-04 20:12:11 -08:00
3f60d98163 Update comments (#2310) 2019-01-04 19:19:56 -08:00
ea00c1274e Add net sanity failure metric 2019-01-04 18:45:55 -08:00
b7dc9dbc76 RPC API now assumes a drone running on the bootstrap leader 2019-01-04 18:45:55 -08:00
8b357dcb32 cargo fmt 2019-01-04 16:39:04 -08:00
1f6346d880 De-dup ledgers - db_ledger is now the only ledger written to disk 2019-01-04 16:37:00 -08:00
b7bd38744c Spelling and formatting 2019-01-04 16:04:31 -08:00
f8a67e282a Ignore test_tpu_forwarder (#2307) 2019-01-04 16:02:50 -08:00
0a7e199c82 Don't follow the leader: assume drone runs on the network entrypoint 2019-01-04 15:58:42 -08:00
5143f6d6f1 Boot unused crate 2019-01-04 14:34:23 -07:00
30b662df39 Remove clones in native programs 2019-01-04 13:38:03 -07:00
33f2d83506 Add timeout and prints to port search
Otherwise nc can hang forever.
2019-01-04 11:07:17 -08:00
4244a14ad3 Bump rand from 0.6.2 to 0.6.3
Bumps [rand](https://github.com/rust-random/rand) from 0.6.2 to 0.6.3.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/0.6.2...0.6.3)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-04 11:09:27 -07:00
f031fe58fa Bump rand from 0.6.1 to 0.6.2
Bumps [rand](https://github.com/rust-random/rand) from 0.6.1 to 0.6.2.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/0.6.1...0.6.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-04 08:43:36 -07:00
84cc240f34 Enhance ledger-tool
Add a command-line argument (min-hashes) to restrict the entries
processed by ledger-tool.  For example, --min-hashes 1 will strip
"empty" Entries, i.e. those with num_hashes = 0.

Add basic ledger tool test
2019-01-04 08:17:43 -07:00
b26906df1b Bump rand_chacha from 0.1.0 to 0.1.1
Bumps [rand_chacha](https://github.com/rust-random/rand) from 0.1.0 to 0.1.1.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/rand_chacha-0.1.0...rand_isaac-0.1.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-04 08:15:18 -07:00
56a3197f7f spelling 2019-01-03 18:48:24 -08:00
0505d7bd32 Don't double-clone every account 2019-01-03 17:42:37 -07:00
a448c0b81e implement per-thread, per-batch sleep in ms (throttling allows easier UI dev) (#2293)
* implement per-thread, per-batch sleep in ms (throttling allows easier UI development)
* tidy up sleep() call with Duration::from_millis() instead of Duration::new()
* fixup indentation style
* removing multinode-demo/client-throttled.sh (same functionality available via arguments)
2019-01-03 17:16:06 -05:00
8116fe8def Add proposed design for db_ledger (#2253)
* Add proposed design for db_ledger
2019-01-03 14:12:55 -08:00
7c6dcc8c73 Ignore wallet/target 2019-01-03 10:28:43 -08:00
1a9401e1f3 Permit build on Cargo.{lock,toml} changes 2019-01-03 09:35:11 -08:00
00d310f86d Remove some metrics datapoint, as it was causing excessive logging (#2287)
- 100 nodes test was bringing down the influx DB server
2019-01-03 09:25:11 -08:00
c4259fc8cc Bump libc from 0.2.45 to 0.2.46
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.45 to 0.2.46.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.45...0.2.46)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-03 09:13:03 -07:00
8c5614daa1 Bump serde_derive from 1.0.82 to 1.0.84
Bumps [serde_derive](https://github.com/serde-rs/serde) from 1.0.82 to 1.0.84.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.82...v1.0.84)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-02 15:54:13 -08:00
eb668c6466 Bump serde from 1.0.82 to 1.0.84
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.82 to 1.0.84.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.82...v1.0.84)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2019-01-02 16:42:35 -07:00
a461c5682d First stab at Rust BPF (#2269)
First stab at Rust BPF
2019-01-02 15:12:42 -08:00
e3478ee2ab svg logo and increased font size for better reading experience 2019-01-02 08:33:57 -07:00
0bea870b22 Dynamic N layer 'avalanche' broadcast and retransmit (#2058)
* Dynamic N layer avalanche broadcast and retransmit
2019-01-02 14:16:15 +05:30
5fbdc6450d Bump serde_json from 1.0.33 to 1.0.34
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.33 to 1.0.34.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.33...v1.0.34)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-30 21:15:59 -08:00
1531a1777a Add RPC API check 2018-12-24 22:51:36 -08:00
f38345fdad Cargo.lock 2018-12-24 22:51:36 -08:00
04d46ea33f Run oom-monitor as root 2018-12-24 22:51:36 -08:00
3a2fa9a650 Enable ledger/validator sanity for non-perf testnets 2018-12-24 22:51:36 -08:00
f5bbc5e961 Fix args 2018-12-23 20:56:13 -08:00
95c9fefbd0 Make sanity failure message more visible 2018-12-23 17:30:59 -08:00
073a48ab85 Restore timeout 2018-12-23 17:30:41 -08:00
753a783ba9 Add solana user to adm group for /var/log/syslog access 2018-12-23 17:28:35 -08:00
58f2598d5d Revert "Validators make a transaction to advertise their storage last_id"
This reverts commit a1759aed19.
2018-12-23 14:02:09 -08:00
3c835b692b Use netLogDir 2018-12-23 10:33:43 -08:00
7f2fa8bbcb Collect and upload network logs 2018-12-23 10:19:10 -08:00
a6fd1ca3db Add logs subcommand to fetch remote logs from each network node 2018-12-23 10:19:10 -08:00
58a4905916 Make reconstruct_entries_from_blobs() support Blobs and borrowed SharedBlobs, make distinction between to_blobs and to_shared_blobs (#2270) 2018-12-22 19:30:30 -08:00
2c9607d5da Rename getConfirmation -> getConfirmationTime 2018-12-22 12:47:02 -08:00
371cb4f0f3 Document getConfirmationTime 2018-12-22 12:47:02 -08:00
b46c809544 source ci/upload-ci-artifact.sh 2018-12-22 12:34:30 -08:00
eb29a2898c Uplaod net/log/ files as buildkite artifacts 2018-12-22 12:22:58 -08:00
c3a74e5e63 Avoid unnecessary shellcheck directives 2018-12-22 11:57:47 -08:00
a1759aed19 Validators make a transaction to advertise their storage last_id
* Also implement more storage contract logic
* Add transactions for proof validation,
* Move storage state members into system storage account userdata
2018-12-21 15:45:30 -08:00
1a3387706d Spawn threads based on cpu count (#2232) 2018-12-21 13:55:45 -08:00
41f8764232 Ignore error while enabling nvidia persistence mode (#2265) 2018-12-21 12:37:51 -08:00
4bf797c8f1 Load nvidia drivers on node startup (#2263)
* Load nvidia drivers on node startup

* added new script to enable nvidia driver persistent mode

* remove set -ex
2018-12-21 11:43:52 -08:00
7e3b54f826 Remove llc step when building BPF C programs (#2254) 2018-12-21 08:49:29 -08:00
23d3a9ae42 Use CUDA for testnet automation performance calculations (#2259) 2018-12-21 04:27:31 -08:00
756156e9db Use SSD for testnet automation (#2257) 2018-12-20 20:13:56 -08:00
4807fb4c5c Use if to be more explict about error handling (set -e trouble?) 2018-12-20 19:07:17 -08:00
dd25c5b085 Link Cargo.toml features 2018-12-20 19:07:17 -08:00
becfd1e9fa ci/test-stable-perf.sh now runs on macOS 2018-12-20 17:23:22 -08:00
951d6398a0 Rename finality to confirmation (#2250)
* Rename finality to confirmation

* fix cargo fmt errors
2018-12-20 15:47:48 -08:00
7c98545b33 Use newer votes to calculate confirmation time (#2247) 2018-12-20 15:27:47 -08:00
bb1060bdad Reduce ticks per block to increase voting frequency (#2242) 2018-12-20 14:43:03 -08:00
7ad45a91ec Fix compile error 2018-12-20 13:47:36 -08:00
51045962d3 Adjust settings 2018-12-20 12:32:25 -08:00
034c5d0422 db_ledger now fully encapsulates rocksdb 2018-12-20 12:32:25 -08:00
7148c14178 Debug broadcast (#2233)
* Account for duplicate blobs in process_blobs

* Increase max bytes for level base to match write buffer
2018-12-20 12:12:04 -08:00
93fb61dc8f Re-export rocksdb::DBRawIterator until it can be encapsulated 2018-12-20 10:38:03 -08:00
b36ceb5be4 Remove rocksdb dependency from result.rs 2018-12-20 10:38:03 -08:00
37d7ad819b Purge DB::destroy() usage 2018-12-20 10:38:03 -08:00
6bb6785936 Document updating Cargo.lock during a version bump 2018-12-20 09:20:00 -08:00
cb70824ed1 Cargo.lock 2018-12-20 09:20:00 -08:00
ddc1082e8c Stable dashboard can now actually come from the stable channel 2018-12-20 08:04:59 -08:00
f98d72a30b Fetch latest tag 2018-12-19 20:17:49 -08:00
71df71c601 Revert Clang to C lang change 2018-12-19 20:17:23 -08:00
1d0f7c44e2 Copy editing introduction
Not sure how else to comment, but I'd encourage keeping the content timeless rather than an update. So don't talk about recent releases or next we're doing X. (just a suggestion ;)
2018-12-19 20:17:23 -08:00
d78f19f8bb Select correct branch for {testnet,-perf} when using a stable channel tag 2018-12-19 17:46:18 -08:00
0e567381fb v0.12.0 2018-12-19 17:03:28 -08:00
533 changed files with 58248 additions and 34136 deletions

View File

@ -1,10 +1,12 @@
{
"_public_key": "ae29f4f7ad2fc92de70d470e411c8426d5d48db8817c9e3dae574b122192335f",
"environment": {
"CODECOV_TOKEN": "EJ[1:Kqnm+k1Z4p8nr7GqMczXnzh6azTk39tj3bAbCKPitUc=:EzVa4Gpj2Qn5OhZQlVfGFchuROgupvnW:CbWc6sNh1GCrAbrncxDjW00zUAD/Sa+ccg7CFSz8Ua6LnCYnSddTBxJWcJEbEs0MrjuZRQ==]",
"CRATES_IO_TOKEN": "EJ[1:Kqnm+k1Z4p8nr7GqMczXnzh6azTk39tj3bAbCKPitUc=:qF7QrUM8j+19mptcE1YS71CqmrCM13Ah:TZCatJeT1egCHiufE6cGFC1VsdJkKaaqV6QKWkEsMPBKvOAdaZbbVz9Kl+lGnIsF]",
"INFLUX_DATABASE": "EJ[1:Kqnm+k1Z4p8nr7GqMczXnzh6azTk39tj3bAbCKPitUc=:PetD/4c/EbkQmFEcK21g3cBBAPwFqHEw:wvYmDZRajy2WngVFs9AlwyHk]",
"INFLUX_USERNAME": "EJ[1:Kqnm+k1Z4p8nr7GqMczXnzh6azTk39tj3bAbCKPitUc=:WcnqZdmDFtJJ01Zu5LbeGgbYGfRzBdFc:a7c5zDDtCOu5L1Qd2NKkxT6kljyBcbck]",
"INFLUX_PASSWORD": "EJ[1:Kqnm+k1Z4p8nr7GqMczXnzh6azTk39tj3bAbCKPitUc=:LIZgP9Tp9yE9OlpV8iogmLOI7iW7SiU3:x0nYdT1A6sxu+O+MMLIN19d2t6rrK1qJ3+HnoWG3PDodsXjz06YJWQKU/mx6saqH+QbGtGV5mk0=]"
"CODECOV_TOKEN": "EJ[1:+7nLVR8NlnN48zgaJPPXF9JOZDXVNHDZLeARlCFHyRk=:rHBSqXK7uSnveA4qwUxARZjTNZcA0hXU:ko8lLGwPECpVm19znWBRxKEpMF7xpTHBCEzVOxRar2wDThw4lNDAKqTS61vtkJLtdkHtug==]",
"CRATES_IO_TOKEN": "EJ[1:+7nLVR8NlnN48zgaJPPXF9JOZDXVNHDZLeARlCFHyRk=:NzN6y0ooXJBYvxB589khepthSxhKFkLB:ZTTFZh2A/kB2SAgjJJAMbwAfanRlzxOCNMVcA2MXBCpQHJeeZGULg+0MLACYswfS]",
"GITHUB_TOKEN": "EJ[1:+7nLVR8NlnN48zgaJPPXF9JOZDXVNHDZLeARlCFHyRk=:iy0Fnxeo0aslTCvgXc5Ddj2ly6ZsQ8gK:GNOOj/kZUJ2rYKxTbLyVKtajWNoGQ3PcChwfEB4HdN18qDHlB96Z7gx01Pcf0qeIHODOWRtxlH4=]",
"INFLUX_DATABASE": "EJ[1:+7nLVR8NlnN48zgaJPPXF9JOZDXVNHDZLeARlCFHyRk=:Ly/TpIRF0oCxmiBWv225S3mX8s6pfQR+:+tXGB2c9rRCVDcgNO1IDOo89]",
"INFLUX_PASSWORD": "EJ[1:+7nLVR8NlnN48zgaJPPXF9JOZDXVNHDZLeARlCFHyRk=:ycrq1uQLoSfI932czD+krUOaJeLWpeq6:2iS7ukp/C7wVD3IT0GvQVcwccWGyLr4UocStF/XiDi0OB/N3YKIKN8SQU4ob1b6StAPZ/XOHmag=]",
"INFLUX_USERNAME": "EJ[1:+7nLVR8NlnN48zgaJPPXF9JOZDXVNHDZLeARlCFHyRk=:35hBKofakZ4Db/u0TOW53RXoNWzJTIcl:HWREcMTrgZ8DGB0ZupgSzNWr/tVyE06P]",
"SOLANA_INSTALL_UPDATE_MANIFEST_KEYPAIR_x86_64_unknown_linux_gnu": "EJ[1:+7nLVR8NlnN48zgaJPPXF9JOZDXVNHDZLeARlCFHyRk=:kRz8CyJYKAg/AiwgLrcRNDJAmlRX2zvX:uV1XV6y2Fb+dN4Z9BIMPBRiNS3n+NL8GlJXyu1i7meIsph1DzfLg4Thcp5Mj9nUsFNLgqQgjnsa5C4XNY/h5AgMSzRrJxVj7RhVTRmDJ5/Vjq6v7wCMRfBOvF3rITsV4zTwWSV8yafFmS+ZQ+QJTRgtYsuoYAUNZ06IEebfDHcuNwws72hEGoD9w43hOLSpyEOmXbtZ9h1lIRxrgsrhYDpBlU5LkhDeTXAX5M5dwYxyquJFRwd5quGDV5DYsCh9bAkbjAyjWYymVJ78U9YJIQHT9izzQqTDlMQN49EbLo7MDIaC7O7HVtb7unDJs+DRejbHacoyWVulqVVwu3GRiZezu8zdjwzGHphMMxOtKQaidnqYgflNp/O01I8wZRgR1alsGcmIhEhI8YV/IvQ==]"
}
}

View File

@ -1,2 +1,33 @@
CI_BUILD_START=$(date +%s)
export CI_BUILD_START
#
# Kill any running docker containers, which are potentially left over from the
# previous CI job
#
(
containers=$(docker ps -q)
if [[ $(hostname) != metrics-solana-com && -n $containers ]]; then
echo "+++ Killing stale docker containers"
docker ps
# shellcheck disable=SC2086 # Don't want to double quote $containers
docker kill $containers
fi
)
# Processes from previously aborted CI jobs seem to loiter, unclear why as one
# would expect the buildkite-agent to clean up all child processes of the
# aborted CI job.
# But as a workaround for now manually kill some known loiterers. These
# processes will all have the `init` process as their PPID:
(
victims=
for name in bash cargo docker solana; do
victims="$victims $(pgrep -u "$(id -u)" -P 1 -d \ $name)"
done
for victim in $victims; do
echo "Killing pid $victim"
kill -9 "$victim" || true
done
)

View File

@ -1,5 +1,12 @@
ignore:
- "src/bin"
coverage:
range: 50..100
round: down
precision: 1
status:
project: off
patch: off
comment:
layout: "diff"
behavior: default
require_changes: no

3
.gitignore vendored
View File

@ -1,4 +1,7 @@
/target/
/ledger-tool/target/
/wallet/target/
/core/target/
/book/html/
/book/src/img/
/book/src/tests.ok

View File

@ -8,6 +8,56 @@ don't agree with a convention, submit a PR patching this document and let's disc
the PR is accepted, *all* code should be updated as soon as possible to reflect the new
conventions.
Pull Requests
---
Small, frequent PRs are much preferred to large, infrequent ones. A large PR is difficult
to review, can block others from making progress, and can quickly get its author into
"rebase hell". A large PR oftentimes arises when one change requires another, which requires
another, and then another. When you notice those dependencies, put the fix into a commit of
its own, then checkout a new branch, and cherrypick it. Open a PR to start the review
process and then jump back to your original branch to keep making progress. Once the commit
is merged, you can use git-rebase to purge it from your original branch.
```bash
$ git pull --rebase upstream master
```
### How big is too big?
If there are no functional changes, PRs can be very large and that's no problem. If,
however, your changes are making meaningful changes or additions, then about 1,000 lines of
changes is about the most you should ask a Solana maintainer to review.
### Should I send small PRs as I develop large, new components?
Add only code to the codebase that is ready to be deployed. If you are building a large
library, consider developing it in a separate git repository. When it is ready to be
integrated, the Solana maintainers will work with you to decide on a path forward. Smaller
libraries may be copied in whereas very large ones may be pulled in with a package manager.
### When will my PR be reviewed?
PRs are typically reviewed and merged in under 7 days. If your PR has been open for longer,
it's a strong indicator that the reviewers aren't confident the change meets the quality
standards of the codebase. You might consider closing it and coming back with smaller PRs
and longer descriptions detailing what problem it solves and how it solves it.
Draft Pull Requests
---
If you want early feedback on your PR, use GitHub's "Draft Pull Request"
mechanism. Draft PRs are a convenient way to collaborate with the Solana
maintainers without triggering notifications as you make changes. When you feel
your PR is ready for a broader audience, you can transition your draft PR to a
standard PR with the click of a button.
Do not add reviewers to draft PRs. GitHub doesn't automatically clear approvals
when you click "Ready for Review", so a review that meant "I approve of the
direction" suddenly has the appearance of "I approve of these changes." Instead,
add a comment that mentions the usernames that you would like a review from. Ask
explicitly what you would like feedback on.
Rust coding conventions
---
@ -46,24 +96,23 @@ understood. Avoid introducing new 3-letter terms, which can be confused with 3-l
[Terms currently in use](book/src/terminology.md)
Proposing architectural changes
Design Proposals
---
Solana's architecture is described by a book generated from markdown files in
the `book/src/` directory, maintained by an *editor* (currently @garious). To
change the architecture, you'll need to at least propose a change the content
under the [Proposed
Changes](https://solana-labs.github.io/solana/proposals.html) chapter. Here's
the full process:
add a design proposal, you'll need to at least propose a change the content
under the [Accepted Design
Proposals](https://solana-labs.github.io/book-edge/proposals.html) chapter.
Here's the full process:
1. Propose to a change to the architecture by creating a PR that adds a
markdown document to the directory `book/src/` and references it from the
[table of contents](book/src/SUMMARY.md). Add the editor and any relevant
*maintainers* to the PR review.
1. Propose a design by creating a PR that adds a markdown document to the
directory `book/src/` and references it from the [table of
contents](book/src/SUMMARY.md). Add any relevant *maintainers* to the PR review.
2. The PR being merged indicates your proposed change was accepted and that the
editor and maintainers support your plan of attack.
maintainers support your plan of attack.
3. Submit PRs that implement the proposal. When the implementation reveals the
need for tweaks to the architecture, be sure to update the proposal and have
need for tweaks to the proposal, be sure to update the proposal and have
that change reviewed by the same people as in step 1.
4. Once the implementation is complete, the editor will then work to integrate
the document into the book.
4. Once the implementation is complete, submit a PR that moves the link from
the Accepted Proposals to the Implemented Proposals section.

2477
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,91 +1,3 @@
[package]
name = "solana"
description = "Blockchain, Rebuilt for Scale"
version = "0.11.0"
documentation = "https://docs.rs/solana"
homepage = "https://solana.com/"
readme = "README.md"
repository = "https://github.com/solana-labs/solana"
authors = ["Solana Maintainers <maintainers@solana.com>"]
license = "Apache-2.0"
edition = "2018"
[badges]
codecov = { repository = "solana-labs/solana", branch = "master", service = "github" }
[features]
bpf_c = ["solana-bpfloader/bpf_c"]
chacha = []
cuda = []
erasure = []
ipv6 = []
test = []
unstable = []
[dependencies]
bincode = "1.0.0"
bs58 = "0.2.0"
bv = { version = "0.10.0", features = ["serde"] }
byteorder = "1.2.1"
chrono = { version = "0.4.0", features = ["serde"] }
hashbrown = "0.1.7"
indexmap = "1.0"
itertools = "0.8.0"
libc = "0.2.45"
log = "0.4.2"
nix = "0.12.0"
rand = "0.6.1"
rand_chacha = "0.1.0"
rayon = "1.0.0"
reqwest = "0.9.0"
ring = "0.13.2"
rocksdb = "0.10.1"
serde = "1.0.82"
serde_derive = "1.0.82"
serde_json = "1.0.10"
solana-bpfloader = { path = "programs/native/bpf_loader", version = "0.11.0" }
solana-drone = { path = "drone", version = "0.11.0" }
solana-jsonrpc-core = "0.4.0"
solana-jsonrpc-http-server = "0.4.0"
solana-jsonrpc-macros = "0.4.0"
solana-jsonrpc-pubsub = "0.4.0"
solana-jsonrpc-ws-server = "0.4.0"
solana-logger = { path = "logger", version = "0.11.0" }
solana-metrics = { path = "metrics", version = "0.11.0" }
solana-native-loader = { path = "programs/native/native_loader", version = "0.11.0" }
solana-netutil = { path = "netutil", version = "0.11.0" }
solana-sdk = { path = "sdk", version = "0.11.0" }
solana-system-program = { path = "programs/native/system", version = "0.11.0" }
tokio = "0.1"
tokio-codec = "0.1"
untrusted = "0.6.2"
[dev-dependencies]
hex-literal = "0.1.1"
matches = "0.1.6"
[[bench]]
name = "bank"
[[bench]]
name = "banking_stage"
[[bench]]
name = "db_ledger"
[[bench]]
name = "ledger"
[[bench]]
name = "signature"
[[bench]]
name = "sigverify"
[[bench]]
required-features = ["chacha"]
name = "chacha"
[workspace]
members = [
".",
@ -93,25 +5,36 @@ members = [
"bench-tps",
"drone",
"fullnode",
"fullnode-config",
"genesis",
"gossip",
"install",
"keygen",
"kvstore",
"ledger-tool",
"logger",
"metrics",
"programs/bpf/rust/noop",
"programs/native/bpf_loader",
"programs/native/budget",
"programs/native/erc20",
"programs/native/lua_loader",
"programs/native/native_loader",
"programs/native/noop",
"programs/native/storage",
"programs/native/system",
"programs/native/vote",
"programs/bpf",
"programs/bpf_loader",
"programs/budget_api",
"programs/budget_program",
"programs/config_api",
"programs/config_program",
"programs/exchange_api",
"programs/exchange_program",
"programs/token_api",
"programs/token_program",
"programs/failure_program",
"programs/noop_program",
"programs/stake_api",
"programs/stake_program",
"programs/storage_api",
"programs/storage_program",
"programs/vote_api",
"programs/vote_program",
"replicator",
"sdk",
"upload-perf",
"vote-signer",
"wallet",
]
exclude = ["programs/bpf/rust/noop"]

View File

@ -26,7 +26,9 @@ Furthermore, and much to our surprise, it can be implemented using a mechanism t
Architecture
===
Before you jump into the code, review the online book [Solana: Blockchain Rebuilt for Scale](https://solana-labs.github.io/solana/).
Before you jump into the code, review the online book [Solana: Blockchain Rebuilt for Scale](https://solana-labs.github.io/book/).
(The _latest_ development version of the online book is also [available here](https://solana-labs.github.io/book-edge/).)
Developing
===
@ -42,7 +44,7 @@ $ source $HOME/.cargo/env
$ rustup component add rustfmt-preview
```
If your rustc version is lower than 1.31.0, please update it:
If your rustc version is lower than 1.34.0, please update it:
```bash
$ rustup update
@ -67,6 +69,11 @@ Build
$ cargo build --all
```
Then to run a minimal local cluster
```bash
$ ./run.sh
```
Testing
---
@ -76,16 +83,10 @@ Run the test suite:
$ cargo test --all
```
To emulate all the tests that will run on a Pull Request, run:
```bash
$ ./ci/run-local.sh
```
Local Testnet
---
Start your own testnet locally, instructions are in the book [Solana: Blockchain Rebuild for Scale: Getting Started](https://solana-labs.github.io/solana/getting-started.html).
Start your own testnet locally, instructions are in the book [Solana: Blockchain Rebuild for Scale: Getting Started](https://solana-labs.github.io/book/getting-started.html).
Remote Testnets
---
@ -103,10 +104,7 @@ We maintain several testnets:
They are deployed with the `ci/testnet-manager.sh` script through a list of [scheduled
buildkite jobs](https://buildkite.com/solana-labs/testnet-management/settings/schedules).
Each testnet can be manually manipulated from buildkite as well. The `-perf`
testnets use a release tarball while the non`-perf` builds use the snap build
(we've observed that the snap build runs slower than a tarball but this has yet
to be root caused).
Each testnet can be manually manipulated from buildkite as well.
## How do I reset the testnet?
Manually trigger the [testnet-management](https://buildkite.com/solana-labs/testnet-management) pipeline
@ -127,10 +125,52 @@ can run your own testnet using the scripts in the `net/` directory.
Edit `ci/testnet-manager.sh`
## Metrics Server Maintenance
Sometimes the dashboard becomes unresponsive. This happens due to glitch in the metrics server.
The current solution is to reset the metrics server. Use the following steps.
1. The server is hosted in a GCP VM instance. Check if the VM instance is down by trying to SSH
into it from the GCP console. The name of the VM is ```metrics-solana-com```.
2. If the VM is inaccessible, reset it from the GCP console.
3. Once VM is up (or, was already up), the metrics services can be restarted from build automation.
1. Navigate to https://buildkite.com/solana-labs/metrics-dot-solana-dot-com in your web browser
2. Click on ```New Build```
3. This will show a pop up dialog. Click on ```options``` drop down.
4. Type in ```FORCE_START=true``` in ```Environment Variables``` text box.
5. Click ```Create Build```
6. This will restart the metrics services, and the dashboards should be accessible afterwards.
## Debugging Testnet
Testnet may exhibit different symptoms of failures. Primary statistics to check are
1. Rise in Confirmation Time
2. Nodes are not voting
3. Panics, and OOM notifications
Check the following if there are any signs of failure.
1. Did testnet deployment fail?
1. View buildkite logs for the last deployment: https://buildkite.com/solana-labs/testnet-management
2. Use the relevant branch
3. If the deployment failed, look at the build logs. The build artifacts for each remote node is uploaded.
It's a good first step to triage from these logs.
2. You may have to log into remote node if the deployment succeeded, but something failed during runtime.
1. Get the private key for the testnet deployment from ```metrics-solana-com``` GCP instance.
2. SSH into ```metrics-solana-com``` using GCP console and do the following.
```bash
sudo bash
cd ~buildkite-agent/.ssh
ls
```
3. Copy the relevant private key to your local machine
4. Find the public IP address of the AWS instance for the remote node using AWS console
5. ```ssh -i <private key file> ubuntu@<ip address of remote node>```
6. The logs are in ```~solana\solana``` folder
Benchmarking
---
First install the nightly build of rustc. `cargo bench` requires unstable features:
First install the nightly build of rustc. `cargo bench` requires use of the
unstable features only available in the nightly build.
```bash
$ rustup install nightly
@ -139,7 +179,7 @@ $ rustup install nightly
Run the benchmarks:
```bash
$ cargo +nightly bench --features="unstable"
$ cargo +nightly bench
```
Release Process

View File

@ -43,8 +43,7 @@ the `master` branch as late as possible prior to the milestone release.
### v*X.Y.Z* release tag
The release tags are created as desired by the owner of the given stabilization
branch, and cause that *X.Y.Z* release to be shipped to https://crates.io,
https://snapcraft.io/, and elsewhere.
branch, and cause that *X.Y.Z* release to be shipped to https://crates.io
Immediately after a new v*X.Y.Z* branch tag has been created, the `Cargo.toml`
patch version number (*Z*) of the stabilization branch is incremented by the
@ -64,27 +63,49 @@ There are three release channels that map to branches as follows:
### Changing channels
When cutting a new channel branch these pre-steps are required:
#### Create the new branch
1. Pick your branch point for release on master.
2. Create the branch. The name should be "v" + the first 2 "version" fields from Cargo.toml. For example, a Cargo.toml with version = "0.9.0" implies the next branch name is "v0.9".
4. Push the new branch to the solana repository
3. Update Cargo.toml on master to the next semantic version (e.g. 0.9.0 -> 0.10.0) by running `./scripts/increment-cargo-version.sh`.
5. Land your Cargo.toml change as a master PR.
1. Create the branch. The name should be "v" + the first 2 "version" fields
from Cargo.toml. For example, a Cargo.toml with version = "0.9.0" implies
the next branch name is "v0.9".
1. Note the Cargo.toml in the repo root directory does not contain a version. Look at any other Cargo.toml file.
1. Create a new branch and push this branch to the solana repository.
1. `git checkout -b <branchname>`
1. `git push -u origin <branchname>`
At this point, ci/channel-info.sh should show your freshly cut release branch as "BETA_CHANNEL" and the previous release branch as "STABLE_CHANNEL".
#### Update master with the next version
1. After the new branch has been created and pushed, update Cargo.toml on **master** to the next semantic version (e.g. 0.9.0 -> 0.10.0)
by running `./scripts/increment-cargo-version.sh`, then rebuild with
`cargo build` to cause a refresh of `Cargo.lock`.
1. Push your Cargo.toml change and the autogenerated Cargo.lock changes to the
master branch
At this point, `ci/channel-info.sh` should show your freshly cut release branch as
"BETA_CHANNEL" and the previous release branch as "STABLE_CHANNEL".
### Updating channels (i.e. "making a release")
We use [github's Releases UI](https://github.com/solana-labs/solana/releases) for tagging a release.
1. Go [there ;)](https://github.com/solana-labs/solana/releases).
2. Click "Draft new release". The release tag must exactly match the `version` field in `/Cargo.toml` prefixed by `v` (ie, `<branchname>.X`).
3. If the first major release on the branch (e.g. v0.8.0), paste in [this template](https://raw.githubusercontent.com/solana-labs/solana/master/.github/RELEASE_TEMPLATE.md) and fill it in.
4. Test the release by generating a tag using semver's rules. First try at a release should be `<branchname>.X-rc.0`.
5. Verify release automation:
1. Click "Draft new release". The release tag must exactly match the `version`
field in `/Cargo.toml` prefixed by `v` (ie, `<branchname>.X`).
1. If the Cargo.toml verion field is **0.12.3**, then the release tag must be **v0.12.3**
1. If this is the first release on the branch (e.g. v0.13.**0**), paste in [this
template](https://raw.githubusercontent.com/solana-labs/solana/master/.github/RELEASE_TEMPLATE.md)
and fill it in.
1. Test the release by generating a tag using semver's rules. First try at a
release should be `<branchname>.X-rc.0`.
1. Verify release automation:
1. [Crates.io](https://crates.io/crates/solana) should have an updated Solana version.
2. ...
6. After testnet deployment, verify that testnets are running correct software. http://metrics.solana.com should show testnet running on a hash from your newly created branch.
7. Once the release has been made, update Cargo.toml on release to the next semantic version (e.g. 0.9.0 -> 0.9.1) by running `./scripts/increment-cargo-version.sh patch`.
1. ...
1. After testnet deployment, verify that testnets are running correct software.
http://metrics.solana.com should show testnet running on a hash from your
newly created branch.
1. Once the release has been made, update Cargo.toml on the release branch to the next
semantic version (e.g. 0.9.0 -> 0.9.1) by running
`./scripts/increment-cargo-version.sh patch`, then rebuild with `cargo
build` to cause a refresh of `Cargo.lock`.
1. Push your Cargo.toml change and the autogenerated Cargo.lock changes to the
release branch.

View File

@ -2,16 +2,17 @@
authors = ["Solana Maintainers <maintainers@solana.com>"]
edition = "2018"
name = "solana-bench-streamer"
version = "0.11.0"
version = "0.13.3"
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
[dependencies]
clap = "2.32.0"
solana = { path = "..", version = "0.11.0" }
solana-logger = { path = "../logger", version = "0.11.0" }
solana-netutil = { path = "../netutil", version = "0.11.0" }
clap = "2.33.0"
solana = { path = "../core", version = "0.13.3" }
solana-logger = { path = "../logger", version = "0.13.3" }
solana-netutil = { path = "../netutil", version = "0.13.3" }
[features]
cuda = []
cuda = ["solana/cuda"]
erasure = []

View File

@ -1,4 +1,4 @@
use clap::{App, Arg};
use clap::{crate_description, crate_name, crate_version, App, Arg};
use solana::packet::{Packet, SharedPackets, BLOB_SIZE, PACKET_DATA_SIZE};
use solana::result::Result;
use solana::streamer::{receiver, PacketReceiver};
@ -51,7 +51,9 @@ fn sink(exit: Arc<AtomicBool>, rvs: Arc<AtomicUsize>, r: PacketReceiver) -> Join
fn main() -> Result<()> {
let mut num_sockets = 1usize;
let matches = App::new("solana-bench-streamer")
let matches = App::new(crate_name!())
.about(crate_description!())
.version(crate_version!())
.arg(
Arg::with_name("num-recv-sockets")
.long("num-recv-sockets")
@ -81,12 +83,7 @@ fn main() -> Result<()> {
let (s_reader, r_reader) = channel();
read_channels.push(r_reader);
read_threads.push(receiver(
Arc::new(read),
exit.clone(),
s_reader,
"bench-streamer",
));
read_threads.push(receiver(Arc::new(read), &exit, s_reader, "bench-streamer"));
}
let t_producer1 = producer(&addr, exit.clone());

View File

@ -2,20 +2,23 @@
authors = ["Solana Maintainers <maintainers@solana.com>"]
edition = "2018"
name = "solana-bench-tps"
version = "0.11.0"
version = "0.13.3"
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
[dependencies]
clap = "2.32.0"
clap = "2.33.0"
rayon = "1.0.3"
serde_json = "1.0.10"
solana = { path = "..", version = "0.11.0" }
solana-drone = { path = "../drone", version = "0.11.0" }
solana-logger = { path = "../logger", version = "0.11.0" }
solana-metrics = { path = "../metrics", version = "0.11.0" }
solana-sdk = { path = "../sdk", version = "0.11.0" }
serde_json = "1.0.39"
solana = { path = "../core", version = "0.13.3" }
solana-client = { path = "../client", version = "0.13.3" }
solana-drone = { path = "../drone", version = "0.13.3" }
solana-logger = { path = "../logger", version = "0.13.3" }
solana-metrics = { path = "../metrics", version = "0.13.3" }
solana-netutil = { path = "../netutil", version = "0.13.3" }
solana-sdk = { path = "../sdk", version = "0.13.3" }
[features]
cuda = []
cuda = ["solana/cuda"]
erasure = []

View File

@ -1,14 +1,21 @@
use solana_metrics;
use crate::cli::Config;
use rayon::prelude::*;
use solana::client::mk_client;
use solana::cluster_info::NodeInfo;
use solana::thin_client::ThinClient;
use solana::cluster_info::FULLNODE_PORT_RANGE;
use solana::contact_info::ContactInfo;
use solana::gen_keys::GenKeys;
use solana::gossip_service::discover_nodes;
use solana_client::thin_client::create_client;
use solana_client::thin_client::ThinClient;
use solana_drone::drone::request_airdrop_transaction;
use solana_metrics::influxdb;
use solana_sdk::client::{AsyncClient, SyncClient};
use solana_sdk::hash::Hash;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::{Keypair, KeypairUtil};
use solana_sdk::system_transaction::SystemTransaction;
use solana_sdk::system_instruction;
use solana_sdk::system_transaction;
use solana_sdk::timing::timestamp;
use solana_sdk::timing::{duration_as_ms, duration_as_s};
use solana_sdk::transaction::Transaction;
@ -19,6 +26,7 @@ use std::process::exit;
use std::sync::atomic::{AtomicBool, AtomicIsize, AtomicUsize, Ordering};
use std::sync::{Arc, RwLock};
use std::thread::sleep;
use std::thread::Builder;
use std::time::Duration;
use std::time::Instant;
@ -33,33 +41,227 @@ pub const MAX_SPENDS_PER_TX: usize = 4;
pub type SharedTransactions = Arc<RwLock<VecDeque<Vec<(Transaction, u64)>>>>;
pub fn metrics_submit_token_balance(token_balance: u64) {
println!("Token balance: {}", token_balance);
pub fn do_bench_tps(config: Config) {
let Config {
network_addr: network,
drone_addr,
id,
threads,
thread_batch_sleep_ms,
num_nodes,
duration,
tx_count,
sustained,
} = config;
let nodes = discover_nodes(&network, num_nodes).unwrap_or_else(|err| {
eprintln!("Failed to discover {} nodes: {:?}", num_nodes, err);
exit(1);
});
if nodes.len() < num_nodes {
eprintln!(
"Error: Insufficient nodes discovered. Expecting {} or more",
num_nodes
);
exit(1);
}
let cluster_entrypoint = nodes[0].clone(); // Pick the first node, why not?
let client = create_client(cluster_entrypoint.client_facing_addr(), FULLNODE_PORT_RANGE);
let mut barrier_client =
create_client(cluster_entrypoint.client_facing_addr(), FULLNODE_PORT_RANGE);
let mut seed = [0u8; 32];
seed.copy_from_slice(&id.public_key_bytes()[..32]);
let mut rnd = GenKeys::new(seed);
println!("Creating {} keypairs...", tx_count * 2);
let mut total_keys = 0;
let mut target = tx_count * 2;
while target > 0 {
total_keys += target;
target /= MAX_SPENDS_PER_TX;
}
let gen_keypairs = rnd.gen_n_keypairs(total_keys as u64);
let barrier_source_keypair = Keypair::new();
let barrier_dest_id = Pubkey::new_rand();
println!("Get lamports...");
let num_lamports_per_account = 20;
// Sample the first keypair, see if it has lamports, if so then resume
// to avoid lamport loss
let keypair0_balance = client
.poll_get_balance(&gen_keypairs.last().unwrap().pubkey())
.unwrap_or(0);
if num_lamports_per_account > keypair0_balance {
let extra = num_lamports_per_account - keypair0_balance;
let total = extra * (gen_keypairs.len() as u64);
airdrop_lamports(&client, &drone_addr, &id, total);
println!("adding more lamports {}", extra);
fund_keys(&client, &id, &gen_keypairs, extra);
}
let start = gen_keypairs.len() - (tx_count * 2) as usize;
let keypairs = &gen_keypairs[start..];
airdrop_lamports(&barrier_client, &drone_addr, &barrier_source_keypair, 1);
println!("Get last ID...");
let mut blockhash = client.get_recent_blockhash().unwrap();
println!("Got last ID {:?}", blockhash);
let first_tx_count = client.get_transaction_count().expect("transaction count");
println!("Initial transaction count {}", first_tx_count);
let exit_signal = Arc::new(AtomicBool::new(false));
// Setup a thread per validator to sample every period
// collect the max transaction rate and total tx count seen
let maxes = Arc::new(RwLock::new(Vec::new()));
let sample_period = 1; // in seconds
println!("Sampling TPS every {} second...", sample_period);
let v_threads: Vec<_> = nodes
.into_iter()
.map(|v| {
let exit_signal = exit_signal.clone();
let maxes = maxes.clone();
Builder::new()
.name("solana-client-sample".to_string())
.spawn(move || {
sample_tx_count(&exit_signal, &maxes, first_tx_count, &v, sample_period);
})
.unwrap()
})
.collect();
let shared_txs: SharedTransactions = Arc::new(RwLock::new(VecDeque::new()));
let shared_tx_active_thread_count = Arc::new(AtomicIsize::new(0));
let total_tx_sent_count = Arc::new(AtomicUsize::new(0));
let s_threads: Vec<_> = (0..threads)
.map(|_| {
let exit_signal = exit_signal.clone();
let shared_txs = shared_txs.clone();
let cluster_entrypoint = cluster_entrypoint.clone();
let shared_tx_active_thread_count = shared_tx_active_thread_count.clone();
let total_tx_sent_count = total_tx_sent_count.clone();
Builder::new()
.name("solana-client-sender".to_string())
.spawn(move || {
do_tx_transfers(
&exit_signal,
&shared_txs,
&cluster_entrypoint,
&shared_tx_active_thread_count,
&total_tx_sent_count,
thread_batch_sleep_ms,
);
})
.unwrap()
})
.collect();
// generate and send transactions for the specified duration
let start = Instant::now();
let mut reclaim_lamports_back_to_source_account = false;
let mut i = keypair0_balance;
while start.elapsed() < duration {
let balance = client.poll_get_balance(&id.pubkey()).unwrap_or(0);
metrics_submit_lamport_balance(balance);
// ping-pong between source and destination accounts for each loop iteration
// this seems to be faster than trying to determine the balance of individual
// accounts
let len = tx_count as usize;
generate_txs(
&shared_txs,
&keypairs[..len],
&keypairs[len..],
threads,
reclaim_lamports_back_to_source_account,
&cluster_entrypoint,
);
// In sustained mode overlap the transfers with generation
// this has higher average performance but lower peak performance
// in tested environments.
if !sustained {
while shared_tx_active_thread_count.load(Ordering::Relaxed) > 0 {
sleep(Duration::from_millis(100));
}
}
// It's not feasible (would take too much time) to confirm each of the `tx_count / 2`
// transactions sent by `generate_txs()` so instead send and confirm a single transaction
// to validate the network is still functional.
send_barrier_transaction(
&mut barrier_client,
&mut blockhash,
&barrier_source_keypair,
&barrier_dest_id,
);
i += 1;
if should_switch_directions(num_lamports_per_account, i) {
reclaim_lamports_back_to_source_account = !reclaim_lamports_back_to_source_account;
}
}
// Stop the sampling threads so it will collect the stats
exit_signal.store(true, Ordering::Relaxed);
println!("Waiting for validator threads...");
for t in v_threads {
if let Err(err) = t.join() {
println!(" join() failed with: {:?}", err);
}
}
// join the tx send threads
println!("Waiting for transmit threads...");
for t in s_threads {
if let Err(err) = t.join() {
println!(" join() failed with: {:?}", err);
}
}
let balance = client.poll_get_balance(&id.pubkey()).unwrap_or(0);
metrics_submit_lamport_balance(balance);
compute_and_report_stats(
&maxes,
sample_period,
&start.elapsed(),
total_tx_sent_count.load(Ordering::Relaxed),
);
}
fn metrics_submit_lamport_balance(lamport_balance: u64) {
println!("Token balance: {}", lamport_balance);
solana_metrics::submit(
influxdb::Point::new("bench-tps")
.add_tag("op", influxdb::Value::String("token_balance".to_string()))
.add_field("balance", influxdb::Value::Integer(token_balance as i64))
.add_tag("op", influxdb::Value::String("lamport_balance".to_string()))
.add_field("balance", influxdb::Value::Integer(lamport_balance as i64))
.to_owned(),
);
}
pub fn sample_tx_count(
fn sample_tx_count(
exit_signal: &Arc<AtomicBool>,
maxes: &Arc<RwLock<Vec<(SocketAddr, NodeStats)>>>,
first_tx_count: u64,
v: &NodeInfo,
v: &ContactInfo,
sample_period: u64,
) {
let mut client = mk_client(&v);
let client = create_client(v.client_facing_addr(), FULLNODE_PORT_RANGE);
let mut now = Instant::now();
let mut initial_tx_count = client.transaction_count();
let mut initial_tx_count = client.get_transaction_count().expect("transaction count");
let mut max_tps = 0.0;
let mut total;
let log_prefix = format!("{:21}:", v.tpu.to_string());
loop {
let tx_count = client.transaction_count();
let tx_count = client.get_transaction_count().expect("transaction count");
assert!(
tx_count >= initial_tx_count,
"expected tx_count({}) >= initial_tx_count({})",
@ -99,8 +301,13 @@ pub fn sample_tx_count(
}
}
/// Send loopback payment of 0 tokens and confirm the network processed it
pub fn send_barrier_transaction(barrier_client: &mut ThinClient, last_id: &mut Hash, id: &Keypair) {
/// Send loopback payment of 0 lamports and confirm the network processed it
fn send_barrier_transaction(
barrier_client: &mut ThinClient,
blockhash: &mut Hash,
source_keypair: &Keypair,
dest_id: &Pubkey,
) {
let transfer_start = Instant::now();
let mut poll_count = 0;
@ -112,9 +319,12 @@ pub fn send_barrier_transaction(barrier_client: &mut ThinClient, last_id: &mut H
);
}
*last_id = barrier_client.get_last_id();
*blockhash = barrier_client.get_recent_blockhash().unwrap();
let transaction =
system_transaction::create_user_account(&source_keypair, dest_id, 0, *blockhash, 0);
let signature = barrier_client
.transfer(0, &id, id.pubkey(), last_id)
.async_send_transaction(transaction)
.expect("Unable to send barrier transaction");
let confirmatiom = barrier_client.poll_for_signature(&signature);
@ -136,7 +346,7 @@ pub fn send_barrier_transaction(barrier_client: &mut ThinClient, last_id: &mut H
// Sanity check that the client balance is still 1
let balance = barrier_client
.poll_balance_with_timeout(
&id.pubkey(),
&source_keypair.pubkey(),
&Duration::from_millis(100),
&Duration::from_secs(10),
)
@ -154,29 +364,29 @@ pub fn send_barrier_transaction(barrier_client: &mut ThinClient, last_id: &mut H
exit(1);
}
let new_last_id = barrier_client.get_last_id();
if new_last_id == *last_id {
let new_blockhash = barrier_client.get_recent_blockhash().unwrap();
if new_blockhash == *blockhash {
if poll_count > 0 && poll_count % 8 == 0 {
println!("last_id is not advancing, still at {:?}", *last_id);
println!("blockhash is not advancing, still at {:?}", *blockhash);
}
} else {
*last_id = new_last_id;
*blockhash = new_blockhash;
}
poll_count += 1;
}
}
pub fn generate_txs(
fn generate_txs(
shared_txs: &SharedTransactions,
source: &[Keypair],
dest: &[Keypair],
threads: usize,
reclaim: bool,
leader: &NodeInfo,
contact_info: &ContactInfo,
) {
let mut client = mk_client(leader);
let last_id = client.get_last_id();
let client = create_client(contact_info.client_facing_addr(), FULLNODE_PORT_RANGE);
let blockhash = client.get_recent_blockhash().unwrap();
let tx_count = source.len();
println!("Signing transactions... {} (reclaim={})", tx_count, reclaim);
let signing_start = Instant::now();
@ -190,7 +400,7 @@ pub fn generate_txs(
.par_iter()
.map(|(id, keypair)| {
(
Transaction::system_new(id, keypair.pubkey(), 1, last_id),
system_transaction::create_user_account(id, &keypair.pubkey(), 1, blockhash, 0),
timestamp(),
)
})
@ -205,7 +415,7 @@ pub fn generate_txs(
bsps * 1_000_000_f64,
nsps / 1_000_f64,
duration_as_ms(&duration),
last_id,
blockhash,
);
solana_metrics::submit(
influxdb::Point::new("bench-tps")
@ -227,15 +437,19 @@ pub fn generate_txs(
}
}
pub fn do_tx_transfers(
fn do_tx_transfers(
exit_signal: &Arc<AtomicBool>,
shared_txs: &SharedTransactions,
leader: &NodeInfo,
contact_info: &ContactInfo,
shared_tx_thread_count: &Arc<AtomicIsize>,
total_tx_sent_count: &Arc<AtomicUsize>,
thread_batch_sleep_ms: usize,
) {
let client = mk_client(&leader);
let client = create_client(contact_info.client_facing_addr(), FULLNODE_PORT_RANGE);
loop {
if thread_batch_sleep_ms > 0 {
sleep(Duration::from_millis(thread_batch_sleep_ms as u64));
}
let txs;
{
let mut shared_txs_wl = shared_txs.write().unwrap();
@ -246,7 +460,7 @@ pub fn do_tx_transfers(
println!(
"Transferring 1 unit {} times... to {}",
txs0.len(),
leader.tpu
contact_info.tpu
);
let tx_len = txs0.len();
let transfer_start = Instant::now();
@ -255,7 +469,7 @@ pub fn do_tx_transfers(
if now > tx.1 && now - tx.1 > 1000 * 30 {
continue;
}
client.transfer_signed(&tx.0).unwrap();
client.async_send_transaction(tx.0).unwrap();
}
shared_tx_thread_count.fetch_add(-1, Ordering::Relaxed);
total_tx_sent_count.fetch_add(tx_len, Ordering::Relaxed);
@ -281,8 +495,8 @@ pub fn do_tx_transfers(
}
}
pub fn verify_funding_transfer(client: &mut ThinClient, tx: &Transaction, amount: u64) -> bool {
for a in &tx.account_keys[1..] {
fn verify_funding_transfer(client: &ThinClient, tx: &Transaction, amount: u64) -> bool {
for a in &tx.message().account_keys[1..] {
if client.get_balance(a).unwrap_or(0) >= amount {
return true;
}
@ -294,8 +508,8 @@ pub fn verify_funding_transfer(client: &mut ThinClient, tx: &Transaction, amount
/// fund the dests keys by spending all of the source keys into MAX_SPENDS_PER_TX
/// on every iteration. This allows us to replay the transfers because the source is either empty,
/// or full
pub fn fund_keys(client: &mut ThinClient, source: &Keypair, dests: &[Keypair], tokens: u64) {
let total = tokens * dests.len() as u64;
fn fund_keys(client: &ThinClient, source: &Keypair, dests: &[Keypair], lamports: u64) {
let total = lamports * dests.len() as u64;
let mut funded: Vec<(&Keypair, u64)> = vec![(source, total)];
let mut notfunded: Vec<&Keypair> = dests.iter().collect();
@ -324,7 +538,7 @@ pub fn fund_keys(client: &mut ThinClient, source: &Keypair, dests: &[Keypair], t
}
}
// try to transfer a "few" at a time with recent last_id
// try to transfer a "few" at a time with recent blockhash
// assume 4MB network buffers, and 512 byte packets
const FUND_CHUNK_LEN: usize = 4 * 1024 * 1024 / 512;
@ -338,7 +552,10 @@ pub fn fund_keys(client: &mut ThinClient, source: &Keypair, dests: &[Keypair], t
.map(|(k, m)| {
(
k.clone(),
Transaction::system_move_many(k, &m, Default::default(), 0),
Transaction::new_unsigned_instructions(system_instruction::transfer_many(
&k.pubkey(),
&m,
)),
)
})
.collect();
@ -348,7 +565,7 @@ pub fn fund_keys(client: &mut ThinClient, source: &Keypair, dests: &[Keypair], t
while !to_fund_txs.is_empty() {
let receivers = to_fund_txs
.iter()
.fold(0, |len, (_, tx)| len + tx.instructions.len());
.fold(0, |len, (_, tx)| len + tx.message().instructions.len());
println!(
"{} {} to {} in {} txs",
@ -362,21 +579,27 @@ pub fn fund_keys(client: &mut ThinClient, source: &Keypair, dests: &[Keypair], t
to_fund_txs.len(),
);
let last_id = client.get_last_id();
let blockhash = client.get_recent_blockhash().unwrap();
// re-sign retained to_fund_txes with updated last_id
// re-sign retained to_fund_txes with updated blockhash
to_fund_txs.par_iter_mut().for_each(|(k, tx)| {
tx.sign(&[k], last_id);
tx.sign(&[*k], blockhash);
});
to_fund_txs.iter().for_each(|(_, tx)| {
client.transfer_signed(&tx).expect("transfer");
client.async_send_transaction(tx.clone()).expect("transfer");
});
// retry anything that seems to have dropped through cracks
// again since these txs are all or nothing, they're fine to
// retry
to_fund_txs.retain(|(_, tx)| !verify_funding_transfer(client, &tx, amount));
for _ in 0..10 {
to_fund_txs.retain(|(_, tx)| !verify_funding_transfer(client, &tx, amount));
if to_fund_txs.is_empty() {
break;
}
sleep(Duration::from_millis(100));
}
tries += 1;
}
@ -387,29 +610,24 @@ pub fn fund_keys(client: &mut ThinClient, source: &Keypair, dests: &[Keypair], t
}
}
pub fn airdrop_tokens(
client: &mut ThinClient,
drone_addr: &SocketAddr,
id: &Keypair,
tx_count: u64,
) {
fn airdrop_lamports(client: &ThinClient, drone_addr: &SocketAddr, id: &Keypair, tx_count: u64) {
let starting_balance = client.poll_get_balance(&id.pubkey()).unwrap_or(0);
metrics_submit_token_balance(starting_balance);
metrics_submit_lamport_balance(starting_balance);
println!("starting balance {}", starting_balance);
if starting_balance < tx_count {
let airdrop_amount = tx_count - starting_balance;
println!(
"Airdropping {:?} tokens from {} for {}",
"Airdropping {:?} lamports from {} for {}",
airdrop_amount,
drone_addr,
id.pubkey(),
);
let last_id = client.get_last_id();
match request_airdrop_transaction(&drone_addr, &id.pubkey(), airdrop_amount, last_id) {
let blockhash = client.get_recent_blockhash().unwrap();
match request_airdrop_transaction(&drone_addr, &id.pubkey(), airdrop_amount, blockhash) {
Ok(transaction) => {
let signature = client.transfer_signed(&transaction).unwrap();
let signature = client.async_send_transaction(transaction).unwrap();
client.poll_for_signature(&signature).unwrap();
}
Err(err) => {
@ -426,7 +644,7 @@ pub fn airdrop_tokens(
});
println!("current balance {}...", current_balance);
metrics_submit_token_balance(current_balance);
metrics_submit_lamport_balance(current_balance);
if current_balance - starting_balance != airdrop_amount {
println!(
"Airdrop failed! {} {} {}",
@ -439,7 +657,7 @@ pub fn airdrop_tokens(
}
}
pub fn compute_and_report_stats(
fn compute_and_report_stats(
maxes: &Arc<RwLock<Vec<(SocketAddr, NodeStats)>>>,
sample_period: u64,
tx_send_elapsed: &Duration,
@ -503,16 +721,21 @@ pub fn compute_and_report_stats(
);
}
// First transfer 3/4 of the tokens to the dest accounts
// then ping-pong 1/4 of the tokens back to the other account
// this leaves 1/4 token buffer in each account
pub fn should_switch_directions(num_tokens_per_account: u64, i: u64) -> bool {
i % (num_tokens_per_account / 4) == 0 && (i >= (3 * num_tokens_per_account) / 4)
// First transfer 3/4 of the lamports to the dest accounts
// then ping-pong 1/4 of the lamports back to the other account
// this leaves 1/4 lamport buffer in each account
fn should_switch_directions(num_lamports_per_account: u64, i: u64) -> bool {
i % (num_lamports_per_account / 4) == 0 && (i >= (3 * num_lamports_per_account) / 4)
}
#[cfg(test)]
mod tests {
use super::*;
use solana::fullnode::FullnodeConfig;
use solana::local_cluster::{ClusterConfig, LocalCluster};
use solana_drone::drone::run_local_drone;
use std::sync::mpsc::channel;
#[test]
fn test_switch_directions() {
assert_eq!(should_switch_directions(20, 0), false);
@ -527,4 +750,33 @@ mod tests {
assert_eq!(should_switch_directions(20, 100), true);
assert_eq!(should_switch_directions(20, 101), false);
}
#[test]
#[ignore]
fn test_bench_tps() {
let fullnode_config = FullnodeConfig::default();
const NUM_NODES: usize = 1;
let cluster = LocalCluster::new(&ClusterConfig {
node_stakes: vec![999_990; NUM_NODES],
cluster_lamports: 2_000_000,
fullnode_config,
..ClusterConfig::default()
});
let drone_keypair = Keypair::new();
cluster.transfer(&cluster.funding_keypair, &drone_keypair.pubkey(), 1_000_000);
let (addr_sender, addr_receiver) = channel();
run_local_drone(drone_keypair, addr_sender, None);
let drone_addr = addr_receiver.recv_timeout(Duration::from_secs(2)).unwrap();
let mut cfg = Config::default();
cfg.network_addr = cluster.entry_point_info.gossip;
cfg.drone_addr = drone_addr;
cfg.tx_count = 100;
cfg.duration = Duration::from_secs(5);
cfg.num_nodes = NUM_NODES;
do_bench_tps(cfg);
}
}

View File

@ -2,7 +2,7 @@ use std::net::SocketAddr;
use std::process::exit;
use std::time::Duration;
use clap::{crate_version, App, Arg, ArgMatches};
use clap::{crate_description, crate_name, crate_version, App, Arg, ArgMatches};
use solana_drone::drone::DRONE_PORT;
use solana_sdk::signature::{read_keypair, Keypair, KeypairUtil};
@ -15,9 +15,8 @@ pub struct Config {
pub num_nodes: usize,
pub duration: Duration,
pub tx_count: usize,
pub thread_batch_sleep_ms: usize,
pub sustained: bool,
pub reject_extra_nodes: bool,
pub converge_only: bool,
}
impl Default for Config {
@ -30,16 +29,15 @@ impl Default for Config {
num_nodes: 1,
duration: Duration::new(std::u64::MAX, 0),
tx_count: 500_000,
thread_batch_sleep_ms: 0,
sustained: false,
reject_extra_nodes: false,
converge_only: false,
}
}
}
/// Defines and builds the CLI args for a run of the benchmark
pub fn build_args<'a, 'b>() -> App<'a, 'b> {
App::new("solana-bench-tps")
App::new(crate_name!()).about(crate_description!())
.version(crate_version!())
.arg(
Arg::with_name("network")
@ -73,11 +71,6 @@ pub fn build_args<'a, 'b>() -> App<'a, 'b> {
.takes_value(true)
.help("Wait for NUM nodes to converge"),
)
.arg(
Arg::with_name("reject-extra-nodes")
.long("reject-extra-nodes")
.help("Require exactly `num-nodes` on convergence. Appropriate only for internal networks"),
)
.arg(
Arg::with_name("threads")
.short("t")
@ -93,11 +86,6 @@ pub fn build_args<'a, 'b>() -> App<'a, 'b> {
.takes_value(true)
.help("Seconds to run benchmark, then exit; default is forever"),
)
.arg(
Arg::with_name("converge-only")
.long("converge-only")
.help("Exit immediately after converging"),
)
.arg(
Arg::with_name("sustained")
.long("sustained")
@ -110,6 +98,14 @@ pub fn build_args<'a, 'b>() -> App<'a, 'b> {
.takes_value(true)
.help("Number of transactions to send per batch")
)
.arg(
Arg::with_name("thread-batch-sleep-ms")
.short("z")
.long("thread-batch-sleep-ms")
.value_name("NUM")
.takes_value(true)
.help("Per-thread-per-iteration sleep in ms"),
)
}
/// Parses a clap `ArgMatches` structure into a `Config`
@ -121,14 +117,14 @@ pub fn extract_args<'a>(matches: &ArgMatches<'a>) -> Config {
let mut args = Config::default();
if let Some(addr) = matches.value_of("network") {
args.network_addr = addr.parse().unwrap_or_else(|e| {
eprintln!("failed to parse network: {}", e);
args.network_addr = solana_netutil::parse_host_port(addr).unwrap_or_else(|e| {
eprintln!("failed to parse network address: {}", e);
exit(1)
});
}
if let Some(addr) = matches.value_of("drone") {
args.drone_addr = addr.parse().unwrap_or_else(|e| {
args.drone_addr = solana_netutil::parse_host_port(addr).unwrap_or_else(|e| {
eprintln!("failed to parse drone address: {}", e);
exit(1)
});
@ -158,9 +154,14 @@ pub fn extract_args<'a>(matches: &ArgMatches<'a>) -> Config {
args.tx_count = s.to_string().parse().expect("can't parse tx_account");
}
if let Some(t) = matches.value_of("thread-batch-sleep-ms") {
args.thread_batch_sleep_ms = t
.to_string()
.parse()
.expect("can't parse thread-batch-sleep-ms");
}
args.sustained = matches.is_present("sustained");
args.converge_only = matches.is_present("converge-only");
args.reject_extra_nodes = matches.is_present("reject-extra-nodes");
args
}

View File

@ -1,73 +1,7 @@
mod bench;
mod cli;
use solana::client::mk_client;
use solana::cluster_info::{ClusterInfo, NodeInfo};
use solana::gossip_service::GossipService;
use solana::service::Service;
use solana::signature::GenKeys;
use solana::thin_client::poll_gossip_for_leader;
use solana_metrics;
use solana_sdk::signature::KeypairUtil;
use std::collections::VecDeque;
use std::process::exit;
use std::sync::atomic::{AtomicBool, AtomicIsize, AtomicUsize, Ordering};
use std::sync::{Arc, RwLock};
use std::thread::sleep;
use std::thread::Builder;
use std::time::Duration;
use std::time::Instant;
use crate::bench::*;
/// Creates a cluster and waits for the network to converge, returning the peers, leader, and gossip service
/// # Arguments
/// `leader` - the input leader node
/// `exit_signal` - atomic bool used to signal early exit to cluster
/// `num_nodes` - the number of nodes
/// # Panics
/// Panics if the spy node `RwLock` somehow ends up unreadable
fn converge(
leader: &NodeInfo,
exit_signal: &Arc<AtomicBool>,
num_nodes: usize,
) -> (Vec<NodeInfo>, Option<NodeInfo>, GossipService) {
//lets spy on the network
let (node, gossip_socket) = ClusterInfo::spy_node();
let mut spy_cluster_info = ClusterInfo::new(node);
spy_cluster_info.insert_info(leader.clone());
spy_cluster_info.set_leader(leader.id);
let spy_ref = Arc::new(RwLock::new(spy_cluster_info));
let gossip_service = GossipService::new(&spy_ref, None, gossip_socket, exit_signal.clone());
let mut v: Vec<NodeInfo> = vec![];
// wait for the network to converge, 30 seconds should be plenty
for _ in 0..30 {
{
let spy_ref = spy_ref.read().unwrap();
println!("{}", spy_ref.node_info_trace());
if spy_ref.leader_data().is_some() {
v = spy_ref.rpc_peers();
if v.len() >= num_nodes {
println!("CONVERGED!");
break;
} else {
println!(
"{} node(s) discovered (looking for {} or more)",
v.len(),
num_nodes
);
}
}
}
sleep(Duration::new(1, 0));
}
let leader = spy_ref.read().unwrap().leader_data().cloned();
(v, leader, gossip_service)
}
use crate::bench::do_bench_tps;
fn main() {
solana_logger::setup();
@ -77,228 +11,5 @@ fn main() {
let cfg = cli::extract_args(&matches);
let cli::Config {
network_addr: network,
drone_addr,
id,
threads,
num_nodes,
duration,
tx_count,
sustained,
reject_extra_nodes,
converge_only,
} = cfg;
println!("Looking for leader at {:?}", network);
let leader = poll_gossip_for_leader(network, None).expect("unable to find leader on network");
let exit_signal = Arc::new(AtomicBool::new(false));
let (nodes, leader, gossip_service) = converge(&leader, &exit_signal, num_nodes);
if nodes.len() < num_nodes {
println!(
"Error: Insufficient nodes discovered. Expecting {} or more",
num_nodes
);
exit(1);
}
if reject_extra_nodes && nodes.len() > num_nodes {
println!(
"Error: Extra nodes discovered. Expecting exactly {}",
num_nodes
);
exit(1);
}
if leader.is_none() {
println!("no leader");
exit(1);
}
if converge_only {
return;
}
let leader = leader.unwrap();
println!("leader RPC is at {} {}", leader.rpc, leader.id);
let mut client = mk_client(&leader);
let mut barrier_client = mk_client(&leader);
let mut seed = [0u8; 32];
seed.copy_from_slice(&id.public_key_bytes()[..32]);
let mut rnd = GenKeys::new(seed);
println!("Creating {} keypairs...", tx_count * 2);
let mut total_keys = 0;
let mut target = tx_count * 2;
while target > 0 {
total_keys += target;
target /= MAX_SPENDS_PER_TX;
}
let gen_keypairs = rnd.gen_n_keypairs(total_keys as u64);
let barrier_id = rnd.gen_n_keypairs(1).pop().unwrap();
println!("Get tokens...");
let num_tokens_per_account = 20;
// Sample the first keypair, see if it has tokens, if so then resume
// to avoid token loss
let keypair0_balance = client
.poll_get_balance(&gen_keypairs.last().unwrap().pubkey())
.unwrap_or(0);
if num_tokens_per_account > keypair0_balance {
let extra = num_tokens_per_account - keypair0_balance;
let total = extra * (gen_keypairs.len() as u64);
airdrop_tokens(&mut client, &drone_addr, &id, total);
println!("adding more tokens {}", extra);
fund_keys(&mut client, &id, &gen_keypairs, extra);
}
let start = gen_keypairs.len() - (tx_count * 2) as usize;
let keypairs = &gen_keypairs[start..];
airdrop_tokens(&mut barrier_client, &drone_addr, &barrier_id, 1);
println!("Get last ID...");
let mut last_id = client.get_last_id();
println!("Got last ID {:?}", last_id);
let first_tx_count = client.transaction_count();
println!("Initial transaction count {}", first_tx_count);
// Setup a thread per validator to sample every period
// collect the max transaction rate and total tx count seen
let maxes = Arc::new(RwLock::new(Vec::new()));
let sample_period = 1; // in seconds
println!("Sampling TPS every {} second...", sample_period);
let v_threads: Vec<_> = nodes
.into_iter()
.map(|v| {
let exit_signal = exit_signal.clone();
let maxes = maxes.clone();
Builder::new()
.name("solana-client-sample".to_string())
.spawn(move || {
sample_tx_count(&exit_signal, &maxes, first_tx_count, &v, sample_period);
})
.unwrap()
})
.collect();
let shared_txs: SharedTransactions = Arc::new(RwLock::new(VecDeque::new()));
let shared_tx_active_thread_count = Arc::new(AtomicIsize::new(0));
let total_tx_sent_count = Arc::new(AtomicUsize::new(0));
let s_threads: Vec<_> = (0..threads)
.map(|_| {
let exit_signal = exit_signal.clone();
let shared_txs = shared_txs.clone();
let leader = leader.clone();
let shared_tx_active_thread_count = shared_tx_active_thread_count.clone();
let total_tx_sent_count = total_tx_sent_count.clone();
Builder::new()
.name("solana-client-sender".to_string())
.spawn(move || {
do_tx_transfers(
&exit_signal,
&shared_txs,
&leader,
&shared_tx_active_thread_count,
&total_tx_sent_count,
);
})
.unwrap()
})
.collect();
// generate and send transactions for the specified duration
let start = Instant::now();
let mut reclaim_tokens_back_to_source_account = false;
let mut i = keypair0_balance;
while start.elapsed() < duration {
let balance = client.poll_get_balance(&id.pubkey()).unwrap_or(0);
metrics_submit_token_balance(balance);
// ping-pong between source and destination accounts for each loop iteration
// this seems to be faster than trying to determine the balance of individual
// accounts
let len = tx_count as usize;
generate_txs(
&shared_txs,
&keypairs[..len],
&keypairs[len..],
threads,
reclaim_tokens_back_to_source_account,
&leader,
);
// In sustained mode overlap the transfers with generation
// this has higher average performance but lower peak performance
// in tested environments.
if !sustained {
while shared_tx_active_thread_count.load(Ordering::Relaxed) > 0 {
sleep(Duration::from_millis(100));
}
}
// It's not feasible (would take too much time) to confirm each of the `tx_count / 2`
// transactions sent by `generate_txs()` so instead send and confirm a single transaction
// to validate the network is still functional.
send_barrier_transaction(&mut barrier_client, &mut last_id, &barrier_id);
i += 1;
if should_switch_directions(num_tokens_per_account, i) {
reclaim_tokens_back_to_source_account = !reclaim_tokens_back_to_source_account;
}
}
// Stop the sampling threads so it will collect the stats
exit_signal.store(true, Ordering::Relaxed);
println!("Waiting for validator threads...");
for t in v_threads {
if let Err(err) = t.join() {
println!(" join() failed with: {:?}", err);
}
}
// join the tx send threads
println!("Waiting for transmit threads...");
for t in s_threads {
if let Err(err) = t.join() {
println!(" join() failed with: {:?}", err);
}
}
let balance = client.poll_get_balance(&id.pubkey()).unwrap_or(0);
metrics_submit_token_balance(balance);
compute_and_report_stats(
&maxes,
sample_period,
&start.elapsed(),
total_tx_sent_count.load(Ordering::Relaxed),
);
// join the cluster_info client threads
gossip_service.join().unwrap();
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_switch_directions() {
assert_eq!(should_switch_directions(20, 0), false);
assert_eq!(should_switch_directions(20, 1), false);
assert_eq!(should_switch_directions(20, 14), false);
assert_eq!(should_switch_directions(20, 15), true);
assert_eq!(should_switch_directions(20, 16), false);
assert_eq!(should_switch_directions(20, 19), false);
assert_eq!(should_switch_directions(20, 20), true);
assert_eq!(should_switch_directions(20, 21), false);
assert_eq!(should_switch_directions(20, 99), false);
assert_eq!(should_switch_directions(20, 100), true);
assert_eq!(should_switch_directions(20, 101), false);
}
do_bench_tps(cfg);
}

View File

@ -1,232 +0,0 @@
#![feature(test)]
extern crate test;
use rand::{thread_rng, Rng};
use rayon::prelude::*;
use solana::bank::Bank;
use solana::banking_stage::{BankingStage, NUM_THREADS};
use solana::entry::Entry;
use solana::mint::Mint;
use solana::packet::to_packets_chunked;
use solana::status_deque::MAX_ENTRY_IDS;
use solana_sdk::hash::hash;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::{Keypair, KeypairUtil, Signature};
use solana_sdk::system_transaction::SystemTransaction;
use solana_sdk::transaction::Transaction;
use std::iter;
use std::sync::mpsc::{channel, Receiver};
use std::sync::Arc;
use std::time::Duration;
use test::Bencher;
fn check_txs(receiver: &Receiver<Vec<Entry>>, ref_tx_count: usize) {
let mut total = 0;
loop {
let entries = receiver.recv_timeout(Duration::new(1, 0));
if let Ok(entries) = entries {
for entry in &entries {
total += entry.transactions.len();
}
} else {
break;
}
if total >= ref_tx_count {
break;
}
}
assert_eq!(total, ref_tx_count);
}
#[bench]
fn bench_banking_stage_multi_accounts(bencher: &mut Bencher) {
let txes = 1000 * NUM_THREADS;
let mint_total = 1_000_000_000_000;
let mint = Mint::new(mint_total);
let (verified_sender, verified_receiver) = channel();
let bank = Arc::new(Bank::new(&mint));
let dummy_leader_id = Keypair::new().pubkey();
let dummy = Transaction::system_move(
&mint.keypair(),
mint.keypair().pubkey(),
1,
mint.last_id(),
0,
);
let transactions: Vec<_> = (0..txes)
.into_par_iter()
.map(|_| {
let mut new = dummy.clone();
let from: Vec<u8> = (0..64).map(|_| thread_rng().gen()).collect();
let to: Vec<u8> = (0..64).map(|_| thread_rng().gen()).collect();
let sig: Vec<u8> = (0..64).map(|_| thread_rng().gen()).collect();
new.account_keys[0] = Pubkey::new(&from[0..32]);
new.account_keys[1] = Pubkey::new(&to[0..32]);
new.signatures = vec![Signature::new(&sig[0..64])];
new
})
.collect();
// fund all the accounts
transactions.iter().for_each(|tx| {
let fund = Transaction::system_move(
&mint.keypair(),
tx.account_keys[0],
mint_total / txes as u64,
mint.last_id(),
0,
);
let x = bank.process_transaction(&fund);
assert!(x.is_ok());
});
//sanity check, make sure all the transactions can execute sequentially
transactions.iter().for_each(|tx| {
let res = bank.process_transaction(&tx);
assert!(res.is_ok(), "sanity test transactions");
});
bank.clear_signatures();
//sanity check, make sure all the transactions can execute in parallel
let res = bank.process_transactions(&transactions);
for r in res {
assert!(r.is_ok(), "sanity parallel execution");
}
bank.clear_signatures();
let verified: Vec<_> = to_packets_chunked(&transactions.clone(), 192)
.into_iter()
.map(|x| {
let len = x.read().unwrap().packets.len();
(x, iter::repeat(1).take(len).collect())
})
.collect();
let (_stage, signal_receiver) = BankingStage::new(
&bank,
verified_receiver,
Default::default(),
&mint.last_id(),
None,
dummy_leader_id,
);
let mut id = mint.last_id();
for _ in 0..MAX_ENTRY_IDS {
id = hash(&id.as_ref());
bank.register_tick(&id);
}
bencher.iter(move || {
// make sure the tx last id is still registered
if bank.count_valid_ids(&[mint.last_id()]).len() == 0 {
bank.register_tick(&mint.last_id());
}
for v in verified.chunks(verified.len() / NUM_THREADS) {
verified_sender.send(v.to_vec()).unwrap();
}
check_txs(&signal_receiver, txes);
bank.clear_signatures();
});
}
#[bench]
fn bench_banking_stage_multi_programs(bencher: &mut Bencher) {
let progs = 4;
let txes = 1000 * NUM_THREADS;
let mint_total = 1_000_000_000_000;
let mint = Mint::new(mint_total);
let (verified_sender, verified_receiver) = channel();
let bank = Arc::new(Bank::new(&mint));
let dummy_leader_id = Keypair::new().pubkey();
let dummy = Transaction::system_move(
&mint.keypair(),
mint.keypair().pubkey(),
1,
mint.last_id(),
0,
);
let transactions: Vec<_> = (0..txes)
.into_par_iter()
.map(|_| {
let mut new = dummy.clone();
let from: Vec<u8> = (0..32).map(|_| thread_rng().gen()).collect();
let sig: Vec<u8> = (0..64).map(|_| thread_rng().gen()).collect();
let to: Vec<u8> = (0..32).map(|_| thread_rng().gen()).collect();
new.account_keys[0] = Pubkey::new(&from[0..32]);
new.account_keys[1] = Pubkey::new(&to[0..32]);
let prog = new.instructions[0].clone();
for i in 1..progs {
//generate programs that spend to random keys
let to: Vec<u8> = (0..32).map(|_| thread_rng().gen()).collect();
let to_key = Pubkey::new(&to[0..32]);
new.account_keys.push(to_key);
assert_eq!(new.account_keys.len(), i + 2);
new.instructions.push(prog.clone());
assert_eq!(new.instructions.len(), i + 1);
new.instructions[i].accounts[1] = 1 + i as u8;
assert_eq!(new.key(i, 1), Some(&to_key));
assert_eq!(
new.account_keys[new.instructions[i].accounts[1] as usize],
to_key
);
}
assert_eq!(new.instructions.len(), progs);
new.signatures = vec![Signature::new(&sig[0..64])];
new
})
.collect();
transactions.iter().for_each(|tx| {
let fund = Transaction::system_move(
&mint.keypair(),
tx.account_keys[0],
mint_total / txes as u64,
mint.last_id(),
0,
);
assert!(bank.process_transaction(&fund).is_ok());
});
//sanity check, make sure all the transactions can execute sequentially
transactions.iter().for_each(|tx| {
let res = bank.process_transaction(&tx);
assert!(res.is_ok(), "sanity test transactions");
});
bank.clear_signatures();
//sanity check, make sure all the transactions can execute in parallel
let res = bank.process_transactions(&transactions);
for r in res {
assert!(r.is_ok(), "sanity parallel execution");
}
bank.clear_signatures();
let verified: Vec<_> = to_packets_chunked(&transactions.clone(), 96)
.into_iter()
.map(|x| {
let len = x.read().unwrap().packets.len();
(x, iter::repeat(1).take(len).collect())
})
.collect();
let (_stage, signal_receiver) = BankingStage::new(
&bank,
verified_receiver,
Default::default(),
&mint.last_id(),
None,
dummy_leader_id,
);
let mut id = mint.last_id();
for _ in 0..MAX_ENTRY_IDS {
id = hash(&id.as_ref());
bank.register_tick(&id);
}
bencher.iter(move || {
// make sure the transactions are still valid
if bank.count_valid_ids(&[mint.last_id()]).len() == 0 {
bank.register_tick(&mint.last_id());
}
for v in verified.chunks(verified.len() / NUM_THREADS) {
verified_sender.send(v.to_vec()).unwrap();
}
check_txs(&signal_receiver, txes);
bank.clear_signatures();
});
}

View File

@ -1,199 +0,0 @@
#![feature(test)]
use rand;
extern crate test;
use rand::seq::SliceRandom;
use rand::{thread_rng, Rng};
use rocksdb::{Options, DB};
use solana::db_ledger::{DataCf, DbLedger, LedgerColumnFamilyRaw};
use solana::ledger::{get_tmp_ledger_path, make_large_test_entries, make_tiny_test_entries, Block};
use solana::packet::{Blob, BLOB_HEADER_SIZE};
use test::Bencher;
// Given some blobs and a ledger at ledger_path, benchmark writing the blobs to the ledger
fn bench_write_blobs(bench: &mut Bencher, blobs: &mut [&mut Blob], ledger_path: &str) {
let db_ledger =
DbLedger::open(&ledger_path).expect("Expected to be able to open database ledger");
let slot = 0;
let num_blobs = blobs.len();
bench.iter(move || {
for blob in blobs.iter_mut() {
let index = blob.index().unwrap();
let key = DataCf::key(slot, index);
let size = blob.size().unwrap();
db_ledger
.data_cf
.put(&db_ledger.db, &key, &blob.data[..BLOB_HEADER_SIZE + size])
.unwrap();
blob.set_index(index + num_blobs as u64).unwrap();
}
});
DB::destroy(&Options::default(), &ledger_path)
.expect("Expected successful database destruction");
}
// Insert some blobs into the ledger in preparation for read benchmarks
fn setup_read_bench(
db_ledger: &mut DbLedger,
num_small_blobs: u64,
num_large_blobs: u64,
slot: u64,
) {
// Make some big and small entries
let mut entries = make_large_test_entries(num_large_blobs as usize);
entries.extend(make_tiny_test_entries(num_small_blobs as usize));
// Convert the entries to blobs, write the blobs to the ledger
let shared_blobs = entries.to_blobs();
for b in shared_blobs.iter() {
b.write().unwrap().set_slot(slot).unwrap();
}
db_ledger
.write_shared_blobs(&shared_blobs)
.expect("Expectd successful insertion of blobs into ledger");
}
// Write small blobs to the ledger
#[bench]
#[ignore]
fn bench_write_small(bench: &mut Bencher) {
let ledger_path = get_tmp_ledger_path("bench_write_small");
let num_entries = 32 * 1024;
let entries = make_tiny_test_entries(num_entries);
let shared_blobs = entries.to_blobs();
let mut blob_locks: Vec<_> = shared_blobs.iter().map(|b| b.write().unwrap()).collect();
let mut blobs: Vec<&mut Blob> = blob_locks.iter_mut().map(|b| &mut **b).collect();
bench_write_blobs(bench, &mut blobs, &ledger_path);
}
// Write big blobs to the ledger
#[bench]
#[ignore]
fn bench_write_big(bench: &mut Bencher) {
let ledger_path = get_tmp_ledger_path("bench_write_big");
let num_entries = 32 * 1024;
let entries = make_tiny_test_entries(num_entries);
let shared_blobs = entries.to_blobs();
let mut blob_locks: Vec<_> = shared_blobs.iter().map(|b| b.write().unwrap()).collect();
let mut blobs: Vec<&mut Blob> = blob_locks.iter_mut().map(|b| &mut **b).collect();
bench_write_blobs(bench, &mut blobs, &ledger_path);
}
#[bench]
#[ignore]
fn bench_read_sequential(bench: &mut Bencher) {
let ledger_path = get_tmp_ledger_path("bench_read_sequential");
let mut db_ledger =
DbLedger::open(&ledger_path).expect("Expected to be able to open database ledger");
// Insert some big and small blobs into the ledger
let num_small_blobs = 32 * 1024;
let num_large_blobs = 32 * 1024;
let total_blobs = num_small_blobs + num_large_blobs;
let slot = 0;
setup_read_bench(&mut db_ledger, num_small_blobs, num_large_blobs, slot);
let num_reads = total_blobs / 15;
let mut rng = rand::thread_rng();
bench.iter(move || {
// Generate random starting point in the range [0, total_blobs - 1], read num_reads blobs sequentially
let start_index = rng.gen_range(0, num_small_blobs + num_large_blobs);
for i in start_index..start_index + num_reads {
let _ =
db_ledger
.data_cf
.get_by_slot_index(&db_ledger.db, slot, i as u64 % total_blobs);
}
});
DB::destroy(&Options::default(), &ledger_path)
.expect("Expected successful database destruction");
}
#[bench]
#[ignore]
fn bench_read_random(bench: &mut Bencher) {
let ledger_path = get_tmp_ledger_path("bench_read_random");
let mut db_ledger =
DbLedger::open(&ledger_path).expect("Expected to be able to open database ledger");
// Insert some big and small blobs into the ledger
let num_small_blobs = 32 * 1024;
let num_large_blobs = 32 * 1024;
let total_blobs = num_small_blobs + num_large_blobs;
let slot = 0;
setup_read_bench(&mut db_ledger, num_small_blobs, num_large_blobs, slot);
let num_reads = total_blobs / 15;
// Generate a num_reads sized random sample of indexes in range [0, total_blobs - 1],
// simulating random reads
let mut rng = rand::thread_rng();
let indexes: Vec<usize> = (0..num_reads)
.map(|_| rng.gen_range(0, total_blobs) as usize)
.collect();
bench.iter(move || {
for i in indexes.iter() {
let _ = db_ledger
.data_cf
.get_by_slot_index(&db_ledger.db, slot, *i as u64);
}
});
DB::destroy(&Options::default(), &ledger_path)
.expect("Expected successful database destruction");
}
#[bench]
#[ignore]
fn bench_insert_data_blob_small(bench: &mut Bencher) {
let ledger_path = get_tmp_ledger_path("bench_insert_data_blob_small");
let db_ledger =
DbLedger::open(&ledger_path).expect("Expected to be able to open database ledger");
let num_entries = 32 * 1024;
let entries = make_tiny_test_entries(num_entries);
let mut shared_blobs = entries.to_blobs();
shared_blobs.shuffle(&mut thread_rng());
bench.iter(move || {
for blob in shared_blobs.iter_mut() {
let index = blob.read().unwrap().index().unwrap();
db_ledger.write_shared_blobs(vec![blob.clone()]).unwrap();
blob.write()
.unwrap()
.set_index(index + num_entries as u64)
.unwrap();
}
});
DB::destroy(&Options::default(), &ledger_path)
.expect("Expected successful database destruction");
}
#[bench]
#[ignore]
fn bench_insert_data_blob_big(bench: &mut Bencher) {
let ledger_path = get_tmp_ledger_path("bench_insert_data_blob_big");
let db_ledger =
DbLedger::open(&ledger_path).expect("Expected to be able to open database ledger");
let num_entries = 32 * 1024;
let entries = make_large_test_entries(num_entries);
let mut shared_blobs = entries.to_blobs();
shared_blobs.shuffle(&mut thread_rng());
bench.iter(move || {
for blob in shared_blobs.iter_mut() {
let index = blob.read().unwrap().index().unwrap();
db_ledger.write_shared_blobs(vec![blob.clone()]).unwrap();
blob.write()
.unwrap()
.set_index(index + num_entries as u64)
.unwrap();
}
});
DB::destroy(&Options::default(), &ledger_path)
.expect("Expected successful database destruction");
}

1
book/.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
theme/highlight.js binary

View File

@ -0,0 +1,25 @@
+---------------------------------------------------------------------------------------------------------+
| Neighborhood Above |
| |
| +----------------+ +----------------+ +----------------+ +----------------+ |
| | +------>+ +------>+ +------>+ | |
| | Neighbor 1 | | Neighbor 2 | | Neighbor 3 | | Neighbor 4 | |
| | +<------+ +<------+ +<------+ | |
| +--+-------------+ +--+-------------+ +-----+----------+ +--+-------------+ |
| | | | | |
+---------------------------------------------------------------------------------------------------------+
| | | |
| | | |
| | | |
| | | |
| | | |
+---------------------------------------------------------------------------------------------------------+
| | | Neighborhood Below | | |
| v v v v |
| +--+-------------+ +--+-------------+ +-----+----------+ +--+-------------+ |
| | +------>+ +------>+ +------>+ | |
| | Neighbor 1 | | Neighbor 2 | | Neighbor 3 | | Neighbor 4 | |
| | +<------+ +<------+ +<------+ | |
| +----------------+ +----------------+ +----------------+ +----------------+ |
| |
+---------------------------------------------------------------------------------------------------------+

View File

@ -1,25 +1,28 @@
.-------------.
| |
.-------------+ Leader +══════════════╗
| | | ║
| `-------------` ║
v v
.-------------. .-------------.
| +--------------------------->| |
.----+ Validator 1 | | Validator 2 +═══╗
| | |<═══════════════════════════+ | ║
| `------+------` `------+------`
| |
| `------------------------------.
| |
| ╔════════════════════════════════╝
| |
V v V v
.-------------. .-------------. .-------------. .-------------.
| | | | | | | |
| Validator 3 +------>| Validator 4 +══════>| Validator 5 +------>| Validator 6 |
| | | | | | | |
`-------------` `-------------` `-------------` `------+------`
^
║ ║
╚═════════════════════════════════════════════════════════════════╝
+--------------+
| |
+------------+ Leader +------------+
| | | |
| +--------------+ |
v v
+--------+--------+ +--------+--------+
| +--------------------->+ |
+-----------------+ Validator 1 | | Validator 2 +-------------+
| | +<---------------------+ | |
| +------+-+-+------+ +---+-+-+---------+ |
| | | | | | | |
| | | | | | | |
| +---------------------------------------------+ | | |
| | | | | | | |
| | | | | +----------------------+ | |
| | | | | | | |
| | | | +--------------------------------------------+ |
| | | | | | | |
| | | +----------------------+ | | |
| | | | | | | |
v v v v v v v v
+--------------------+ +--------------------+ +--------------------+ +--------------------+
| | | | | | | |
| Neighborhood 1 | | Neighborhood 2 | | Neighborhood 3 | | Neighborhood 4 |
| | | | | | | |
+--------------------+ +--------------------+ +--------------------+ +--------------------+

View File

@ -0,0 +1,9 @@
1
|
2
/|
/ |
| |
| 4
|
5

View File

@ -0,0 +1,11 @@
1
|
3
|\
| \
| |
| |
| |
6 |
|
7

13
book/art/forks.bob Normal file
View File

@ -0,0 +1,13 @@
1
|\
2 \
/| |
/ | 3
| | |\
| 4 | \
| | |
5 | |
| |
6 |
|
7

View File

@ -1,27 +1,30 @@
.---------------------------.
| Fullnode |
| |
.--------. | .------------------. |
| |---->| | |
| Client | | | JSON RPC Service | |
| |<----| | |
`----+---` | `------------------` |
| | ^ | .------------------.
| | | .----------------. | | Validators |
| | | | Gossip Service +----->| |
| | | `--------+-------` | | .------------. |
| | | ^ | | | | | |
| | | | v | | | Upstream | |
| | .--+---. .-+---. | | | Validators | |
| | | Bank |<--| TVU |<--------------+ | |
| | `------` `-----` | | `------------` |
| | ^ | | |
| | | | | .------------. |
| | .--+--. .-----------. | | | | |
`-------->| TPU +-->| Broadcast +--------->| Downstream | |
| `-----` | Service | | | | Validators | |
| `-----------` | | | | |
| | | `------------` |
`---------------------------` | |
`------------------`
.--------------------------------------.
| Fullnode |
| |
.--------. | .-------------------. |
| |---->| | |
| Client | | | JSON RPC Service | |
| |<----| | |
`----+---` | `-------------------` |
| | ^ |
| | | .----------------. | .------------------.
| | | | Gossip Service |<----------| Validators |
| | | `----------------` | | |
| | | ^ | | |
| | | | | | .------------. |
| | .---+---. .----+---. .-----------. | | | | |
| | | Bank |<-+ Replay | | BlobFetch |<------+ Upstream | |
| | | Forks | | Stage | | Stage | | | | Validators | |
| | `-------` `--------` `--+--------` | | | | |
| | ^ ^ | | | `------------` |
| | | | v | | |
| | | .--+--------. | | |
| | | | Blocktree | | | |
| | | `-----------` | | .------------. |
| | | ^ | | | | |
| | | | | | | Downstream | |
| | .--+--. .-------+---. | | | Validators | |
`-------->| TPU +---->| Broadcast +--------------->| | |
| `-----` | Stage | | | `------------` |
| `-----------` | `------------------`
`--------------------------------------`

View File

@ -0,0 +1,30 @@
msc {
hscale="2.2";
VoteSigner,
Validator,
Cluster,
StakerX,
StakerY;
|||;
Validator box Validator [label="boot.."];
VoteSigner <:> Validator [label="register\n\n(optional)"];
Validator => Cluster [label="VoteState::Initialize(VoteSigner)"];
StakerX => Cluster [label="StakeState::Delegate(Validator)"];
StakerY => Cluster [label="StakeState::Delegate(Validator)"];
|||;
Validator box Cluster [label="\nvalidate\n"];
Validator => VoteSigner [label="sign(vote)"];
VoteSigner >> Validator [label="signed vote"];
Validator => Cluster [label="gossip(vote)"];
...;
... ;
Validator abox Validator [label="\nmax\nlockout\n"];
|||;
StakerX => Cluster [label="StakeState::RedeemCredits()"];
StakerY => Cluster [label="StakeState::RedeemCredits()"] ;
}

View File

@ -1,9 +1,10 @@
.------------. .-----------. .---------------. .--------------. .-----------------------.
| PoH verify +---> | sigverify +--->| lock accounts +--->| validate fee +--->| allocate new accounts +--->
| TVU | `-----------` `---------------` `--------------` `-----------------------`
`------------`
.-----------. .-------------. .--------------. .--------------------.
| sigverify +--->| lock memory +--->| validate fee +--->| allocate accounts +--->
`-----------` `-------------` `--------------` `--------------------`
.------------. .---------. .--------------. .--------------.
--->| load data +--->| execute +--->| commit data +-->|unlock memory |
`------------` `---------` `--------------` `--------------`
.---------------. .---------. .------------. .-----------------. .-----------------.
--->| load accounts +--->| execute +--->| PoH record +--->| commit accounts +-->| unlock accounts |
`---------------` `---------` | TPU | `-----------------` `-----------------`
`------------`

View File

@ -1,16 +1,17 @@
.------------------------------------------------------.
| TPU .-------------. |
| | PoH Service | |
| `--------+----` |
| ^ | |
| | v |
| .-------. .-----------. .-+-------. .--------. | .------------.
.---------. | | Fetch | | SigVerify | | Banking | | Ledger | | | Broadcast |
| Clients |--->| Stage |->| Stage |->| Stage |-->| Write +---->| Service |
`---------` | | | | | | | | Stage | | | |
| `-------` `-----------` `----+----` `--------` | `------------`
| | |
`---------------------------------|--------------------`
.-------------.
| PoH Service |
`--------+----`
^ |
.------------------------------|----|--------------------.
| TPU | v |
| .-------. .-----------. .-+-------. .-----------. | .------------.
.---------. | | Fetch | | SigVerify | | Banking | | Broadcast | | | Downstream |
| Clients |--->| Stage |->| Stage |->| Stage |->| Stage |---->| Validators |
`---------` | | | | | | | | | | | |
| `-------` `-----------` `----+----` `-----------` | `------------`
| | |
`---------------------------------|----------------------`
|
v
.------.

View File

@ -3,17 +3,17 @@
`--------`
^
|
.------------------------------------|---------------------------------.
| TVU | |
| | |
| .-------. .------------. .----+---. .--------. .---------. |
.------------. | | Blob | | Retransmit | | Replay | | Ledger | | Storage | |
| Upstream +----->| Fetch |-->| Stage |-->| Stage |-->| Write |-->| Stage | |
| Validators | | | Stage | | | | | | Stage | | | |
`------------` | `-------` `----+-------` `----+---` `--------` `---------` |
| ^ | | |
| | | | |
`--------|----------|----------------|---------------------------------`
.------------------------------------|--------------------.
| TVU | |
| | |
| .-------. .------------. .----+---. .---------. |
.------------. | | Blob | | Retransmit | | Replay | | Storage | |
| Upstream +----->| Fetch +-->| Stage +-->| Stage +-->| Stage | |
| Validators | | | Stage | | | | | | | |
`------------` | `-------` `----+-------` `----+---` `---------` |
| ^ | | |
| | | | |
`--------|----------|----------------|--------------------`
| | |
| V v
.+-----------. .------.

View File

@ -15,23 +15,53 @@
- [Synchronization](synchronization.md)
- [Leader Rotation](leader-rotation.md)
- [Fork Generation](fork-generation.md)
- [Managing Forks](managing-forks.md)
- [Data Plane Fanout](data-plane-fanout.md)
- [Ledger Replication](ledger-replication.md)
- [Secure Vote Signing](vote-signing.md)
- [Staking Delegation and Rewards](stake-delegation-and-rewards.md)
- [Anatomy of a Fullnode](fullnode.md)
- [TPU](tpu.md)
- [TVU](tvu.md)
- [Blocktree](blocktree.md)
- [Gossip Service](gossip.md)
- [The Runtime](runtime.md)
- [Proposed Architectural Changes](proposals.md)
- [Ledger Replication](ledger-replication.md)
- [Secure Enclave](enclave.md)
- [Staking Rewards](staking-rewards.md)
- [Fork Selection](fork-selection.md)
- [Entry Tree](entry-tree.md)
## Appendix
- [Appendix](appendix.md)
- [API Reference](api-reference.md)
- [Blockstreamer](blockstreamer.md)
- [JSON RPC API](jsonrpc-api.md)
- [JavaScript API](javascript-api.md)
- [solana-wallet CLI](wallet.md)
- [Accepted Design Proposals](proposals.md)
- [Ledger Replication](ledger-replication-to-implement.md)
- [Secure Vote Signing](vote-signing-to-implement.md)
- [Staking Rewards](staking-rewards.md)
- [Passive Stake Delegation and Rewards](passive-stake-delegation-and-rewards.md)
- [Reliable Vote Transmission](reliable-vote-transmission.md)
- [Persistent Account Storage](persistent-account-storage.md)
- [Cluster Economics](ed_overview.md)
- [Validation-client Economics](ed_validation_client_economics.md)
- [State-validation Protocol-based Rewards](ed_vce_state_validation_protocol_based_rewards.md)
- [State-validation Transaction Fees](ed_vce_state_validation_transaction_fees.md)
- [Replication-validation Transaction Fees](ed_vce_replication_validation_transaction_fees.md)
- [Validation Stake Delegation](ed_vce_validation_stake_delegation.md)
- [Replication-client Economics](ed_replication_client_economics.md)
- [Storage-replication Rewards](ed_rce_storage_replication_rewards.md)
- [Replication-client Reward Auto-delegation](ed_rce_replication_client_reward_auto_delegation.md)
- [Economic Sustainability](ed_economic_sustainability.md)
- [Attack Vectors](ed_attack_vectors.md)
- [Economic Design MVP](ed_mvp.md)
- [References](ed_references.md)
- [Cluster Test Framework](cluster-test-framework.md)
- [Testing Programs](testing-programs.md)
- [Credit-only Accounts](credit-only-credit-debit-accounts.md)
- [Cluster Software Installation and Updates](installer.md)
- [Deterministic Transaction Fees](transaction-fees.md)
- [Implemented Design Proposals](implemented-proposals.md)
- [Fork Selection](fork-selection.md)
- [Leader-to-Leader Transition](leader-leader-transition.md)
- [Leader-to-Validator Transition](leader-validator-transition.md)
- [Testnet Participation](testnet-participation.md)

View File

@ -0,0 +1,4 @@
# API Reference
The following sections contain API references material you may find useful
when developing applications utilizing a Solana cluster.

View File

@ -1,4 +0,0 @@
# Appendix
The following sections contain reference material you may find useful in your
Solana journey.

View File

@ -0,0 +1,84 @@
# Block Confirmation
A validator votes on a PoH hash for two purposes. First, the vote indicates it
believes the ledger is valid up until that point in time. Second, since many
valid forks may exist at a given height, the vote also indicates exclusive
support for the fork. This document describes only the former. The latter is
described in [fork selection](fork-selection.md).
## Current Design
To start voting, a validator first registers an account to which it will send
its votes. It then sends votes to that account. The vote contains the tick
height of the block it is voting on. The account stores the 32 highest heights.
### Problems
* Only the validator knows how to find its own votes directly.
Other components, such as the one that calculates confirmation time, needs to
be baked into the fullnode code. The fullnode code queries the bank for all
accounts owned by the vote program.
* Voting ballots do not contain a PoH hash. The validator is only voting that
it has observed an arbitrary block at some height.
* Voting ballots do not contain a hash of the bank state. Without that hash,
there is no evidence that the validator executed the transactions and
verified there were no double spends.
## Proposed Design
### No Cross-block State Initially
At the moment a block is produced, the leader shall add a NewBlock transaction
to the ledger with a number of tokens that represents the validation reward.
It is effectively an incremental multisig transaction that sends tokens from
the mining pool to the validators. The account should allocate just enough
space to collect the votes required to achieve a supermajority. When a
validator observes the NewBlock transaction, it has the option to submit a vote
that includes a hash of its ledger state (the bank state). Once the account has
sufficient votes, the vote program should disperse the tokens to the
validators, which causes the account to be deleted.
#### Logging Confirmation Time
The bank will need to be aware of the vote program. After each transaction, it
should check if it is a vote transaction and if so, check the state of that
account. If the transaction caused the supermajority to be achieved, it should
log the time since the NewBlock transaction was submitted.
### Finality and Payouts
Locktower is the proposed [fork selection](fork-selection.md) algorithm. It
proposes that payment to miners be postponed until the *stack* of validator
votes reaches a certain depth, at which point rollback is not economically
feasible. The vote program may therefore implement locktower. Vote instructions
would need to reference a global locktower account so that it can track
cross-block state.
## Challenges
### On-chain voting
Using programs and accounts to implement this is a bit tedious. The hardest
part is figuring out how much space to allocate in NewBlock. The two variables
are the *active set* and the stakes of those validators. If we calculate the
active set at the time NewBlock is submitted, the number of validators to
allocate space for is known upfront. If, however, we allow new validators to
vote on old blocks, then we'd need a way to allocate space dynamically.
Similar in spirit, if the leader caches stakes at the time of NewBlock, the
vote program doesn't need to interact with the bank when it processes votes. If
we don't, then we have the option to allow stakes to float until a vote is
submitted. A validator could conceivably reference its own staking account, but
that'd be the current account value instead of the account value of the most
recently finalized bank state. The bank currently doesn't offer a means to
reference accounts from particular points in time.
### Voting Implications on Previous Blocks
Does a vote on one height imply a vote on all blocks of lower heights of
that fork? If it does, we'll need a way to lookup the accounts of all
blocks that haven't yet reached supermajority. If not, the validator could
send votes to all blocks explicitly to get the block rewards.

37
book/src/blockstreamer.md Normal file
View File

@ -0,0 +1,37 @@
# Blockstreamer
Solana supports a node type called an *blockstreamer*. This fullnode variation
is intended for applications that need to observe the data plane without
participating in transaction validation or ledger replication.
A blockstreamer runs without a vote signer, and can optionally stream ledger
entries out to a Unix domain socket as they are processed. The JSON-RPC service
still functions as on any other node.
To run a blockstreamer, include the argument `no-signer` and (optional)
`blockstream` socket location:
```bash
$ ./multinode-demo/fullnode-x.sh --no-signer --blockstream <SOCKET>
```
The stream will output a series of JSON objects:
- An Entry event JSON object is sent when each ledger entry is processed, with
the following fields:
* `dt`, the system datetime, as RFC3339-formatted string
* `t`, the event type, always "entry"
* `s`, the slot height, as unsigned 64-bit integer
* `h`, the tick height, as unsigned 64-bit integer
* `entry`, the entry, as JSON object
- A Block event JSON object is sent when a block is complete, with the
following fields:
* `dt`, the system datetime, as RFC3339-formatted string
* `t`, the event type, always "block"
* `s`, the slot height, as unsigned 64-bit integer
* `h`, the tick height, as unsigned 64-bit integer
* `l`, the slot leader id, as base-58 encoded string
* `id`, the block id, as base-58 encoded string

102
book/src/blocktree.md Normal file
View File

@ -0,0 +1,102 @@
# Blocktree
After a block reaches finality, all blocks from that one on down
to the genesis block form a linear chain with the familiar name
blockchain. Until that point, however, the validator must maintain all
potentially valid chains, called *forks*. The process by which forks
naturally form as a result of leader rotation is described in
[fork generation](fork-generation.md). The *blocktree* data structure
described here is how a validator copes with those forks until blocks
are finalized.
The blocktree allows a validator to record every blob it observes
on the network, in any order, as long as the blob is signed by the expected
leader for a given slot.
Blobs are moved to a fork-able key space the tuple of `leader slot` + `blob
index` (within the slot). This permits the skip-list structure of the Solana
protocol to be stored in its entirety, without a-priori choosing which fork to
follow, which Entries to persist or when to persist them.
Repair requests for recent blobs are served out of RAM or recent files and out
of deeper storage for less recent blobs, as implemented by the store backing
Blocktree.
### Functionalities of Blocktree
1. Persistence: the Blocktree lives in the front of the nodes verification
pipeline, right behind network receive and signature verification. If the
blob received is consistent with the leader schedule (i.e. was signed by the
leader for the indicated slot), it is immediately stored.
2. Repair: repair is the same as window repair above, but able to serve any
blob that's been received. Blocktree stores blobs with signatures,
preserving the chain of origination.
3. Forks: Blocktree supports random access of blobs, so can support a
validator's need to rollback and replay from a Bank checkpoint.
4. Restart: with proper pruning/culling, the Blocktree can be replayed by
ordered enumeration of entries from slot 0. The logic of the replay stage
(i.e. dealing with forks) will have to be used for the most recent entries in
the Blocktree.
### Blocktree Design
1. Entries in the Blocktree are stored as key-value pairs, where the key is the concatenated
slot index and blob index for an entry, and the value is the entry data. Note blob indexes are zero-based for each slot (i.e. they're slot-relative).
2. The Blocktree maintains metadata for each slot, in the `SlotMeta` struct containing:
* `slot_index` - The index of this slot
* `num_blocks` - The number of blocks in the slot (used for chaining to a previous slot)
* `consumed` - The highest blob index `n`, such that for all `m < n`, there exists a blob in this slot with blob index equal to `n` (i.e. the highest consecutive blob index).
* `received` - The highest received blob index for the slot
* `next_slots` - A list of future slots this slot could chain to. Used when rebuilding
the ledger to find possible fork points.
* `last_index` - The index of the blob that is flagged as the last blob for this slot. This flag on a blob will be set by the leader for a slot when they are transmitting the last blob for a slot.
* `is_rooted` - True iff every block from 0...slot forms a full sequence without any holes. We can derive is_rooted for each slot with the following rules. Let slot(n) be the slot with index `n`, and slot(n).is_full() is true if the slot with index `n` has all the ticks expected for that slot. Let is_rooted(n) be the statement that "the slot(n).is_rooted is true". Then:
is_rooted(0)
is_rooted(n+1) iff (is_rooted(n) and slot(n).is_full()
3. Chaining - When a blob for a new slot `x` arrives, we check the number of blocks (`num_blocks`) for that new slot (this information is encoded in the blob). We then know that this new slot chains to slot `x - num_blocks`.
4. Subscriptions - The Blocktree records a set of slots that have been "subscribed" to. This means entries that chain to these slots will be sent on the Blocktree channel for consumption by the ReplayStage. See the `Blocktree APIs` for details.
5. Update notifications - The Blocktree notifies listeners when slot(n).is_rooted is flipped from false to true for any `n`.
### Blocktree APIs
The Blocktree offers a subscription based API that ReplayStage uses to ask for entries it's interested in. The entries will be sent on a channel exposed by the Blocktree. These subscription API's are as follows:
1. `fn get_slots_since(slot_indexes: &[u64]) -> Vec<SlotMeta>`: Returns new slots connecting to any element of the list `slot_indexes`.
2. `fn get_slot_entries(slot_index: u64, entry_start_index: usize, max_entries: Option<u64>) -> Vec<Entry>`: Returns the entry vector for the slot starting with `entry_start_index`, capping the result at `max` if `max_entries == Some(max)`, otherwise, no upper limit on the length of the return vector is imposed.
Note: Cumulatively, this means that the replay stage will now have to know when a slot is finished, and subscribe to the next slot it's interested in to get the next set of entries. Previously, the burden of chaining slots fell on the Blocktree.
### Interfacing with Bank
The bank exposes to replay stage:
1. `prev_hash`: which PoH chain it's working on as indicated by the hash of the last
entry it processed
2. `tick_height`: the ticks in the PoH chain currently being verified by this
bank
3. `votes`: a stack of records that contain:
1. `prev_hashes`: what anything after this vote must chain to in PoH
2. `tick_height`: the tick height at which this vote was cast
3. `lockout period`: how long a chain must be observed to be in the ledger to
be able to be chained below this vote
Replay stage uses Blocktree APIs to find the longest chain of entries it can
hang off a previous vote. If that chain of entries does not hang off the
latest vote, the replay stage rolls back the bank to that vote and replays the
chain from there.
### Pruning Blocktree
Once Blocktree entries are old enough, representing all the possible forks
becomes less useful, perhaps even problematic for replay upon restart. Once a
validator's votes have reached max lockout, however, any Blocktree contents
that are not on the PoH chain for that vote for can be pruned, expunged.
Replicator nodes will be responsible for storing really old ledger contents,
and validators need only persist their bank periodically.

View File

@ -0,0 +1,122 @@
# Cluster Test Framework
This document proposes the Cluster Test Framework (CTF). CTF is a test harness
that allows tests to execute against a local, in-process cluster or a
deployed cluster.
## Motivation
The goal of CTF is to provide a framework for writing tests independent of where
and how the cluster is deployed. Regressions can be captured in these tests and
the tests can be run against deployed clusters to verify the deployment. The
focus of these tests should be on cluster stability, consensus, fault tolerance,
API stability.
Tests should verify a single bug or scenario, and should be written with the
least amount of internal plumbing exposed to the test.
## Design Overview
Tests are provided an entry point, which is a `contact_info::ContactInfo`
structure, and a keypair that has already been funded.
Each node in the cluster is configured with a `fullnode::FullnodeConfig` at boot
time. At boot time this configuration specifies any extra cluster configuration
required for the test. The cluster should boot with the configuration when it
is run in-process or in a data center.
Once booted, the test will discover the cluster through a gossip entry point and
configure any runtime behaviors via fullnode RPC.
## Test Interface
Each CTF test starts with an opaque entry point and a funded keypair. The test
should not depend on how the cluster is deployed, and should be able to exercise
all the cluster functionality through the publicly available interfaces.
```rust,ignore
use crate::contact_info::ContactInfo;
use solana_sdk::signature::{Keypair, KeypairUtil};
pub fn test_this_behavior(
entry_point_info: &ContactInfo,
funding_keypair: &Keypair,
num_nodes: usize,
)
```
## Cluster Discovery
At test start, the cluster has already been established and is fully connected.
The test can discover most of the available nodes over a few second.
```rust,ignore
use crate::gossip_service::discover_nodes;
// Discover the cluster over a few seconds.
let cluster_nodes = discover_nodes(&entry_point_info, num_nodes);
```
## Cluster Configuration
To enable specific scenarios, the cluster needs to be booted with special
configurations. These configurations can be captured in
`fullnode::FullnodeConfig`.
For example:
```rust,ignore
let mut fullnode_config = FullnodeConfig::default();
fullnode_config.rpc_config.enable_fullnode_exit = true;
let local = LocalCluster::new_with_config(
num_nodes,
10_000,
100,
&fullnode_config
);
```
## How to design a new test
For example, there is a bug that shows that the cluster fails when it is flooded
with invalid advertised gossip nodes. Our gossip library and protocol may
change, but the cluster still needs to stay resilient to floods of invalid
advertised gossip nodes.
Configure the RPC service:
```rust,ignore
let mut fullnode_config = FullnodeConfig::default();
fullnode_config.rpc_config.enable_rpc_gossip_push = true;
fullnode_config.rpc_config.enable_rpc_gossip_refresh_active_set = true;
```
Wire the RPCs and write a new test:
```rust,ignore
pub fn test_large_invalid_gossip_nodes(
entry_point_info: &ContactInfo,
funding_keypair: &Keypair,
num_nodes: usize,
) {
let cluster = discover_nodes(&entry_point_info, num_nodes);
// Poison the cluster.
let client = create_client(entry_point_info.client_facing_addr(), FULLNODE_PORT_RANGE);
for _ in 0..(num_nodes * 100) {
client.gossip_push(
cluster_info::invalid_contact_info()
);
}
sleep(Durration::from_millis(1000));
// Force refresh of the active set.
for node in &cluster {
let client = create_client(node.client_facing_addr(), FULLNODE_PORT_RANGE);
client.gossip_refresh_active_set();
}
// Verify that spends still work.
verify_spends(&cluster);
}
```

View File

@ -96,4 +96,5 @@ that header information becomes the primary consumer of network bandwidth. At
the time of this writing, the approach is scaling well up to about 150
validators. To scale up to hundreds of thousands of validators, each node can
apply the same technique as the leader node to another set of nodes of equal
size. We call the technique *data plane fanout*, but it is not yet implemented.
size. We call the technique *data plane fanout*; learn more in the [data plan
fanout](data-plane-fanout.md) section.

View File

@ -0,0 +1,140 @@
# Credit-Only Accounts
This design covers the handling of credit-only and credit-debit accounts in the
[runtime](runtime.md). Accounts already distinguish themselves as credit-only or
credit-debit based on the program ID specified by the transaction's instruction.
Programs must treat accounts that are not owned by them as credit-only.
To identify credit-only accounts by program id would require the account to be
fetched and loaded from disk. This operation is expensive, and while it is
occurring, the runtime would have to reject any transactions referencing the same
account.
The proposal introduces a `num_readonly_accounts` field to the transaction
structure, and removes the `program_ids` dedicated vector for program accounts.
This design doesn't change the runtime transaction processing rules.
Programs still can't write or spend accounts that they do not own, but it
allows the runtime to optimistically take the correct lock for each account
specified in the transaction before loading the accounts from storage.
Accounts selected as credit-debit by the transaction can still be treated as
credit-only by the instructions.
## Runtime handling
credit-only accounts have the following properties:
* Can be deposited into: Deposits can be implemented as a simple `atomic_add`.
* read-only access to account data.
Instructions that debit or modify the credit-only account data will fail.
## Account Lock Optimizations
The Accounts module keeps track of current locked accounts in the runtime,
which separates credit-only accounts from the credit-debit accounts. The credit-only
accounts can be cached in memory and shared between all the threads executing
transactions.
The current runtime can't predict whether an account is credit-only or credit-debit when
the transaction account keys are locked at the start of the transaction
processing pipeline. Accounts referenced by the transaction have not been
loaded from the disk yet.
An ideal design would cache the credit-only accounts while they are referenced by
any transaction moving through the runtime, and release the cache when the last
transaction exits the runtime.
## Credit-only accounts and read-only account data
Credit-only account data can be treated as read-only. Credit-debit
account data is treated as read-write.
## Transaction changes
To enable the possibility of caching accounts only while they are in the
runtime, the Transaction structure should be changed in the following way:
* `program_ids: Vec<Pubkey>` - This vector is removed. Program keys can be
placed at the end of the `account_keys` vector within the `num_readonly_accounts`
number set to the number of programs.
* `num_readonly_accounts: u8` - The number of keys from the **end** of the
transaction's `account_keys` array that is credit-only.
The following possible accounts are present in an transaction:
* paying account
* RW accounts
* R accounts
* Program IDs
The paying account must be credit-debit, and program IDs must be credit-only. The
first account in the `account_keys` array is always the account that pays for
the transaction fee, therefore it cannot be credit-only. For these reasons the
credit-only accounts are all grouped together at the end of the `account_keys`
vector. Counting credit-only accounts from the end allow for the default `0`
value to still be functionally correct, since a transaction will succeed with
all credit-debit accounts.
Since accounts can only appear once in the transaction's `account_keys` array,
an account can only be credit-only or credit-debit in a single transaction, not
both. The runtime treats a transaction as one atomic unit of execution. If any
instruction needs credit-debit access to an account, a copy needs to be made. The
write lock is held for the entire time the transaction is being processed by
the runtime.
## Starvation
Read locks for credit-only accounts can keep the runtime from executing
transactions requesting a write lock to a credit-debit account.
When a request for a write lock is made while a read lock is open, the
transaction requesting the write lock should be cached. Upon closing the read
lock, the pending transactions can be pushed through the runtime.
While a pending write transaction exists, any additional read lock requests for
that account should fail. It follows that any other write lock requests will also
fail. Currently, clients must retransmit when a transaction fails because of
a pending transaction. This approach would mimic that behavior as closely as
possible while preventing write starvation.
## Program execution with credit-only accounts
Before handing off the accounts to program execution, the runtime can mark each
account in each instruction as a credit-only account. The credit-only accounts can
be passed as references without an extra copy. The transaction will abort on a
write to credit-only.
An alternative is to detect writes to credit-only accounts and fail the
transactions before commit.
## Alternative design
This design attempts to cache a credit-only account after loading without the use
of a transaction-specified credit-only accounts list. Instead, the credit-only
accounts are held in a reference-counted table inside the runtime as the
transactions are processed.
1. Transaction accounts are locked.
a. If the account is present in the credit-only' table, the TX does not fail.
The pending state for this TX is marked NeedReadLock.
2. Transaction accounts are loaded.
a. Transaction accounts that are credit-only increase their reference
count in the `credit-only` table.
b. Transaction accounts that need a write lock and are present in the
`credit-only` table fail.
3. Transaction accounts are unlocked.
a. Decrement the `credit-only` lock table reference count; remove if its 0
b. Remove from the `lock` set if the account is not in the `credit-only`
table.
The downside with this approach is that if the `lock` set mutex is released
between lock and load to allow better pipelining of transactions, a request for
a credit-only account may fail. Therefore, this approach is not suitable for
treating programs as credit-only accounts.
Holding the accounts lock mutex while fetching the account from disk would
potentially have a significant performance hit on the runtime. Fetching from
disk is expected to be slow, but can be parallelized between multiple disks.

View File

@ -0,0 +1,84 @@
# Data Plane Fanout
A Solana cluster uses a multi-layer mechanism called *data plane fanout* to
broadcast transaction blobs to all nodes in a very quick and efficient manner.
In order to establish the fanout, the cluster divides itself into small
collections of nodes, called *neighborhoods*. Each node is responsible for
sharing any data it receives with the other nodes in its neighborhood, as well
as propagating the data on to a small set of nodes in other neighborhoods.
During its slot, the leader node distributes blobs between the validator nodes
in one neighborhood (layer 1). Each validator shares its data within its
neighborhood, but also retransmits the blobs to one node in each of multiple
neighborhoods in the next layer (layer 2). The layer-2 nodes each share their
data with their neighborhood peers, and retransmit to nodes in the next layer,
etc, until all nodes in the cluster have received all the blobs.
<img alt="Two layer cluster" src="img/data-plane.svg" class="center"/>
## Neighborhood Assignment - Weighted Selection
In order for data plane fanout to work, the entire cluster must agree on how the
cluster is divided into neighborhoods. To achieve this, all the recognized
validator nodes (the TVU peers) are sorted by stake and stored in a list. This
list is then indexed in different ways to figure out neighborhood boundaries and
retransmit peers. For example, the leader will simply select the first nodes to
make up layer 1. These will automatically be the highest stake holders, allowing
the heaviest votes to come back to the leader first. Layer-1 and lower-layer
nodes use the same logic to find their neighbors and lower layer peers.
## Layer and Neighborhood Structure
The current leader makes its initial broadcasts to at most `DATA_PLANE_FANOUT`
nodes. If this layer 1 is smaller than the number of nodes in the cluster, then
the data plane fanout mechanism adds layers below. Subsequent layers follow
these constraints to determine layer-capacity: Each neighborhood contains
`NEIGHBORHOOD_SIZE` nodes and each layer may have up to `DATA_PLANE_FANOUT/2`
neighborhoods.
As mentioned above, each node in a layer only has to broadcast its blobs to its
neighbors and to exactly 1 node in each next-layer neighborhood, instead of to
every TVU peer in the cluster. In the default mode, each layer contains
`DATA_PLANE_FANOUT/2` neighborhoods. The retransmit mechanism also supports a
second, `grow`, mode of operation that squares the number of neighborhoods
allowed each layer. This dramatically reduces the number of layers needed to
support a large cluster, but can also have a negative impact on the network
pressure on each node in the lower layers. A good way to think of the default
mode (when `grow` is disabled) is to imagine it as chain of layers, where the
leader sends blobs to layer-1 and then layer-1 to layer-2 and so on, the `layer
capacities` remain constant, so all layers past layer-2 will have the same
number of nodes until the whole cluster is covered. When `grow` is enabled, this
becomes a traditional fanout where layer-3 will have the square of the number of
nodes in layer-2 and so on.
#### Configuration Values
`DATA_PLANE_FANOUT` - Determines the size of layer 1. Subsequent
layers have `DATA_PLANE_FANOUT/2` neighborhoods when `grow` is inactive.
`NEIGHBORHOOD_SIZE` - The number of nodes allowed in a neighborhood.
Neighborhoods will fill to capacity before new ones are added, i.e if a
neighborhood isn't full, it _must_ be the last one.
`GROW_LAYER_CAPACITY` - Whether or not retransmit should be behave like a
_traditional fanout_, i.e if each additional layer should have growing
capacities. When this mode is disabled (default), all layers after layer 1 have
the same capacity, keeping the network pressure on all nodes equal.
Currently, configuration is set when the cluster is launched. In the future,
these parameters may be hosted on-chain, allowing modification on the fly as the
cluster sizes change.
## Neighborhoods
The following diagram shows how two neighborhoods in different layers interact.
What this diagram doesn't capture is that each neighbor actually receives
blobs from one validator per neighborhood above it. This means that, to
cripple a neighborhood, enough nodes (erasure codes +1 per neighborhood) from
the layer above need to fail. Since multiple neighborhoods exist in the upper
layer and a node will receive blobs from a node in each of those neighborhoods,
we'd need a big network failure in the upper layers to end up with incomplete
data.
<img alt="Inner workings of a neighborhood"
src="img/data-plane-neighborhood.svg" class="center"/>

View File

@ -46,7 +46,7 @@ desired cluster.
## Attack vectors
### Invalid last_id
### Invalid recent_blockhash
The drone may prefer its airdrops only target a particular Solana cluster. To
do that, it listens to the cluster for new entry IDs and ensure any requests
@ -68,8 +68,8 @@ A client may request multiple airdrops before the first has been submitted to
the ledger. The client may do this maliciously or simply because it thinks the
first request was dropped. The drone should not simply query the cluster to
ensure the client has not already received an airdrop. Instead, it should use
`last_id` to ensure the previous request is expired before signing another.
Note that the Solana cluster will reject any transaction with a `last_id`
`recent_blockhash` to ensure the previous request is expired before signing another.
Note that the Solana cluster will reject any transaction with a `recent_blockhash`
beyond a certain *age*.
### Denial of Service

View File

@ -0,0 +1,11 @@
## Attack Vectors
### Colluding validation and replication clients
A colluding validation-client, may take the strategy to mark PoReps from non-colluding replicator nodes as invalid as an attempt to maximize the rewards for the colluding replicator nodes. In this case, it isnt feasible for the offended-against replicator nodes to petition the network for resolution as this would result in a network-wide vote on each offending PoRep and create too much overhead for the network to progress adequately. Also, this mitigation attempt would still be vulnerable to a >= 51% staked colluder.
Alternatively, transaction fees from submitted PoReps are pooled and distributed across validation-clients in proportion to the number of valid PoReps discounted by the number of invalid PoReps as voted by each validator-client. Thus invalid votes are directly dis-incentivized through this reward channel. Invalid votes that are revealed by replicator nodes as fishing PoReps, will not be discounted from the payout PoRep count.
Another collusion attack involves a validator-client who may take the strategy to ignore invalid PoReps from colluding replicator and vote them as valid. In this case, colluding replicator-clients would not have to store the data while still receiving rewards for validated PoReps. Additionally, colluding validator nodes would also receive rewards for validating these PoReps. To mitigate this attack, validators must randomly sample PoReps corresponding to the ledger block they are validating and because of this, there will be multiple validators that will receive the colluding replicators invalid submissions. These non-colluding validators will be incentivized to mark these PoReps as invalid as they have no way to determine whether the proposed invalid PoRep is actually a fishing PoRep, for which a confirmation vote would result in the validators stake being slashed.
In this case, the proportion of time a colluding pair will be successful has an upper limit determined by the % of stake of the network claimed by the colluding validator. This also sets bounds to the value of such an attack. For example, if a colluding validator controls 10% of the total validator stake, transaction fees will be lost (likely sent to mining pool) by the colluding replicator 90% of the time and so the attack vector is only profitable if the per-PoRep reward at least 90% higher than the average PoRep transaction fee. While, probabilistically, some colluding replicator-client PoReps will find their way to colluding validation-clients, the network can also monitor rates of paired (validator + replicator) discrepancies in voting patterns and censor identified colluders in these cases.

View File

@ -0,0 +1,18 @@
## Economic Sustainability
Long term economic sustainability is one of the guiding principles of Solanas economic design. While it is impossible to predict how decentralized economies will develop over time, especially economies with flexible decentralized governances, we can arrange economic components such that, under certain conditions, a sustainable economy may take shape in the long term. In the case of Solanas network, these components take the form of the remittances and deposits into and out of the reserve mining pool.
The dominant remittances from the Solana mining pool are validator and replicator rewards. The deposit mechanism is a flat, protocol-specified and adjusted, % of each transaction fee.
The Replicator rewards are to be delivered to replicators from the mining pool after successful PoRep validation. The per-PoRep reward amount is determined as a function of the total network storage redundancy at the time of the PoRep validation and the network goal redundancy. This function is likely to take the form of a discount from a base reward to be delivered when the network has achieved and maintained its goal redundancy. An example of such a reward function is shown in **Figure 3**
<!-- ![image alt text](porep_reward.png) -->
<p style="text-align:center;"><img src="img/porep_reward.png" alt="==PoRep Reward Curve ==" width="800"/></p>
**Figure 3**: Example PoRep reward design as a function of global network storage redundancy.
In the example shown in Figure 1, multiple per PoRep base rewards are explored (as a % of Tx Fee) to be delivered when the global ledger replication redundancy meets 10X. When the global ledger replication redundancy is less than 10X, the base reward is discounted as a function of the square of the ratio of the actual ledger replication redundancy to the goal redundancy (i.e. 10X).
The other protocol-based remittance goes to validation-clients as a reward distributed in proportion to stake-weight for voting to validate the ledger state. The functional issuance of this reward is described in [State-validation Protocol-based Rewards](ed_vce_state_validation_protocol_based_rewards.md) and is designed to reduce over time until validators are incentivized solely through collection of transaction fees. Therefore, in the long-run, protocol-based rewards to replication-nodes will be the only remittances from the mining pool, and will have to be countered by the portion of each non-PoRep transaction fee that is directed back into the mining pool. I.e. for a long-term self-sustaining economy, replicator-client rewards must be subsidized through a minimum fee on each non-PoRep transaction pre-allocated to the mining pool. Through this constraint, we can write the following inequality:
**== WIP [here](https://docs.google.com/document/d/1HBDasdkjS4Ja9wC_tIUsZPVcxGAWTuYOq9zf6xoQNps/edit?usp=sharing) ==**

12
book/src/ed_mvp.md Normal file
View File

@ -0,0 +1,12 @@
## Proposed MVP of Economic Design
The preceeding sections, outlined in the [Economic Design Overview](ed_overview.md), describe a long-term vision of a sustainable Solana economy. Of course, we don't expect the final implementation to perfectly match what has been described above. We intend to fully engage with network stakeholders throughout the implementation phases (i.e. pre-testnet, testnet, mainnet) to ensure the system supports, and is representative of, the various network participants' interests. The first step toward this goal, however, is outlining a some desired MVP economic features to be available for early pre-testnet and testnet participants. Below is a rough sketch outlining basic economic functionality from which a more complete and functional system can be developed.
### MVP Economic Features
* Faucet to deliver testnet SOLs to validators for staking and dapp development.
* Mechanism by which validators are rewarded in proportion to their stake. Interest rate mechansism (i.e. to be determined by total % staked) to come later.
* Ability to delegate tokens to validator nodes.
* Replicators to receive fixed, arbitrary reward for submitting validated PoReps. Reward size mechanism (i.e. PoRep reward as a function of total ledger redundancy) to come later.
* Pooling of replicator PoRep transaction fees and weighted distribution to validators based on PoRep verification (see [Replication-validation Transaction Fees](ed_vce_replication_validation_transaction_fees.md). It will be useful to test this protection against attacks on testnet.
* Nice-to-have: auto-delegation of replicator rewards to validator.

16
book/src/ed_overview.md Normal file
View File

@ -0,0 +1,16 @@
## Economic Design Overview
Solanas crypto-economic system is designed to promote a healthy, long term self-sustaining economy with participant incentives aligned to the security and decentralization of the network. The main participants in this economy are validation-clients and replication-clients. Their contributions to the network, state validation and data storage respectively, and their requisite remittance mechanisms are discussed below.
The main channels of participant remittances are referred to as protocol-based rewards and transaction fees. Protocol-based rewards are protocol-derived issuances from a network-controlled reserve of tokens (sometimes referred to as the mining pool). These rewards will constitute the total reward delivered to replication clients and a portion of the total rewards for validation clients, the remaining sourced from transaction fees. In the early days of the network, it is likely that protocol-based rewards, deployed based on predefined issuance schedule, will drive the majority of participant incentives to join the network.
These protocol-based rewards, to be distributed to participating validation and replication clients, are to be specified as annual interest rates calculated per, real-time, Solana epoch [DEFINITION]. As discussed further below, the issuance rates are determined as a function of total network validator staked percentage and total replication provided by replicators in each previous epoch. The choice for validator and replicator client rewards to be based on participation rates, rather than a global fixed inflation or interest rate, emphasizes a protocol priority of overall economic security, rather than monetary supply predictability. Due to Solanas hard total supply cap of 1B tokens and the bounds of client participant rates in the protocol, we believe that global interest, and supply issuance, scenarios should be able to be modeled with reasonable uncertainties.
Transaction fees are market-based participant-to-participant transfers, attached to network interactions as a necessary motivation and compensation for the inclusion and execution of a proposed transaction (be it a state execution or proof-of-replication verification). A mechanism for continuous and long-term funding of the mining pool through a pre-dedicated portion of transaction fees is also discussed below.
A high-level schematic of Solanas crypto-economic design is shown below in **Figure 1**. The specifics of validation-client economics are described in sections: [Validation-client Economics](ed_validation_client_economics.md), [State-validation Protocol-based Rewards](ed_vce_state_validation_protocol_based_rewards.md), [State-validation Transaction Fees](ed_vce_state_validation_transaction_fees.md) and [Replication-validation Transaction Fees](ed_vce_replication_validation_transaction_fees.md). Also, the chapter titled [Validation Stake Delegation](ed_vce_validation_stake_delegation.md) closes with a discussion of validator delegation opportunties and marketplace. The [Replication-client Economics](ed_replication_client_economics.md) chapter will review the Solana network design for global ledger storage/redundancy and replicator-client economics ([Storage-replication rewards](ed_rce_storage_replication_rewards.md)) along with a replicator-to-validator delegation mechanism designed to aide participant on-boarding into the Solana economy discussed in [Replication-client Reward Auto-delegation](ed_rce_replication_client_reward_auto_delegation.md). The [Economic Sustainability](ed_economic_sustainability.md) section dives deeper into Solanas design for long-term economic sustainability and outlines the constraints and conditions for a self-sustaining economy. An outline of features for an MVP economic design is discussed in the [Economic Design MVP](ed_mvp.md) section. Finally, in chapter [Attack Vectors](ed_attack_vectors.md), various attack vectors will be described and potential vulnerabilities explored and parameterized.
<!-- ![img alt text](solana_economic_design.png) -->
<p style="text-align:center;"><img src="img/solana_economic_design.png" alt="== Solana Economic Design Diagram ==" width="800"/></p>
**Figure 1**: Schematic overview of Solana economic incentive design.

View File

@ -0,0 +1,5 @@
### Replication-client Reward Auto-delegation
The ability for Solana network participants to earn rewards by providing storage service is a unique on-boarding path that requires little hardware overhead and minimal upfront capital. It offers an avenue for individuals with extra-storage space on their home laptops or PCs to contribute to the security of the network and become integrated into the Solana economy.
To enhance this on-boarding ramp and facilitate further participation and investment in the Solana economy, replication-clients have the opportunity to auto-delegate their rewards to validation-clients of their choice. Much like the automatic reinvestment of stock dividends, in this scenario, a replicator-client can earn Solana tokens by providing some storage capacity to the network (i.e. via submitting valid PoReps), have the protocol-based rewards automatically assigned as delegation to a staked validator node and therefore earning interest in the validation-client reward pool.

View File

@ -0,0 +1,5 @@
### Storage-replication Rewards
Replicator-clients download, encrypt and submit PoReps for ledger block sections.3 PoReps submitted to the PoH stream, and subsequently validated, function as evidence that the submitting replicator client is indeed storing the assigned ledger block sections on local hard drive space as a service to the network. Therefore, replicator clients should earn protocol rewards proportional to the amount of storage, and the number of successfully validated PoReps, that they are verifiably providing to the network.
Additionally, replicator clients have the opportunity to capture a portion of slashed bounties [TBD] of dishonest validator clients. This can be accomplished by a replicator client submitting a verifiably false PoRep for which a dishonest validator client receives and signs as a valid PoRep. This reward incentive is to prevent lazy validators and minimize validator-replicator collusion attacks, more on this below.

View File

@ -0,0 +1,7 @@
## References
1. [https://blog.ethereum.org/2016/07/27/inflation-transaction-fees-cryptocurrency-monetary-policy/](https://blog.ethereum.org/2016/07/27/inflation-transaction-fees-cryptocurrency-monetary-policy/)
2. [https://medium.com/solana-labs/how-to-create-decentralized-storage-for-a-multi-petabyte-digital-ledger-2499a3a8c281](https://medium.com/solana-labs/how-to-create-decentralized-storage-for-a-multi-petabyte-digital-ledger-2499a3a8c281)
3. [https://medium.com/solana-labs/how-to-create-decentralized-storage-for-a-multi-petabyte-digital-ledger-2499a3a8c281](https://medium.com/solana-labs/how-to-create-decentralized-storage-for-a-multi-petabyte-digital-ledger-2499a3a8c281)

View File

@ -0,0 +1,3 @@
## Replication-client economics
Replication-clients should be rewarded for providing the network with storage space. Incentivization of the set of replicators provides data security through redundancy of the historical ledger. Replication nodes are rewarded in proportion to the amount of ledger data storage provided. These rewards are captured by generating and entering Proofs of Replication (PoReps) into the PoH stream which can be validated by Validation nodes as described above in the [Replication-validation Transaction Fees](ed_vce_replication_validation_transaction_fees.md) chapter.

View File

@ -0,0 +1,3 @@
## Validation-client Economics
Validator-clients are eligible to receive protocol-based (i.e. via mining pool) rewards issued via stake-based annual interest rates by providing compute (CPU+GPU) resources to validate and vote on a given PoH state. These protocol-based rewards are determined through an algorithmic schedule as a function of total amount of Solana tokens staked in the system and duration since network launch (genesis block). Additionally, these clients may earn revenue through two types of transaction fees: state-validation transaction fees and pooled Proof-of-Replication (PoRep) transaction fees. The distribution of these two types of transaction fees to the participating validation set are designed independently as economic goals and attack vectors are unique between the state- generation/validation mechanism and the ledger replication/validation mechanism. For clarity, we separately describe the design and motivation of the three types of potential revenue streams for validation-clients below: state-validation protocol-based rewards, state-validation transaction fees and PoRep-validation transaction fees.

View File

@ -0,0 +1,9 @@
### Replication-validation Transaction Fees
As previously mentioned, validator-clients will also be responsible for validating PoReps submitted into the PoH stream by replicator-clients. In this case, validators are providing compute (CPU/GPU) and light storage resources to confirm that these replication proofs could only be generated by a client that is storing the referenced PoH leger block.2
While replication-clients are incentivized and rewarded through protocol-based rewards schedule (see [Replication-client Economics](ed_replication_client_economics.md)), validator-clients will be incentivized to include and validate PoReps in PoH through the distribution of the transaction fees associated with the submitted PoRep. As will be described in detail in the Section 3.1, replication-client rewards are protocol-based and designed to reward based on a global data redundancy factor. I.e. the protocol will incentivize replication-client participation through rewards based on a target ledger redundancy (e.g. 10x data redundancy). It was chosen not to include a distribution of these rewards to PoRep validators, and to rely only on the collection of PoRep attached transaction fees, due to the fact that the confluence of two participation incentive modes (state-validation inflation rate via global staked % and replication-validation rewards based on global redundancy factor) on the incentives of a single network participant (a validator-client) potentially opened up a significant incentive-driven attack surface area.
The validation of PoReps by validation-clients is computationally more expensive than state-validation (detail in the [Economic Sustainability](ed_economic_sustainability.md) chapter), thus the transaction fees are expected to be proportionally higher. However, because replication-client rewards are distributed in proportion to and only after submitted PoReps are validated, they are uniquely motivated for the inclusion and validation of their proofs. This pressure is expected to generate an adequate market economy between replication-clients and validation-clients. Additionally, transaction fees submitted with PoReps have no minimum amount pre-allocated to the mining pool, as do state-validation transaction fees.
There are various attack vectors available for colluding validation and replication clients, as described in detail below in [Economic Sustainability](ed_economic_sustainability). To protect against various collusion attack vectors, for a given epoch, PoRep transaction fees are pooled, and redistributed across participating validation-clients in proportion to the number of validated PoReps in the epoch less the number of invalidated PoReps [DIAGRAM]. This design rewards validators proportional to the number of PoReps they process and validate, while providing negative pressure for validation-clients to submit lazy or malicious invalid votes on submitted PoReps (note that it is computationally prohibitive to determine whether a validator-client has marked a valid PoRep as invalid).

View File

@ -0,0 +1,46 @@
### State-validation protocol-based rewards
Validator-clients have two functional roles in the Solana network
* Validate (vote) the current global state of that PoH along with any Proofs-of-Replication (see [Replication Client Economics](ed_replication_client_economics.md)) that they are eligible to validate
* Be elected as leader on a stake-weighted round-robin schedule during which time they are responsible for collecting outstanding transactions and Proofs-of-Replication and incorporating them into the PoH, thus updating the global state of the network and providing chain continuity.
Validator-client rewards for these services are to be distributed at the end of each Solana epoch. Compensation for validator-clients is provided via a protocol-based annual interest rate dispersed in proportion to the stake-weight of each validator (see below) along with leader-claimed transaction fees available during each leader rotation. I.e. during the time a given validator-client is elected as leader, it has the opportunity to keep a portion of each non-PoRep transaction fee, less a protocol-specified amount that is returned to the mining pool (see [Validation-client State Transaction Fees](ed_vce_state_validation_transaction_fees.md)). PoRep transaction fees are not collected directly by the leader client but pooled and returned to the validator set in proportion to the number of successfully validated PoReps. (see [Replication-client Transaction Fees](ed_vce_replication_validation_transaction_fees.md))
The protocol-based annual interest-rate (%) per epoch to be distributed to validation-clients is to be a function of:
* the current fraction of staked SOLs out of the current total circulating supply,
* the global time since the genesis block instantiation
* the up-time/participation [% of available slots/blocks that validator had opportunity to vote on?] of a given validator over the previous epoch.
The first two factors are protocol parameters only (i.e. independent of validator behavior in a given epoch) and describe a global validation reward schedule designed to both incentivize early participation and optimal security in the network. This schedule sets a maximum annual validator-client interest rate per epoch.
At any given point in time, this interest rate is pegged to a defined value given a specific % staked SOL out of the circulating supply (e.g. 10% interest rate when 66% of circulating SOL is staked). The interest rate adjusts as the square-root [TBD] of the % staked, leading to higher validation-client interest rates as the % staked drops below the targeted goal, thus incentivizing more participation leading to more security in the network. An example of such a schedule, for a specified point in time (e.g. network launch) is shown in **Table 1**.
| Percentage circulating supply staked [%] | Annual validator-client interest rate [%] |
| ---: | ---: |
| 5 | 13.87 |
| 15 | 13.31 |
| 25 | 12.73 |
| 35 | 12.12 |
| 45 | 11.48 |
| 55 | 10.80 |
| **66** | **10.00** |
| 75 | 9.29 |
| 85 | 8.44 |
**Table 1:** Example interest rate schedule based on % SOL staked out of circulating supply. In this case, interest rates are fixed at 10% for 66% of staked circulating supply
Over time, the interest rate, at any network staked percentage, will drop as described by an algorithmic schedule. Validation-client interest rates are designed to be higher in the early days of the network to incentivize participation and jumpstart the network economy. This mining-pool provided interest rate will reduce over time until a network-chosen baseline value is reached. This is a fixed, long-term, interest rate to be provided to validator-clients. This value does not represent the total interest available to validator-clients as transaction fees for both state-validation and ledger storage replication (PoReps) are not accounted for here. A validation-client interest rate schedule as a function of % network staked and time is shown in** Figure 2**.
<!-- ![== Validation Client Interest Rates Figure ==](validation_client_interest_rates.png =250x) -->
<p style="text-align:center;"><img src="img/validation_client_interest_rates.png" alt="drawing" width="800"/></p>
**Figure 2:** In this example schedule, the annual interest rate [%] reduces at around 16.7% per year, until it reaches the long-term, fixed, 4% rate.
This epoch-specific protocol-defined interest rate sets an upper limit of *protocol-generated* annual interest rate (not absolute total interest rate) possible to be delivered to any validator-client per epoch. The distributed interest rate per epoch is then discounted from this value based on the participation of the validator-client during the previous epoch. Each epoch is comprised of XXX slots. The protocol-defined interest rate is then discounted by the log [TBD] of the % of slots a given validator submitted a vote on a PoH branch during that epoch, see **Figure XX**

View File

@ -0,0 +1,20 @@
### State-validation Transaction Fees
Each message sent through the network, to be processed by the current leader validation-client and confirmed as a global state transaction, must contain a transaction fee. Transaction fees offer many benefits in the Solana economic design, for example they:
* provide unit compensation to the validator network for the CPU/GPU resources necessary to process the state transaction,
* reduce network spam by introducing real cost to transactions,
* open avenues for a transaction market to incentivize validation-client to collect and process submitted transactions in their function as leader,
* and provide potential long-term economic stability of the network through a protocol-captured minimum fee amount per transaction, as described below.
Many current blockchain economies (e.g. Bitcoin, Ethereum), rely on protocol-based rewards to support the economy in the short term, with the assumption that the revenue generated through transaction fees will support the economy in the long term, when the protocol derived rewards expire. In an attempt to create a sustainable economy through protocol-based rewards and transaction fees, a fixed portion of each transaction fee is sent to the mining pool, with the resulting fee going to the current leader processing the transaction. These pooled fees, then re-enter the system through rewards distributed to validation-clients, through the process described above, and replication-clients, as discussed below.
The intent of this design is to retain leader incentive to include as many transactions as possible within the leader-slot time, while providing a redistribution avenue that protects against "tax evasion" attacks (i.e. side-channel fee payments)<sup>[1](ed_referenced.md)</sup>. Constraints on the fixed portion of transaction fees going to the mining pool, to establish long-term economic sustainability, are established and discussed in detail in the [Economic Sustainability](ed_economic_sustainability.md) section.
This minimum, protocol-earmarked, portion of each transaction fee can be dynamically adjusted depending on historical gas usage. In this way, the protocol can use the minimum fee to target a desired hardware utilisation. By monitoring a protocol specified gas usage with respect to a desired, target usage amount (e.g. 50% of a block's capacity), the minimum fee can be raised/lowered which should, in turn, lower/raise the actual gas usage per block until it reaches the target amount. This adjustment process can be thought of as similar to the difficulty adjustment algorithm in the Bitcoin protocol, however in this case it is adjusting the minimum transaction fee to guide the transaction processing hardware usage to a desired level.
Additionally, the minimum protocol captured fee can be a consideration in fork selection. In the case of a PoH fork with a malicious, censoring leader, we would expect the total procotol captured fee to be less than a comparable honest fork, due to the fees lost from censoring. If the censoring leader is to compensate for these lost protocol fees, they would have to replace the fees on their fork themselves, thus potentially reducing the incentive to censor in the first place.

View File

@ -0,0 +1,29 @@
### Validation Stake Delegation
Running a Solana validation-client required relatively modest upfront hardware capital investment. **Table 2** provides an example hardware configuration to support ~1M tx/s with estimated off-the-shelf costs:
|Component|Example|Estimated Cost|
|--- |--- |--- |
|GPU|2x 2080 Ti|$2500|
|or|4x 1080 Ti|$2800|
|OS/Ledger Storage|Samsung 860 Evo 2TB|$370|
|Accounts storage|2x Samsung 970 Pro M.2 512GB|$340|
|RAM|32 Gb|$300|
|Motherboard|AMD x399|$400|
|CPU|AMD Threadripper 2920x|$650|
|Case||$100|
|Power supply|EVGA 1600W|$300|
|Network|> 500 mbps||
|Network (1)|Google webpass business bay area 1gbps unlimited|$5500/mo|
|Network (2)|Hurricane Electric bay area colo 1gbps|$500/mo|
**Table 2** example high-end hardware setup for running a Solana client.
Despite the low-barrier to entry as a validation-client, from a capital investment perspective, as in any developing economy, there will be much opportunity and need for trusted validation services as evidenced by node reliability, UX/UI, APIs and other software accessibility tools. Additionally, although Solanas validator node startup costs are nominal when compared to similar networks, they may still be somewhat restrictive for some potential participants. In the spirit of developing a true decentralized, permissionless network, these interested parties still have two options to become involved in the Solana network/economy:
1. Delegation of previously acquired tokens with a reliable validation node to earn a portion of interest generated
2. Provide local storage space as a replication-client and receive rewards by submitting Proof-of-Replication (see [Replication-client Economics](ed_replication_client_economics.md)).
a. This participant has the additional option to directly delegate their earned storage rewards ([Replication-client Reward Auto-delegation](ed_rce_replication_client_reward_auto_delegation.md))
Delegation of tokens to validation-clients, via option 1, provides a way for passive Solana token holders to become part of the active Solana economy and earn interest rates proportional to the interest rate generated by the delegated validation-client. Additionally, this feature creates a healthy validation-client market, with potential validation-client nodes competing to build reliable, transparent and profitable delegation services.

View File

@ -1,121 +0,0 @@
# Entry Tree
This document proposes a change to ledger and window to support Solana's [fork
generation](fork-generation.md) behavior.
## Current Design
### Functionality of Window And Ledger
The basic responsibilities of the window and the ledger in a Solana fullnode
are:
1. Window: serve as a temporary, RAM-backed store of blobs of the PoH chain
for re-ordering and assembly into contiguous blocks to be sent to the bank
for verification.
2. Window: serve as a RAM-backed repair facility for other validator nodes,
which may query the network for as-yet unreceived blobs.
3. Ledger: provide disk-based storage of the PoH chain in case of node
restart.
4. Ledger: provide disk-backed repair facility for when the (smaller)
RAM-backed window doesn't cover the repair request.
The window is at the front of a validator node's processing pipeline, blobs are
received, cached, re-ordered before being deserialized into Entries, passed to
the bank for verification, and finally on to the ledger, which is at the back
of a validator node's pipeline.
The window holds blobs (the over-the-air format, serialized Entries,
one-per-blob). The ledger holds serialized Entries without any blob
information.
### Limitations
#### One-dimensional key space
The window and the ledger are indexed by ledger height, which is number of
Entries ever generated in the PoH chain until the current blob. This
limitation prevents the window and the ledger from storing the overlapping
histories possible in Solana's consensus protocol.
#### Limited caching
The window is a circular buffer. It cannot accept blobs that are farther in
the future than the window is currently working. If a blob arrives that is too
far ahead, it is dropped and will subsequently need to be repaired, incurring
further delay for the node.
#### Loss of blob signatures
Because the blob signatures are stripped before being stored by the ledger,
repair requests served from the ledger can't be verified to the original
leader.
#### Rollback and checkpoint, switching forks, separate functions
The window and the ledger can't handle replay of alternate forks. Once a Blob
has passed through the window, it's in the past. The replay stage of a
validator will need to roll back to a previous checkpoint and decode an
alternate set of Blobs to the Bank. The separated and one-way nature of window
and ledger makes this hard.
## New Design
A unified window and ledger allows a validator to record every blob it observes
on the network, in any order, as long as the blob is consistent with the
network's leader schedule.
Blobs are moved to a fork-able key space the tuple of `leader slot` + `blob
index` (within the slot). This permits the skip-list structure of the Solana
protocol to be stored in its entirety, without a-priori choosing which fork to
follow, which Entries to persist or when to persist them.
Repair requests for recent blobs are served out of RAM or recent files and out
of deeper storage for less recent blobs, as implemented by the store backing
EntryTree.
### Functionalities of EntryTree
1. Persistence: the EntryTree lives in the front of the nodes verification
pipeline, right behind network receive and signature verification. If the
blob received is consistent with the leader schedule (i.e. was signed by the
leader for the indicated slot), it is immediately stored.
2. Repair: repair is the same as window repair above, but able to serve any
blob that's been received. EntryTree stores blobs with signatures,
preserving the chain of origination.
3. Forks: EntryTree supports random access of blobs, so can support a
validator's need to rollback and replay from a Bank checkpoint.
4. Restart: with proper pruning/culling, the EntryTree can be replayed by
ordered enumeration of entries from slot 0. The logic of the replay stage
(i.e. dealing with forks) will have to be used for the most recent entries in
the EntryTree.
### Interfacing with Bank
The bank exposes to replay stage:
1. prev_id: which PoH chain it's working on as indicated by the id of the last
entry it processed
2. tick_height: the ticks in the PoH chain currently being verified by this
bank
3. votes: a stack of records that contain
1. prev_ids: what anything after this vote must chain to in PoH
2. tick height: the tick_height at which this vote was cast
3. lockout period: how long a chain must be observed to be in the ledger to
be able to be chained below this vote
Replay stage uses EntryTree APIs to find the longest chain of entries it can
hang off a previous vote. If that chain of entries does not hang off the
latest vote, the replay stage rolls back the bank to that vote and replays the
chain from there.
### Pruning EntryTree
Once EntryTree entries are old enough, representing all the possible forks
becomes less useful, perhaps even problematic for replay upon restart. Once a
validator's votes have reached max lockout, however, any EntryTree contents
that are not on the PoH chain for that vote for can be pruned, expunged.
Replicator nodes will be responsible for storing really old ledger contents,
and validators need only persist their bank periodically.

View File

@ -59,9 +59,11 @@ Validators vote based on a greedy choice to maximize their reward described in
### Validator's View
#### Time Progression The diagram below represents a validator's view of the
PoH stream with possible forks over time. L1, L2, etc. are leader slot, and
`E`s represent entries from that leader during that leader's slot. The 'x's
#### Time Progression
The diagram below represents a validator's view of the
PoH stream with possible forks over time. L1, L2, etc. are leader slots, and
`E`s represent entries from that leader during that leader's slot. The `x`s
represent ticks only, and time flows downwards in the diagram.

View File

@ -1,53 +1,75 @@
# Fork Selection
This article describes Solana's *Nakomoto Fork Selection* algorithm based on time
locks. It satisfies the following properties:
This design describes a *Fork Selection* algorithm. It addresses the following
problems:
* A voter can eventually recover from voting on a fork that doesn't become the
fork with the desired network finality.
* If the voters share a common ancestor then they will converge to a fork
containing that ancestor no matter how they are partitioned. The converged
ancestor may not be the latest possible ancestor at the start of the fork.
* Rollback requires exponentially more time for older votes than for newer
votes.
* Voters have the freedom to set a minimum network confirmation threshold
before committing a vote to a higher lockout. This allows each voter to make
a trade-off between risk and reward. See [cost of rollback](#cost-of-rollback).
* Some forks may not end up accepted by the super-majority of the cluster, and
voters need to recover from voting on such forks.
* Many forks may be votable by different voters, and each voter may see a
different set of votable forks. The selected forks should eventually converge
for the cluster.
* Reward based votes have an associated risk. Voters should have the ability to
configure how much risk they take on.
* The [cost of rollback](#cost-of-rollback) needs to be computable. It is
important to clients that rely on some measurable form of Consistency. The
costs to break consistency need to be computable, and increase super-linearly
for older votes.
* ASIC speeds are different between nodes, and attackers could employ Proof of
History ASICS that are much faster than the rest of the cluster. Consensus
needs to be resistant to attacks that exploit the variability in Proof of
History ASIC speed.
For brevity this design assumes that a single voter with a stake is deployed as
an individual validator in the cluster.
## Time
For networks like Solana, time can be the PoH hash count, which is a VDF that
provides a source of time before consensus. Other networks adopting this
approach would need to consider a global source of time.
The Solana cluster generates a source of time via a Verifiable Delay Function we
are calling [Proof of History](book/src/synchronization.md).
For Solana, time uniquely identifies a specific leader for fork generation. At
any given time only 1 leader, which can be computed from the ledger itself, can
propose a fork. For more details, see [fork generation](fork-generation.md)
and [leader rotation](leader-rotation.md).
Proof of History is used to create a deterministic round robin schedule for all
the active leaders. At any given time only 1 leader, which can be computed from
the ledger itself, can propose a fork. For more details, see [fork
generation](fork-generation.md) and [leader rotation](leader-rotation.md).
## Lockouts
The purpose of the lockout is to force a validator to commit opportunity cost to
a specific fork. Lockouts are measured in slots, and therefor represent a
real-time forced delay that a validator needs to wait before breaking the
commitment to a fork.
Validators that violate the lockouts and vote for a diverging fork within the
lockout should be punished. The proposed punishment is to slash the validator
stake if a concurrent vote within a lockout for a non-descendant fork can be
proven to the cluster.
## Algorithm
The basic idea to this approach is to stack consensus votes. Each vote in the
stack is a confirmation of a fork. Each confirmed fork is an ancestor of the
fork above it. Each consensus vote has a `lockout` in units of time before the
validator can submit a vote that does not contain the confirmed fork as an
ancestor.
The basic idea to this approach is to stack consensus votes and double lockouts.
Each vote in the stack is a confirmation of a fork. Each confirmed fork is an
ancestor of the fork above it. Each vote has a `lockout` in units of slots
before the validator can submit a vote that does not contain the confirmed fork
as an ancestor.
When a vote is added to the stack, the lockouts of all the previous votes in
the stack are doubled (more on this in [Rollback](#Rollback)). With each new
vote, a voter commits the previous votes to an ever-increasing lockout. At 32
When a vote is added to the stack, the lockouts of all the previous votes in the
stack are doubled (more on this in [Rollback](#Rollback)). With each new vote,
a validator commits the previous votes to an ever-increasing lockout. At 32
votes we can consider the vote to be at `max lockout` any votes with a lockout
equal to or above `1<<32` are dequeued (FIFO). Dequeuing a vote is the trigger
for a reward. If a vote expires before it is dequeued, it and all the votes
above it are popped (LIFO) from the vote stack. The voter needs to start
above it are popped (LIFO) from the vote stack. The validator needs to start
rebuilding the stack from that point.
### Rollback
Before a vote is pushed to the stack, all the votes leading up to vote with a
lower lock time than the new vote are popped. After rollback lockouts are not
doubled until the voter catches up to the rollback height of votes.
doubled until the validator catches up to the rollback height of votes.
For example, a vote stack with the following state:
@ -89,67 +111,123 @@ votes.
### Slashing and Rewards
The purpose of the lockout is to force a voter to commit opportunity cost to a
specific fork. Voters that violate the lockouts and vote for a diverging fork
within the lockout should be punished. Slashing or simply freezing the voter
from rewards for a long period of time can be used as punishment.
Voters should be rewarded for selecting the fork that the rest of the network
selected as often as possible. This is well-aligned with generating a reward
when the vote stack is full and the oldest vote needs to be dequeued. Thus a
reward should be generated for each successful dequeue.
Validators should be rewarded for selecting the fork that the rest of the
cluster selected as often as possible. This is well-aligned with generating a
reward when the vote stack is full and the oldest vote needs to be dequeued.
Thus a reward should be generated for each successful dequeue.
### Cost of Rollback
Cost of rollback of *fork A* is defined as the cost in terms of lockout time to
the validators to confirm any other fork that does not include *fork A* as an
the validator to confirm any other fork that does not include *fork A* as an
ancestor.
The **Economic Finality** of *fork A* can be calculated as the loss of all the
rewards from rollback of *fork A* and its descendants, plus the opportunity
cost of reward due to the exponentially growing lockout of the votes that have
rewards from rollback of *fork A* and its descendants, plus the opportunity cost
of reward due to the exponentially growing lockout of the votes that have
confirmed *fork A*.
### Thresholds
Each voter can independently set a threshold of network commitment to a fork
before that voter commits to a fork. For example, at vote stack index 7, the
lockout is 256 time units. A voter may withhold votes and let votes 0-7 expire
unless the vote at index 7 has at greater than 50% commitment in the network.
This allows each voter to independently control how much risk to commit to a
fork. Committing to forks at a higher frequency would allow the voter to earn
more rewards.
Each validator can independently set a threshold of cluster commitment to a fork
before that validator commits to a fork. For example, at vote stack index 7,
the lockout is 256 time units. A validator may withhold votes and let votes 0-7
expire unless the vote at index 7 has at greater than 50% commitment in the
cluster. This allows each validator to independently control how much risk to
commit to a fork. Committing to forks at a higher frequency would allow the
validator to earn more rewards.
### Algorithm parameters
These parameters need to be tuned.
The following parameters need to be tuned:
* Number of votes in the stack before dequeue occurs (32).
* Rate of growth for lockouts in the stack (2x).
* Starting default lockout (2).
* Threshold depth for minimum network commitment before committing to the fork
(8).
* Minimum network commitment size at threshold depth (50%+).
* Threshold depth for minimum cluster commitment before committing to the fork
(8).
* Minimum cluster commitment size at threshold depth (50%+).
### Free Choice
A "Free Choice" is an unenforcible voter action. A voter that maximizes
self-reward over all possible futures should behave in such a way that the
system is stable, and the local greedy choice should result in a greedy choice
over all possible futures. A set of voter that are engaging in choices to
disrupt the protocol should be bound by their stake weight to the denial of
service. Two options exits for voter:
A "Free Choice" is an unenforcible validator action. There is no way for the
protocol to encode and enforce these actions since each validator can modify the
code and adjust the algorithm. A validator that maximizes self-reward over all
possible futures should behave in such a way that the system is stable, and the
local greedy choice should result in a greedy choice over all possible futures.
A set of validator that are engaging in choices to disrupt the protocol should
be bound by their stake weight to the denial of service. Two options exits for
validator:
* a voter can outrun previous voters in virtual generation and submit a
* a validator can outrun previous validator in virtual generation and submit a
concurrent fork
* a voter can withhold a vote to observe multiple forks before voting
In both cases, the voters in the network have several forks to pick from
* a validator can withhold a vote to observe multiple forks before voting
In both cases, the validator in the cluster have several forks to pick from
concurrently, even though each fork represents a different height. In both
cases it is impossible for the protocol to detect if the voter behavior is
cases it is impossible for the protocol to detect if the validator behavior is
intentional or not.
### Greedy Choice for Concurrent Forks
When evaluating multiple forks, each voter should pick the fork that will
maximize economic finality for the network, or the latest fork if all are equal.
When evaluating multiple forks, each validator should use the following rules:
1. Forks must satisfy the *Threshold* rule.
2. Pick the fork that maximizes the total cluster lockout time for all the
ancestor forks.
3. Pick the fork that has the greatest amount of cluster transaction fees.
4. Pick the latest fork in terms of PoH.
Cluster transaction fees are fees that are deposited to the mining pool as
described in the [Staking Rewards](book/src/staking-rewards.md) section.
## PoH ASIC Resistance
Votes and lockouts grow exponentially while ASIC speed up is linear. There are
two possible attack vectors involving a faster ASIC.
### ASIC censorship
An attacker generates a concurrent fork that outruns previous leaders in an
effort to censor them. A fork proposed by this attacker will be available
concurrently with the next available leader. For nodes to pick this fork it
must satisfy the *Greedy Choice* rule.
1. Fork must have equal number of votes for the ancestor fork.
2. Fork cannot be so far a head as to cause expired votes.
3. Fork must have a greater amount of cluster transaction fees.
This attack is then limited to censoring the previous leaders fees, and
individual transactions. But it cannot halt the cluster, or reduce the
validator set compared to the concurrent fork. Fee censorship is limited to
access fees going to the leaders but not the validators.
### ASIC Rollback
An attacker generates a concurrent fork from an older block to try to rollback
the cluster. In this attack the concurrent fork is competing with forks that
have already been voted on. This attack is limited by the exponential growth of
the lockouts.
* 1 vote has a lockout of 2 slots. Concurrent fork must be at least 2 slots
ahead, and be produced in 1 slot. Therefore requires an ASIC 2x faster.
* 2 votes have a lockout of 4 slots. Concurrent fork must be at least 4 slots
ahead and produced in 2 slots. Therefore requires an ASIC 2x faster.
* 3 votes have a lockout of 8 slots. Concurrent fork must be at least 8 slots
ahead and produced in 3 slots. Therefore requires an ASIC 2.6x faster.
* 10 votes have a lockout of 1024 slots. 1024/10, or 102.4x faster ASIC.
* 20 votes have a lockout of 2^20 slots. 2^20/20, or 52,428.8x faster ASIC.

View File

@ -41,6 +41,12 @@ $ git checkout $TAG
### Configuration Setup
Ensure important programs such as the vote program are built before any
nodes are started
```bash
$ cargo build --all
```
The network is initialized with a genesis ledger and fullnode configuration files.
These files can be generated by running the following script.
@ -155,100 +161,8 @@ This will dump all the threads stack traces into gdb.txt
In this example the client connects to our public testnet. To run validators on the testnet you would need to open udp ports `8000-10000`.
```bash
$ ./multinode-demo/client.sh --network $(dig +short testnet.solana.com):8001 --duration 60
$ ./multinode-demo/client.sh --network testnet.solana.com:8001 --duration 60
```
You can observe the effects of your client's transactions on our [dashboard](https://metrics.solana.com:3000/d/testnet/testnet-hud?orgId=2&from=now-30m&to=now&refresh=5s&var-testnet=testnet)
## Linux Snap
A Linux [Snap](https://snapcraft.io/) is available, which can be used to easily
get Solana running on supported Linux systems without building anything from
source for evaluation. Note that CUDA is not supported by the Snap so
performance will be limited.
The `edge` Snap channel is updated daily with the latest
development from the `master` branch. To install:
```bash
$ sudo snap install solana --edge --devmode
```
Once installed the usual Solana programs will be available as `solona.*` instead
of `solana-*`. For example, `solana.fullnode` instead of `solana-fullnode`.
Update to the latest version at any time with:
```bash
$ snap info solana
$ sudo snap refresh solana --devmode
```
### Daemon Support
The snap supports running fullnodes and a drone as system daemons.
Run `sudo snap get solana` to view the current daemon configuration. To view
daemon logs:
1. Run `sudo snap logs -n=all solana` to view the daemon initialization log
2. Runtime logging can be found under `/var/snap/solana/current/bootstrap-leader/`,
`/var/snap/solana/current/fullnode/`, or `/var/snap/solana/current/drone/` depending
on which `mode=` was selected. Within each log directory the file `current`
contains the latest log, and the files `*.s` (if present) contain older rotated
logs.
Disable the daemon at any time by running:
```bash
$ sudo snap set solana mode=
```
Runtime configuration files for the daemon can be found in
`/var/snap/solana/current/config`.
#### Leader Daemon
```bash
$ sudo snap set solana mode=bootstrap-leader
```
`rsync` must be configured and running on the leader.
1. Ensure rsync is installed with `sudo apt-get -y install rsync`
2. Edit `/etc/rsyncd.conf` to include the following
```ini
[config]
path = /var/snap/solana/current/config
hosts allow = *
read only = true
```
3. Run `sudo systemctl enable rsync; sudo systemctl start rsync`
4. Test by running `rsync -Pzravv rsync://<ip-address-of-leader>/config
solana-config` from another machine. **If the leader is running on a cloud
provider it may be necessary to configure the Firewall rules to permit ingress
to port tcp:873, tcp:9900 and the port range udp:8000-udp:10000**
To run both the Leader and Drone:
```bash
$ sudo snap set solana mode=bootstrap-leader+drone
```
#### Validator daemon
```bash
$ sudo snap set solana mode=fullnode
```
By default the node will attempt to connect to **testnet.solana.com**, override the
cluster entrypoint IP address by running:
```bash
$ sudo snap set solana mode=fullnode entrypoint-ip=127.0.0.1 #<-- change IP address
```
It's assumed that the node at the entrypoint IP will be running `rsync`
configured as described in the previous **Leader daemon** section.

View File

@ -77,3 +77,52 @@ Nodes retain prior versions of values (those updated by a pull or push) and
expired values (those older than `GOSSIP_PULL_CRDS_TIMEOUT_MS`) in
`purged_values` (things I recently had). Nodes purge `purged_values` that are
older than `5 * GOSSIP_PULL_CRDS_TIMEOUT_MS`.
## Eclipse Attacks
An eclipse attack is an attempt to take over the set of node connections with
adversarial endpoints.
This is relevant to our implementation in the following ways.
* Pull messages select a random node from the network. An eclipse attack on
*pull* would require an attacker to influence the random selection in such a way
that only adversarial nodes are selected for pull.
* Push messages maintain an active set of nodes and select a random fanout for
every push message. An eclipse attack on *push* would influence the active set
selection, or the random fanout selection.
### Time and Stake based weights
Weights are calculated based on `time since last picked` and the `natural log` of the `stake weight`.
Taking the `ln` of the stake weight allows giving all nodes a fairer chance of network
coverage in a reasonable amount of time. It helps normalize the large possible `stake weight` differences between nodes.
This way a node with low `stake weight`, compared to a node with large `stake weight` will only have to wait a
few multiples of ln(`stake`) seconds before it gets picked.
There is no way for an adversary to influence these parameters.
### Pull Message
A node is selected as a pull target based on the weights described above.
### Push Message
A prune message can only remove an adversary from a potential connection.
Just like *pull message*, nodes are selected into the active set based on weights.
## Notable differences from PlumTree
The active push protocol described here is based on (Plum
Tree)[https://haslab.uminho.pt/jop/files/lpr07a.pdf]. The main differences are:
* Push messages have a wallclock that is signed by the originator. Once the
wallclock expires the message is dropped. A hop limit is difficult to implement
in an adversarial setting.
* Lazy Push is not implemented because its not obvious how to prevent an
adversary from forging the message fingerprint. A naive approach would allow an
adversary to be prioritized for pull based on their input.

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 KiB

View File

@ -0,0 +1,3 @@
# Implemented Design Proposals
The following design proposals are fully implemented.

213
book/src/installer.md Normal file
View File

@ -0,0 +1,213 @@
## Cluster Software Installation and Updates
Currently users are required to build the solana cluster software themselves
from the git repository and manually update it, which is error prone and
inconvenient.
This document proposes an easy to use software install and updater that can be
used to deploy pre-built binaries for supported platforms. Users may elect to
use binaries supplied by Solana or any other party they trust. Deployment of
updates is managed using an on-chain update manifest program.
### Motivating Examples
#### Fetch and run a pre-built installer using a bootstrap curl/shell script
The easiest install method for supported platforms:
```bash
$ curl -sSf https://raw.githubusercontent.com/solana-labs/solana/v0.13.0/install/solana-install-init.sh | sh
```
This script will check github for the latest tagged release and download and run the
`solana-install` binary from there.
If additional arguments need to be specified during the installation, the
following shell syntax is used:
```bash
$ init_args=.... # arguments for `solana-installer init ...`
$ curl -sSf https://raw.githubusercontent.com/solana-labs/solana/v0.13.0/install/solana-install-init.sh | sh -s - ${init_args}
```
#### Fetch and run a pre-built installer from a Github release
With a well-known release URL, a pre-built binary can be obtained for supported
platforms:
```bash
$ curl -o solana-install https://github.com/solana-labs/solana/releases/download/v0.13.0/solana-install-x86_64-apple-darwin
$ chmod +x ./solana-install
$ ./solana-install --help
```
#### Build and run the installer from source
If a pre-built binary is not available for a given platform, building the
installer from source is always an option:
```bash
$ git clone https://github.com/solana-labs/solana.git
$ cd solana/install
$ cargo run -- --help
```
#### Deploy a new update to a cluster
Given a solana release tarball (as created by `ci/publish-tarball.sh`) that has already been uploaded to a publicly accessible URL,
the following commands will deploy the update:
```bash
$ solana-keygen -o update-manifest.json # <-- only generated once, the public key is shared with users
$ solana-install deploy http://example.com/path/to/solana-release.tar.bz2 update-manifest.json
```
#### Run a validator node that auto updates itself
```bash
$ solana-install init --pubkey 92DMonmBYXwEMHJ99c9ceRSpAmk9v6i3RdvDdXaVcrfj # <-- pubkey is obtained from whoever is deploying the updates
$ export PATH=~/.local/share/solana-install/bin:$PATH
$ solana-keygen ... # <-- runs the latest solana-keygen
$ solana-install run solana-fullnode ... # <-- runs a fullnode, restarting it as necesary when an update is applied
```
### On-chain Update Manifest
An update manifest is used to advertise the deployment of new release tarballs
on a solana cluster. The update manifest is stored using the `config` program,
and each update manifest account describes a logical update channel for a given
target triple (eg, `x86_64-apple-darwin`). The account public key is well-known
between the entity deploying new updates and users consuming those updates.
The update tarball itself is hosted elsewhere, off-chain and can be fetched from
the specified `download_url`.
```rust,ignore
use solana_sdk::signature::Signature;
/// Information required to download and apply a given update
pub struct UpdateManifest {
pub timestamp_secs: u64, // When the release was deployed in seconds since UNIX EPOCH
pub download_url: String, // Download URL to the release tar.bz2
pub download_sha256: String, // SHA256 digest of the release tar.bz2 file
}
/// Userdata of an Update Manifest program Account.
#[derive(Serialize, Deserialize, Default, Debug, PartialEq)]
pub struct SignedUpdateManifest {
pub manifest: UpdateManifest,
pub manifest_signature: Signature,
}
```
Note that the `manifest` field itself contains a corresponding signature
(`manifest_signature`) to guard against man-in-the-middle attacks between the
`solana-install` tool and the solana cluster RPC API.
To guard against rollback attacks, `solana-install` will refuse to install an
update with an older `timestamp_secs` than what is currently installed.
### Release Archive Contents
A release archive is expected to be a tar file compressed with
bzip2 with the following internal structure:
* `/version.yml` - a simple YAML file containing the field `"target"` - the
target tuple. Any additional fields are ignored.
* `/bin/` -- directory containing available programs in the release.
`solana-install` will symlink this directory to
`~/.local/share/solana-install/bin` for use by the `PATH` environment
variable.
* `...` -- any additional files and directories are permitted
### solana-install Tool
The `solana-install` tool is used by the user to install and update their cluster software.
It manages the following files and directories in the user's home directory:
* `~/.config/solana/install/config.yml` - user configuration and information about currently installed software version
* `~/.local/share/solana/install/bin` - a symlink to the current release. eg, `~/.local/share/solana-update/<update-pubkey>-<manifest_signature>/bin`
* `~/.local/share/solana/install/releases/<download_sha256>/` - contents of a release
#### Command-line Interface
```manpage
solana-install 0.13.0
The solana cluster software installer
USAGE:
solana-install [OPTIONS] <SUBCOMMAND>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-c, --config <PATH> Configuration file to use [default: /Users/mvines/Library/Preferences/solana/install.yml]
SUBCOMMANDS:
deploy deploys a new update
help Prints this message or the help of the given subcommand(s)
info displays information about the current installation
init initializes a new installation
run Runs a program while periodically checking and applying software updates
update checks for an update, and if available downloads and applies it
```
```manpage
solana-install-init
initializes a new installation
USAGE:
solana-install init [OPTIONS]
FLAGS:
-h, --help Prints help information
OPTIONS:
-d, --data_dir <PATH> Directory to store install data [default: /Users/mvines/Library/Application Support/solana]
-u, --url <URL> JSON RPC URL for the solana cluster [default: https://api.testnet.solana.com/]
-p, --pubkey <PUBKEY> Public key of the update manifest [default: 9XX329sPuskWhH4DQh6k16c87dHKhXLBZTL3Gxmve8Gp]
```
```manpage
solana-install-info
displays information about the current installation
USAGE:
solana-install info [FLAGS]
FLAGS:
-h, --help Prints help information
-l, --local only display local information, don't check the cluster for new updates
```
```manpage
solana-install-deploy
deploys a new update
USAGE:
solana-install deploy <download_url> <update_manifest_keypair>
FLAGS:
-h, --help Prints help information
ARGS:
<download_url> URL to the solana release archive
<update_manifest_keypair> Keypair file for the update manifest (/path/to/keypair.json)
```
```manpage
solana-install-update
checks for an update, and if available downloads and applies it
USAGE:
solana-install update
FLAGS:
-h, --help Prints help information
```
```manpage
solana-install-run
Runs a program while periodically checking and applying software updates
USAGE:
solana-install run <program_name> [program_arguments]...
FLAGS:
-h, --help Prints help information
ARGS:
<program_name> program to run
<program_arguments>... arguments to supply to the program
The program will be restarted upon a successful software update
```

View File

@ -1,20 +1,20 @@
# What is Solana?
Solana is the name of an open source project that is implementing a new
Solana is the name of an open source project that is implementing a new,
high-performance, permissionless blockchain. Solana is also the name of a
company headquartered in San Francisco that maintains the open source project.
# About this Book
This book describes the Solana open source project, a blockchain built from the
ground up for scale. The book covers why to use it, how to use it, how it
ground up for scale. The book covers why it's useful, how to use it, how it
works, and why it will continue to work long after the company Solana closes
its doors. The goal of the Solana architecture is to demonstrate there exists a
set of software algorithms that when used in combination to implement a
blockchain, removes software as a performance bottleneck, allowing transaction
throughput to scale proportionally with network bandwidth. The architecture
goes on to satisfy all three desirable properties of a proper blockchain: that
it not only be scalable, but that it is also secure and decentralized.
goes on to satisfy all three desirable properties of a proper blockchain:
it is scalable, secure and decentralized.
The architecture describes a theoretical upper bound of 710 thousand
transactions per second (tps) on a standard gigabit network and 28.4 million
@ -32,7 +32,7 @@ solicitation for investment.
# History of the Solana Codebase
In November of 2017 Anatoly Yakovenko published a whitepaper describing Proof
In November of 2017, Anatoly Yakovenko published a whitepaper describing Proof
of History, a technique for keeping time between computers that do not trust
one another. From Anatoly's previous experience designing distributed systems
at Qualcomm, Mesosphere and Dropbox, he knew that a reliable clock makes
@ -41,13 +41,13 @@ resulting network can be blazing fast, bound only by network bandwidth.
Anatoly watched as blockchain systems without clocks, such as Bitcoin and
Ethereum, struggled to scale beyond 15 transactions per second worldwide when
centralized payment systems such as Visa required peaks of 65,000. Without a
centralized payment systems such as Visa required peaks of 65,000 tps. Without a
clock, it was clear they'd never graduate to being the global payment system or
global supercomputer they had dreamed to be. When Anatoly solved the problem of
global supercomputer most had dreamed them to be. When Anatoly solved the problem of
getting computers that dont trust each other to agree on time, he knew he had
the key to bring 40 years of distributed systems research to the world of
blockchain. The resulting cluster wouldn't be just 10 times faster, or a 100
times, or a 1,000 times, but 10,000 times faster right out of the gate!
times, or a 1,000 times, but 10,000 times faster, right out of the gate!
Anatoly's implementation began in a private codebase and was implemented in the
C programming language. Greg Fitzgerald, who had previously worked with Anatoly
@ -72,7 +72,7 @@ Anatoly recruited Greg, Stephen and three others to co-found a company, then
called Loom.
Around the same time, Ethereum-based project Loom Network sprung up and many
people were confused if they were the same project. The Loom team decided it
people were confused about whether they were the same project. The Loom team decided it
would rebrand. They chose the name Solana, a nod to a small beach town North of
San Diego called Solana Beach, where Anatoly, Greg and Stephen lived and surfed
for three years when they worked for Qualcomm. On March 28th, the team created
@ -81,13 +81,13 @@ Solana.
In June of 2018, the team scaled up the technology to run on cloud-based
networks and on July 19th, published a 50-node, permissioned, public testnet
consistently supporting bursts of 250,000 transactions per second. In the most
recent release, v0.10 Pillbox, the team published a permissioned testnet
consistently supporting bursts of 250,000 transactions per second. In a later release in
December, called v0.10 Pillbox, the team published a permissioned testnet
running 150 nodes on a gigabit network and demonstrated soak tests processing
an *average* of 200 thousand transactions per second with bursts over 500
thousand. The project was also extended to support on-chain programs written in
the C programming language and run concurrently in a safe execution environment
called BPF. Next step: going permissionless.
called BPF.
# What is a Solana Cluster?
@ -110,7 +110,7 @@ organization that launched it.
A sol is the name of Solana's native token, which can be passed to nodes in a
Solana cluster in exchange for running an on-chain program or validating its
output. The Solana protocol defines that only 1 billion sols will ever exist,
but that the system may perform micropayments of fractional sols and that a sol
but that the system may perform micropayments of fractional sols, and that a sol
may be split as many as 34 times. The fractional sol is called a *lamport*. It
is named in honor of Solana's biggest technical influence, [Leslie
Lamport](https://en.wikipedia.org/wiki/Leslie_Lamport). A lamport has a value

View File

@ -22,10 +22,13 @@ Methods
---
* [confirmTransaction](#confirmtransaction)
* [getBalance](#getbalance)
* [getAccountInfo](#getaccountinfo)
* [getLastId](#getlastid)
* [getBalance](#getbalance)
* [getClusterNodes](#getclusternodes)
* [getRecentBlockhash](#getrecentblockhash)
* [getSignatureStatus](#getsignaturestatus)
* [getSlotLeader](#getslotleader)
* [getNumBlocksSinceSignatureConfirmation](#getnumblockssincesignatureconfirmation)
* [getTransactionCount](#gettransactioncount)
* [requestAirdrop](#requestairdrop)
* [sendTransaction](#sendtransaction)
@ -34,6 +37,8 @@ Methods
* [Subscription Websocket](#subscription-websocket)
* [accountSubscribe](#accountsubscribe)
* [accountUnsubscribe](#accountunsubscribe)
* [programSubscribe](#programsubscribe)
* [programUnsubscribe](#programunsubscribe)
* [signatureSubscribe](#signaturesubscribe)
* [signatureUnsubscribe](#signatureunsubscribe)
@ -111,6 +116,30 @@ curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "id":1, "
---
### getClusterNodes
Returns information about all the nodes participating in the cluster
##### Parameters:
None
##### Results:
The result field will be an array of JSON objects, each with the following sub fields:
* `id` - Node identifier, as base-58 encoded string
* `gossip` - Gossip network address for the node
* `tpu` - TPU network address for the node
* `rpc` - JSON RPC network address for the node, or `null` if the JSON RPC service is not enabled
##### Example:
```bash
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "id":1, "method":"getClusterNodes"}' http://localhost:8899
// Result
{"jsonrpc":"2.0","result":[{"gossip":"10.239.6.48:8001","id":"9QzsJf7LPLj8GkXbYT3LFDKqsj2hHG7TA3xinJHu8epQ","rpc":"10.239.6.48:8899","tpu":"10.239.6.48:8856"}],"id":1}
```
---
### getAccountInfo
Returns all information associated with the account of provided Pubkey
@ -120,9 +149,9 @@ Returns all information associated with the account of provided Pubkey
##### Results:
The result field will be a JSON object with the following sub fields:
* `tokens`, number of tokens assigned to this account, as a signed 64-bit integer
* `lamports`, number of lamports assigned to this account, as a signed 64-bit integer
* `owner`, array of 32 bytes representing the program this account has been assigned to
* `userdata`, array of bytes representing any userdata associated with the account
* `data`, array of bytes representing any data associated with the account
* `executable`, boolean indicating if the account contains a program (and is strictly read-only)
* `loader`, array of 32 bytes representing the loader for this program (if `executable`), otherwise all
@ -132,24 +161,24 @@ The result field will be a JSON object with the following sub fields:
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "id":1, "method":"getAccountInfo", "params":["2gVkYWexTHR5Hb2aLeQN3tnngvWzisFKXDUPrgMHpdST"]}' http://localhost:8899
// Result
{"jsonrpc":"2.0","result":{"executable":false,"loader":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"owner":[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"tokens":1,"userdata":[3,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,50,48,53,48,45,48,49,45,48,49,84,48,48,58,48,48,58,48,48,90,252,10,7,28,246,140,88,177,98,82,10,227,89,81,18,30,194,101,199,16,11,73,133,20,246,62,114,39,20,113,189,32,50,0,0,0,0,0,0,0,247,15,36,102,167,83,225,42,133,127,82,34,36,224,207,130,109,230,224,188,163,33,213,13,5,117,211,251,65,159,197,51,0,0,0,0,0,0]},"id":1}
{"jsonrpc":"2.0","result":{"executable":false,"loader":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"owner":[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"lamports":1,"data":[3,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,50,48,53,48,45,48,49,45,48,49,84,48,48,58,48,48,58,48,48,90,252,10,7,28,246,140,88,177,98,82,10,227,89,81,18,30,194,101,199,16,11,73,133,20,246,62,114,39,20,113,189,32,50,0,0,0,0,0,0,0,247,15,36,102,167,83,225,42,133,127,82,34,36,224,207,130,109,230,224,188,163,33,213,13,5,117,211,251,65,159,197,51,0,0,0,0,0,0]},"id":1}
```
---
### getLastId
Returns the last entry ID from the ledger
### getRecentBlockhash
Returns a recent block hash from the ledger
##### Parameters:
None
##### Results:
* `string` - the ID of last entry, a Hash as base-58 encoded string
* `string` - a Hash as base-58 encoded string
##### Example:
```bash
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "method":"getLastId"}' http://localhost:8899
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "method":"getRecentBlockhash"}' http://localhost:8899
// Result
{"jsonrpc":"2.0","result":"GH7ome3EiwEr7tu9JuTh2dpYWBJK3z69Xm1ZE3MEE6JC","id":1}
@ -166,12 +195,10 @@ events.
* `string` - Signature of Transaction to confirm, as base-58 encoded string
##### Results:
* `string` - Transaction status:
* `Confirmed` - Transaction was successful
* `SignatureNotFound` - Unknown transaction
* `ProgramRuntimeError` - An error occurred in the program that processed this Transaction
* `AccountInUse` - Another Transaction had a write lock one of the Accounts specified in this Transaction. The Transaction may succeed if retried
* `GenericFailure` - Some other error occurred. **Note**: In the future new Transaction statuses may be added to this list. It's safe to assume that all new statuses will be more specific error conditions that previously presented as `GenericFailure`
* `null` - Unknown transaction
* `object` - Transaction status:
* `"Ok": null` - Transaction was successful
* `"Err": <ERR>` - Transaction failed with TransactionError <ERR> [TransactionError definitions](https://github.com/solana-labs/solana/blob/master/sdk/src/transaction.rs#L14)
##### Example:
```bash
@ -182,7 +209,48 @@ curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "id":1, "
{"jsonrpc":"2.0","result":"SignatureNotFound","id":1}
```
-----
### getSlotLeader
Returns the current slot leader
##### Parameters:
None
##### Results:
* `string` - Node Id as base-58 encoded string
##### Example:
```bash
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "method":"getSlotLeader"}' http://localhost:8899
// Result
{"jsonrpc":"2.0","result":"ENvAW7JScgYq6o4zKZwewtkzzJgDzuJAFxYasvmEQdpS","id":1}
```
-----
### getNumBlocksSinceSignatureConfirmation
Returns the current number of blocks since signature has been confirmed.
##### Parameters:
* `string` - Signature of Transaction to confirm, as base-58 encoded string
##### Results:
* `integer` - count, as unsigned 64-bit integer
##### Example:
```bash
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "id":1, "method":"getNumBlocksSinceSignatureConfirmation", "params":["5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW"]}' http://localhost:8899
// Result
{"jsonrpc":"2.0","result":8,"id":1}
```
---
### getTransactionCount
Returns the current Transaction count from the ledger
@ -204,11 +272,11 @@ curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "m
---
### requestAirdrop
Requests an airdrop of tokens to a Pubkey
Requests an airdrop of lamports to a Pubkey
##### Parameters:
* `string` - Pubkey of account to receive tokens, as base-58 encoded string
* `integer` - token quantity, as a signed 64-bit integer
* `string` - Pubkey of account to receive lamports, as base-58 encoded string
* `integer` - lamports, as a signed 64-bit integer
##### Results:
* `string` - Transaction Signature of airdrop, as base-58 encoded string
@ -252,7 +320,8 @@ After connect to the RPC PubSub websocket at `ws://<ADDRESS>/`:
---
### accountSubscribe
Subscribe to an account to receive notifications when the userdata for a given account public key changes
Subscribe to an account to receive notifications when the lamports or data
for a given account public key changes
##### Parameters:
* `string` - account Pubkey, as base-58 encoded string
@ -271,13 +340,13 @@ Subscribe to an account to receive notifications when the userdata for a given a
##### Notification Format:
```bash
{"jsonrpc": "2.0","method": "accountNotification", "params": {"result": {"executable":false,"loader":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"owner":[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"tokens":1,"userdata":[3,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,50,48,53,48,45,48,49,45,48,49,84,48,48,58,48,48,58,48,48,90,252,10,7,28,246,140,88,177,98,82,10,227,89,81,18,30,194,101,199,16,11,73,133,20,246,62,114,39,20,113,189,32,50,0,0,0,0,0,0,0,247,15,36,102,167,83,225,42,133,127,82,34,36,224,207,130,109,230,224,188,163,33,213,13,5,117,211,251,65,159,197,51,0,0,0,0,0,0]},"subscription":0}}
{"jsonrpc": "2.0","method": "accountNotification", "params": {"result": {"executable":false,"loader":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"owner":[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"lamports":1,"data":[3,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,50,48,53,48,45,48,49,45,48,49,84,48,48,58,48,48,58,48,48,90,252,10,7,28,246,140,88,177,98,82,10,227,89,81,18,30,194,101,199,16,11,73,133,20,246,62,114,39,20,113,189,32,50,0,0,0,0,0,0,0,247,15,36,102,167,83,225,42,133,127,82,34,36,224,207,130,109,230,224,188,163,33,213,13,5,117,211,251,65,159,197,51,0,0,0,0,0,0]},"subscription":0}}
```
---
### accountUnsubscribe
Unsubscribe from account userdata change notifications
Unsubscribe from account change notifications
##### Parameters:
* `integer` - id of account Subscription to cancel
@ -296,6 +365,54 @@ Unsubscribe from account userdata change notifications
---
### programSubscribe
Subscribe to a program to receive notifications when the lamports or data
for a given account owned by the program changes
##### Parameters:
* `string` - program_id Pubkey, as base-58 encoded string
##### Results:
* `integer` - Subscription id (needed to unsubscribe)
##### Example:
```bash
// Request
{"jsonrpc":"2.0", "id":1, "method":"programSubscribe", "params":["9gZbPtbtHrs6hEWgd6MbVY9VPFtS5Z8xKtnYwA2NynHV"]}
// Result
{"jsonrpc": "2.0","result": 0,"id": 1}
```
##### Notification Format:
* `string` - account Pubkey, as base-58 encoded string
* `object` - account info JSON object (see [getAccountInfo](#getaccountinfo) for field details)
```bash
{"jsonrpc":"2.0","method":"programNotification","params":{{"result":["8Rshv2oMkPu5E4opXTRyuyBeZBqQ4S477VG26wUTFxUM",{"executable":false,"lamports":1,"owner":[129,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"data":[1,1,1,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,50,48,49,56,45,49,50,45,50,52,84,50,51,58,53,57,58,48,48,90,235,233,39,152,15,44,117,176,41,89,100,86,45,61,2,44,251,46,212,37,35,118,163,189,247,84,27,235,178,62,55,89,0,0,0,0,50,0,0,0,0,0,0,0,235,233,39,152,15,44,117,176,41,89,100,86,45,61,2,44,251,46,212,37,35,118,163,189,247,84,27,235,178,62,45,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}],"subscription":0}}
```
---
### programUnsubscribe
Unsubscribe from program-owned account change notifications
##### Parameters:
* `integer` - id of account Subscription to cancel
##### Results:
* `bool` - unsubscribe success message
##### Example:
```bash
// Request
{"jsonrpc":"2.0", "id":1, "method":"programUnsubscribe", "params":[0]}
// Result
{"jsonrpc": "2.0","result": true,"id": 1}
```
---
### signatureSubscribe
Subscribe to a transaction signature to receive notification when the transaction is confirmed
On `signatureNotification`, the subscription is automatically cancelled
@ -323,10 +440,10 @@ On `signatureNotification`, the subscription is automatically cancelled
---
### signatureUnsubscribe
Unsubscribe from account userdata change notifications
Unsubscribe from signature confirmation notification
##### Parameters:
* `integer` - id of account subscription to cancel
* `integer` - subscription id to cancel
##### Results:
* `bool` - unsubscribe success message

View File

@ -0,0 +1,101 @@
# Leader to Leader Transition
This design describes how leaders transition production of the PoH ledger
between each other as each leader generates its own slot.
## Challenges
Current leader and the next leader are both racing to generate the final tick
for the current slot. The next leader may arrive at that slot while still
processing the current leader's entries.
The ideal scenario would be that the next leader generated its own slot right
after it was able to vote for the current leader. It is very likely that the
next leader will arrive at their PoH slot height before the current leader
finishes broadcasting the entire block.
The next leader has to make the decision of attaching its own block to the last
completed block, or wait to finalize the pending block. It is possible that the
next leader will produce a block that proposes that the current leader failed,
even though the rest of the network observes that block succeeding.
The current leader has incentives to start its slot as early as possible to
capture economic rewards. Those incentives need to be balanced by the leader's
need to attach its block to a block that has the most commitment from the rest
of the network.
## Leader timeout
While a leader is actively receiving entries for the previous slot, the leader
can delay broadcasting the start of its block in real time. The delay is
locally configurable by each leader, and can be dynamically based on the
previous leader's behavior. If the previous leader's block is confirmed by the
leader's TVU before the timeout, the PoH is reset to the start of the slot and
this leader produces its block immediately.
The downsides:
* Leader delays its own slot, potentially allowing the next leader more time to
catch up.
The upsides compared to guards:
* All the space in a block is used for entries.
* The timeout is not fixed.
* The timeout is local to the leader, and therefore can be clever. The leader's
heuristic can take into account avalanche performance.
* This design doesn't require a ledger hard fork to update.
* The previous leader can redundantly transmit the last entry in the block to
the next leader, and the next leader can speculatively decide to trust it to
generate its block without verification of the previous block.
* The leader can speculatively generate the last tick from the last received
entry.
* The leader can speculatively process transactions and guess which ones are not
going to be encoded by the previous leader. This is also a censorship attack
vector. The current leader may withhold transactions that it receives from the
clients so it can encode them into its own slot. Once processed, entries can be
replayed into PoH quickly.
## Alternative design options
### Guard tick at the end of the slot
A leader does not produce entries in its block after the *penultimate tick*,
which is the last tick before the first tick of the next slot. The network
votes on the *last tick*, so the time difference between the *penultimate tick*
and the *last tick* is the forced delay for the entire network, as well as the
next leader before a new slot can be generated. The network can produce the
*last tick* from the *penultimate tick*.
If the next leader receives the *penultimate tick* before it produces its own
*first tick*, it will reset its PoH and produce the *first tick* from the
previous leader's *penultimate tick*. The rest of the network will also reset
its PoH to produce the *last tick* as the id to vote on.
The downsides:
* Every vote, and therefore confirmation, is delayed by a fixed timeout. 1 tick,
or around 100ms.
* Average case confirmation time for a transaction would be at least 50ms worse.
* It is part of the ledger definition, so to change this behavior would require
a hard fork.
* Not all the available space is used for entries.
The upsides compared to leader timeout:
* The next leader has received all the previous entries, so it can start
processing transactions without recording them into PoH.
* The previous leader can redundantly transmit the last entry containing the
*penultimate tick* to the next leader. The next leader can speculatively
generate the *last tick* as soon as it receives the *penultimate tick*, even
before verifying it.

View File

@ -3,17 +3,102 @@
At any given moment, a cluster expects only one fullnode to produce ledger
entries. By having only one leader at a time, all validators are able to replay
identical copies of the ledger. The drawback of only one leader at a time,
however, is that a malicious leader is cabable of censoring votes and
however, is that a malicious leader is capable of censoring votes and
transactions. Since censoring cannot be distinguished from the network dropping
packets, the cluster cannot simply elect a single node to hold the leader role
indefinitely. Instead, the cluster minimizes the influence of a malcioius
indefinitely. Instead, the cluster minimizes the influence of a malicious
leader by rotating which node takes the lead.
Each validator selects the expected leader using the same algorithm, described
below. When the validator receives a new signed ledger entry, it can be certain
that entry was produced by the expected leader.
that entry was produced by the expected leader. The order of slots which each
leader is assigned a slot is called a *leader schedule*.
## Leader Schedule Generation
## Leader Schedule Rotation
A validator rejects blocks that are not signed by the *slot leader*. The list
of identities of all slot leaders is called a *leader schedule*. The leader
schedule is recomputed locally and periodically. It assigns slot leaders for a
duration of time called an _epoch_. The schedule must be computed far in advance
of the slots it assigns, such that the ledger state it uses to compute the
schedule is finalized. That duration is called the *leader schedule offset*.
Solana sets the offset to the duration of slots until the next epoch. That is,
the leader schedule for an epoch is calculated from the ledger state at the
start of the previous epoch. The offset of one epoch is fairly arbitrary and
assumed to be sufficiently long such that all validators will have finalized
their ledger state before the next schedule is generated. A cluster may choose
to shorten the offset to reduce the time between stake changes and leader
schedule updates.
While operating without partitions lasting longer than an epoch, the schedule
only needs to be generated when the root fork crosses the epoch boundary. Since
the schedule is for the next epoch, any new stakes committed to the root fork
will not be active until the next epoch. The block used for generating the
leader schedule is the first block to cross the epoch boundary.
Without a partition lasting longer than an epoch, the cluster will work as
follows:
1. A validator continuously updates its own root fork as it votes.
2. The validator updates its leader schedule each time the slot height crosses
an epoch boundary.
For example:
The epoch duration is 100 slots. The root fork is updated from fork computed at
slot height 99 to a fork computed at slot height 102. Forks with slots at height
100,101 were skipped because of failures. The new leader schedule is computed
using fork at slot height 102. It is active from slot 200 until it is updated
again.
No inconsistency can exist because every validator that is voting with the
cluster has skipped 100 and 101 when its root passes 102. All validators,
regardless of voting pattern, would be committing to a root that is either 102,
or a descendant of 102.
### Leader Schedule Rotation with Epoch Sized Partitions.
The duration of the leader schedule offset has a direct relationship to the
likelihood of a cluster having an inconsistent view of the correct leader
schedule.
Consider the following scenario:
Two partitions that are generating half of the blocks each. Neither is coming
to a definitive supermajority fork. Both will cross epoch 100 and 200 without
actually committing to a root and therefore a cluster wide commitment to a new
leader schedule.
In this unstable scenario, multiple valid leader schedules exist.
* A leader schedule is generated for every fork whose direct parent is in the
previous epoch.
* The leader schedule is valid after the start of the next epoch for descendant
forks until it is updated.
Each partition's schedule will diverge after the partition lasts more than an
epoch. For this reason, the epoch duration should be selected to be much much
larger then slot time and the expected length for a fork to be committed to
root.
After observing the cluster for a sufficient amount of time, the leader schedule
offset can be selected based on the median partition duration and its standard
deviation. For example, an offset longer then the median partition duration
plus six standard deviations would reduce the likelihood of an inconsistent
ledger schedule in the cluster to 1 in 1 million.
## Leader Schedule Generation at Genesis
The genesis block declares the first leader for the first epoch. This leader
ends up scheduled for the first two epochs because the leader schedule is also
generated at slot 0 for the next epoch. The length of the first two epochs can
be specified in the genesis block as well. The minimum length of the first
epochs must be greater than or equal to the maximum rollback depth as defined in
[fork selection](fork-selection.md).
## Leader Schedule Generation Algorithm
Leader schedule is generated using a predefined seed. The process is as follows:
@ -27,12 +112,42 @@ Leader schedule is generated using a predefined seed. The process is as follows
stake-weighted ordering.
5. This ordering becomes valid after a cluster-configured number of ticks.
## Schedule Attack Vectors
### Seed
The seed that is selected is predictable but unbiasable. There is no grinding
attack to influence its outcome. The active set, however, can be biased by a
leader by censoring validator votes. To reduce the likelihood of censorship,
the active set is sampled many slots in advance, such that votes will have been
collected by multiple leaders. If even one node is honest, the malicious
leaders will not be able to use censorship to influence the leader schedule.
attack to influence its outcome.
### Active Set
A leader can bias the active set by censoring validator votes. Two possible
ways exist for leaders to censor the active set:
* Ignore votes from validators
* Refuse to vote for blocks with votes from validators
To reduce the likelihood of censorship, the active set is calculated at the
leader schedule offset boundary over an *active set sampling duration*. The
active set sampling duration is long enough such that votes will have been
collected by multiple leaders.
### Staking
Leaders can censor new staking transactions or refuse to validate blocks with
new stakes. This attack is similar to censorship of validator votes.
### Validator operational key loss
Leaders and validators are expected to use ephemeral keys for operation, and
stake owners authorize the validators to do work with their stake via
delegation.
The cluster should be able to recover from the loss of all the ephemeral keys
used by leaders and validators, which could occur through a common software
vulnerability shared by all the nodes. Stake owners should be able to vote
directly co-sign a validator vote even though the stake is currently delegated
to a validator.
## Appending Entries

View File

@ -0,0 +1,84 @@
# Leader-to-Validator Transition
A fullnode typically operates as a validator. If, however, a staker delegates
its stake to a fullnode, it will occasionally be selected as a *slot leader*.
As a slot leader, the fullnode is responsible for producing blocks during an
assigned *slot*. A slot has a duration of some number of preconfigured *ticks*.
The duration of those ticks are estimated with a *PoH Recorder* described later
in this document.
## BankFork
BankFork tracks changes to the bank state over a specific slot. Once the final
tick has been registered the state is frozen. Any attempts to write to are
rejected.
## Validator
A validator operates on many different concurrent forks of the bank state until
it generates a PoH hash with a height within its leader slot.
## Slot Leader
A slot leader builds blocks on top of only one fork, the one it last voted on.
## PoH Recorder
Slot leaders and validators use a PoH Recorder for both estimating slot height
and for recording transactions.
### PoH Recorder when Validating
The PoH Recorder acts as a simple VDF when validating. It tells the validator
when it needs to switch to the slot leader role. Every time the validator votes
on a fork, it should use the fork's latest block id to re-seed the VDF.
Re-seeding solves two problems. First, it synchronizes its VDF to the leader's,
allowing it to more accurately determine when its leader slot begins. Second,
if the previous leader goes down, all wallclock time is accounted for in the
next leader's PoH stream. For example, if one block is missing when the leader
starts, the block it produces should have a PoH duration of two blocks. The
longer duration ensures the following leader isn't attempting to snip all the
transactions from the previous leader's slot.
### PoH Recorder when Leading
A slot leader use the PoH Recorder to record transactions, locking their
positions in time. The PoH hash must be derived from a previous leader's last
block. If it isn't, its block will fail PoH verification and be rejected by
the cluster.
The PoH Recorder also serves to inform the slot leader when its slot is over.
The leader needs to take care not to modify its bank if recording the
transaction would generate a PoH height outside its designated slot. The
leader, therefore, should not commit account changes until after it generates
the entry's PoH hash. When the PoH height falls outside its slot any
transactions in its pipeline may be dropped or forwarded to the next leader.
Forwarding is preferred, as it would minimize network congestion, allowing the
cluster to advertise higher TPS capacity.
## Fullnode Loop
The PoH Recorder manages the transition between modes. Once a ledger is
replayed, the validator can run until the recorder indicates it should be
the slot leader. As a slot leader, the node can then execute and record
transactions.
The loop is synchronized to PoH and does a synchronous start and stop of the
slot leader functionality. After stopping, the validator's TVU should find
itself in the same state as if a different leader had sent it the same block.
The following is pseudocode for the loop:
1. Query the LeaderScheduler for the next assigned slot.
2. Run the TVU over all the forks.
1. TVU will send votes to what it believes is the "best" fork.
2. After each vote, restart the PoH Recorder to run until the next assigned
slot.
3. When time to be a slot leader, start the TPU. Point it to the last fork the
TVU voted on.
4. Produce entries until the end of the slot.
1. For the duration of the slot, the TVU must not vote on other forks.
2. After the slot ends, the TPU freezes its BankFork. After freezing,
the TVU may resume voting.
5. Goto 1.

View File

@ -0,0 +1,39 @@
# Ledger Replication
Replication behavior yet to be implemented.
### Validator behavior
3. Every NUM\_KEY\_ROTATION\_TICKS it also validates samples received from
replicators. It signs the PoH hash at that point and uses the following
algorithm with the signature as the input:
- The low 5 bits of the first byte of the signature creates an index into
another starting byte of the signature.
- The validator then looks at the set of storage proofs where the byte of
the proof's sha state vector starting from the low byte matches exactly
with the chosen byte(s) of the signature.
- If the set of proofs is larger than the validator can handle, then it
increases to matching 2 bytes in the signature.
- Validator continues to increase the number of matching bytes until a
workable set is found.
- It then creates a mask of valid proofs and fake proofs and sends it to
the leader. This is a storage proof confirmation transaction.
5. After a lockout period of NUM\_SECONDS\_STORAGE\_LOCKOUT seconds, the
validator then submits a storage proof claim transaction which then causes the
distribution of the storage reward if no challenges were seen for the proof to
the validators and replicators party to the proofs.
### Replicator behavior
9. The replicator then generates another set of offsets which it submits a fake
proof with an incorrect sha state. It can be proven to be fake by providing the
seed for the hash result.
- A fake proof should consist of a replicator hash of a signature of a PoH
value. That way when the replicator reveals the fake proof, it can be
verified on chain.
10. The replicator monitors the ledger, if it sees a fake proof integrated, it
creates a challenge transaction and submits it to the current leader. The
transacation proves the validator incorrectly validated a fake storage proof.
The replicator is rewarded and the validator's staking balance is slashed or
frozen.

View File

@ -15,55 +15,6 @@ proof and it also requires the validator to have the entirety of the encrypted
data present for verification of every proof of every identity. So the space
required to validate is `number_of_proofs * data_size`
## Terminology
#### replicator
Storage mining client, stores some part of the ledger enumerated in blocks and
submits storage proofs to the chain. Not a full-node.
#### ledger segment
Portion of the ledger which is downloaded by the replicator where storage proof
data is derived.
#### CBC block
Smallest encrypted chunk of ledger, an encrypted ledger segment would be made of
many CBC blocks. `ledger_segment_size / cbc_block_size` to be exact.
#### storage proof
A set of sha hash state which is constructed by sampling the encrypted version
of the stored ledger segment at certain offsets.
#### fake storage proof
A proof which has the same format as a storage proof, but the sha state is
actually from hashing a known ledger value which the storage client can reveal
and is also easily verifiable by the network on-chain.
#### storage proof confirmation
A transaction by a validator which indicates the set of real and fake proofs
submitted by a storage miner. The transaction would contain a list of proof
hash values and a bit which says if this hash is valid or fake.
#### storage proof challenge
A transaction from a replicator that verifiably proves that a validator
confirmed a fake proof.
#### storage proof claim
A transaction from a validator which is after the timeout period given from the
storage proof confirmation and which no successful challenges have been
observed which rewards the parties of the storage proofs and confirmations.
#### storage validation capacity
The number of keys and samples that a validator can verify each storage epoch.
## Optimization with PoH
Our improvement on this approach is to randomly sample the encrypted segments
@ -72,7 +23,7 @@ PoH ledger. Thus the segments stay in the exact same order for every PoRep and
verification can stream the data and verify all the proofs in a single batch.
This way we can verify multiple proofs concurrently, each one on its own CUDA
core. The total space required for verification is `1_ledger_segment +
2_cbc_blocks * number_of_identities` with core count of equal to
2_cbc_blocks * number_of_identities` with core count equal to
`number_of_identities`. We use a 64-byte chacha CBC block size.
## Network
@ -123,25 +74,8 @@ transaction which tells the network how many proofs it can process in a given
period defined by NUM\_KEY\_ROTATION\_TICKS.
2. Every NUM\_KEY\_ROTATION\_TICKS the validator stores the PoH value at that
height.
3. Every NUM\_KEY\_ROTATION\_TICKS it also validates samples received from
replicators. It signs the PoH hash at that point and uses the following
algorithm with the signature as the input:
- The low 5 bits of the first byte of the signature creates an index into
another starting byte of the signature.
- The validator then looks at the set of storage proofs where the byte of
the proof's sha state vector starting from the low byte matches exactly
with the chosen byte(s) of the signature.
- If the set of proofs is larger than the validator can handle, then it
increases to matching 2 bytes in the signature.
- Validator continues to increase the number of matching bytes until a
workable set is found.
- It then creates a mask of valid proofs and fake proofs and sends it to
the leader. This is a storage proof confirmation transaction.
3. Validator generates a storage proof confirmation transaction.
4. The storage proof confirmation transaction is integrated into the ledger.
5. After a lockout period of NUM\_SECONDS\_STORAGE\_LOCKOUT seconds, the
validator then submits a storage proof claim transaction which then causes the
distribution of the storage reward if no challenges were seen for the proof to
the validators and replicators party to the proofs.
6. Validator responds to RPC interfaces for what the last storage epoch PoH
value is and its entry\_height.
@ -152,7 +86,7 @@ ledger data, they have to rely on other full nodes (validators) for
information. Any given validator may or may not be malicious and give incorrect
information, although there are not any obvious attack vectors that this could
accomplish besides having the replicator do extra wasted work. For many of the
operations there are number of options depending on how paranoid a replicator
operations there are a number of options depending on how paranoid a replicator
is:
- (a) replicator can ask a validator
- (b) replicator can ask multiple validators
@ -179,17 +113,7 @@ segment.
8. The replicator sends a PoRep proof transaction which contains its sha state
at the end of the sampling operation, its seed and the samples it used to the
current leader and it is put onto the ledger.
9. The replicator then generates another set of offsets which it submits a fake
proof with an incorrect sha state. It can be proven to be fake by providing the
seed for the hash result.
- A fake proof should consist of a replicator hash of a signature of a PoH
value. That way when the replicator reveals the fake proof, it can be
verified on chain.
10. The replicator monitors the ledger, if it sees a fake proof integrated, it
creates a challenge transaction and submits it to the current leader. The
transacation proves the validator incorrectly validated a fake storage proof.
The replicator is rewarded and the validator's staking balance is slashed or
frozen.
### Finding who has a given block of ledger

View File

@ -0,0 +1,63 @@
# Managing Forks in the Ledger
The ledger is permitted to fork at slot boundaries. The resulting data
structure forms a tree called a *blocktree*. When the fullnode interprets the
blocktree, it must maintain state for each fork in the chain. We call each
instance an *active fork*. It is the responsibility of a fullnode to weigh
those forks, such that it may eventually select a fork.
A fullnode selects a fork by submiting a vote to a slot leader on that fork.
The vote commits the fullnode for a duration of time called a *lockout period*.
The fullnode is not permitted to vote on a different fork until that lockout
period expires. Each subsequent vote on the same fork doubles the length of the
lockout period. After some cluster-configured number of votes (currently 32),
the length of the lockout period reaches what's called *max lockout*. Until the
max lockout is reached, the fullnode has the option to wait until the lockout
period is over and then vote on another fork. When it votes on another fork, it
performs a operation called *rollback*, whereby the state rolls back in time to
a shared checkpoint and then jumps forward to the tip of the fork that it just
voted on. The maximum distance that a fork may roll back is called the
*rollback depth*. Rollback depth is the number of votes required to achieve
max lockout. Whenever a fullnode votes, any checkpoints beyond the rollback
depth become unreachable. That is, there is no scenario in which the fullnode
will need to roll back beyond rollback depth. It therefore may safely *prune*
unreachable forks and *squash* all checkpoints beyond rollback depth into the
root checkpoint.
## Active Forks
An active fork is as a sequence of checkpoints that has a length at least one
longer than the rollback depth. The shortest fork will have a length exactly
one longer than the rollback depth. For example:
<img alt="Forks" src="img/forks.svg" class="center"/>
The following sequences are *active forks*:
* {4, 2, 1}
* {5, 2, 1}
* {6, 3, 1}
* {7, 3, 1}
## Pruning and Squashing
A fullnode may vote on any checkpoint in the tree. In the diagram above,
that's every node except the leaves of the tree. After voting, the fullnode
prunes nodes that fork from a distance farther than the rollback depth and then
takes the opportunity to minimize its memory usage by squashing any nodes it
can into the root.
Starting from the example above, wth a rollback depth of 2, consider a vote on
5 versus a vote on 6. First, a vote on 5:
<img alt="Forks after pruning" src="img/forks-pruned.svg" class="center"/>
The new root is 2, and any active forks that are not descendants from 2 are
pruned.
Alternatively, a vote on 6:
<img alt="Forks" src="img/forks-pruned2.svg" class="center"/>
The tree remains with a root of 1, since the active fork starting at 6 is only
2 checkpoints from the root.

View File

@ -0,0 +1,212 @@
# Stake Delegation and Reward
This design proposal focuses on the software architecture for the on-chain
voting and staking programs. Incentives for staking is covered in [staking
rewards](staking-rewards.md).
The current architecture requires a vote for each delegated stake from the
validator, and therefore does not scale to allow replicator clients to
automatically delegate their rewards.
The design proposes a new set of programs for voting and stake delegation, The
proposed programs allow many stake accounts to passively earn rewards with a
single validator vote without permission or active involvement from the
validator.
## Current Design Problems
In the current design each staker creates their own VoteState, and assigns a
**delegate** in the VoteState that can submit votes. Since the validator has to
actively vote for each stake delegated to it, validators can censor stakes by
not voting for them.
The number of votes is equal to the number of stakers, and not the number of
validators. Replicator clients are expected to delegate their replication
rewards as they are earned, and therefore the number of stakes is expected to be
large compared to the number of validators in a long running cluster.
## Proposed changes to the current design.
The general idea is that instead of the staker, the validator will own the
VoteState program. In this proposal the VoteState program is there to track
validator votes, count validator generated credits and to provide any
additional validator specific state. The VoteState program is not aware of any
stakes delegated to it, and has no staking weight.
The rewards generated are proportional to the amount of lamports staked. In
this proposal stake state is stored as part of the StakeState program. This
program is owned by the staker only. Lamports stored in this program are the
stake. Unlike the current design, this program contains a new field to indicate
which VoteState program the stake is delegated to.
### VoteState
VoteState is the current state of all the votes the **delegate** has submitted
to the bank. VoteState contains the following state information:
* votes - The submitted votes data structure.
* credits - The total number of rewards this vote program has generated over its
lifetime.
* root\_slot - The last slot to reach the full lockout commitment necessary for
rewards.
* commission - The commission taken by this VoteState for any rewards claimed by
staker's StakeState accounts. This is the percentage ceiling of the reward.
* Account::lamports - The accumulated lamports from the commission. These do not
count as stakes.
* `authorized_vote_signer` - Only this identity is authorized to submit votes, and
this field can only modified by this entity
### VoteInstruction::Initialize
* `account[0]` - RW - The VoteState
`VoteState::authorized_vote_signer` is initialized to `account[0]`
other VoteState members defaulted
### VoteInstruction::AuthorizeVoteSigner(Pubkey)
* `account[0]` - RW - The VoteState
`VoteState::authorized_vote_signer` is set to to `Pubkey`, instruction must by
signed by Pubkey
### StakeState
A StakeState takes one of two forms, StakeState::Delegate and StakeState::MiningPool.
### StakeState::Delegate
StakeState is the current delegation preference of the **staker**. StakeState
contains the following state information:
* Account::lamports - The staked lamports.
* `voter_id` - The pubkey of the VoteState instance the lamports are
delegated to.
* `credits_observed` - The total credits claimed over the lifetime of the
program.
### StakeState::MiningPool
There are two approaches to the mining pool. The bank could allow the
StakeState program to bypass the token balance check, or a program representing
the mining pool could run on the network. To avoid a single network wide lock,
the pool can be split into several mining pools. This design focuses on using a
StakeState::MiningPool as the cluster wide mining pools.
* 256 StakeState::MiningPool are initialized, each with 1/256 number of mining pool
tokens stored as `Account::lamports`.
The stakes and the MiningPool are accounts that are owned by the same `Stake`
program.
### StakeInstruction::Initialize
* `account[0]` - RW - The StakeState::Delegate instance.
`StakeState::Delegate::credits_observed` is initialized to `VoteState::credits`.
`StakeState::Delegate::voter_id` is initialized to `account[1]`
* `account[1]` - R - The VoteState instance.
### StakeInstruction::RedeemVoteCredits
The VoteState program and the StakeState programs maintain a lifetime counter
of total rewards generated and claimed. Therefore an explicit `Clear`
instruction is not necessary. When claiming rewards, the total lamports
deposited into the StakeState and as validator commission is proportional to
`VoteState::credits - StakeState::credits_observed`.
* `account[0]` - RW - The StakeState::MiningPool instance that will fulfill the
reward.
* `account[1]` - RW - The StakeState::Delegate instance that is redeeming votes
credits.
* `account[2]` - R - The VoteState instance, must be the same as
`StakeState::voter_id`
Reward is payed out for the difference between `VoteState::credits` to
`StakeState::Delgate.credits_observed`, and `credits_observed` is updated to
`VoteState::credits`. The commission is deposited into the `VoteState` token
balance, and the reward is deposited to the `StakeState::Delegate` token balance. The
reward and the commission is weighted by the `StakeState::lamports` divided by total lamports staked.
The Staker or the owner of the Stake program sends a transaction with this
instruction to claim the reward.
Any random MiningPool can be used to redeem the credits.
```rust,ignore
let credits_to_claim = vote_state.credits - stake_state.credits_observed;
stake_state.credits_observed = vote_state.credits;
```
`credits_to_claim` is used to compute the reward and commission, and
`StakeState::Delegate::credits_observed` is updated to the latest
`VoteState::credits` value.
### Collecting network fees into the MiningPool
At the end of the block, before the bank is frozen, but after it processed all
the transactions for the block, a virtual instruction is executed to collect
the transaction fees.
* A portion of the fees are deposited into the leader's account.
* A portion of the fees are deposited into the smallest StakeState::MiningPool
account.
### Benefits
* Single vote for all the stakers.
* Clearing of the credit variable is not necessary for claiming rewards.
* Each delegated stake can claim its rewards independently.
* Commission for the work is deposited when a reward is claimed by the delegated
stake.
This proposal would benefit from the `read-only` accounts proposal to allow for
many rewards to be claimed concurrently.
## Passive Delegation
Any number of instances of StakeState::Delegate programs can delegate to a single
VoteState program without an interactive action from the identity controlling
the VoteState program or submitting votes to the program.
The total stake allocated to a VoteState program can be calculated by the sum of
all the StakeState programs that have the VoteState pubkey as the
`StakeState::Delegate::voter_id`.
## Example Callflow
<img alt="Passive Staking Callflow" src="img/passive-staking-callflow.svg" class="center"/>
## Future work
Validators may want to split the stake delegated to them amongst many validator
nodes since stake is used as weight in the network control and data planes. One
way to implement this would be for the StakeState to delegate to a pool of
validators instead of a single one.
Instead of a single `vote_id` and `credits_observed` entry in the StakeState
program, the program can be initialized with a vector of tuples.
```rust,ignore
Voter {
voter_id: Pubkey,
credits_observed: u64,
weight: u8,
}
```
* voters: Vec<Voter> - Array of VoteState accounts that are voting rewards with
this stake.
A StakeState program would claim a fraction of the reward from each voter in
the `voters` array, and each voter would be delegated a fraction of the stake.

View File

@ -0,0 +1,153 @@
# Persistent Account Storage
The set of Accounts represent the current computed state of all the transactions
that have been processed by a fullnode. Each fullnode needs to maintain this
entire set. Each block that is proposed by the network represents a change to
this set, and since each block is a potential rollback point the changes need to
be reversible.
Persistent storage like NVMEs are 20 to 40 times cheaper than DDR. The problem
with persistent storage is that write and read performance is much slower than
DDR and care must be taken in how data is read or written to. Both reads and
writes can be split between multiple storage drives and accessed in parallel.
This design proposes a data structure that allows for concurrent reads and
concurrent writes of storage. Writes are optimized by using an AppendVec data
structure, which allows a single writer to append while allowing access to many
concurrent readers. The accounts index maintains a pointer to a spot where the
account was appended to every fork, thus removing the need for explicit
checkpointing of state.
# AppendVec
AppendVec is a data structure that allows for random reads concurrent with a
single append-only writer. Growing or resizing the capacity of the AppendVec
requires exclusive access. This is implemented with an atomic `offset`, which
is updated at the end of a completed append.
The underlying memory for an AppendVec is a memory-mapped file. Memory-mapped
files allow for fast random access and paging is handled by the OS.
# Account Index
The account index is designed to support a single index for all the currently
forked Accounts.
```rust,ignore
type AppendVecId = usize;
type Fork = u64;
struct AccountMap(Hashmap<Fork, (AppendVecId, u64)>);
type AccountIndex = HashMap<Pubkey, AccountMap>;
```
The index is a map of account Pubkeys to a map of Forks and the location of the
Account data in an AppendVec. To get the version of an account for a specific Fork:
```rust,ignore
/// Load the account for the pubkey.
/// This function will load the account from the specified fork, falling back to the fork's parents
/// * fork - a virtual Accounts instance, keyed by Fork. Accounts keep track of their parents with Forks,
/// the persistent store
/// * pubkey - The Account's public key.
pub fn load_slow(&self, id: Fork, pubkey: &Pubkey) -> Option<&Account>
```
The read is satisfied by pointing to a memory-mapped location in the
`AppendVecId` at the stored offset. A reference can be returned without a copy.
## Root Forks
The [fork selection algorithm](fork-selection.md) eventually selects a fork as a
root fork and the fork is squashed. A squashed/root fork cannot be rolled back.
When a fork is squashed, all accounts in its parents not already present in the
fork are pulled up into the fork by updating the indexes. Accounts with zero
balance in the squashed fork are removed from fork by updating the indexes.
An account can be *garbage-collected* when squashing makes it unreachable.
Three possible options exist:
* Maintain a HashSet<u64> of root forks. One is expected to be created every
second. The entire tree can be garbage-collected later. Alternatively, if
every fork keeps a reference count of accounts, garbage collection could occur
any time an index location is updated.
* Remove any pruned forks from the index. Any remaining forks lower in number
than the root are can be considered root.
* Scan the index, migrate any old roots into the new one. Any remaining forks
lower than the new root can be deleted later.
# Append-only Writes
All the updates to Accounts occur as append-only updates. For every account
update, a new version is stored in the AppendVec.
It is possible to optimize updates within a single fork by returning a mutable
reference to an already stored account in a fork. The Bank already tracks
concurrent access of accounts and guarantees that a write to a specific account
fork will not be concurrent with a read to an account at that fork. To support
this operation, AppendVec should implement this function:
```rust,ignore
fn get_mut(&self, index: u64) -> &mut T;
```
This API allows for concurrent mutable access to a memory region at `index`. It
relies on the Bank to guarantee exclusive access to that index.
# Garbage collection
As accounts get updated, they move to the end of the AppendVec. Once capacity
has run out, a new AppendVec can be created and updates can be stored there.
Eventually references to an older AppendVec will disappear because all the
accounts have been updated, and the old AppendVec can be deleted.
To speed up this process, it's possible to move Accounts that have not been
recently updated to the front of a new AppendVec. This form of garbage
collection can be done without requiring exclusive locks to any of the data
structures except for the index update.
The initial implementation for garbage collection is that once all the accounts in
an AppendVec become stale versions, it gets reused. The accounts are not updated
or moved around once appended.
# Index Recovery
Each bank thread has exclusive access to the accounts during append, since the
accounts locks cannot be released until the data is committed. But there is no
explicit order of writes between the separate AppendVec files. To create an
ordering, the index maintains an atomic write version counter. Each append to
the AppendVec records the index write version number for that append in the
entry for the Account in the AppendVec.
To recover the index, all the AppendVec files can be read in any order, and the
latest write version for every fork should be stored in the index.
# Snapshots
To snapshot, the underlying memory-mapped files in the AppendVec need to be
flushed to disk. The index can be written out to disk as well.
# Performance
* Append-only writes are fast. SSDs and NVMEs, as well as all the OS level
kernel data structures, allow for appends to run as fast as PCI or NVMe bandwidth
will allow (2,700 MB/s).
* Each replay and banking thread writes concurrently to its own AppendVec.
* Each AppendVec could potentially be hosted on a separate NVMe.
* Each replay and banking thread has concurrent read access to all the
AppendVecs without blocking writes.
* Index requires an exclusive write lock for writes. Single-thread performance
for HashMap updates is on the order of 10m per second.
* Banking and Replay stages should use 32 threads per NVMe. NVMes have
optimal performance with 32 concurrent readers or writers.

View File

@ -3,8 +3,8 @@
A client *app* interacts with a Solana cluster by sending it *transactions*
with one or more *instructions*. The Solana *runtime* passes those instructions
to user-contributed *programs*. An instruction might, for example, tell a
program to move *tokens* from one *account* to another or create an interactive
contract that governs how tokens are moved. Instructions are executed
program to move *lamports* from one *account* to another or create an interactive
contract that governs how lamports are moved. Instructions are executed
atomically. If any instruction is invalid, any changes made within the
transaction are discarded.
@ -21,9 +21,7 @@ used to reference the program in subsequent transactions.
A program may be written in any programming language that can target the
Berkley Packet Filter (BPF) safe execution environment. The Solana SDK offers
the best support for C programs, which is compiled to BPF using the [LLVM
compiler infrastructure](https://llvm.org). Alternatively, a client might
choose to bypass LLVM and use Python, Lua or C++ to generate BPF directly via
the [BPF Compiler Collection](https://github.com/iovisor/bcc) (BCC).
compiler infrastructure](https://llvm.org).
## Storing State between Transactions

View File

@ -0,0 +1,124 @@
# Reliable Vote Transmission
Validator votes are messages that have a critical function for consensus and
continuous operation of the network. Therefore it is critical that they are
reliably delivered and encoded into the ledger.
## Challenges
1. Leader rotation is triggered by PoH, which is clock with high drift. So many
nodes are likely to have an incorrect view if the next leader is active in
realtime or not.
2. The next leader may be easily be flooded. Thus a DDOS would not only prevent
delivery of regular transactions, but also consensus messages.
3. UDP is unreliable, and our asynchronous protocol requires any message that is
transmitted to be retransmitted until it is observed in the ledger.
Retransmittion could potentially cause an unintentional *thundering herd*
against the leader with a large number of validators. Worst case flood would be
`(num_nodes * num_retransmits)`.
4. Tracking if the vote has been transmitted or not via the ledger does not
guarantee it will appear in a confirmed block. The current observed block may
be unrolled. Validators would need to maintain state for each vote and fork.
## Design
1. Send votes as a push message through gossip. This ensures delivery of the
vote to all the next leaders, not just the next future one.
2. Leaders will read the Crds table for new votes and encode any new received
votes into the blocks they propose. This allows for validator votes to be
included in rollback forks by all the future leaders.
3. Validators that receive votes in the ledger will add them to their local crds
table, not as a push request, but simply add them to the table. This shortcuts
the push message protocol, so the validation messages do not need to be
retransmitted twice around the network.
4. CrdsValue for vote should look like this ``` Votes(Vec<Transaction>) ```
Each vote transaction should maintain a `wallclock` in its data. The merge
strategy for Votes will keep the last N set of votes as configured by the local
client. For push/pull the vector is traversed recursively and each Transaction
is treated as an individual CrdsValue with its own local wallclock and
signature.
Gossip is designed for efficient propagation of state. Messages that are sent
through gossip-push are batched and propagated with a minimum spanning tree to
the rest of the network. Any partial failures in the tree are actively repaired
with the gossip-pull protocol while minimizing the amount of data transfered
between any nodes.
## How this design solves the Challenges
1. Because there is no easy way for validators to be in sync with leaders on the
leader's "active" state, gossip allows for eventual delivery regardless of that
state.
2. Gossip will deliver the messages to all the subsequent leaders, so if the
current leader is flooded the next leader would have already received these
votes and is able to encode them.
3. Gossip minimizes the number of requests through the network by maintaining an
efficient spanning tree, and using bloom filters to repair state. So retransmit
back-off is not necessary and messages are batched.
4. Leaders that read the crds table for votes will encode all the new valid
votes that appear in the table. Even if this leader's block is unrolled, the
next leader will try to add the same votes without any additional work done by
the validator. Thus ensuring not only eventual delivery, but eventual encoding
into the ledger.
## Performance
1. Worst case propagation time to the next leader is Log(N) hops with a base
depending on the fanout. With our current default fanout of 6, it is about 6
hops to 20k nodes.
2. The leader should receive 20k validation votes aggregated by gossip-push into
64kb blobs. Which would reduce the number of packets for 20k network to 80
blobs.
3. Each validators votes is replicated across the entire network. To maintain a
queue of 5 previous votes the Crds table would grow by 25 megabytes. `(20,000
nodes * 256 bytes * 5)`.
## Two step implementation rollout
Initially the network can perform reliably with just 1 vote transmitted and
maintained through the network with the current Vote implementation. For small
networks a fanout of 6 is sufficient. With small network the memory and push
overhead is minor.
### Sub 1k validator network
1. Crds just maintains the validators latest vote.
2. Votes are pushed and retransmitted regardless if they are appearing in the
ledger.
3. Fanout of 6.
* Worst case 256kb memory overhead per node.
* Worst case 4 hops to propagate to every node.
* Leader should receive the entire validator vote set in 4 push message blobs.
### Sub 20k network
Everything above plus the following:
1. CRDS table maintains a vector of 5 latest validator votes.
2. Votes encode a wallclock. CrdsValue::Votes is a type that recurses into the
transaction vector for all the gossip protocols.
3. Increase fanout to 20.
* Worst case 25mb memory overhead per node.
* Sub 4 hops worst case to deliver to the entire network.
* 80 blobs received by the leader for all the validator messages.

View File

@ -6,7 +6,7 @@ separating program code from the state it operates on, the runtime is able to
choreograph concurrent access. Transactions accessing only credit-only
accounts are executed in parallel whereas transactions accessing writable
accounts are serialized. The runtime interacts with the program through an
entrypoint with a well-defined interface. The userdata stored in an account is
entrypoint with a well-defined interface. The data stored in an account is
an opaque type, an array of bytes. The program has full control over its
contents.
@ -18,7 +18,7 @@ transaction fails to commit.
### Account Structure
Accounts maintain a token balance and program-specific memory.
Accounts maintain a lamport balance and program-specific memory.
# Transaction Engine
@ -27,58 +27,90 @@ entrypoint.
## Execution
Transactions are batched and processed in a pipeline
Transactions are batched and processed in a pipeline. The TPU and TVU follow a
slightly different path. The TPU runtime ensures that PoH record occurs before
memory is committed.
The TVU runtime ensures that PoH verification occurs before the runtime
processes any transactions.
<img alt="Runtime pipeline" src="img/runtime.svg" class="center"/>
At the *execute* stage, the loaded pages have no data dependencies, so all the
At the *execute* stage, the loaded accounts have no data dependencies, so all the
programs can be executed in parallel.
The runtime enforces the following rules:
1. Only the *owner* program may modify the contents of an account. This means
that upon assignment userdata vector is guaranteed to be zero.
that upon assignment data vector is guaranteed to be zero.
2. Total balances on all the accounts is equal before and after execution of a
transaction.
transaction.
3. After the transaction is executed, balances of credit-only accounts must be
greater than or equal to the balances before the transaction.
greater than or equal to the balances before the transaction.
4. All instructions in the transaction executed atomically. If one fails, all
account modifications are discarded.
account modifications are discarded.
Execution of the program involves mapping the program's public key to an
entrypoint which takes a pointer to the transaction, and an array of loaded
pages.
accounts.
## SystemProgram Interface
The interface is best described by the `Instruction::userdata` that the user
The interface is best described by the `Instruction::data` that the user
encodes.
* `CreateAccount` - This allows the user to create and assign an account to a
Program.
* `Assign` - allows the user to assign an existing account to a program.
* `Move` - moves tokens between account's that are associated with
* `Spawn` - spawn a new program from an account
* `CreateAccount` - This allows the user to create an account with an allocated
data array and assign it to a Program.
* `Assign` - Allows the user to assign an existing account to a program.
* `Move` - Moves lamports between accounts.
## Program State Security
For blockchain to function correctly, the program code must be resilient to user
inputs. That is why in this design the program specific code is the only code
that can change the state of the data byte array in the Accounts that are
assigned to it. It is also the reason why `Assign` or `CreateAccount` must zero
out the data. Otherwise there would be no possible way for the program to
distinguish the recently assigned account data from a natively generated
state transition without some additional metadata from the runtime to indicate
that this memory is assigned instead of natively generated.
To pass messages between programs, the receiving program must accept the message
and copy the state over. But in practice a copy isn't needed and is
undesirable. The receiving program can read the state belonging to other
Accounts without copying it, and during the read it has a guarantee of the
sender program's state.
## Notes
1. There is no dynamic memory allocation. Client's need to use `CreateAccount`
* There is no dynamic memory allocation. Client's need to use `CreateAccount`
instructions to create memory before passing it to another program. This
instruction can be composed into a single transaction with the call to the
program itself.
2. Runtime guarantees that when memory is assigned to the program it is zero
initialized.
3. Runtime guarantees that a program's code is the only thing that can modify
memory that its assigned to
4. Runtime guarantees that the program can only spend tokens that are in
accounts that are assigned to it
5. Runtime guarantees the balances belonging to accounts are balanced before
and after the transaction
6. Runtime guarantees that multiple instructions all executed successfully when
a transaction is committed.
* `CreateAccount` and `Assign` guarantee that when account is assigned to the
program, the Account's data is zero initialized.
* Once assigned to program an Account cannot be reassigned.
* Runtime guarantees that a program's code is the only code that can modify
Account data that the Account is assigned to.
* Runtime guarantees that the program can only spend lamports that are in
accounts that are assigned to it.
* Runtime guarantees the balances belonging to accounts are balanced before
and after the transaction.
* Runtime guarantees that instructions all executed successfully when a
transaction is committed.
# Future Work
* [Continuations and Signals for long running
Transactions](https://github.com/solana-labs/solana/issues/1485)

View File

@ -0,0 +1,68 @@
# Stake Delegation and Rewards
Stakers are rewarded for helping validate the ledger. They do it by delegating
their stake to fullnodes. Those fullnodes do the legwork and send votes to the
stakers' staking accounts. The rest of the cluster uses those stake-weighted
votes to select a block when forks arise. Both the fullnode and staker need
some economic incentive to play their part. The fullnode needs to be
compensated for its hardware and the staker needs to be compensated for risking
getting its stake slashed. The economics are covered in [staking
rewards](staking-rewards.md). This chapter, on the other hand, describes the
underlying mechanics of its implementation.
## Vote and Rewards accounts
The rewards process is split into two on-chain programs. The Vote program
solves the problem of making stakes slashable. The Rewards account acts as
custodian of the rewards pool. It is responsible for paying out each staker
once the staker proves to the Rewards program that it participated in
validating the ledger.
The Vote account contains the following state information:
* votes - The submitted votes.
* `delegate_id` - An identity that may operate with the weight of this
account's stake. It is typically the identity of a fullnode, but may be any
identity involved in stake-weighted computations.
* `authorized_voter_id` - Only this identity is authorized to submit votes.
* `credits` - The amount of unclaimed rewards.
* `root_slot` - The last slot to reach the full lockout commitment necessary
for rewards.
The Rewards program is stateless and pays out reward when a staker submits its
Vote account to the program. Claiming a reward requires a transaction that
includes the following instructions:
1. `RewardsInstruction::RedeemVoteCredits`
2. `VoteInstruction::ClearCredits`
The Rewards program transfers lamports from the Rewards account to the Vote
account's public key. The Rewards program also ensures that the `ClearCredits`
instruction follows the `RedeemVoteCredits` instruction, such that a staker may
not claim rewards for the same work more than once.
### Delegating Stake
`VoteInstruction::DelegateStake` allows the staker to choose a fullnode to
validate the ledger on its behalf. By being a delegate, the fullnode is
entitled to collect transaction fees when its is leader. The larger the stake,
the more often the fullnode will be able to collect those fees.
### Authorizing a Vote Signer
`VoteInstruction::AuthorizeVoter` allows a staker to choose a signing service
for its votes. That service is responsible for ensuring the vote won't cause
the staker to be slashed.
## Limitations
Many stakers may delegate their stakes to the same fullnode. The fullnode must
send a separate vote to each staking account. If there are far more stakers
than fullnodes, that's a lot of network traffic. An alternative design might
have fullnodes submit each vote to just one account and then have each staker
submit that account along with their own to collect its reward.

View File

@ -22,8 +22,7 @@ specific attributes to be modified as is allowed by Solana's Proof of History
### General Overview
Solana's ledger validation design is based on a rotating, stake-weighted
randomly selected leader broadcasting transactions in a PoH data
Solana's ledger validation design is based on a rotating, stake-weighted selected leader broadcasting transactions in a PoH data
structure to validating nodes. These nodes, upon receiving the leader's
broadcast, have the opportunity to vote on the current state and PoH height by
signing a transaction into the PoH stream.
@ -50,43 +49,12 @@ specific parameters will be necessary:
Solana's trustless sense of time and ordering provided by its PoH data
structure, along with its
[avalanche](https://www.youtube.com/watch?v=qt_gDRXHrHQ&t=1s) data broadcast
and transmission design, should provide subsecond confirmation times that scale
and transmission design, should provide sub-second transaction confirmation times that scale
with the log of the number of nodes in the cluster. This means we shouldn't
have to restrict the number of validating nodes with a prohibitive 'minimum
deposits' and expect nodes to be able to become validators with nominal amounts
of SOL staked. This should also render validation pools, a proposed solution
for economic censorship imposed by minimum staking amounts currently described
in Casper, unnecessary and remove the concern for needing to put slashable
stake at risk while relying on others to play by the rules.
of SOL staked. At the same time, Solana's focus on high-throughput should create incentive for validation clients to provide high-performant and reliable hardware. Combined with potential a minimum network speed threshold to join as a validation-client, we expect a healthy validation delegation market to emerge. To this end, Solana's testnet will lead into a "Tour de SOL" validation-client competition, focusing on throughput and uptime to rank and reward testnet validators.
### Stake-weighted Rewards
Rewards are expected to be paid out to active validators as a function of
validator activity and as a proportion of the percentage of SOL they have at
stake out of the entirety of the staking pool.
We expect to define a baseline annual validator payout/inflation rate based on
the total SOL deposited. E.g. 10% annual interest on SOL deposited with X total
SOL deposited as slashable on the cluster. This is the same design as currently
proposed in Casper FFG which has additionally specifies how inflation rates
adjust as a function of total ETH deposited. Specifically, Casper validator
returns are proportional to the inverse square root of the total deposits and
initial annual rates are estimated as:
| Deposit Size | Annual Validator Interest |
|-------------:|--------------------------:|
| 2.5M ETH | 10.12% |
| 10M ETH | 5.00% |
| 20M ETH | 3.52% |
| 40M ETH | 2.48% |
This has the nice property of potentially incentivizing participation around a
target deposit size. Incentivisation of specific participation rates more
directly (rather than deposit size) may something also worth exploring.
The specifics of the Solana validator reward scheme are to be worked out in
parallel with a design for transaction fee assignment as well as our storage
mining reward scheme.
### Slashing rules
@ -149,8 +117,8 @@ This is an area currently under exploration
### Penalties
As previously discussed, annual validator reward rates are to be specified as a
function of total amount staked. The cluster rewards validators who are online
As discussed in the [Economic Design](ed_overview.md) section, annual validator interest rates are to be specified as a
function of total percentage of circulating supply that has been staked. The cluster rewards validators who are online
and actively participating in the validation process throughout the entirety of
their *validation period*. For validators that go offline/fail to validate
transactions during this period, their annual reward is effectively reduced.

View File

@ -54,9 +54,9 @@ function](https://eprint.iacr.org/2018/601.pdf) or *VDF*.
A desirable property of a VDF is that verification time is very fast. Solana's
approach to verifying its delay function is proportional to the time it took to
create it. Split over a 4000 core GPU, it is sufficiently fast for Solana's
needs, but if you asked the authors the paper cited above, they might tell you
needs, but if you asked the authors of the paper cited above, they might tell you
([and have](https://github.com/solana-labs/solana/issues/388)) that Solana's
approach is algorithmically slow it shouldn't be called a VDF. We argue the
approach is algorithmically slow and it shouldn't be called a VDF. We argue the
term VDF should represent the category of verifiable delay functions and not
just the subset with certain performance characteristics. Until that's
resolved, Solana will likely continue using the term PoH for its

View File

@ -19,18 +19,27 @@ A fraction of a [block](#block); the smallest unit sent between
#### block
A contiguous set of [entries](#entry) on the ledger covered by a
[vote](#ledger-vote). The duration of a block is some cluster-configured
number of [ticks](#tick). Also called [voting period](#voting-period).
[vote](#ledger-vote). A [leader](#leader) produces at most one block per
[slot](#slot).
#### block height
The number of [blocks](#block) beneath the current block plus one. The [genesis
block](#genesis-block), for example, has block height 1.
The number of [blocks](#block) beneath the current block. The first block after
the [genesis block](#genesis-block) has height zero.
#### block id
The [entry id](#entry-id) of the last entry in a [block](#block).
#### bootstrap leader
The first [fullnode](#fullnode) to take the [leader](#leader) role.
#### CBC block
Smallest encrypted chunk of ledger, an encrypted ledger segment would be made of
many CBC blocks. `ledger_segment_size / cbc_block_size` to be exact.
#### client
A [node](#node) that utilizes the [cluster](#cluster).
@ -59,11 +68,24 @@ consensus.
An off-chain service that acts as a custodian for a user's private key. It
typically serves to validate and sign transactions.
#### fake storage proof
A proof which has the same format as a storage proof, but the sha state is
actually from hashing a known ledger value which the storage client can reveal
and is also easily verifiable by the network on-chain.
#### entry
An entry on the [ledger](#ledger) either a [tick](#tick) or a [transactions
entry](#transactions-entry).
#### entry id
A globally unique identifier that is also a proof that the [entry](#entry) was
generated after a duration of time, all [transactions](#transaction) included
in the entry, and all previous entries on the [ledger](#ledger). See [Proof of
History](#proof-of-history).
#### epoch
The time, i.e. number of [slots](#slot), for which a [leader
@ -80,13 +102,13 @@ A full participant in the [cluster](#cluster) either a [leader](#leader) or
#### fullnode state
The result of interpreting all programs on the ledger a given [tick
The result of interpreting all programs on the ledger at a given [tick
height](#tick-height). It includes at least the set of all [accounts](#account)
holding nonzero [native tokens](#native-tokens).
#### genesis block
The first [block](#block) of the [ledger](#ledger).
The configuration file that prepares the [ledger](#ledger) for the first [block](#block).
#### hash
@ -99,7 +121,7 @@ in a [transaction](#instruction).
#### keypair
A [public key](#public-key) and coesponding [secret key](#secret-key).
A [public key](#public-key) and corresponding [secret key](#secret-key).
#### lamport
@ -127,6 +149,11 @@ at any moment in time.
A list of [entries](#entry) containing [transactions](#transaction) signed by
[clients](#client).
#### ledger segment
Portion of the ledger which is downloaded by the replicator where storage proof
data is derived.
#### ledger vote
A [hash](#hash) of the [fullnode's state](#fullnode-state) at a given [tick
@ -152,7 +179,7 @@ The [token](#token) used to track work done by [nodes](#node) in a cluster.
#### node
A computer particpating in a [cluster](#cluster).
A computer participating in a [cluster](#cluster).
#### node count
@ -166,7 +193,7 @@ See [Proof of History](#proof-of-history).
The code that interprets [instructions](#instruction).
#### program ID
#### program id
The public key of the [account](#account) containing a [program](#program).
@ -181,6 +208,11 @@ verified in less time than it took to produce.
The public key of a [keypair](#keypair).
#### replicator
Storage mining client, stores some part of the ledger enumerated in blocks and
submits storage proofs to the chain. Not a full-node.
#### runtime
The component of a [fullnode](#fullnode) responsible for [program](#program)
@ -192,8 +224,8 @@ The private key of a [keypair](#keypair).
#### slot
The time (i.e. number of [blocks](#block)) for which a [leader](#leader)
ingests transactions and produces [entries](#entry).
The period of time for which a [leader](#leader) ingests transactions and
produces a [block](#block).
#### sol
@ -205,6 +237,32 @@ by the company Solana.
Tokens forfeit to the [cluster](#cluster) if malicious [fullnode](#fullnode)
behavior can be proven.
#### storage proof
A set of sha hash state which is constructed by sampling the encrypted version
of the stored ledger segment at certain offsets.
#### storage proof challenge
A transaction from a replicator that verifiably proves that a validator
confirmed a fake proof.
#### storage proof claim
A transaction from a validator which is after the timeout period given from the
storage proof confirmation and which no successful challenges have been
observed which rewards the parties of the storage proofs and confirmations.
#### storage proof confirmation
A transaction by a validator which indicates the set of real and fake proofs
submitted by a storage miner. The transaction would contain a list of proof
hash values and a bit which says if this hash is valid or fake.
#### storage validation capacity
The number of keys and samples that a validator can verify each storage epoch.
#### thin client
A type of [client](#client) that trusts it is communicating with a valid
@ -252,8 +310,3 @@ that it ran, which can then be verified in less time than it took to produce.
#### vote
See [ledger vote](#ledger-vote).
#### voting period
The duration of a [block](#block).

View File

@ -0,0 +1,64 @@
## Testing Programs
Applications send transactions to a Solana cluster and query validators to
confirm the transactions were processed and to check each transaction's result.
When the cluster doesn't behave as anticipated, it could be for a number of
reasons:
* The program is buggy
* The BPF loader rejected an unsafe program instruction
* The transaction was too big
* The transaction was invalid
* The Runtime tried to execute the transaction when another one was accessing
the same account
* The network dropped the transaction
* The cluster rolled back the ledger
* A validator responded to queries maliciously
### The Transact Trait
To troubleshoot, the application should retarget a lower-level component, where
fewer errors are possible. Retargeting can be done with different
implementations of the Transact trait.
When Futures 0.3.0 is released, the Transact trait may look like this:
```rust,ignore
trait Transact {
async fn send_transactions(txs: &[Transaction]) -> Vec<Result<(), TransactionError>>;
}
```
Users send transactions and asynchrounously await their results.
#### Transact with Clusters
The highest level implementation targets a Solana cluster, which may be a
deployed testnet or a local cluster running on a development machine.
#### Transact with the TPU
The next level is the TPU implementation of Transact. At the TPU level, the
application sends transactions over Rust channels, where there can be no
surprises from network queues or dropped packets. The TPU implements all
"normal" transaction errors. It does signature verification, may report
account-in-use errors, and otherwise results in the ledger, complete with proof
of history hashes.
### Low-level testing
### Testing with the Bank
Below the TPU level is the Bank. The Bank doesn't do signature verification or
generate a ledger. The Bank is a convenient layer at which to test new on-chain
programs. It allows developers to toggle between native program implementations
and BPF-compiled variants. No need for the Transact trait here. The Bank's API
is synchronous.
### Unit-testing with the Runtime
Below the Bank is the Runtime. The Runtime is the ideal test environment for
unit-testing. By statically linking the Runtime into a native program
implementation, the developer gains the shortest possible edit-compile-run
loop. Without any dynamic linking, stack traces include debug symbols and
program errors are straightforward to troubleshoot.

View File

@ -0,0 +1,141 @@
## Testnet Participation
This document describes how to participate in the testnet as a
validator node.
Please note some of the information and instructions described here may change
in future releases.
### Testnet Overview
The testnet features a validator running at .testnet.solana.com, which
serves as the entrypoint to the cluster for your validator.
Additionally there is a blockexplorer available at
[http://testnet.solana.com/](http://testnet.solana.com/).
The testnet is configured to reset the ledger every 24hours, or sooner
should an hourly automated sanity test fail.
### Machine Requirements
Since the testnet is not intended for stress testing of max transaction
throughput, a higher-end machine with a GPU is not necessary to participate.
However ensure the machine used is not behind a residential NAT to avoid NAT
traversal issues. A cloud-hosted machine works best. Ensure that IP ports
8000 through 10000 are not blocked for Internet traffic.
Prebuilt binaries are available for Linux x86_64 (Ubuntu 18.04 recommended).
MacOS or WSL users may build from source.
#### Confirm The Testnet Is Reachable
Before attaching a validator node, sanity check that the cluster is accessible
to your machine by running some simple wallet commands. If any of these
commands fail, please retry 5-10 minutes later to confirm the testnet is not
just restarting itself before debugging further.
Fetch the current testnet transaction count over JSON RPC:
```bash
$ curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' http://testnet.solana.com:8899
```
Inspect the blockexplorer at [http://testnet.solana.com/](http://testnet.solana.com/) for activity.
Run the following command to join the gossip network and view all the other nodes in the cluster:
```bash
$ solana-gossip --network testnet.solana.com:8001
```
View the [metrics dashboard](https://metrics.solana.com:3000/d/testnet-edge/testnet-monitor-edge?var-testnet=testnet)
for more detail on cluster activity.
### Validator Setup
#### Obtaining The Software
##### Bootstrap with `solana-install`
The `solana-install` tool can be used to easily install and upgrade the cluster
software on Linux x86_64 systems.
Install the latest release with a single shell command:
```bash
$ curl -sSf https://raw.githubusercontent.com/solana-labs/solana/v0.13.0/install/solana-install-init.sh | \
sh -s - --url https://api.testnet.solana.com
```
Alternatively build the `solana-install` program from source and run the
following command to obtain the same result:
```bash
$ solana-install init --url https://api.testnet.solana.com
```
After a successful install, `solana-install update` may be used to easily update the cluster
software to a newer version.
##### Download Prebuilt Binaries
Binaries are available for Linux x86_64 systems.
Download the binaries by navigating to https://github.com/solana-labs/solana/releases/latest, download
**solana-release-x86_64-unknown-linux-gnu.tar.bz2**, then extract the archive:
```bash
$ tar jxf solana-release-x86_64-unknown-linux-gnu.tar.bz2
$ cd solana-release/
$ export PATH=$PWD/bin:$PATH
```
##### Build From Source
If you are unable to use the prebuilt binaries or prefer to build it yourself from source, navigate to:
> https://github.com/solana-labs/solana/releases/latest
Download the source code tarball (solana-*[release]*.tar.gz) from our latest release tag. Extract the code and build the binaries with:
```bash
$ ./scripts/cargo-install-all.sh .
$ export PATH=$PWD/bin:$PATH
```
### Starting The Validator
Sanity check that you are able to interact with the cluster by receiving a small
airdrop of lamports from the testnet drone:
```bash
$ solana-wallet -n testnet.solana.com airdrop 123
$ solana-wallet -n testnet.solana.com balance
```
Then the following command will start a new validator node.
If this is a `solana-install`-installation:
```bash
$ fullnode-x.sh --public-address --poll-for-new-genesis-block testnet.solana.com
```
Alternatively, the `solana-install run` command can be used to run the validator
node while periodically checking for and applying software updates:
```bash
$ solana-install run fullnode-x.sh -- --public-address --poll-for-new-genesis-block testnet.solana.com
```
When not using `solana-install`:
```bash
$ USE_INSTALL=1 ./multinode-demo/fullnode-x.sh --public-address --poll-for-new-genesis-block testnet.solana.com
```
Then from another console, confirm the IP address if your node is now visible in
the gossip network by running:
```bash
$ solana-gossip --network testnet.solana.com:8001
```
Congratulations, you're now participating in the testnet cluster!
#### Controlling local network port allocation
By default the validator will dynamically select available network ports in the
8000-10000 range, and may be overridden with `--dynamic-port-range`. For
example, `fullnode-x.sh --dynamic-port-range 11000-11010 ...` will restrict the
validator to ports 11000-11011.
### Sharing Metrics From Your Validator
If you'd like to share metrics perform the following steps before starting the
validator node:
```bash
export u="username obtained from the Solana maintainers"
export p="password obtained from the Solana maintainers"
export SOLANA_METRICS_CONFIG="db=testnet,u=${u:?},p=${p:?}"
source scripts/configure-metrics.sh
```

View File

@ -23,13 +23,13 @@ Next, follow the steps in the git repository's
[README](https://github.com/solana-labs/example-tictactoe/blob/master/README.md).
## Getting tokens to users
## Getting lamports to users
You may have noticed you interacted with the Solana cluster without first
needing to aquire tokens to pay transaction fees. Under the hood, the web
needing to acquire lamports to pay transaction fees. Under the hood, the web
app creates a new ephemeral identity and sends a request to an off-chain
service for a signed transation authorizes a user to start a new game.
service for a signed transaction authorizing a user to start a new game.
The service is called a *drone*. When the app sends the signed transaction
to the Solana cluster, the drone's tokens are spent to pay the transaction
to the Solana cluster, the drone's lamports are spent to pay the transaction
fee and start the game. In a real world app, the drone might request the user
watch an ad or pass a CAPTCHA before signing over its tokens.
watch an ad or pass a CAPTCHA before signing over its lamports.

View File

@ -0,0 +1,59 @@
# Deterministic Transaction Fees
Transactions currently include a fee field that indicates the maximum fee field
a slot leader is permitted to charge to process a transaction. The cluster, on
the other hand, agrees on a minimum fee. If the network is congested, the slot
leader may prioritize the transactions offering higher fees. That means the
client won't know how much was collected until the transaction is confirmed by
the cluster and the remaining balance is checked. It smells of exactly what we
dislike about Ethereum's "gas", non-determinism.
## Implementation Status
This design is not yet implemented, but is written as though it has been. Once
implemented, delete this comment.
### Congestion-driven fees
Each validator uses *signatures per slot* (SPS) to estimate network congestion
and *SPS target* to estimate the desired processing capacity of the cluster.
The validator learns the SPS target from the genesis block, whereas it
calculates SPS from the ledger data in the previous epoch.
### Calculating fees
The client uses the JSON RPC API to query the cluster for the current fee
parameters. Those parameters are tagged with a blockhash and remain valid
until that blockhash is old enough to be rejected by the slot leader.
Before sending a transaction to the cluster, a client may submit the
transaction and fee account data to an SDK module called the *fee calculator*.
So long as the client's SDK version matches the slot leader's version, the
client is assured that its account will be changed exactly the same number of
lamports as returned by the fee calculator.
### Fee Parameters
In the first implementation of this design, the only fee parameter is
`lamports_per_signature`. The more signatures the cluster needs to verify, the
higher the fee. The exact number of lamports is determined by the ratio of SPS
to the SPS target. The cluster lowers `lamports_per_signature` when SPS is
below the target and raises it when at or above the target.
Future parameters might include:
* `lamports_per_pubkey` - cost to load an account
* `lamports_per_slot_distance` - higher cost to load very old accounts
* `lamports_per_byte` - cost per size of account loaded
* `lamports_per_bpf_instruction` - cost to run a program
### Attacks
#### Hijacking the SPS Target
A group of validators can centralize the cluster if they can convince it to
raise the SPS Target above a point where the rest of the validators can keep
up. Raising the target will cause fees to drop, presumably creating more demand
and therefore higher TPS. If the validator doesn't have hardware that can
process that many transactions that fast, its confirmation votes will
eventually get so long that the cluster will be forced to boot it.

View File

@ -1,18 +1,17 @@
# Signing using Secure Enclave
# Secure Vote Signing
This document defines the security mechanism of signing keys used by the
fullnodes. Every node contains an asymmetric key that's used for signing
and verifying the votes. The node signs the vote transactions using its private
key. Other entities can verify the signature using the node's public key.
This design describes additional vote signing behavior that will make the
process more secure.
The node's stake or its resources could be compromised if its private key is
used to sign incorrect data (e.g. voting on multiple forks of the ledger). So,
it's important to safeguard the private key.
Currently, Solana implements a vote-signing service that evaluates each vote to
ensure it does not violate a slashing condition. The service could potentially
have different variations, depending on the hardware platform capabilities. In
particular, it could be used in conjunction with a secure enclave (such as SGX).
The enclave could generate an asymmetric key, exposing an API for user
(untrusted) code to sign the vote transactions, while keeping the vote-signing
private key in its protected memory.
Secure Enclaves (such as SGX) provide a layer of memory and computation
protection. An enclave can be used to generate an asymmetric key and keep the
private key in its protected memory. It can expose an API that user (untrusted)
code can use for signing the transactions.
The following sections outline how this architecture would work:
## Message Flow
@ -26,13 +25,13 @@ code can use for signing the transactions.
2. The node performs attestation of the enclave (e.g using Intel's IAS APIs)
* The node ensures that the Secure Enclave is running on a TPM and is
signed by a trusted party
3. The owner of the node grants ephemeral key permission to use its stake. This
process is TBD.
3. The stakeholder of the node grants ephemeral key permission to use its stake.
This process is TBD.
4. The node's untrusted, non-enclave software calls trusted enclave software
using its interface to sign transactions and other data.
* In case of vote signing, the node needs to verify the PoH. The PoH
verification is an integral part of signing. The enclave would be
presented with some verifiable data that it'll check before signing the vote.
presented with some verifiable data to check before signing the vote.
* The process of generating the verifiable data in untrusted space is TBD
## PoH Verification
@ -101,81 +100,8 @@ confirming that it has observed some probability of economic finality of the
submitted fork at a depth where an additional vote would create a lockout for
an undesirable amount of time if that fork turns out not to be live.
## Signing service
The signing service consists of a a JSON RPC server, and a request processor.
At startup, it starts the RPC server at a configured port and waits for
client/validator requests. It expects the following type of requests.
1. Register a new validator node
* The request contains validator's identity (public key)
* The request is signed with validator's private key
* The service will drop the request if signature of the request cannot be
verified
* The service will create a new voting asymmetric key for the validator,
and return the public key as a response
* If a validator retries to register, it'll return the public key from the
pre-existing keypair
2. Sign a vote
* The request contains voting transaction, and all verification data (as
described in Ancestor Verification)
* The request is signed with validator's private key
* The service will drop the request if signature of the request cannot be
verified
* The service will verify the voting data
* The service will return a signed transaction (or signature for the
transaction)
The service could potentially have different variations, depending on the
hardware platform capabilities. For example, if the hardware supports a secure
enclave, the service can offload asymmetric key generation, and private key
protection to the enclave. A less secure implementation of the service could
simply carry the keypair in the process memory.
## Validator voting
A validator node, at startup, creates a new vote account and registers it with
the cluster. This is done by submitting a new "vote register" transaction. The
transaction contains validator's keypair, it's vote signing public key, and
some additional information. The other nodes on the cluster process this
transaction and include the new validator in the active set.
Subsequently, the validator submits a "new vote" transaction on a voting event.
This vote is signed with validator's voting private key.
The validator code will change to interface with Signing service for "vote
register" and "new vote" use cases.
### Configuration
The validator node will be configured with Signing service's network endpoint
(IP/Port).
### Register
At startup, the validator will call Signing service using JSON RPC to register
itself. The RPC call will return the voting public key for the validator node.
The validator will create a new "vote register" transaction including this
public key in it, and submit it to the cluster.
### Collect votes for last period
The validator will look up the votes submitted by all the nodes in the cluster
for the last voting period. This information will be submitted to signing
service with new vote signing request.
### New Vote Signing
The validator will create a "new vote" transaction and send it to the signing
service using JSON RPC. The RPC request will also include the vote verification
data. On success, RPC call will return the signature for the vote. On failure,
RPC call will return the failure code.
## Challenges
1. The nodes are currently being configured with asymmetric keys that are
generated and stored in PKCS8 files.
2. The genesis block contains an entry that's signed with leader's private key.
This entry is used to identify the primordial leader.
3. Generation of verifiable data in untrusted space for PoH verification in the
1. Generation of verifiable data in untrusted space for PoH verification in the
enclave.
4. Need infrastructure for granting stake to an ephemeral key.
2. Need infrastructure for granting stake to an ephemeral key.

91
book/src/vote-signing.md Normal file
View File

@ -0,0 +1,91 @@
# Secure Vote Signing
A validator fullnode receives entries from the current leader and submits votes
confirming those entries are valid. This vote submission presents a security
challenge, because forged votes that violate consensus rules could be used
to slash the validator's stake.
The validator votes on its chosen fork by submitting a transaction that uses an
asymmetric key to sign the result of its validation work. Other entities can
verify this signature using the validator's public key. If the validator's key
is used to sign incorrect data (e.g. votes on multiple forks of the ledger), the
node's stake or its resources could be compromised.
Solana addresses this risk by splitting off a separate *vote signer* service
that evaluates each vote to ensure it does not violate a slashing condition.
## Validators, Vote Signers, and Stakeholders
When a validator receives multiple blocks for the same slot, it tracks all
possible forks until it can determine a "best" one. A validator selects the best
fork by submitting a vote to it, using a vote signer to minimize the possibility
of its vote inadvertently violating a consensus rule and getting a stake
slashed.
A vote signer evaluates the vote proposed by the validator and signs the vote
only if it does not violate a slashing condition. A vote signer only needs to
maintain minimal state regarding the votes it signed and the votes signed by the
rest of the cluster. It doesn't need to process a full set of transactions.
A stakeholder is an identity that has control of the staked capital. The
stakeholder can delegate its stake to the vote signer. Once a stake is
delegated, the vote signer votes represent the voting weight of all the
delegated stakes, and produce rewards for all the delegated stakes.
Currently, there is a 1:1 relationship between validators and vote signers, and
stakeholders delegate their entire stake to a single vote signer.
## Signing service
The vote signing service consists of a JSON RPC server and a request processor.
At startup, the service starts the RPC server at a configured port and waits for
validator requests. It expects the following type of requests:
1. Register a new validator node
* The request must contain validator's identity (public key)
* The request must be signed with the validator's private key
* The service drops the request if signature of the request cannot be
verified
* The service creates a new voting asymmetric key for the validator, and
returns the public key as a response
* If a validator tries to register again, the service returns the public key
from the pre-existing keypair
2. Sign a vote
* The request must contain a voting transaction and all verification data
* The request must be signed with the validator's private key
* The service drops the request if signature of the request cannot be
verified
* The service verifies the voting data
* The service returns a signature for the transaction
## Validator voting
A validator node, at startup, creates a new vote account and registers it with
the cluster by submitting a new "vote register" transaction. The other nodes on
the cluster process this transaction and include the new validator in the active
set. Subsequently, the validator submits a "new vote" transaction signed with
the validator's voting private key on each voting event.
### Configuration
The validator node is configured with the signing service's network endpoint
(IP/Port).
### Registration
At startup, the validator registers itself with its signing service using JSON
RPC. The RPC call returns the voting public key for the validator node. The
validator creates a new "vote register" transaction including this public
key, and submits it to the cluster.
### Vote Collection
The validator looks up the votes submitted by all the nodes in the cluster
for the last voting period. This information is submitted to the signing
service with a new vote signing request.
### New Vote Signing
The validator creates a "new vote" transaction and sends it to the signing
service using JSON RPC. The RPC request also includes the vote verification
data. On success, the RPC call returns the signature for the vote. On failure,
RPC call returns the failure code.

View File

@ -14,7 +14,7 @@ $ solana-wallet address
<PUBKEY>
```
#### Airdrop Tokens
#### Airdrop Lamports
```sh
// Command
@ -41,7 +41,7 @@ $ solana-wallet balance
$ solana-wallet confirm <TX_SIGNATURE>
// Return
"Confirmed" / "Not found"
"Confirmed" / "Not found" / "Transaction failed with error <ERR>"
```
#### Deploy program
@ -78,7 +78,7 @@ $ solana-wallet pay <PUBKEY> 123 \
#### Authorized Transfer
A third party must send a signature to unlock the tokens.
A third party must send a signature to unlock the lamports.
```sh
// Command
$ solana-wallet pay <PUBKEY> 123 \
@ -168,25 +168,27 @@ $ solana-wallet send-timestamp <PUBKEY> <PROCESS_ID> --date 2018-12-24T23:59:00
### Usage
```manpage
solana-wallet 0.11.0
solana-wallet 0.12.0
USAGE:
solana-wallet [OPTIONS] [SUBCOMMAND]
solana-wallet [FLAGS] [OPTIONS] [SUBCOMMAND]
FLAGS:
-h, --help Prints help information
--rpc-tls Enable TLS for the RPC endpoint
-V, --version Prints version information
OPTIONS:
-k, --keypair <PATH> /path/to/id.json
-n, --network <HOST:PORT> Rendezvous with the network at this gossip entry point; defaults to 127.0.0.1:8001
--proxy <URL> Address of TLS proxy
--port <NUM> Optional rpc-port configuration to connect to non-default nodes
--timeout <SECS> Max seconds to wait to get necessary gossip from the network
--drone-host <IP ADDRESS> Drone host to use [default: same as --host]
--drone-port <PORT> Drone port to use [default: 9900]
-n, --host <IP ADDRESS> Host to use for both RPC and drone [default: 127.0.0.1]
-k, --keypair <PATH> /path/to/id.json
--rpc-host <IP ADDRESS> RPC host to use [default: same as --host]
--rpc-port <PORT> RPC port to use [default: 8899]
SUBCOMMANDS:
address Get your public key
airdrop Request a batch of tokens
airdrop Request a batch of lamports
balance Get your balance
cancel Cancel a transfer
confirm Confirm transaction by signature
@ -199,7 +201,7 @@ SUBCOMMANDS:
```
```manpage
solana-wallet-address
solana-wallet-address
Get your public key
USAGE:
@ -211,8 +213,8 @@ FLAGS:
```
```manpage
solana-wallet-airdrop
Request a batch of tokens
solana-wallet-airdrop
Request a batch of lamports
USAGE:
solana-wallet airdrop <NUM>
@ -222,11 +224,11 @@ FLAGS:
-V, --version Prints version information
ARGS:
<NUM> The number of tokens to request
<NUM> The number of lamports to request
```
```manpage
solana-wallet-balance
solana-wallet-balance
Get your balance
USAGE:
@ -238,7 +240,7 @@ FLAGS:
```
```manpage
solana-wallet-cancel
solana-wallet-cancel
Cancel a transfer
USAGE:
@ -253,7 +255,7 @@ ARGS:
```
```manpage
solana-wallet-confirm
solana-wallet-confirm
Confirm transaction by signature
USAGE:
@ -268,7 +270,7 @@ ARGS:
```
```manpage
solana-wallet-deploy
solana-wallet-deploy
Deploy a program
USAGE:
@ -283,7 +285,7 @@ ARGS:
```
```manpage
solana-wallet-get-transaction-count
solana-wallet-get-transaction-count
Get current transaction count
USAGE:
@ -295,29 +297,29 @@ FLAGS:
```
```manpage
solana-wallet-pay
solana-wallet-pay
Send a payment
USAGE:
solana-wallet pay [FLAGS] [OPTIONS] <PUBKEY> <NUM>
FLAGS:
--cancelable
--cancelable
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
--after <DATETIME> A timestamp after which transaction will execute
--require-timestamp-from <PUBKEY> Require timestamp from this third party
--require-signature-from <PUBKEY>... Any third party signatures required to unlock the tokens
--require-signature-from <PUBKEY>... Any third party signatures required to unlock the lamports
ARGS:
<PUBKEY> The pubkey of recipient
<NUM> The number of tokens to send
<NUM> The number of lamports to send
```
```manpage
solana-wallet-send-signature
solana-wallet-send-signature
Send a signature to authorize a transfer
USAGE:
@ -333,7 +335,7 @@ ARGS:
```
```manpage
solana-wallet-send-timestamp
solana-wallet-send-timestamp
Send a timestamp to unlock a transfer
USAGE:
@ -350,4 +352,3 @@ ARGS:
<PUBKEY> The pubkey of recipient
<PROCESS_ID> The process id of the transfer to unlock
```

View File

@ -7,6 +7,9 @@ First fetch the example code:
```sh
$ git clone https://github.com/solana-labs/example-webwallet.git
$ cd example-webwallet
$ TAG=$(git describe --tags $(git rev-list --tags
--max-count=1))
$ git checkout $TAG
```
Next, follow the steps in the git repository's

View File

@ -318,7 +318,7 @@ ul#searchresults span.teaser em {
.sidebar img {
display: block;
max-width: 70%;
margin: 0 auto;
margin: 20px auto;
}
.js .sidebar {
transition: transform 0.3s; /* Animation: slide away */
@ -443,6 +443,12 @@ ul#searchresults span.teaser em {
border-top-right-radius: inherit;
}
.content p {
line-height: 1.6;
margin-top: 0;
padding: 0 28px;
}
.content h1 {
font-size: 25px;
font-weight: 300;
@ -457,14 +463,10 @@ ul#searchresults span.teaser em {
font-family: Poppins, sans-serif;
}
.content p {
line-height: 1.6;
margin-top: 0;
padding: 0 28px;
}
.content h2 {
font-family: Poppins, sans-serif;
font-size: 15px;
font-size: 20px;
font-weight: 300;
margin-top: 2em;
margin-bottom: 0;
@ -473,12 +475,13 @@ ul#searchresults span.teaser em {
padding-bottom: 1.2em;
}
.content h3 {
.content h3, h4, h5 {
font-size: 15px;
margin-top: 2.5em;
margin-bottom: 0.8em;
padding: 0 28px;
}
.content code {
background-color: rgba(0,0,0,0.05);
padding: 3px;
@ -501,15 +504,6 @@ ul#searchresults span.teaser em {
padding: 2em 28px;
}
.content h4,
.content h5 {
font-size: 15px;
margin-top: 2.5em;
margin-bottom: 0.8em;
padding: 0 28px;
}
.content table {
margin-bottom: 1em;
}

View File

@ -16,7 +16,7 @@ body {
font-size: 1rem;
overflow-x: hidden;
font-family: Lato, 'Helvetica Neue', 'Arial', sans-serif;
font-size: 14px;
font-size: 16px;
font-weight: 300;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;

View File

@ -76,7 +76,8 @@
</script>
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<img src="https://manuel-calavera.github.io/images/logo.png" alt="">
<img
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI3NTQiIGhlaWdodD0iMTUxIiB2aWV3Qm94PSIwIDAgNzU0IDE1MSI+PGcgZmlsbD0iI0ZGRiIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNMjY4IDMxaDE2LjQxOXY3NC4yNTVIMzQ5TDMzNS41NjYgMTIwSDI2OHpNNjQuMDAyIDg0LjExM0gyOC4xMjV2LS4wMWMtLjIzNC4wMDctLjQ2OC4wMS0uNzAzLjAxLTE0LjM2OCAwLTI2LjAxNi0xMS44OS0yNi4wMTYtMjYuNTU3QzEuNDA2IDQyLjg5IDEzLjA1NCAzMSAyNy40MjIgMzFjLjIzNSAwIC40Ny4wMDMuNzAzLjAxVjMxSDkwTDcxLjcxOSA0OC4yMjZIMjcuNDA1Yy01LjAzOSAwLTkuMTI0IDQuMTc3LTkuMTI0IDkuMzMgMCA1LjE1NCA0LjA4NSA5LjMzMSA5LjEyNCA5LjMzMWgzOC42ODl2LjA4NkM3OS40NzUgNjguMDcgOTAgNzkuNTAyIDkwIDkzLjQ0MyA5MCAxMDguMTEgNzguMzUyIDEyMCA2My45ODQgMTIwYy0uNzEgMC0xLjQxMy0uMDI5LTIuMTA5LS4wODZWMTIwSDBsMTkuNjg4LTE3LjIyNmg0NC4zMTRjNS4wMzggMCA5LjEyMy00LjE3NyA5LjEyMy05LjMzIDAtNS4xNTQtNC4wODUtOS4zMzEtOS4xMjMtOS4zMzF6TTE1MC40NjkgMzEuMDE1VjMxaDU5LjA2MnYuMDE1YzguMzcyLjM2NiAxNS4wOTYgNy4yMyAxNS40NTQgMTUuNzc1SDIyNXY1NS45ODRoLS4wMTVjLjAxLjIzOC4wMTUuNDc3LjAxNS43MTggMCA4Ljg3Ny02Ljg2MyAxNi4xMTctMTUuNDY5IDE2LjQ5M1YxMjBIMTUwLjQ3di0uMDE1Yy04LjYwNi0uMzc2LTE1LjQ2OS03LjYxNi0xNS40NjktMTYuNDkzIDAtLjI0LjAwNS0uNDguMDE1LS43MThIMTM1VjQ2Ljc5aC4wMTVjLjM1OC04LjU0NiA3LjA4Mi0xNS40MSAxNS40NTQtMTUuNzc1ek0xNjEuNTQzIDQ2LjhjLTUuMjMzLjIzLTkuNDM1IDQuNTQ3LTkuNjU5IDkuOTIzaC0uMDA5djM1LjIxNmguMDFjLS4wMDcuMTUtLjAxLjMtLjAxLjQ1MSAwIDUuNTg0IDQuMjkgMTAuMTM4IDkuNjY4IDEwLjM3NXYuMDFoMzYuOTE0di0uMDFjNS4zNzgtLjIzNyA5LjY2OC00Ljc5MSA5LjY2OC0xMC4zNzUgMC0uMTUxLS4wMDMtLjMwMi0uMDEtLjQ1MWguMDFWNTYuNzIzaC0uMDFjLS4yMjMtNS4zNzYtNC40MjUtOS42OTMtOS42NTgtOS45MjN2LS4wMWgtMzYuOTE0di4wMXpNNDA5Ljg3NSA1NS40MDNWNzIuNjNoNTYuMjVWNTUuNDAzYzAtNS41NS00LjQwNy0xMC4wNDgtOS44NDQtMTAuMDQ4SDQxOS43MmMtNS40MzcgMC05Ljg0NCA0LjQ5OS05Ljg0NCAxMC4wNDh6TTQ2Ni4xMjUgMTIwVjg1LjU0OGgtNTYuMjVWMTIwSDM5M1Y0OC4yMjZoLjAxNWExNy4xNCAxNy4xNCAwIDAgMS0uMDE1LS43MThDMzkzIDM4LjM5MSA0MDAuMjQgMzEgNDA5LjE3MiAzMWMuMjM1IDAgLjQ3LjAwNS43MDMuMDE1VjMxaDU3LjY1NnYuMDE1YzguNjA2LjM3NiAxNS40NjkgNy42MTYgMTUuNDY5IDE2LjQ5MyAwIC4yNC0uMDA1LjQ4LS4wMTUuNzE4SDQ4M1YxMjBoLTE2Ljg3NXpNNjc3Ljg3NSA1NS40MDNWNzIuNjNoNTYuMjVWNTUuNDAzYzAtNS41NS00LjQwNy0xMC4wNDgtOS44NDQtMTAuMDQ4SDY4Ny43MmMtNS40MzcgMC05Ljg0NCA0LjQ5OS05Ljg0NCAxMC4wNDh6TTczNC4xMjUgMTIwVjg1LjU0OGgtNTYuMjVWMTIwSDY2MVY0OC4yMjZoLjAxNWExNy4xNCAxNy4xNCAwIDAgMS0uMDE1LS43MThDNjYxIDM4LjM5MSA2NjguMjQgMzEgNjc3LjE3MiAzMWMuMjM1IDAgLjQ3LjAwNS43MDMuMDE1VjMxaDU3LjY1NnYuMDE1YzguNjA2LjM3NiAxNS40NjkgNy42MTYgMTUuNDY5IDE2LjQ5MyAwIC4yNC0uMDA1LjQ4LS4wMTUuNzE4SDc1MVYxMjBoLTE2Ljg3NXpNNjAxLjEyNSA5OC40NTdWMzFINjE4djg5aC0xNi44NzV2LS4xNDlsLTU2LjI1LTY1Ljg4M1YxMjBINTI4VjMxaDE2Ljg3NXoiLz48L2c+PC9zdmc+" width="150" height="30" alt="Solana">
{{#toc}}{{/toc}}
</nav>

19
build-perf-libs.sh Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
#
# Builds perf-libs from the upstream source and installs them into the correct
# location in the tree
#
set -e
cd "$(dirname "$0")"
if [[ -d target/perf-libs ]]; then
echo "target/perf-libs/ already exists, to continue run:"
echo "$ rm -rf target/perf-libs"
exit 1
fi
set -x
git clone git@github.com:solana-labs/solana-perf-libs.git target/perf-libs
cd target/perf-libs
make -j"$(nproc)"
make DESTDIR=. install

View File

@ -1,46 +0,0 @@
use std::env;
use std::fs;
fn main() {
println!("cargo:rerun-if-changed=build.rs");
// Ensure target/perf-libs/ exists. It's been observed that
// a cargo:rerun-if-changed= directive with a non-existent
// directory triggers a rebuild on every |cargo build| invocation
fs::create_dir_all("target/perf-libs").unwrap_or_else(|err| {
if err.kind() != std::io::ErrorKind::AlreadyExists {
panic!("Unable to create target/perf-libs: {:?}", err);
}
});
let chacha = !env::var("CARGO_FEATURE_CHACHA").is_err();
let cuda = !env::var("CARGO_FEATURE_CUDA").is_err();
let erasure = !env::var("CARGO_FEATURE_ERASURE").is_err();
if chacha || cuda || erasure {
println!("cargo:rerun-if-changed=target/perf-libs");
println!("cargo:rustc-link-search=native=target/perf-libs");
}
if chacha {
println!("cargo:rerun-if-changed=target/perf-libs/libcpu-crypt.a");
}
if cuda {
let cuda_home = match env::var("CUDA_HOME") {
Ok(cuda_home) => cuda_home,
Err(_) => String::from("/usr/local/cuda"),
};
println!("cargo:rerun-if-changed=target/perf-libs/libcuda-crypt.a");
println!("cargo:rustc-link-lib=static=cuda-crypt");
println!("cargo:rustc-link-search=native={}/lib64", cuda_home);
println!("cargo:rustc-link-lib=dylib=cudart");
println!("cargo:rustc-link-lib=dylib=cuda");
println!("cargo:rustc-link-lib=dylib=cudadevrt");
}
if erasure {
println!("cargo:rerun-if-changed=target/perf-libs/libgf_complete.so");
println!("cargo:rerun-if-changed=target/perf-libs/libJerasure.so");
println!("cargo:rustc-link-lib=dylib=Jerasure");
println!("cargo:rustc-link-lib=dylib=gf_complete");
}
}

View File

@ -1,12 +1,9 @@
steps:
#- command: "ci/snap.sh"
# timeout_in_minutes: 40
# name: "snap"
- command: "sdk/docker-solana/build.sh"
timeout_in_minutes: 20
name: "publish docker"
- command: "ci/publish-crate.sh"
timeout_in_minutes: 20
timeout_in_minutes: 40
name: "publish crate"
branches: "!master"
- command: "ci/publish-bpf-sdk.sh"

View File

@ -1,35 +1,33 @@
steps:
- command: "ci/shellcheck.sh"
name: "shellcheck"
timeout_in_minutes: 20
- command: "ci/docker-run.sh solanalabs/rust:1.31.0 ci/test-checks.sh"
timeout_in_minutes: 5
- command: ". ci/rust-version.sh; ci/docker-run.sh $$rust_stable_docker_image ci/test-checks.sh"
name: "checks"
timeout_in_minutes: 30
timeout_in_minutes: 15
- wait
- command: "ci/test-stable-perf.sh"
name: "stable-perf"
timeout_in_minutes: 20
artifact_paths: "log-*.txt"
agents:
- "queue=cuda"
- command: "ci/test-bench.sh"
name: "bench"
timeout_in_minutes: 30
- command: "ci/docker-run.sh solanalabs/rust:1.31.0 ci/test-stable.sh"
timeout_in_minutes: 20
- command: ". ci/rust-version.sh; ci/docker-run.sh $$rust_stable_docker_image ci/test-stable.sh"
name: "stable"
timeout_in_minutes: 30
- command: "ci/docker-run.sh solanalabs/rust-nightly:2018-12-18 ci/test-coverage.sh"
timeout_in_minutes: 25
artifact_paths: "log-*.txt"
- command: ". ci/rust-version.sh; ci/docker-run.sh $$rust_nightly_docker_image ci/test-coverage.sh"
name: "coverage"
timeout_in_minutes: 30
timeout_in_minutes: 20
# TODO: Fix and re-enable test-large-network.sh
# - command: "ci/test-large-network.sh || true"
# name: "large-network [ignored]"
# timeout_in_minutes: 20
# agents:
# - "queue=large"
- command: "ci/pr-snap.sh"
timeout_in_minutes: 20
name: "snap"
branches: "pull/*"
- wait
- trigger: "solana-secondary"
branches: "!pull/*"

View File

@ -82,10 +82,26 @@ for tag in "${tags[@]}"; do
fi
done
echo EDGE_CHANNEL=master
echo BETA_CHANNEL="${beta:+v$beta}"
echo STABLE_CHANNEL="${stable:+v$stable}"
echo BETA_CHANNEL_LATEST_TAG="${beta_tag:+v$beta_tag}"
echo STABLE_CHANNEL_LATEST_TAG="${stable_tag:+v$stable_tag}"
EDGE_CHANNEL=master
BETA_CHANNEL=${beta:+v$beta}
STABLE_CHANNEL=${stable:+v$stable}
BETA_CHANNEL_LATEST_TAG=${beta_tag:+v$beta_tag}
STABLE_CHANNEL_LATEST_TAG=${stable_tag:+v$stable_tag}
if [[ $BUILDKITE_BRANCH = "$STABLE_CHANNEL" ]]; then
CHANNEL=stable
elif [[ $BUILDKITE_BRANCH = "$EDGE_CHANNEL" ]]; then
CHANNEL=edge
elif [[ $BUILDKITE_BRANCH = "$BETA_CHANNEL" ]]; then
CHANNEL=beta
fi
echo EDGE_CHANNEL="$EDGE_CHANNEL"
echo BETA_CHANNEL="$BETA_CHANNEL"
echo BETA_CHANNEL_LATEST_TAG="$BETA_CHANNEL_LATEST_TAG"
echo STABLE_CHANNEL="$STABLE_CHANNEL"
echo STABLE_CHANNEL_LATEST_TAG="$STABLE_CHANNEL_LATEST_TAG"
echo CHANNEL="$CHANNEL"
exit 0

View File

@ -1,17 +1,26 @@
#!/usr/bin/env bash
#
# Outputs the current crate version
# Outputs the current crate version from a given Cargo.toml
#
set -e
cd "$(dirname "$0")"/..
Cargo_toml=$1
[[ -n $Cargo_toml ]] || {
echo "Usage: $0 path/to/Cargo.toml"
exit 0
}
[[ -r $Cargo_toml ]] || {
echo "Error: unable to read $Cargo_toml"
exit 1
}
while read -r name equals value _; do
if [[ $name = version && $equals = = ]]; then
echo "${value//\"/}"
exit 0
fi
done < <(cat Cargo.toml)
done < <(cat "$Cargo_toml")
echo Unable to locate version in Cargo.toml 1>&2
exit 1

View File

@ -71,7 +71,6 @@ ARGS+=(
--env CI
--env CODECOV_TOKEN
--env CRATES_IO_TOKEN
--env SNAPCRAFT_CREDENTIALS_KEY
)
if $INTERACTIVE; then

View File

@ -4,11 +4,9 @@ ARG date
RUN set -x \
&& rustup install nightly-$date \
&& rustup show \
&& mv /usr/local/rustup/toolchains/nightly-$date-* \
/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu \
&& rustup show \
&& rustc --version \
&& cargo --version \
&& rustc +nightly --version \
&& cargo +nightly --version
&& rustc +nightly-$date --version \
&& cargo +nightly-$date --version

View File

@ -15,11 +15,11 @@ To update the pinned version:
1. Run `ci/docker-rust-nightly/build.sh` to rebuild the nightly image locally,
or potentially `ci/docker-rust-nightly/build.sh YYYY-MM-DD` if there's a
specific YYYY-MM-DD that is desired (default is today's build).
1. Run `SOLANA_DOCKER_RUN_NOSETUID=1 ci/docker-run.sh --nopull solanalabs/rust-nightly:YYYY-MM-DD ci/test-nightly.sh`
1. Run `SOLANA_DOCKER_RUN_NOSETUID=1 ci/docker-run.sh --nopull solanalabs/rust-nightly:YYYY-MM-DD ci/test-coverage.sh`
to confirm the new nightly image builds. Fix any issues as needed
1. Run `docker login` to enable pushing images to Docker Hub, if you're authorized.
1. Run `CI=true ci/docker-rust-nightly/build.sh YYYY-MM-DD` to push the new nightly image to dockerhub.com.
1. Modify the `solanalabs/rust-nightly:YYYY-MM-DD` reference in `ci/buildkite.yml` from the previous to
1. Modify the `solanalabs/rust-nightly:YYYY-MM-DD` reference in `ci/rust-version.sh` from the previous to
new *YYYY-MM-DD* value, send a PR with this change and any codebase adjustments needed.
## Troubleshooting

View File

@ -1,6 +1,6 @@
# Note: when the rust version is changed also modify
# ci/buildkite.yml to pick up the new image tag
FROM rust:1.31.0
FROM rust:1.34.0
RUN set -x \
&& apt update \
@ -17,6 +17,7 @@ RUN set -x \
lcov \
libclang-common-7-dev \
llvm-7 \
mscgen \
rsync \
sudo \
\

Some files were not shown because too many files have changed in this diff Show More