Skip to content

Commit

Permalink
Merge tag 'v0.17.1' into draft-test
Browse files Browse the repository at this point in the history
Namada 0.17.0 is a scheduled minor release featuring several improvements to the slashing mechanism, wallet address derivation, transaction structure and the ledger stability.

* tag 'v0.17.1':
  Namada 0.17.1
  fix: change installer link
  fix: change installer link
  fix: wasm unit remove hardcoded vp hash
  test/e2e/slashing: wait for first block on copied validator before tx
  changelog: add #1534
  [ci] wasm checksums update
  test/storage: fill-in block header for commit if missing
  test/e2e/ledger/genesis_validators: validator wait for tx block height
  rpc: use the new shell last_block query to find last committed block
  core/storage: impl Display for BlockHash
  core/time: impl Display for DateTimeUtc
  shared/queries/shell: expose the last committed block from storage
  core/storage: Store last committed block's hash and time with its height
  fix typo in #1444 changelog
  remove unnecessary changelogs
  • Loading branch information
Fraccaman committed Jun 13, 2023
2 parents 3cacdd4 + a5bad39 commit df7c22a
Show file tree
Hide file tree
Showing 62 changed files with 344 additions and 154 deletions.
2 changes: 0 additions & 2 deletions .changelog/unreleased/improvements/1431-rm-empty-keys-mod.md

This file was deleted.

2 changes: 0 additions & 2 deletions .changelog/unreleased/improvements/1444-cse-in-inflation.md

This file was deleted.

This file was deleted.

2 changes: 2 additions & 0 deletions .changelog/v0.17.1/bug-fixes/1534-fix-block-query.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Fix a client block query to avoid seeing pre-committed blocks.
([\#1534](https://github.com/anoma/namada/pull/1534))
2 changes: 2 additions & 0 deletions .changelog/v0.17.1/improvements/1444-cse-in-inflation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Improve computations readability when calculating inflations
([#1444](https://github.com/anoma/namada/pull/1444))
2 changes: 2 additions & 0 deletions .changelog/v0.17.1/summary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Namada 0.17.0 is a scheduled minor release featuring several improvements to the slashing mechanism,
wallet address derivation, transaction structure and the ledger stability.
14 changes: 7 additions & 7 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ jobs:
run: sccache --start-server
- name: Install cargo tool
run: |
curl https://i.jpillora.com/${{ matrix.mdbook_version }}! | bash
curl https://i.jpillora.com/${{ matrix.mdbook_mermaid }}! | bash
curl https://i.jpillora.com/${{ matrix.mdbook_linkcheck }}! | bash
curl https://i.jpillora.com/${{ matrix.mdbook_open_on_gh }}! | bash
curl https://i.jpillora.com/${{ matrix.mdbook_admonish }}! | bash
curl https://i.jpillora.com/${{ matrix.mdbook_katex }}! | bash
curl https://i.jpillora.com/${{ matrix.mdbook_pagetoc }}! | bash
curl -k https://installer.heliax.click/${{ matrix.mdbook_version }}! | bash
curl -k https://installer.heliax.click/${{ matrix.mdbook_mermaid }}! | bash
curl -k https://installer.heliax.click/${{ matrix.mdbook_linkcheck }}! | bash
curl -k https://installer.heliax.click/${{ matrix.mdbook_open_on_gh }}! | bash
curl -k https://installer.heliax.click/${{ matrix.mdbook_admonish }}! | bash
curl -k https://installer.heliax.click/${{ matrix.mdbook_katex }}! | bash
curl -k https://installer.heliax.click/${{ matrix.mdbook_pagetoc }}! | bash
cd ${{ matrix.make.folder }} && mdbook-admonish install
- name: ${{ matrix.make.name }}
run: ${{ matrix.make.command }}
Expand Down
58 changes: 56 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,65 @@
# CHANGELOG

## Unreleased
## v0.17.1

Namada 0.17.0 is a scheduled minor release featuring several improvements to the slashing mechanism,
wallet address derivation, transaction structure and the ledger stability.

### BUG FIXES

- Persists a newly added storage field for epoch update blocks delay to be
available after node restart when not `None` which may break consensus.
([\#1455](https://github.com/anoma/namada/pull/1455))
- Client: Fixed an off-by-one error to stop waiting for start or catch-up when
max tries are reached. ([\#1456](https://github.com/anoma/namada/pull/1456))
- Include the wasm tx hash instead of the wasm blob when constructing a
transaction ([#1474](https://github.com/anoma/namada/pull/1474))
- Fix a client block query to avoid seeing pre-committed blocks.
([\#1534](https://github.com/anoma/namada/pull/1534))

### DOCS

- Adds specs for gas and fee ([#889](https://github.com/anoma/namada/pull/889))

### FEATURES

- The implementation of the cubic slashing system that touches virtually all
parts of the proof-of-stake system. Slashes tokens are currently kept in the
PoS address rather than being transferred to the Slash Pool address. This PR
also includes significant testing infrastructure, highlighted by the PoS state
machine test with slashing. ([#892](https://github.com/anoma/namada/pull/892))
- Implements HD wallet derivation / recovery from a given mnemonic code
([\#1110](https://github.com/anoma/namada/pull/1110))
- PoS: Added a client command `find-validator --tm-address <address>`
to find validator's Namada address by Tendermint address.
([\#1344](https://github.com/anoma/namada/pull/1344))

### IMPROVEMENTS

- Make Namada transactions signable on hardware constrained wallets by making
them smaller. ([#1093](https://github.com/anoma/namada/pull/1093))
- Added `multicore` feature flag to the namada and namada_core
crate that can be switched off for JS WASM build.
Additionally, changed the `trait ShieldedUtils` to be async.
([\#1238](https://github.com/anoma/namada/pull/1238))
- Zeroizes memory containing passphrases in wallet.
([\#1425](https://github.com/anoma/namada/issues/1425))
- Added some missing cli option for cli wallet
([#1432](https://github.com/anoma/namada/pull/1432))
- Improve logging error when submiting an invalid validator commission change tx
([#1434](https://github.com/anoma/namada/pull/1434))
- Correct a typo in the error change commission error handling
([#1435](https://github.com/anoma/namada/pull/1435))
- Improve the reveal tx naming in cli
([#1436](https://github.com/anoma/namada/pull/1436))
- Improve computations readability when calculating inflations
([#1444](https://github.com/anoma/namada/pull/1444))
- Remove abci++ dependencies ([#1449](https://github.com/anoma/namada/pull/1449))
- Reorganize the structure of transactions
([#1462](https://github.com/anoma/namada/pull/1462))
- Improved log entries related to PoS system.
([\#1509](https://github.com/anoma/namada/pull/1509))

## v0.16.0

Namada 0.16.0 is a regular release focused on providing the Namada SDK
Expand All @@ -26,7 +80,7 @@ applications). ([#925](https://github.com/anoma/namada/pull/925))

## v0.15.4

Namada 0.15.4 is a maintenance release addressing the invalid creation of blocks due to missing replay protection checks during prepare
Namada 0.15.4 is a maintenance release addressing the invalid creation of blocks due to missing replay protection checks during prepare
proposal.

### BUG FIXES
Expand Down
22 changes: 11 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = "GPL-3.0"
name = "namada_apps"
readme = "../README.md"
resolver = "2"
version = "0.16.0"
version = "0.17.1"
default-run = "namada"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
15 changes: 13 additions & 2 deletions apps/src/lib/client/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,19 @@ pub async fn query_and_print_epoch<
/// Query the last committed block
pub async fn query_block<C: namada::ledger::queries::Client + Sync>(
client: &C,
) -> crate::facade::tendermint_rpc::endpoint::block::Response {
namada::ledger::rpc::query_block(client).await
) {
let block = namada::ledger::rpc::query_block(client).await;
match block {
Some(block) => {
println!(
"Last committed block ID: {}, height: {}, time: {}",
block.hash, block.height, block.time
);
}
None => {
println!("No block has been committed yet.");
}
}
}

/// Query the results of the last committed block
Expand Down
2 changes: 1 addition & 1 deletion apps/src/lib/node/ledger/shell/finalize_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ where
hash: BlockHash,
byzantine_validators: Vec<Evidence>,
) -> (BlockHeight, bool) {
let height = self.wl_storage.storage.last_height + 1;
let height = self.wl_storage.storage.get_last_block_height() + 1;

self.gas_meter.reset();

Expand Down
2 changes: 1 addition & 1 deletion apps/src/lib/node/ledger/shell/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ where
tracing::info!(
"Committed block hash: {}, height: {}",
root,
self.wl_storage.storage.last_height,
self.wl_storage.storage.get_last_block_height(),
);
response.data = root.0;
response
Expand Down
6 changes: 4 additions & 2 deletions apps/src/lib/node/ledger/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,14 +354,16 @@ mod tests {
let is_last_write = blocks_write_value.last().unwrap().1;

// The upper bound is arbitrary.
for height in storage.last_height.0..storage.last_height.0 + 10 {
for height in storage.get_last_block_height().0
..storage.get_last_block_height().0 + 10
{
let height = BlockHeight::from(height);
let (value_bytes, _gas) = storage.read_with_height(&key, height)?;
if is_last_write {
let value_bytes =
value_bytes.expect("Should have been written");
let value: BlockHeight = types::decode(value_bytes).unwrap();
assert_eq!(value, storage.last_height);
assert_eq!(value, storage.get_last_block_height());
} else if value_bytes.is_some() {
let value: BlockHeight =
types::decode(value_bytes.unwrap()).unwrap();
Expand Down
56 changes: 40 additions & 16 deletions apps/src/lib/node/ledger/storage/rocksdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
//! - `root`: root hash
//! - `store`: the tree's store
//! - `hash`: block hash
//! - `time`: block time
//! - `epoch`: block epoch
//! - `address_gen`: established address generator
//! - `header`: block's header
Expand Down Expand Up @@ -570,6 +571,7 @@ impl DB for RocksDB {
read_opts.set_iterate_upper_bound(next_height_prefix);
let mut merkle_tree_stores = MerkleTreeStoresRead::default();
let mut hash = None;
let mut time = None;
let mut epoch = None;
let mut pred_epochs = None;
let mut address_gen = None;
Expand Down Expand Up @@ -618,6 +620,11 @@ impl DB for RocksDB {
types::decode(bytes).map_err(Error::CodingError)?,
)
}
"time" => {
time = Some(
types::decode(bytes).map_err(Error::CodingError)?,
)
}
"epoch" => {
epoch = Some(
types::decode(bytes).map_err(Error::CodingError)?,
Expand All @@ -638,22 +645,27 @@ impl DB for RocksDB {
None => unknown_key_error(path)?,
}
}
match (hash, epoch, pred_epochs, address_gen) {
(Some(hash), Some(epoch), Some(pred_epochs), Some(address_gen)) => {
Ok(Some(BlockStateRead {
merkle_tree_stores,
hash,
height,
epoch,
pred_epochs,
results,
next_epoch_min_start_height,
next_epoch_min_start_time,
update_epoch_blocks_delay,
address_gen,
tx_queue,
}))
}
match (hash, time, epoch, pred_epochs, address_gen) {
(
Some(hash),
Some(time),
Some(epoch),
Some(pred_epochs),
Some(address_gen),
) => Ok(Some(BlockStateRead {
merkle_tree_stores,
hash,
height,
time,
epoch,
pred_epochs,
results,
next_epoch_min_start_height,
next_epoch_min_start_time,
update_epoch_blocks_delay,
address_gen,
tx_queue,
})),
_ => Err(Error::Temporary {
error: "Essential data couldn't be read from the DB"
.to_string(),
Expand All @@ -672,6 +684,7 @@ impl DB for RocksDB {
header,
hash,
height,
time,
epoch,
pred_epochs,
next_epoch_min_start_height,
Expand Down Expand Up @@ -803,6 +816,15 @@ impl DB for RocksDB {
.0
.put_cf(block_cf, key.to_string(), types::encode(&hash));
}
// Block time
{
let key = prefix_key
.push(&"time".to_owned())
.map_err(Error::KeyError)?;
batch
.0
.put_cf(block_cf, key.to_string(), types::encode(&time));
}
// Block epoch
{
let key = prefix_key
Expand Down Expand Up @@ -1444,6 +1466,7 @@ mod test {
let merkle_tree = MerkleTree::<Sha256Hasher>::default();
let merkle_tree_stores = merkle_tree.stores();
let hash = BlockHash::default();
let time = DateTimeUtc::now();
let epoch = Epoch::default();
let pred_epochs = Epochs::default();
let height = BlockHeight::default();
Expand All @@ -1458,6 +1481,7 @@ mod test {
header: None,
hash: &hash,
height,
time,
epoch,
results: &results,
pred_epochs: &pred_epochs,
Expand Down
Loading

0 comments on commit df7c22a

Please sign in to comment.