Technical Release notes and Changelog for 0.9.3, 0.9.4, 0.9.5, 1.1.0

Things you need to know:

  1. Accounts.csv is now accounts.toml (allowing for genesis delegation)

  2. Nodes that are offline will removed from the auction at the end of an Era and ejected after the auction delay period.

  3. In Delta-11

    1. Genesis is at 2021-03-15T17:00:00Z

      1. Blocks will not be produced until after genesis

      2. You do not need a trusted_hash if your node is started prior to genesis

    2. Era length is 120 minutes. Before it was 30 minutes.

    3. The auction delay period is 1 Era (120 minutes). Before it was 3 Eras (90 minutes).

    4. The token bonded in at genesis will have bid locked in the auction contract. Rewards will be locked also.

    5. The faucet will dispense about 1000 CSPR, and the total starting supply is set to 10 Billion CSPR.

  4. The status endpoint on port 8888 includes

    1. “round_length” for validating nodes returns a time value, for non-validating nodes returns null

    2. the validator public key as "our_public_signing_key"

    3. “genesis_hash” renamed to "starting_state_root_hash"

  5. The data type for delegation rate in add_bid.wasm deploy has changed from u64 to u8. Please re-build add_bid..

  6. Rewards are now automatically re-staked to bids when they are distributed by the protocol.

  7. Transfers have a minimum transfer amount of 2_500_000_000 motes.

Known Issues

  1. Genesis staked keys will have their bids locked! This is how mainnet will work. If a genesis node goes offline, it will be evicted from the validator set & have to send in a special transaction to resume their bid.

  2. Joining issue - due to the faster block speed, synchronizing the protocol state is an issue. The team has reproduced the issue and is working on a fix. In the meantime - an upgrade has been staged to reduce the rate of block production.

Network Info

chain_name: "delta-11"

starting_state_root_hash: "01ed..56b0"

github tag for compiling contracts: v0.9.3

Install Dependencies

Instructions assume Ubuntu 18.04 or later system

https://github.com/CasperLabs/casper-node README has more information on dependencies.

sudo apt install gcc g++ pkg-config libssl-dev make wabt jq #install rust https://www.rust-lang.org/tools/install curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Contract Compilation instructions

git clone https://github.com/CasperLabs/casper-node.git cd casper-node git fetch git checkout release-0.9.3 make setup-rs && make build-client-contracts -j

Node Installation Instructions- Clean Installation

#### delta 11 #### # clean up previous version nodes sudo systemctl stop casper-node-launcher.service sudo rm -rf /etc/casper/1_0_0 sudo rm -rf /var/lib/casper/bin/1_0_0 sudo rm -rf /var/lib/casper/casper-node sudo rm /etc/casper/casper-node-launcher-state.toml sudo apt remove -y casper-client casper-node-launcher cd ~ curl -JLO https://bintray.com/casperlabs/debian/download_file?file_path=casper-client_0.9.3-0_amd64.deb curl -JLO https://bintray.com/casperlabs/debian/download_file?file_path=casper-node-launcher_0.3.1-0_amd64.deb sudo apt install -y ./casper-client_0.9.3-0_amd64.deb ./casper-node-launcher_0.3.1-0_amd64.deb sudo -u casper /etc/casper/pull_casper_node_version.sh 1_0_0 delta-11 sudo -u casper /etc/casper/config_from_example.sh 1_0_0 # After genesis a trusted hash is needed in config.toml. This retrieves and loads it. Please verify by looking at the top of /etc/casper/1_0_0/config.toml sudo sed -i "/trusted_hash =/c\trusted_hash = '$(curl -s 18.144.176.168:8888/status | jq -r .last_added_block_info.hash | tr -d '\n')'" /etc/casper/1_0_0/config.toml # If you DO NOT have keys yet, you can create them with this. KEEP YOUR KEYS. sudo -u casper casper-client keygen /etc/casper/validator_keys sudo logrotate -f /etc/logrotate.d/casper-node sudo systemctl start casper-node-launcher; sleep 2 systemctl status casper-node-launcher

Upgrade your node to 0.9.4

Stage the Upgrade on your node. Do NOT shut down or restart your node. This upgrade will take place at Era 34.

 

Detailed List of Changes

1263 - NO-TICKET: Include chainspec version in handshake

------------------------------------------
This introduces a protocol version field into the handshake, which is ignored by the V1.0.0 node. At the same time, if absent, V1.0.0 is filled in.
As a result, every version of the release node software has a correct protocol version field.

-----------------------------------------

1258 - NO-TICKET: limit deploy size to 1MiB

-----------------------------------------
This PR limits the deploy size, both when accepting one in the node, and when creating one in the client.

-----------------------------------------

1256 - NO-TICKET: Limit message size in chainspec

----------------------------------------

This ensures that nodes are in agreement about what the maximum message size is through the chainspec.

-----------------------------------------

1221 - EE-1207: make definition of system account AccountHash consistent

----------------------------------------
This change will change the AccountHash bytes of the system account to: blake2b(b"system0") (as defined by AccountHash::from_public_key)

----------------------------------------

1218 - NDRS-1053: Introducing Protection Against Replay Attacks

----------------------------------------

If the block validator receives a block with a deploy that was already included in the parent block, it does not detect and reject that replay attack

---------------------------------------

1216 - NDRS-1052: Reconstruct BlockProposerDeploySets state from the block storage.

-----------------------------------------

Instead of persisting the BlockProposerDeploySets to LMDB and loading in on startup, we recreate that state from the collection of finalized deploys

-----------------------------------------

1211 - NO-TICKET: Bugfix for Block Proposer

----------------------------------------

It was possible that handling an old finalized block would rewind the next_finalized value. This PR removes that possibility.

----------------------------------------

1208 - NDRS-1051: Use highest block as an init state for components when no syncing is performed.

-----------------------------------------

All components use LinearChainSync's last known block as an initial state. In the case when there's was syncing performed they failed to initialize properly. We need to return the highest block

------------------------------------------

1206 - NDRS-{1050,1051}: Delta-11 fixes

---------------------------------------

https://casperlabs.atlassian.net/browse/NDRS-1051 https://casperlabs.atlassian.net/browse/NDRS-1050 LinearChainSync does no longer consider State::None as a trigger for finishing syncing. When downloading.

----------------------------------------

1193 - NO-TICKET: Add more logging to track block proposals.

----------------------------------------

This adds INFO-level logs for receiving and validating proposed blocks, and whenever we send a witness unit in a round where we didn't receive a block. Backport of #1191 to 0.9.5.

---------------------------------------

1188 - NO-TICKET: fix issue for deploy validation in deploy acceptor.

----------------------------------------

This PR fixes an issue introduced when the Source enum was extended to hold a third variant.

-----------------------------------------

1180 - OP-1919: Renaming contract_as from @casper/contract to casper-contract.

-----------------------------------------

This PR fixes assemby script publishing.

-----------------------------------------

1187 - OP-1913: new apt repo.

-----------------------------------------

This PR adds new prod apt repo on tag.

-----------------------------------------

1173 - HWY-272: Log oldest seen panorama when syncing.

-----------------------------------------

This PR adds logging of the oldest (lowest sequence number) unit seen per validator while syncing.
Shows the progress of synchronization per validator.

-----------------------------------------

1172 - HWY-271: Log synchronizer queue size.

----------------------------------------

This PR Adds a new timer TIMER_ID_SYNCHRONIZER_QUEUE that is recreated every 5 seconds for every unfinalized era.
Upon handling the timer, lengths of synchronizer

-----------------------------------------

1169 - EE-1204: add activate-bid client contract

-----------------------------------------

This PR adds an activate-bid client contract, that: - compiles to activate_bid.wasm, - takes a single argument named validator_public_key,
and must be deployed using the validator keys in question.

-----------------------------------------

1167 - NO-TICKET: avoid exiting if overwriting execution results with different ones.

-----------------------------------------

This PR changes the behaviour of the storage component to avoid returning an error in the case where we overwrite execution results with a different value.
There is no requirement for repeated executions.

----------------------------------------

1166 - NO-TICKET: Only hard-reset blocks with old protocol versions.

-----------------------------------------

The idea behind hard-reset is to ignore blocks that might have been created in to-be-upgraded eras before an upgrade.
If blocks were legitimately created after an upgrade, we shouldn't be trying to forget them.

-----------------------------------------

1152 - NDRS-1028: Optimize handling of finality signatures in the linear chain component.

-----------------------------------------

This PR makes a couple of changes that optimize how finality signatures are being handled by the node: - we gossip finality signatures created only by our node
-we validate the cryptographic signature at the end (as it's the most expensive test)validator reactor will inform LinearChain when a already-exected block is finalized,
so that LinearChain can update its view about the tip of the chain and handle IsBonded queries properly.

-----------------------------------------

1149 - EE-1203: Validate delegated amount backport.

-----------------------------------------

This PR is a Ref: Backport of #1147 into a release branch

----------------------------------------

1146 - NDRS-1029: Restore block proposer state correctly backport.

-----------------------------------------

This is a backport of #1145.

-----------------------------------------

1125 - NO-TICKET: use actual exit code returned by validator reactor

-----------------------------------------

This PR fixes an issue where the exit code returned by the validator reactor is ignored. It also borrows code from #1070 which ensures all destructors are run before exiting `main`

-----------------------------------------

1129 - NDRS-1003: do not panic on dropped responder

-----------------------------------------

Instead of crashing, quietly sweep a missing response under the rug. This will prevent us crashing on harmless drops, at the cost of potentially not crashing on an important one. Be extra vigilant for ERROR-level log entries.

-----------------------------------------

1128 - HWY-264: Extract `RoundSuccessMeter` constants to configuration file.

-----------------------------------------

-----------------------------------------

1126 - HWY-267: Use higher stakes in test to catch overflow issues.

-----------------------------------------

This would have caught the overflow in HWY-267

-----------------------------------------

1123 - HWY-267: Fix arithmetic overflow. (Backport to 0.9.2)

-----------------------------------------

When determining whether enough nodes are online, we can't use

```

    (total_weight + target_ftt) / 2

```

because `total_weight` could already be close to `u64::MAX`.

-----------------------------------------

1033 - NDRS-928/929: Introducing fetchers for block headers

-----------------------------------------

1120 - NO-TICKET: register runtime memory estimator in joiner reactor

-----------------------------------------

This PR fixes an omission to register the runtime memory metric in the joiner reactor.

-----------------------------------------

1118 - NDRS-1007/OS supplied test port

-----------------------------------------

This hopefully reduces the number of collisions of random ports **in tests** by using OS allocated ports instead of truly random ones. This relies on the technically unspecified, but widely implemented (especially on Linux) property that requested "unused" ports are randomly selected.

A few random tests showed a floor of at least a few hundred port numbers before hitting a duplicate, so I am hopeful that this will  not hit many duplicates.

**This should not affect any production code**, all changes are contained to files that are gated behind `#[cfg(test)]`

-----------------------------------------

1115 - NDRS-1010: Don't create a new era when we should shutdown for an upgrade.

-----------------------------------------

-----------------------------------------

1114 - NDRS-893: Make the syncing process not depend on the Era Supervisor

-----------------------------------------

This rewires events used during syncing so that they do not have to pass through the Era Supervisor anymore:

  • removes `ConsensusRequest::HandleLinearBlock`

  • removes `ConsensusAnnouncement::Handled`

  • makes `LinearChainSync` progress on either `LinearChainAnnouncement::BlockAdded` or `BlockExecutorAnnouncement::BlockAlreadyExecuted` (a new announcement type)

  • adds `ConsensusAnnouncement::CreatedFinalitySignature`, triggered by `LinearChainAnnouncement::BlockAdded` and replacing the response to `ConsensusRequest::HandleLinearBlock` for the purposes of collection of finality signatures.

-----------------------------------------

1113 - NO-TICKET: remove failed bootstrap address from pending set

-----------------------------------------

This PR effectively reverts [0dd0fdd]( ) which created an issue whereby failed bootstrap connections would live forever in the small_network's `pending` set, meaning these bootstrap peers could never be connected to in that session.

-----------------------------------------

1112 - Update cbindgen dependency

-----------------------------------------

REF:

CHANGELOG:

  • Updated `cbindgen` build dependency in `casper-client` from `0.15` to the latest version `0.18`

-----------------------------------------

1092 - EE-1131: Get rid of RootNotFound

-----------------------------------------

Ref:

This PR removes specialized "RootNotFound" struct-error which was moved into `engine_state::error::Error` as a separate variant.

Since RootNotFound is not a special case error anymore and now changed methods shares the same error type with other call sites there is still room for improvement in the error handling.

-----------------------------------------

1089 - EE-1196: pad serialized repr of Key::EraInfo

-----------------------------------------

This PR changes the serialized representation of `Key::EraInfo`, ensuring that this keys has a consistent length with the other key variants.  This is done for the sake of maintaining trie integrity.

-----------------------------------------

1109 - NO-TICKET: Limit not in scope on osx

-----------------------------------------

PR fixes building casper-node on target osx by not setting constant TARGET_OPEN_FILES_LIMIT

-----------------------------------------

1104 - NO-TICKET: Fix Clippy warnings, formatting and remove a redundant argument.

-----------------------------------------

Formatting in `linear_chain_sync.rs` was broken — if it can't fix it, `rustfmt` won't touch it —, there were Clippy warnings in that file, and `BlockAdded` had a redundant `block_hash` argument: Since the `Block` contains its hash and doesn't need to recompute it, this is not needed.

(Found while working on [NDRS-892]( ).)

-----------------------------------------

1103 - NO-TICKET: improve gossiper logging

-----------------------------------------

This PR adds debug-level logging to the gossiper component and the gossip table.

It also adds a new variant `Ourself` to the `Source` enum to account for cases where the current node generates gossip items, for example when gossiping its own public address.

-----------------------------------------

1100 - NDRS-983: Update rand, rand_chacha, rand_pcg

-----------------------------------------

REF:

CHANGELOG:

  • Updated the `rand`, `rand_chacha` and `rand_pcg` crates within the project

  • Refactored to account for updates in rand dependency

-----------------------------------------

1081 - NO-TICKET: Deduplicating trie store integrity check code

------------------------------------------

1106 - [Delta] NDRS-963: chainspec loader now gets the protocol version from the highest

-----------------------------------------

Ports commit from `release-0.9.1` branch to `release-0.9.2`.

-----------------------------------------

1099 - NO-TICKET/reconnect at all costs big (bigger changeset)

-----------------------------------------

This builds upon #1095 and is a larger changeset, attempting to be even more robust and performant. It changes substantially more code, so more testing on a large scale would be required for this one to merge.

-----------------------------------------

1105 - NDRS-963: chainspec loader now gets the protocol version from the highest block.

-----------------------------------------

1108 - NO-TICKET: Fix hex issue

-----------------------------------------

"hex" crate likely got updated as part of other batched deps update and `hex::encode` in newer version is hidden behind a feature switch. This PR fixes `cargo publish` failure that occurs in

```

   Compiling casper-types v0.9.0 (/drone/src/target/package/casper-types-0.9.0)

error[E0425]: cannot find function `encode` in crate `hex`

  --> src/cl_value/jsonrepr.rs:58:30

   |

58 |             Some((json![hex::encode(bytes)], remainder))

   |                              ^^^^^^ not found in `hex`

```

-----------------------------------------

1093 - [Delta] NDRS-1006: Do not fail sync if we run out of peers before we download anything.

-----------------------------------------

1091 - NDRS-1006: Add timeout-based sync failure.

-----------------------------------------

Instead of failing when we run out of peers before we manage to synchronize _any_ linear chain block, we will wait up to 5 minutes (same as in consensus). When we run out of peers, after we started syncing blocks, we will fail and exit. The behavior has been modified only for the "initial sync".

As part of the work in this PR, I've also removed some of the `panic!` calls from the `LinearChainSync` and replaced them with calls to `fatal!` macro that should allow the node to drop all components cleanly.

-----------------------------------------

1087 - NDRS-1005: Mac OS X build fixes

-----------------------------------------

This fixes builds on Mac OS X, whose users will have to live without automatic ulimit adjustments. It has been compiled successfully by @momipsl

-----------------------------------------

1084 - NDRS-1000/Restrict private key permissions

-----------------------------------------

This change ensures that private keys generated by the casper-client are only read/writeable by the owner. Since keys are commonly generated using root, they are protected against regular user access this way.

**Note**: The documentation needs to be updated to reflect this (keys need to be either generated as `casper` or `chown`ed).

-----------------------------------------

1086 - NO-TICK :: NCTL :: custom accounts.toml

-----------------------------------------

@AlexanderLimonov requested that NCTL be updated to support custom accounts.toml so as to simplfiy testing different stake/delegation scenarios.  The `nctl-assets-setup` command now supports an optional parameter `accounts_path`.  If unspecified then the accounts.toml is generated as now, however if specified then it is copied and the public keys injected.

This is a copy of the **expected** format of a custom accounts.toml file:

```# FAUCET.

[[accounts]]

public_key = "PBK_FAUCET"

balance = "1000000000000000000000000000000000"

# VALIDATOR 1.

[[accounts]]

public_key = "PBK_V1"

balance = "1000000000000000000000000000000000"

[accounts.validator]

bonded_amount = "1000000000000001"

delegation_rate = 1

 

# VALIDATOR 2.

[[accounts]]

public_key = "PBK_V2"

balance = "1000000000000000000000000000000000"

[accounts.validator]

bonded_amount = "1000000000000002"

delegation_rate = 2

# VALIDATOR 3.

[[accounts]]

public_key = "PBK_V3"

balance = "1000000000000000000000000000000000"

[accounts.validator]

bonded_amount = "1000000000000003"

delegation_rate = 3

 

# VALIDATOR 4.

[[accounts]]

public_key = "PBK_V4"

balance = "1000000000000000000000000000000000"

[accounts.validator]

bonded_amount = "1000000000000004"

delegation_rate = 4

 

# VALIDATOR 5.

[[accounts]]

public_key = "PBK_V5"

balance = "1000000000000000000000000000000000"

 

[accounts.validator]

bonded_amount = "1000000000000005"

delegation_rate = 5



# VALIDATOR 6.

[[accounts]]

public_key = "PBK_V6"

balance = "1000000000000000000000000000000000"



# VALIDATOR 7.

[[accounts]]

public_key = "PBK_V7"

balance = "1000000000000000000000000000000000"



# VALIDATOR 8.

[[accounts]]

public_key = "PBK_V8"

balance = "1000000000000000000000000000000000"



# VALIDATOR 9.

[[accounts]]

public_key = "PBK_V9"

balance = "1000000000000000000000000000000000"



# VALIDATOR 10.

[[accounts]]

public_key = "PBK_V10"

balance = "1000000000000000000000000000000000"



# USER 1.

[[delegators]]

validator_public_key = "PBK_V1"

delegator_public_key = "PBK_U1"

balance = "1000000000000000000000000000000000"

delegated_amount = "1000000000000001"



# USER 2.

[[delegators]]

validator_public_key = "PBK_V2"

delegator_public_key = "PBK_U2"

balance = "1000000000000000000000000000000000"

delegated_amount = "1000000000000002"



# USER 3.

[[delegators]]

validator_public_key = "PBK_V3"

delegator_public_key = "PBK_U3"

balance = "1000000000000000000000000000000000"

delegated_amount = "1000000000000003"



# USER 4.

[[delegators]]

validator_public_key = "PBK_V4"

delegator_public_key = "PBK_U4"

balance = "1000000000000000000000000000000000"

delegated_amount = "1000000000000004"



# USER 5.

[[delegators]]

validator_public_key = "PBK_V5"

delegator_public_key = "PBK_U5"

balance = "1000000000000000000000000000000000"

delegated_amount = "1000000000000005"



# USER 6.

[[accounts]]

public_key = "PBK_U6"

balance = "1000000000000000000000000000000000"



# USER 7.

[[accounts]]

public_key = "PBK_U7"

balance = "1000000000000000000000000000000000"



# USER 8.

[[accounts]]

public_key = "PBK_U8"

balance = "1000000000000000000000000000000000"



# USER 9.

[[accounts]]

public_key = "PBK_U9"

balance = "1000000000000000000000000000000000"



# USER 10.

[[accounts]]

public_key = "PBK_U10"

balance = "1000000000000000000000000000000000"

```

-----------------------------------------

1079 - FEAT-303: Batched deps update

-----------------------------------------

Ref:

Ref:

  • Removes unused `directories`

  • Bumped smallvec

-----------------------------------------

1076 - EE-1193: Update wasmi to 0.7

-----------------------------------------

Ref:

  • Updates wasmi to 0.7

  • pwasm-utils to 0.16

  • Fixes transfer benchmark

  • Fixes typos in code that were present in wasmi 0.6 and which were also propagated to our code (comparision vs comparsion)

  • Explicit default wasm module of a gas function

Benchmark results against dev (with 67d8b2370cc4d62d5b8cc619a4f750fbcfc1c69c commit cherry picked)

-----------------------------------------

1085 - NO-TICKET: Simplify linear_chain.

-----------------------------------------

This fixes rustfmt and removes some unnecessary `Event` variants.

(Found in preparation of [NDRS-892]( ).)

-----------------------------------------

854 - NO-TICKET/configurable broadcast test

-----------------------------------------

This PR allows tweaking the parameters of a built-in test from the commandline (via envvars) if desired, to avoid the considerable recompilation time.

-----------------------------------------

1034 - NDRS-931: clean shutdown on fatal

-----------------------------------------

This change introduces a special announcement called `ControlAnnouncement`, which can be used to propagate requests for runtime changes upwards

This eliminates the need to `panic!` and makes it possible to shut down the reactor cleanly on a `fatal` error, instead of panicking.

-----------------------------------------

1073 -  EE-1192: store unbonds under Key::Withdraw

-----------------------------------------

This PR removes the `UnbondingPurses` map stored under the auction's `UNBONDING_PURSES_KEY` named key and instead persists bids directly in the state trie under `Key::Withdraw` keys.

-----------------------------------------

1077 - NDRS-974: Get rid of failure

-----------------------------------------

Ref:

Removes failure and uses optional thiserror for std case, and for no_std (i.e. wasm32 target) is hidden behind cfg_attr. This complication happens because thiserror does not support no_std upstream but a PR is pending

-----------------------------------------

1068 - NDRS-966: Fix retrieval of booking block hashes for eras initialized after restart.

-----------------------------------------

Fixes retrieval of booking block hashes for eras initialized after the restart.

-----------------------------------------

1066 - EEE-1188: Restore delegator slashing

-----------------------------------------

Ref:

  • Sets all delegator stakes to 0 for slashed validator

  • Adds a test that ensures delegators of a validator have their stake set to 0 after slashing

-----------------------------------------

1051 - NDRS-947: RFC6979 Compliant Signatures

-----------------------------------------

This PR upgrades the `k256` library to use deterministic signatures conforming to [RFC6979][1]

[1]: https://tools.ietf.org/html/rfc6979

-----------------------------------------

1074 - NO-TICKET: Faster trie integrity checks

-----------------------------------------

1075 - NO-TICKET: Remove a redundant InitializeEras argument.

-----------------------------------------

1065 - typedoc upgrade to 0.19.1

-----------------------------------------

upgraded typedoc to not-latetst version but dependency version (highlight.js) is no longer giving alert about EOL.

@mpapierski please check that this version generates proper documentation :)

 

-----------------------------------------

1067 - NDRS-963: chainspec loader now gets the protocol version from the highest block

-----------------------------------------

Ref:

This PR fixes an issue whereby a restarting node on a network which has upgraded would call the contract runtime's `commit_upgrade()` with an incorrect `current_version`.  Rather than storing the protocol version in storage and using that on restart, we now use the protocol version from the highest block now that it is available to us.

The PR also temporarily disables the trie store check as it is too slow to support as is.  It will be re-enabled in some form once a decision on how to address this issue permanently has been made.

-----------------------------------------

1064 - OP-1882: refactor itst scenarios

-----------------------------------------

Moves common functions used in itst scenarios into a common sourceable script.

-----------------------------------------

1052 - NDRS-955: Make tests include unbonding and dropping eras.

-----------------------------------------

This changes the configuration used in the reactor tests so that the 5-era tests cause eras to become unbonded and dropped in the era validator.

This would have made the tests catch the bug fixed in .

-----------------------------------------

1062 - NO-TICKET: change activation point to represent era ID or genesis timestamp

-----------------------------------------

This PR unifies the genesis timestamp and upgrade activation point into a single enum type.

During a discussion with @EdHastingsCasperLabs, it was noted that genesis timestamps for all chainspecs after the genesis one become meaningless and could be omitted.  Conceptually, the genesis timestamp can be considered the activation point for the first version, hence it seems natural to absorb it into the activation point type

-----------------------------------------

1063 - NO-TICKET: fix gossip metrics

-----------------------------------------

This PR fixes the gossiper metrics, some of which are fairly useless at the moment.

  • `items_received` now correctly represents the total of all gossip items received, whether passed to the component by a client, by a different component (e.g. the small network in the case of starting a new round of gossiping its own address) or by a peer gossiping it.

  • `items_gossiped_onwards` has been replaced by `times_gossiped` and now represents the total number of outbound gossip messages the node has sent.

It also standardises the unregistering of metrics from the Prometheus registry to remove the risky calls to `expect` in the `Drop` impls of many of the metrics structs.  If there are objections to the introduction of a macro to achieve this, I would be happy to change it back to normal function calls.

Tagging @sacherjj & @TomVasile for info.

-----------------------------------------

1056 - OP-1857: NCTL - Validator Ejection Scenario

-----------------------------------------

Implements itst13 from .



Also refactor nightly ci script to take a non-default chainspec.



-----------------------------------------

1060 - NO-TICK :: NCTL :: Auction bid regression fix

-----------------------------------------

  1. Updated auction bid delegation rate to u8.

-----------------------------------------

1058 - EE-1191: reduce footprint of SeigniorageRecipient

-----------------------------------------

This PR replaces the `Delegator` values in the `SeigniorageRecipient` map with stake values, which are all that are necessary for users of this structure.

-----------------------------------------

1039 - NDRS-927: work around blocks not holding protocol version

-----------------------------------------

Ref:



This PR is a workaround for the lack of protocol version in block headers.  Currently, when we restart after an upgrade from the delta network where the upgrade was a hard-reset, the joining node will start with a cached/stored version > 1.0.0.  When the second binary is started, this causes it to attempt to call the EE `commit_upgrade` passing the same version for the current and new protocols.



To get round this, we simply ignore the cached/stored version when calling `commit_upgrade`.  Instead we use a hard-coded `1.0.0` for the current version and the one provided in the chainspec as the new version.  This will need extended if we end up running 0.8.0 nodes on delta in order to be able to upgrade from those.  Hopefully this will not be needed, and it certainly won't be needed in master where we can avoid caching/storing the protocol version in the chainspec loader as it will be available in the block headers.



-----------------------------------------

1055 - EE-1190: remove entrypoint for read_seigniorage_recipients

-----------------------------------------

`Auction::read_seigniorage_recipients` was not being used other than in tests.  Keeping it as a public auction entrypoint presents challenges for iterating on the `SeigniorageRecipient` structure and related.  This PR removes it as a public entrypoint to enable future changes.

 

1054 - NDRS-946: Make sure Chainspec::hash is the same for everyone

-----------------------------------------

Ref:

Changes the way AccountsConfig is deserialized so accounts and delegators are always sorted. Adds a test case that ensures that even with different accounts.toml both Chainspec objects are equal.

-----------------------------------------

1037 - NDRS-944: Prevent panics on failed connection

-----------------------------------------

Fixes a very rare race condition where the node did not know how to handle a connection being dropped in the middle of being established. This has, so far, only been triggered once in the recent months, regardless this is a fix for it.

-----------------------------------------

1046 - NDRS-962: Add more stop conditions for syncing.

-----------------------------------------



This PR adds two new stop conditions for when a node can consider being sync'd with the chain:

  1. When a newly downloaded block has been created less than `max_round_length` ago. Works in situations when the network is running with the highest possible round exponent and otherwise there's a long list of known peers to ask for a new block.

  2. When a newly downloaded block is a switch block of the currently active era. Works in situations when the finalization takes more than the longest possible round and condition **1** wouldn't kick in.



-----------------------------------------

1053 - NO-TICKET: Use the era's earliest block to get activation era validators.

-----------------------------------------

This changes the logic for retrieving the validator set from the global state as discussed [here](https://github.com/CasperLabs/casper-node/pull/1023#discussion_r585640105).



-----------------------------------------

1048 - [Delta] NDRS-962: Stop syncing early.

-----------------------------------------

This PR adds two new conditions for when to stop syncing and transition to an active node:

  1. When the most recently downloaded block was created less than the longest possible round ago.

  2. When the last downloaded block was a switch block of a currently active era.



-----------------------------------------

1041 - NDRS-964: Remove outdated assertion on failed bootstrap connection

-----------------------------------------

The assertion in the code is causing crashes in the wild right now, as it is based on an otherwise harmless-if-failed assertion. It used to check for a double-deletion from a list of pending connections, but failing to remove the value should have no ill effects otherwise.



The code was built when we supported only a single initial node to connect to - either two nodes racing or a duplicate entry in the list of bootstrap are likely what could triggers this (although @sacherjj has not been able to reproduce the latter issue quickly).



-----------------------------------------

1042 - NDRS-964: (backport to 0.7.7) Remove outdated assertion on failed bootstrap connection

-----------------------------------------

Backport of



-----------------------------------------

1043 - NDRS-964: (backport to 0.8.0) Remove outdated assertion on failed bootstrap connection

-----------------------------------------

Backport of



-----------------------------------------

1050 - NO-TICKET: avoid panicking on handling get responses

-----------------------------------------

This PR removes a couple of `todo!`s which could allow a malformed or more likely malicious message to cause the node to panic.



-----------------------------------------

1023 - HWY-248: Get validator map from global state after genesis, an upgrade or a restart.

-----------------------------------------

After genesis, an upgrade or an emergency restart we cannot take the validator set from a key block, so we get it directly from the global state instead.



This is because era 0 does not have a key block, and for an emergency restart and possibly even for some upgrades we will make modifications to the validator set by directly updating the global state.





-----------------------------------------

1001 - NDRS-941 - Remove InsertedTrieKeyAndMissingDescendants

-----------------------------------------



-----------------------------------------

1047 - NO-TICKET: avoid panicking on handling get responses

-----------------------------------------

This PR removes a couple of `todo!`s which could allow a malformed or more likely malicious message to cause the node to panic.



-----------------------------------------

1045 - Genesis setup for mainnet-release-test-1 network.

-----------------------------------------

Setup accounts.toml for 4 genesis validating nodes and preloading bitgo's balance.

Changed finality_threshold_fraction to [1, 3] instead of [1, 10] to match the changes Andreas made to local.



Total supply: 10_000_000_000 . 000_000_000  CSPR



This will test first full release of the protocol version by CI.



-----------------------------------------

958 - NDRS-819: DB integrity check

-----------------------------------------

REF:



CHANGELOG:



  • Added a check in the intializtion of a reactor to check if the `missing_trie_keys` is empty. If it is not, the node will panic

  • Added a `pub` function to allow the reactor during initialization to get the current highest block from storage if it exists

  • Added a `pub` function within the contract runtime to allow for querying of the trie store



-----------------------------------------

1040 - OP-1879: nctl pass chainspec

-----------------------------------------

PR allows `nctl-assets-setup` to optionally take a chainspec_path as an argument. Continues to use old default path if not passed.



ie. ` nctl-assets-setup chainspec_path="/tmp/chainspec.toml.in"`



-----------------------------------------

1020 - NO-TICKET: Enable the "sync over upgrades" IT test.

-----------------------------------------

`master` branch is now ready for this test. I have also disabled the regular `sync_test` as the upgrade version tests the superset of the functionality.



-----------------------------------------

1036 - NO-TICKET: Participation log message: separate inactive from faulty

-----------------------------------------

Log inactive and faulty validators in separate lists.



-----------------------------------------

1038 - NO-TICKET: Fix era cleanup.

-----------------------------------------

The code accidentally cleaned up the current era instead of the old one.



-----------------------------------------

1035 - EE-1176: Rename ProofOfStake to HandlePayment

-----------------------------------------

Ref:



  • Renames occurences of ProofOfStake contract into a Handle Payment

  • Keys prefixed with "pos_" got their prefix removed

  • Some duplicated constants referring old proof of stake were removed and replaced with unified handle payment constants



-----------------------------------------

1018 - EE-1186: persist bids directly in state trie

-----------------------------------------

This PR removes the `Bids` map stored under the auction's `BIDS_KEY` named key and instead persists bids directly in the state trie under `Key::Bid` keys.  It also adds `RpcRequest::GetBids` (and related) in service of `get-auction-info`.



-----------------------------------------

1027 - NDRS-899: Set ulimit

-----------------------------------------

To address issues with networks with > 400 connections, set the open files limit (`ulimit -n`) at the startup.



If this fails, settle for the closest possible maximum. This code will never panic or abort, but warn if the limit cannot be increased.



-----------------------------------------

1026 - Revert "NDRS-925 block executor optimization (1/2)"

-----------------------------------------

Reverts CasperLabs/casper-node#1013



-----------------------------------------

1013 - NDRS-925 block executor optimization (1/2)

-----------------------------------------

This PR combines all messages and functionality from BlockExecutor into ContractRuntime, and represents step 1 of 2.



ref:



-----------------------------------------

1021 - NO-TICKET: fix issue in gossip table

-----------------------------------------

This PR fixes an issue in the gossip table whereby gossip items could avoid being moved to the `finished` or `paused` state, hence leaving the item in the `current` state indefinitely, blocking any further attempts to handle gossip for that item.



We have a termination condition of knowing about `x` peers which hold the data in question, `x` being configurable and set to 15 currently.  We could reach this termination condition in a few different ways:

  1. by receiving a response from a peer we gossiped the item to

  2. by timing out a response we never got from a peer we gossiped the item to

  3. by receiving the item as a gossip request from a peer



The issue is that we currently only move an item from `current` to `finished` or `paused` when handling situation 1.  Situation 2 was assumed to be unneeded as that should trigger a fresh attempt to gossip to a different peer, and _that_ response would eventually be received or a different peer chosen, and so on.



However, if in the meantime we received enough gossip requests from peers to reach the termination condition (situation 3), then when the timeout was triggered, we would recognise that we should no longer gossip this item, and no further gossip request was sent.  This broke the assumption that we would eventually handle a response from a peer.



To fix this, I have updated the logic to move an item to the `finished` state from `current` (or `paused`) when we reach the termination condition in all three of these scenarios.



-----------------------------------------

967 - NDRS-927: backport fixes from release branch

-----------------------------------------

Ref:



This PR backports a couple of fixes to the upgrade process applied to the `release-0.8.0` branch.



-----------------------------------------

1016 - NDRS-942: Delegation rate for validators in accounts.toml

-----------------------------------------

Ref:



This PR changes the structure of accounts.toml to separate `bonded_amount` so `delegation_rate` could be a part of it. If `[accounts.validator]` field in TOML is not specified for given array element, then such account would be normal user without stake. Otherwise it will be considered an account with a stake.



Thanks to this separation of stake related attributes both `bonded_amount` and `delegation_rate` can be properly validated.



-----------------------------------------

1019 - NDRS-945: Compute instance IDs from chainspec hash and era ID.

-----------------------------------------

Don't use the state root hash for computing new era's instance IDs anymore: It's unnecessary since the chainspec and era ID should make it unique, and it's not necessarily available at that point in the code.



(It is still important that all instance IDs are unique: If you participate with the same key in two different instances with the same ID, your messages could be combined to provide a valid proof of an equivocation.)





-----------------------------------------

1011 - NDRS-927: support flexible handshake for delta and upgraded delta nodes

-----------------------------------------

Ref:



This PR re-introduces the relaxation of the network handshake message.  However to ensure it is compatible with 0.7.6 nodes currently running (which require the handshake to provide the chainspec hash), the handshake message has been updated to hold the chainspec hash and the network name.



The change is required in order to support future potential upgrades to the delta network.  For example, a new user would need to run this version of the node to initially join an upgraded delta network, and so the node must be able to communicate with nodes at a newer protocol version.  This would not be possible if we used the chainspec hash to handshake as the protocol version difference would be reflected in the hash, and the nodes would refuse to remain connected.



Nodes will now provide both pieces of data.  Old 0.7.6 nodes will be able to parse this message, silently ignoring the new `network_name` field.  New nodes will deserialize old nodes' handshakes such that the `network_name` is defaulted to an empty string.



On receipt of a handshake message, the nodes now favour checking the `network_name` and fall back to checking the `genesis_config_hash` only if the `network_name` is empty (indicating the handshake was sent from an old 0.7.6 node).



I tested via nctl that a network running this code connects correctly, and also that a single node running this code can remain connected to a network running the 0.7.6 nodes.



-----------------------------------------

1012 - EE-1185: add TrackingCopy::get_keys

-----------------------------------------

This PR adds `get_keys` method to TrackingCopy which reads through the cache to `StateReader::keys_with_prefix`.



The caching behavior is marginally different than how we handle key-value pairs: cached writes must be unioned with reads rather than replace them.



-----------------------------------------

963 - Update Readme

-----------------------------------------

After recent changes and observing community use of the node, we need to state that the node doesn't really run well by itself.



-----------------------------------------

1015 - NO_TICK: fix region

-----------------------------------------

 

-----------------------------------------

1014 - NO-TICKET: Wait a bit shorter after an upgrade.

-----------------------------------------

Instead of waiting 2 eras we can wait 1.



-----------------------------------------

1006 - OP-1853: fix upload to genesis s3

-----------------------------------------

Switches from `upgrade_package_s3_storage.sh` wrapper script to drone s3 plugin.



Reconfigures build wrapper to output into a protocol dir. Borrowed this logic from the `upgrade_package_s3_storage.sh` wrapper.



-----------------------------------------

988 - OP-1840: single doppleganger scenario

-----------------------------------------

Implements itst11 from .



Bumps finality_threshold_fraction: 1/10 -> 1/3





-----------------------------------------

979 - HWY-257: Clear the protocol state of unbonded eras.

-----------------------------------------

All bonded eras are kept in memory because we still need to handle messages for them and detect equivocations.

However, since each era can refer to evidence from previous eras for cross-era slashing, even eras older than that are kept in memory, so that that evidence can be validated. This PR clears the protocol state of all unbonded eras and retains only evidence, to free up the memory. The dropped information is not needed anymore, since evidence cannot have any dependencies.

This should reduce consensus memory usage by almost 50%.





-----------------------------------------

955 - NDRS-835: Handle upgrade points in the node

-----------------------------------------

This code was actually written as a means to enable upgrades on Delta, but it covers the issues [NDRS-835]( ) was about.



Summary:

  • The Era Supervisor now initializes all eras based on the switch blocks, except era 0, which is initialized based on genesis data.

  • The Era Supervisor is constructed with the current era set to the era of the highest known block, or if it's a switch block, to it's era increased by 1.

  • Linear Chain Sync only goes as far back as the highest known block (taken from the Chainspec Loader) when syncing up to the trusted hash; if it hits a stored block that isn't the highest known block, it assumes that the trusted hash supplied was _below_ the highest known block and starts synchronizing descendants of the highest known block.

  • The Block Executor doesn't start from genesis, but is initialized with data from the Chainspec Loader. This is important for proper handling of changes to the global state made by `commit_upgrade` - for the block immediately after the upgrade, the pre-state-hash can't be assumed to be the post-state-hash of the previous block.



-----------------------------------------

1009 - EE-1184: add StateReader::keys_with_prefix

-----------------------------------------

This PR adds a `keys_with_prefix` method to `StateReader`.



This is yet another move towards optimizing the way bids are stored in the auction.  It will be used to read all of the keys in the `Key::Bid` keyspace.



-----------------------------------------

989 - EE-1181: add public key fields to auction::{Bid,Delegator}

-----------------------------------------

This PR adds public key fields to `auction::{Bid, Delegator}`.



In a future PR, bids will be stored under the account hash of the validator public key, so this field ensures that the public key remains associated with the bid.  It is added to `Delegator` for consistency.  We also rename `delegatee` to `validator_public_key`.



-----------------------------------------

1008 - NO-TICKET: revert handshake change

-----------------------------------------

This PR reverts the recent relaxation of the network handshake process in order to allow v0.7.7 nodes to communicate with v0.7.6 nodes.



-----------------------------------------

1005 - EE-1172: Delegators vesting schedule

-----------------------------------------

Ref:

Ref:



This PR adds vesting schedule to genesis delegators which has similar behavior to vesting schedule of genesis validators. This PR also modifies genesis process which will create entries for each defined delegator in `accounts.toml`.



-----------------------------------------

971 - NDRS-857/sample memory metrics in consensus

-----------------------------------------

Reduces heap measuring of large collections by sampling only a subset of their contents.



-----------------------------------------

987 - EE-1180: add Key::Bid

-----------------------------------------

This PR adds a new `Bid` variant to the `Key` type, under which we will store values of type `Bid`.



This precedes upcoming changes to how bids are persisted in the auction module.



-----------------------------------------

1003 - Backport the change to make handshake depend on network name.

-----------------------------------------

Handshake cannot use the chainspec hash anymore since post-upgrade nodes

will be using different chainspec from the joining node (which hasn't

upgraded yet).



-----------------------------------------

985 - EE-1179: deactivate bids instead of removing them

-----------------------------------------

This PR updates the auction module to disable fully-unstaked and slashed bids instead of removing them from the bids map.



This precedes upcoming changes to how bids are persisted in the auction module.



~**NOTE**: This PR depends on #984.~ (MERGED)



~**Actual diff here**: https://github.com/henrytill/casper-node/compare/EE-1178...henrytill:EE-1179~



-----------------------------------------

998 - NO-TICKET: Backport of PR for upgrades + a fix

-----------------------------------------

This backports commits from #955 that were created to address review comments (all commits apart from the last one) and adds a fix for a bug in era initialization.



-----------------------------------------

1002 - NDRS-897 fixup: fix conversion to EE format

-----------------------------------------

The chainspec loader was doing an unnecessary base64 decoding when preparing an `UpgradeConfig` struct (it's already being done when parsing the chainspec) - this is removing it.



-----------------------------------------

997 - NDRS-939: Add a delay before shutdown due to too many equivocations.

-----------------------------------------

If the total weight of equivocators exceeds the configured fault tolerance threshold, consensus cannot continue and the node shuts down. This PR adds a delay for the shutdown so we can still broadcast evidence of the equivocations.





-----------------------------------------

992 - EE-1183: Added Property Testing Around Keys and Stored Values

-----------------------------------------

Ref:



This PR



  • extends property testing coverage of `Key`s and `StoredValue`s



-----------------------------------------

994 - NDRS-940: Do not return any effects after sync done.

-----------------------------------------

@fizyk20 found a bug in my code where it would replace the `self.state` with `curr_state` from before `mark_done()`.



We return `Effects::new()` (no effects) to stop the syncing process and let the reactor progress from joiner to validator.



-----------------------------------------

974 - NDRS-897: Implement global state upgrade file

-----------------------------------------



-----------------------------------------

993 - NDRS-940: Stop sync after very recent block.

-----------------------------------------

We used to mark syncing as done if none of the peers gave us any new block (successor of the latest block we downloaded). This proves to be problematic when we have many peers and they don't respond to us in time, before the next block is created. This way we end up being stuck in a syncing loop.



This PR considers newly downloaded block to be the tip of a chain if it was created less than 1 minute ago.



-----------------------------------------

991 - NO-TICKET: clean up client test output

-----------------------------------------

This PR directs output for the client functions `make_deploy()` and `sign_deploy()` to a [`std::io::Sink`](https://doc.rust-lang.org/std/io/fn.sink.html) rather than stdout when in test configuration.  This avoids cluttering the client test output.



-----------------------------------------

984 - EE-1178: distribute rewards then slash

-----------------------------------------

This PR changes the order of operations in `EngineState::commit_step` so that we distribute rewards before slashing.



This precedes upcoming changes to how bids are persisted in the auction module.



-----------------------------------------

986 - NO-TICKET: clean up Key::Balance

-----------------------------------------

This PR is a followup to to #960.  It addresses a few missing bits, typos, etc..



-----------------------------------------

982 - NO-TICKET :: NCTL :: Enhanced compilation & logging.

-----------------------------------------

  1. Added `NCTL_COMPILE_TARGET` flag to modify `nctl-compile` command.  Defaults to `release` but developer can set it to `debug` in order to compile `casper-node, casper-node-launcher & casper-client` in debug mode.



  1. Added `NCTL_NODE_LOG_FORMAT` flag.  Defaults to `json` but developer can set it to `text` in order to instruct `casper-node` to emit log messages in text format.



  1. Also prepared ground for adding delegators to accounts.toml at a later date.



-----------------------------------------

977 - OP-1844: publish contract-as on tag

-----------------------------------------

Turns on the publishing of `@casper/contract`





-----------------------------------------

973 - NO TICK: Adding in dev as branch target for CI.

-----------------------------------------

Turning this on prior to dev branch cut.



-----------------------------------------

972 - NDRS-880: Add an integration test for a node syncing with upgraded network.

-----------------------------------------

 

-----------------------------------------

981 - NDRS-933: Make delegator entries optional.

-----------------------------------------

Ref:



This PR makes `[[delegators]]` entries in `accounts.toml` optional.



-----------------------------------------

980 - NO-TICKET :: NCTL :: Users are delegators

-----------------------------------------

  1. Each test user account is now a delegator by default.



-----------------------------------------

978 - NDRS-913: Push whole block to the event stream.

-----------------------------------------



moved `deploy_hashes`, `transfer_hashes` and `proposer` from the `BlockHeader` structure to the new `BlockBody`. Up until now, we've been pushing only `BlockHeader` to the event stream, which means that since #892 got merged those three were missing from the event stream events. This PR changes what gets pushed to the event stream – we're now pushing the whole `Block`.



The main differences are in the structure of the event. Instead of `block_header` field containing `BlockHeader` structure, there's now a `block` field with `Block` struct. Structure of the `Block` can be found [here](https://github.com/CasperLabs/casper-node/blob/master/node/src/types/block.rs#L1023).



-----------------------------------------

976 - NO TICKET: increase number of buckets for contract_runtime metrics

-----------------------------------------

Ported from master.



-----------------------------------------

959 - OP-1837: NCTL - validator node shutdown >35% weight and resume

-----------------------------------------

Implements itst02 from .



Test Run: https://drone-auto.casperlabs.io/TomVasile/casper-node/51/1/2



-----------------------------------------

960 - EE-1168: refactor Mint to remove use of named keys

-----------------------------------------

Ref:



This PR

  • introduces a `Key::Balance` variant, under which balance values are stored.  These values are only readable and writable by host-side code.

  • removes the various URefs used for indirection in the mint code.

  • simplifies the structure of balance proofs now that the indirection is gone.

 

-----------------------------------------

964 - NO TICKET increase number of buckets for contract_runtime metrics

-----------------------------------------

Increase the number of buckets for our `contract_runtime` histograms. The old value resulted in values being skewed to 320ms exactly. I'm leaving a note that the last bucket before a similar cutoff would occur at 10.24 seconds as a result of our math here. I tested this in my environment and the metric appears to be fixed.



-----------------------------------------

969 - NO-TICKET/Improve libp2p network memory metrics

-----------------------------------------

This PR rolls up a few things:



  • Completes the memory metrics for the `networking` component, including adding a special counting channel that makes it possible to inspect queues.

  • Adds debug-metrics to the libp2p component that track the number of futures created.

  • Fixes a few bugs in metrics reporting (some still present) for memory in the validator.

  • Improves/fixes the `nctl-utils` prometheus metrics setup.



Almost all changes are confined to `components::network`, thus should have little impact on production.



-----------------------------------------

968 - NDRS-711: add delegators to accounts.toml

-----------------------------------------

This PR adds delegators to accounts.toml





-----------------------------------------

970 - NDRS-887: Enable test_joiner again.

-----------------------------------------

The test used to be flaky, but it just passed 60 times in a row for me, so the problem seems to be fixed.





-----------------------------------------

962 - NDRS-501: avoid unnecessary panics in casper-client

-----------------------------------------

Ref:



This PR is a joint effort by @darthsiroftardis and myself to replace panics in the casper-client with errors where these are not indicative of a programming error.  The result is simpler, clearer reporting to the user in cases of operator error.



-----------------------------------------

965 - NO-TICKET: Fix `nctl` scripts.

-----------------------------------------

broke `nctl` scripts – it used `staked_amount` where `bonded_amount` was [expected](https://github.com/CasperLabs/casper-node/blob/master/node/src/types/chainspec/accounts_config.rs#L24).



-----------------------------------------

957 - NDSR-907: Migrate accounts CSV into TOML.

-----------------------------------------

Ref:



This PR replaces accounts.csv into a structured TOML file in preparation to hold delegators data there as well.



New structure:



```toml

[[accounts]]

public_key = "01522ef6c89038019cb7af05c340623804392dd2bb1f4dab5e4a9c3ab752fc0179"

balance = "1000000000000000000000000000"

bonded_amount = "0"

```



-----------------------------------------

961 - NDRS-895 upgrade delta

-----------------------------------------

Ref:



This PR reverts recent changes to the auction contract in EE which are incompatible with the code in delta.  It also fixes a couple of remaining issues blocking upgrades on delta.



-----------------------------------------

954 - NO-TICKET: add public key and round length to status endpoint

-----------------------------------------

This PR enhances the status endpoints by providing the public signing key of the node and the next round length if the node is a validator.  Example output:



```json

{

  "api_version": "1.0.0",

  "chainspec_name": "casper-net-1",

  "starting_state_root_hash": "fd7b..0314",

  "peers": [

    {

      "node_id": "NodeId::Tls(470b..d032)",

      "address": "127.0.0.1:34554"

    },

    {

      "node_id": "NodeId::Tls(606d..b959)",

      "address": "127.0.0.1:34555"

    },

    {

      "node_id": "NodeId::Tls(a0ef..4e84)",

      "address": "127.0.0.1:34557"

    },

    {

      "node_id": "NodeId::Tls(e85b..0726)",

      "address": "127.0.0.1:34556"

    }

  ],

  "last_added_block_info": {

    "hash": "4453a99848956ad0b81883c78e6434a58997e0532314b4125746a0ee7e7accb6",

    "timestamp": "2021-02-19T00:28:12.672Z",

    "era_id": 3,

    "height": 39,

    "state_root_hash": "ba922bb17997a4481f3f3850560c7e209b3fee889d2b66926650480c8cfaa29f",

    "creator": "015ac2b49f86688057fc2426bf16067bfe428fbb33d1007f1c1583e7f59233cedd"

  },

  "our_public_signing_key": "011925e95db3df8da31ee8dc406471cc29cd413a6ee0dc08aef3eb5732a7b63f07",

  "round_length": "4s 96ms",

  "next_upgrade": null,

  "build_version": "0.9.0-7f5425bf"

}

```



-----------------------------------------

943 - NDRS-895: prepare for upgrading delta nodes

-----------------------------------------

Ref:



This PR brings over almost all commits from master to this feature branch in order to allow for a potential upgrade to nodes currently running on the delta network.



The primary commit which is different to master is [f5b1b6f]( ) which reverts the structure of `Block` to match that on the delta nodes.  This would be the only part of this PR worth reviewing IMO.



-----------------------------------------

948 - EE-1174: Cap delegation rate to 100.

-----------------------------------------

Ref:



This PR caps delegation rate to 100.



Denominator is also changed to 100 so this way commission rate would be a simple percentage instead of a fraction of trillionths.



-----------------------------------------

956 - NDRS-912: Disable slashing.

-----------------------------------------

For the first 90 days we only evict equivocating validators instead of slashing them.





-----------------------------------------

951 - OP-1836: NCTL - random validator node shutdown and sync

-----------------------------------------

Implements itst01 from .



Also refactor nightly ci script to run multiple tests.



Test Run: https://drone-auto.casperlabs.io/TomVasile/casper-node/49/1/2



-----------------------------------------

946 - NO TICKET memory stat gathering from sys-info for consumed mem

-----------------------------------------

Adds a metric `consumed_ram_bytes` for total ram consumed as reported by sys-info. This is useful to compare and contrast what value we get from internal memory metrics.



-----------------------------------------

953 - Add env var to enable detailed consensus metric logging

-----------------------------------------

Add an env var for opting-in to detail mem metrics logging.



-----------------------------------------

952 - NDRS-915: add inactive field to JsonBids

-----------------------------------------

This PR adds the inactive field to the JsonBids structure.





-----------------------------------------

949 - NO-TICKET: Fix bug in the chainspec_loader.

-----------------------------------------

If the node was started in a valid state, it sometimes didn't transition past the initializer phase.



-----------------------------------------

947 - NDRS-880: Add `nctl-upgrade-protocol` command.

-----------------------------------------

This PR adds a new nctl command `nctl-upgrade-protocol`. The command takes two arguments `version` and `era`. Version is expected to be in format `X_Y_Z`.



The command will create `version` directories in all `node-X` directories and copy required files (`casper-node` binary, chainspec and config files). Chainspec will only be updated with the new protocol version and `activation_point.era`. No other changes to the protocol are made.



### Notes



We recognize that this code is not exactly up to `nctl` standards but the command is proving very useful when testing the node upgrades so we want to give it to people early while committing to improving the code as soon as possible.



-----------------------------------------

950 - NO-TICKET: Fix commit_step metric.

-----------------------------------------

 

-----------------------------------------

942 - NDRS-895: provide hard reset chainspec option

-----------------------------------------

Ref:



This PR adds functionality which allows an upgrade chainspec to specify that the node should ignore all blocks created during and after a given era ID.



This will hopefully never be needed, but until our upgrades can handle starting mid-era, we can use this as a fallback mechanism.



-----------------------------------------

944 - NDRS-877: handle termination signals gracefully

-----------------------------------------

Ref:



This PR introduces handling for termination signals which will allow the node to exit gracefully.  This should help avoid database or file corruption as all destructors should run properly before the app calls `std::process::exit()`.



I tested this locally, and the node does exit with a code of 130, 131 or 143 when sent an `INT`, `QUIT` or `TERM` signal respectively, which are the default exit codes Rust uses (128 + the signal value).



-----------------------------------------

941 - NO-TICKET: types: add system module, restructure

-----------------------------------------

This PR:

  • introduces a top-level `system` module to types

  • moves `{auction,mint,proof_of_stake,standard_payment}` to `system`

  • moves the contents of `system_contract_errors` to their related modules in `system`

  • removes the partially-applied `Result` types in the various system error modules

  • moves `SystemContractType` to `system`.



-----------------------------------------

939 - NO-TICKET: reposition {auction,mint,proof_of_stake,standard_payment}

-----------------------------------------

This PR

  • moves `types/src/auction.rs` to `types/src/auction/mod.rs`

  • moves `types/src/mint.rs` to `types/src/mint/mod.rs`

  • moves `types/src/proof_of_stake.rs` to `types/src/proof_of_stake/mod.rs`

  • moves `types/src/standard_payment.rs` to `types/src/standard_payment/mod.rs`

  • inlines `types/src/auction/types.rs` into `types/src/auction/mod.rs`



-----------------------------------------

924 - NDRS-859: use next semver version rather than max when looking for upgrades

-----------------------------------------

Ref:



This PR changes the behaviour of the chainspec loader to look for the immediate next version of casper-node as per semver ordering as opposed to the maximum version.



This brings it in line with the launcher's behaviour, and allows for multiple future versions to be installed concurrently, letting the launcher walk up through the versions sequentially.



-----------------------------------------

937 - OP-1820: Correcting bugs with paths for upgrade_build.

-----------------------------------------

Typos in paths that caused issues with the upload script.



-----------------------------------------

935 - NO-TICKET: Improve joining IT test.

-----------------------------------------

Verify that after syncing, new node is keeping up with the protocol state.



-----------------------------------------

934 - NDRS-878: Add networking metrics for `network` component

-----------------------------------------

Adds the regular networking metrics to the networking component, except for `open_connections`.



Some things are left as `TODO`, as the work has already been done in another branch that is pending a merge in the future.



-----------------------------------------

929 - NO-TICKET: fix issue in Key::from_formatted_str

-----------------------------------------

This PR fixes a bug whereby `Key::from_formatted_str()` doesn't handle parsing a `Key::EraInfo` variant.  It also adds check for that variant to existing tests and adds a couple of serialization round trip tests, one using `bincode` and the other using `serde_json`.



-----------------------------------------

864 - HWY-240: Node should walk linear chain backwards when instantiating Era supervisor.

-----------------------------------------



This is preparing the Era Supervisor to be compatible with fast sync. Unfortunately, it would be rather hard to test it before fast sync lands.



-----------------------------------------

931 - NDRS-862: Client Integration Tests using Tempdir

-----------------------------------------

REF:



CHANGELOG:



  • Refactored client integration tests to use `tempdir` for test file

  • Removed `remove_dir` in `keygen` integration tests as it was outmoded due to use of `tempdir`

  • Changed `rand-core` in `Cargo.toml` to account for a RUSTSEC advisory



-----------------------------------------

932 - NO-TICK: set lfb hash back to original

-----------------------------------------

Previous change caused the synchronization function to always be true. Reverting back to how it originally was.



-----------------------------------------

933 - NDRS-900: Populate block header with correct protocol version.

-----------------------------------------



-----------------------------------------

926 - NDRS-898: Add `ProtocolVersion` to the block header.

-----------------------------------------



NOTE: we still populate the header with the hardcoded version `1.0.0`. Once #918 is merged, I will create a follow-up PR that uses `BlockExecutor`'s protocol version when creating new blocks.



-----------------------------------------

918 - NDRS-840: preparation to support upgrades

-----------------------------------------

Ref:



This PR paves the way for node upgrades.  It contains the following high-level changes:



  • The chainspec is now loaded on startup and a single version passed to all components requiring it.  It is no longer held in storage.

  • The chainspec loader retrieves the highest block from storage and makes a decision on how to proceed based on the block's era ID, whether it's a switch block, the chainspec's protocol version, and the next upgrade's activation point.  The choice may result in the node exiting with a code 0 (an indication to the launcher to run the next installed version), a code 102 (the launcher should run the previous installed version), or a code 101 (the launcher and node should both exit).  Alternatively, the chainspec loader can indicate that the process should continue to run using the next reactor.

  • The chainspec loader now calls the contract runtime methods `commit_genesis()` or `upgrade()` or neither as appropriate (it currently always calls `commit_genesis()`).

  • The JSON-RPC server and event-stream server now use the current protocol version as the API version provided in responses/events to clients.

  • If the trusted hash is not provided in the config, the hash of the highest block will be used instead.



Some details worth noting:

  • The `unbonding_delay` throughout was defined as an `EraId` which was inappropriate, as it represents a count of eras rather than a specific one.  This largely went unnoticed as `EraId` as defined in `casper_types::auction::types` is just an alias.  These aliases would be much more useful if they were newtypes.  In the meantime, this PR replaces usages of `EraId` with `u64` for `unbonding_delay`.

  • The JSON-RPC response to `state_get_auction_info` now follows the same format as other response data, and includes the API version along with the auction info, rather than just the bare auction info (@zie1ony, @momipsl please take note)



This code cannot be tested against current delta nodes as the format of blocks has changed since then, and handling that requires updates to the linear chain sync.  Testing it by trying to upgrade against itself with only a change to the chainspec version and activation point shows that we need to resolve the issue whereby a restarted network panics with `cannot start era with total weight 0`.



-----------------------------------------

917 - OP-1820: Building upgrade package release candidates and staging on S3.

-----------------------------------------

This builds `bin.tar.gz` and `config.tar.gz`.



`config.tar.gz` includes `chainspec.toml`, `accounts.csv`, and `config-example.toml` from `/resources/production`.



`bin.tar.gz` includes `casper-node` built for Ubuntu 18.04 and `README.md` with repo link and github commit hash used to build, to allow other platforms to build casper-node from same code.



Upload script will place these artifacts at http://genesis.casperlabs.io/drone/[git-hash]/[protocol_version].  Where protocol_version is from `resources/production/chainspec.toml` with underscores replacing periods.



These can be used in upgrade tests and one can be selected for network upgrade and moved into the correct location in the `genesis.casperlabs.io` S3 bucket.



-----------------------------------------

919 - EE-1171: Automatically undelegate delegators when a validator fully unbonds

-----------------------------------------

Ref:



This PR introduces an automatic undelegation of delegator funds when a validator fully unbonds their stakes.



-----------------------------------------

930 - NCTL: meet minimum native transfer amount

-----------------------------------------

On master there is now a minimum transfer amount for "native" transfers, configured in the chainspec (deploy section, native_transfer_minimum_motes), and defaulted to 2_500_000_000 motes;-----------------------------------------

927 - NDRS-879: Log active/inactive stake.

-----------------------------------------

This adds a once-per-minute INFO-level log statement listing all faulty and inactive validators, and their total weight as a percentage. Example output

`validator participation; participation=Participation { instance_id: 248c7d082e44ad352e10dcbdac6a442f2cb675d247d9732c276aefce1dddf5a6, faulty_stake_percent: 1, inactive_stake_percent: 0, validators: [(ValidatorIndex(1), PublicKey::Ed25519(2575b4c621544fa3dda5c06bd26eed6304ea10bc57aa4bef4af9d7483ae95115), Equivocated)] }; instance_id=248c..f5a6

`

-----------------------------------------

925 - NDRS-889: Add `Fetcher` metrics.

-----------------------------------------

Adds three metrics do the fetcher:

  • found_in_storage

  • found_on_peer

  • timeouts

Metrics are prefixed with the "type" of the fetcher:

  • linear_chain

  • deploy

  • block_by_height.

-----------------------------------------

920 - NO-TICKET: Speed up sync/join integration test.

-----------------------------------------

This PR decreases the batch sizes of Wasm deploys and native transfers used in the `sync_test.sh`.

The main goal of the `sync_test.sh` is correctness, not performance, so the number of deploys in the network does not matter as long as that number is positive and we have a different type of deploys (native vs Wasm) both before and after the trusted hash.

-----------------------------------------

923 - HWY-164: Pass the round success meter between eras

-----------------------------------------

-----------------------------------------

922 - DEV-21: enforce minimum native transfer amount

-----------------------------------------

This PR adds a new deploy config chainspec parameter for a minimum transfer amount and logic to reject native transfer deploys with an amount less than the minimum.

I defaulted the configured amount to the minimum balance required to exec deploys using an account; but the value can be tweaked if necessary.

-----------------------------------------

914 - NDRS-883: nctl memory metrics

-----------------------------------------

Makes it convenient and easy to run Prometheus with an nctl network, getting access to all the metrics, as well as local process memory usage.

-----------------------------------------

678 - NDRS-624: Reduce Event Size

-----------------------------------------

ref:

Given the body of work still remaining and with teammates on holiday, this is issue is being split in two. Thus, currently compile time restriction of event sizes is not being enforced.

-----------------------------------------

921 - NO-TICKET: change libp2p config settings to their default values

-----------------------------------------

This PR changes two config settings to their default values as specified in the libp2p crate.

-----------------------------------------

913 - HWY-256: Request latest units on era start.

-----------------------------------------

If there's a chance that we're starting an era after it's already finished – send the request for validators' latest panoramas.

-----------------------------------------

915 - NO-TICKET: Measure memory allocation by `Timeouts` collection.

-----------------------------------------

For some reason, we skipped measuring the memory allocation of `Timeouts` collections in the `GossipTable` struct.

----------------------------------------

909 - OP-1811: nctl nightly run

-----------------------------------------

Initial commit of nightly nctl cronjob.

-----------------------------------------

912 - NO-TICKET: Don't evict validators if era was too short to produce a unit.

-----------------------------------------

In practice, with reasonably long eras, this won't make any difference, but in some tests with single-block eras we observed that everyone got evicted because they did not have a chance to create a unit before the last (and only) block.

This PR makes Highway only report a validator as inactive if there was enough time before the first and last block of an era for them to create a unit.

-----------------------------------------

893 - NDRS-808: Merge era_end and next_era_validator_weights.

-----------------------------------------

REF:

CHANGELOG:

  • Renamed `EraEnd` to `EraReport`

  • Created a new umbrella struct titled `EraEnd` to contain `EraReport` and moved `next_era_validator_weights` into `EraEnd`

  • Refactored `FinalizedBlock` to contain `EraReport`

  • Refactored `BlockHeader` to contain the *new* `EraEnd`

  • Added a unit test to check serialization for the *new* `EraEnd` struct

Sample Output

![Screenshot from 2021-02-09 15-33-15](https://user-images.githubusercontent.com/42871449/107431513-2aee0480-6aec-11eb-9224-424f16110614.png)

-----------------------------------------

884 - NDRS-834: Extend upgrade points

-----------------------------------------

Currently there are no upgrade points per se - the chainspec as a whole is kind of an upgrade point. So maybe the `global_state_update` doesn't really belong in `ProtocolConfig` - could be an additional field in the chainspec itself, maybe? I'm open to moving it somewhere else.

-----------------------------------------

906 - NDRS-851: Enforce deploy's runtime args len.

-----------------------------------------

Ref:

This PR adds two configuration switches to a chainspec

```diff

+ [deploys]

+ payment_args_max_length = 1024

+ session_args_max_length = 1024

```

which makes deploy acceptor verify that both payment runtime args and session runtime args are not larger than the configured values.

-----------------------------------------

898 - NDRS-837: Add account-address subcommand

-----------------------------------------

REF:

CHANGELOG

  • Added a new sub-command called `account-address` with a single arg `--public-key` which takes a hex formatted public key or a path to a key and outputs the associated account-hash for the public key

Sample Output:

![Screenshot from 2021-02-10 10-56-44](https://user-images.githubusercontent.com/42871449/107543848-3b0af000-6b8f-11eb-9736-d32ab090bd3d.png)

-----------------------------------------

904 - NDRS-{866|867|868}: Joining node synchronizes with the upgraded chain.

-----------------------------------------

## Description

While executing linear chain blocks (from Genesis up until fully synchronized), node will check on every switch block if it matches the scheduled upgrade. If it does, then it will persist its current state and shut down. After the restart, it will read its last state and continue where it left off. The process repeats until fully synchronized. Once the node is synchronized it will clean the snapshot state of the syncing component.

## JIRA tickets:

## How to test:

  1. Install `nctl`.

  2. Build packages: `nctl-compile`.

  3. Start the network: `nctl-start` (starts 5 nodes by default).

  4. Wait for a couple of eras: `nctl-view-chain-era`

  5. In the root directory of idle node (when using defaults, `node-6` is idle), create a new directory `2_0_0`.

  6. Copy the chainspec to it (`cp config/chainspec.toml 2_0_0`) and modify it to reflect a scheduled upgrade: `protocol_version` needs to be set to the same value as the folder (`2_0_0` in this case) and `protocol.activation_point.era_id` to some non-genesis era that is lower than the current era of the network.

  7. Take a note of trusted hash (`nctl-view-chain-lfb node=1`) and put it in the node config of the new node (`config/node-config.toml` under `node.trusted_hash`).

  8. Start the new node: `nctl-start node=6`.

  9. Observe that the new node synchronizes until the end of an era that is 1 lower than the value set for `protocol.activation_point.era_id` in the `2_0_0` chainspec. `node-6` should shut down.

Since we also want to test that the node resumes after restart, we need to simulate that the upgrade happened and we're ready to continue. To do that, we will remove the `2_0_0` directory. `node-6` should pick up where it left and finish synchronization.

10. Set `node.trusted_hash`, in the genesis chainspec of `node-6`, to a trusted hash (can be a new one).

11. Start the node: `nctl-start node=6`.

12. Check that the node reuses previous state: `cat <node-6 log file> | grep "reusing"` should log the pre-shutdown state.

13. Observe that the node finishes synchronization: `tail -f <node-6 log file> | grep "finished joining"`.

14. Check that all nodes are at the same LFB: `nctl-view-chain-lfb`.

### Notes

I also tested that the state is cleared once the node is synchronized.

To reproduce:

Once the node is synchronized, simply shut it down and restart with a new trusted hash. It won't reuse the previous state and start the joining process from scratch.

-----------------------------------------

897 - NO-TICKET: Rename results to outcomes where it was missed.

-----------------------------------------

-----------------------------------------

902 - HWY-252: Pause consensus if execution lags behind finalization.

-----------------------------------------

In a test with 75 validators and 1000 transactions per block we observed that block execution was much slower than consensus. That didn't stop consensus from finalizing all the era-0 blocks, though, which ended up in the block executor queue. Then there was a gap that would have lasted several hours, where consensus waited for the switch block to be executed, so it could start era 1

This PR makes consensus wait if the block executor falls behind by more than 3 blocks (configurable): Whenever the height of the latest executed block is more than 3 below the height of the latest finalized block, consensus will switch to "paused" mode, using the mechanism introduced in .

-----------------------------------------

907 - NCTL :: view node peer count command

-----------------------------------------

New  command  `nctl-view-node-peer-count`

-----------------------------------------

910 - NO TICKET fix timestamp comparison in small_network blocklist check

-----------------------------------------

fix timestamp comparison in small_network blocklist check

-----------------------------------------

908 - NO_TICKET small_network blocklist tweak

-----------------------------------------

Add decay to blocklist in small_network, along with an exclusion for anything already in `known_addresses`.

-----------------------------------------

901 - EE-1170: evict non-participating validators

-----------------------------------------

This PR:

  • adds an `inactive` field to the `auction::Bid` structure

  • passes eviction information to `Auction::run_auction`, where evicted validators have their bids updated to set `inactive` to `true`.

  • adds an `Auction::activate_bid` method to activate an inactive validator.

cc @fizyk20: Turning on eviction breaks the two `run_equivocator_network` tests.  I have marked them with `#[ignore]`, but I will need your help to address this issue before merging.

-----------------------------------------

892 - NDRS-807: Remove deploy/transfer hashes and proposer out of header

-----------------------------------------

REF:

CHANGELOG:

  • Moved three fields: `deploy_hashes`, `transfer_hashes` and `proposer` out of `BlockHeader` into new stuct `BlockBody`

  • Refactored `linear_chain_sync` and `linear_chain_fast_sync` to have `Block` instead of `BlockHeader`

  • Refactored `era_supervisor` to have `Block` when announcing handling of linear chain blocks.

  • Refactored JsonBlock to account for the change in DTO Block structure.

-----------------------------------------

885 - EE-1165: Reinvest rewards

-----------------------------------------

Ref:

This PR changes the reward distribution logic to reinvest validator/delegator rewards by increasing their stakes. To obtain the reward one has to withdraw or undelegate their bid.

-----------------------------------------

905 - NCTL :: key-value storage contract support

-----------------------------------------

  1. Added support for key value storage.

-----------------------------------------

903 - NCTL :: casper-node-launcher integration

-----------------------------------------

  1. Integration with casper-node-launcher.

  2. Documentaton update.

  3. Account view commands rationalised.

-----------------------------------------

899 - force supervisorctl status to exit 0

-----------------------------------------

workaround for known issue in supervisorctl.

-----------------------------------------

896 - NDRS-876 - track metric for last block time

-----------------------------------------

Adds metrics for `time_of_last_finalized_block`, `block_completion_duration` and fixes an unregistered metric `time_of_last_proposed_block`.

Talking with @EdHastingsCasperLabs `time_of_last_added_block` wasn't going to be meaningful, so we pivoted to instead record `block_completion_duration.`

-----------------------------------------

894 - NDRS-874 - track allocated and total ram use metrics

-----------------------------------------

Add metrics for allocated/total ram (as reported by jemalloc_ctl)

-----------------------------------------

895 - NDRS-875 - track metric for connected peers

-----------------------------------------

Add a metric for the total count of connected peers.

-----------------------------------------

891 - NDRS-865: Syncing node shuts down when upgrade is due.

-----------------------------------------

In order for the joining node (using `linear_chain_sync`) component to synchronize with an upgraded network, it has to be able to detect when the upgrade is due (based on the locally installed chainspecs) and shut down.

After this PR is merged, syncing node will detect that a new chainspec has been installed and shut down after finalizing a linear chain block that should be the last one before the upgrade

-----------------------------------------

888 - NO-TICKET: generate node version consistently

-----------------------------------------

When building from a repo where the git tags were not up to date, the version the node reported was highly misleading, using the latest git tag rather than the version specified in `Cargo.toml`.  This misleading version is used to populate the output when running the node with `-h` or `-V` and is also reported via the status endpoints.  However, when the node first starts, a further version is output which is based upon the value in `Cargo.toml`

This PR ensures the proper crate version as specified in the `Cargo.toml` is used in all these cases.

-----------------------------------------

890 - NO-TICKET: Reject pings by faulty validators.

-----------------------------------------

We don't count faulty validators towards the "online" ones anyway, so there's no point processing their pings.

-----------------------------------------

886 - NO-TICKET: Make the small_net a default networking layer.

-----------------------------------------

Make the `small_net` the default networking component.

In order to enable the libp2p-based version, one has to export `CASPER_ENABLE_LIBP2P_NET` variable

-----------------------------------------

889 - NO-TICKET: Use timestamp in candidate block hash.

-----------------------------------------

I missed that when rebasing on .

-----------------------------------------

887 - NO TICKET: Do not expose private method

-----------------------------------------

-----------------------------------------

875 - NDRS-739: Testing the joiner reactor

-----------------------------------------

Co-authored-by:    Marc Brinkmann <marc@casperlabs.io>

-----------------------------------------

872 - NO-TICKET: fix short-circuit in Runtime::transfer_to_account

-----------------------------------------

No functional changes here, just joticed that this check wasn't correctly factoring in access rights so that we weren't actually short-circuiting when transferring from a given source to itself.