Skip to content

Commit

Permalink
Sync with 0.12.1
Browse files Browse the repository at this point in the history
* maint-0.12:
  Namada 0.12.1
  changelog: add #942
  vp_verify_masp: avoid panicking unwrap()s
  • Loading branch information
juped committed Dec 21, 2022
2 parents 89a01c7 + 6920cbc commit 914da00
Show file tree
Hide file tree
Showing 31 changed files with 87 additions and 69 deletions.
2 changes: 2 additions & 0 deletions .changelog/v0.12.1/bug-fixes/942-vp-verify-masp-failure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Avoid panicking unwrap()s in vp_verify_masp, to prevent crashing the node on
malformed transactions. ([#942](https://github.com/anoma/namada/pull/942))
2 changes: 2 additions & 0 deletions .changelog/v0.12.1/summary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Namada 0.12.1 is a hotfix release, fixing a node crash on malformed
transactions to the MASP.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# CHANGELOG

## v0.12.1

Namada 0.12.1 is a hotfix release, fixing a node crash on malformed
transactions to the MASP.

### BUG FIXES

- Avoid panicking unwrap()s in vp_verify_masp, to prevent crashing the node on
malformed transactions. ([#942](https://github.com/anoma/namada/pull/942))

## v0.12.0

Namada 0.12.0 is a scheduled minor release.
Expand Down
20 changes: 10 additions & 10 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.12.0"
version = "0.12.1"
default-run = "namada"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ edition = "2021"
license = "GPL-3.0"
name = "namada_core"
resolver = "2"
version = "0.12.0"
version = "0.12.1"

[features]
default = []
Expand Down
2 changes: 1 addition & 1 deletion encoding_spec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = "GPL-3.0"
name = "namada_encoding_spec"
readme = "../README.md"
resolver = "2"
version = "0.12.0"
version = "0.12.1"

[features]
default = ["abciplus"]
Expand Down
2 changes: 1 addition & 1 deletion macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ edition = "2021"
license = "GPL-3.0"
name = "namada_macros"
resolver = "2"
version = "0.12.0"
version = "0.12.1"

[lib]
proc-macro = true
Expand Down
2 changes: 1 addition & 1 deletion proof_of_stake/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = "GPL-3.0"
name = "namada_proof_of_stake"
readme = "../README.md"
resolver = "2"
version = "0.12.0"
version = "0.12.1"

[features]
default = ["abciplus"]
Expand Down
2 changes: 1 addition & 1 deletion shared/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ edition = "2021"
license = "GPL-3.0"
name = "namada"
resolver = "2"
version = "0.12.0"
version = "0.12.1"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
20 changes: 12 additions & 8 deletions shared/src/vm/host_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1822,22 +1822,26 @@ where
EVAL: VpEvaluator,
CA: WasmCacheAccess,
{
use masp_primitives::transaction::Transaction;

use crate::types::token::Transfer;

let gas_meter = unsafe { env.ctx.gas_meter.get() };
let (tx_bytes, gas) = env
.memory
.read_bytes(tx_ptr, tx_len as _)
.map_err(|e| vp_host_fns::RuntimeError::MemoryError(Box::new(e)))?;
vp_host_fns::add_gas(gas_meter, gas)?;

let full_tx: Transfer =
BorshDeserialize::try_from_slice(tx_bytes.as_slice()).unwrap();
let shielded_tx: Transaction = full_tx.shielded.unwrap();
Ok(HostEnvResult::from(crate::ledger::masp::verify_shielded_tx(
&shielded_tx,
))
.to_i64())
BorshDeserialize::try_from_slice(tx_bytes.as_slice())
.map_err(vp_host_fns::RuntimeError::EncodingError)?;

match full_tx.shielded {
Some(shielded_tx) => Ok(HostEnvResult::from(
crate::ledger::masp::verify_shielded_tx(&shielded_tx),
)
.to_i64()),
None => Ok(HostEnvResult::Fail.to_i64()),
}
}

/// Log a string from exposed to the wasm VM Tx environment. The message will be
Expand Down
2 changes: 1 addition & 1 deletion tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"
license = "GPL-3.0"
name = "namada_tests"
resolver = "2"
version = "0.12.0"
version = "0.12.1"

[features]
default = ["abciplus", "wasm-runtime"]
Expand Down
2 changes: 1 addition & 1 deletion tx_prelude/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ edition = "2021"
license = "GPL-3.0"
name = "namada_tx_prelude"
resolver = "2"
version = "0.12.0"
version = "0.12.1"

[features]
default = ["abciplus"]
Expand Down
2 changes: 1 addition & 1 deletion vm_env/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ edition = "2021"
license = "GPL-3.0"
name = "namada_vm_env"
resolver = "2"
version = "0.12.0"
version = "0.12.1"

[features]
default = ["abciplus"]
Expand Down
2 changes: 1 addition & 1 deletion vp_prelude/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ edition = "2021"
license = "GPL-3.0"
name = "namada_vp_prelude"
resolver = "2"
version = "0.12.0"
version = "0.12.1"

[features]
default = ["abciplus"]
Expand Down
22 changes: 11 additions & 11 deletions wasm/Cargo.lock

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

34 changes: 17 additions & 17 deletions wasm/checksums.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"tx_bond.wasm": "tx_bond.be9c75f96b3b4880b7934d42ee218582b6304f6326a4588d1e6ac1ea4cc61c49.wasm",
"tx_change_validator_commission.wasm": "tx_change_validator_commission.cd861e0e82f4934be6d8382d6fff98286b4fadbc20ab826b9e817f6666021273.wasm",
"tx_ibc.wasm": "tx_ibc.13daeb0c88abba264d3052129eda0713bcf1a71f6f69bf37ec2494d0d9119f1f.wasm",
"tx_init_account.wasm": "tx_init_account.e21cfd7e96802f8e841613fb89f1571451401d002a159c5e9586855ac1374df5.wasm",
"tx_init_proposal.wasm": "tx_init_proposal.b9a77bc9e416f33f1e715f25696ae41582e1b379422f7a643549884e0c73e9de.wasm",
"tx_init_validator.wasm": "tx_init_validator.1e9732873861c625f239e74245f8c504a57359c06614ba40387a71811ca4a097.wasm",
"tx_reveal_pk.wasm": "tx_reveal_pk.47bc922a8be5571620a647ae442a1af7d03d05d29bef95f0b32cdfe00b11fee9.wasm",
"tx_transfer.wasm": "tx_transfer.bbd1ef5d9461c78f0288986de046baad77e10671addc5edaf3c68ea1ae4ecc99.wasm",
"tx_unbond.wasm": "tx_unbond.c0a690d0ad43a94294a6405bae3327f638a657446c74dc61dbb3a4d2ce488b5e.wasm",
"tx_bond.wasm": "tx_bond.c80510dae9aa8785a33301a16747b358da20cb125edae01e330eba2153ca28f4.wasm",
"tx_change_validator_commission.wasm": "tx_change_validator_commission.655b344c2d9cc602f9250cf390112ff2c9293537cdc1eb4a52c58ee622ccb538.wasm",
"tx_ibc.wasm": "tx_ibc.de66b4cc33061f503c63964debda8061ab9e0f1294e6c5c510d4b94a409a2edf.wasm",
"tx_init_account.wasm": "tx_init_account.87940d07eac068e03cfe5cd8b491032b3f1814d36060cbc761beb528f1c27b46.wasm",
"tx_init_proposal.wasm": "tx_init_proposal.2464b3de1c3aa4ed25cf592366df3b744ec3d2030ce952ea18f38066d4091693.wasm",
"tx_init_validator.wasm": "tx_init_validator.6a27ed0de01ab555628129ac9f05801d5ac812824633bd36e43b1d67b6360db6.wasm",
"tx_reveal_pk.wasm": "tx_reveal_pk.d22e9b3310bad29fea038b42b4120f12b11ffe0ec4012ddf2d709aed490cac97.wasm",
"tx_transfer.wasm": "tx_transfer.3f6d8d0c103bd631c7cd12b58663e026aa9743f8552b14919a1b5bcd9fd31741.wasm",
"tx_unbond.wasm": "tx_unbond.6b801584c4d01f7b52988e5ecf971050e1575f1e15f818f3e2694604b402ebd8.wasm",
"tx_update_vp.wasm": "tx_update_vp.ee2e9b882c4accadf4626e87d801c9ac8ea8c61ccea677e0532fc6c1ee7db6a2.wasm",
"tx_vote_proposal.wasm": "tx_vote_proposal.263fd9f4cb40f283756f394d86bdea3417e9ecd0568d6582c07a5b6bd14287d6.wasm",
"tx_withdraw.wasm": "tx_withdraw.6ce8faf6a32340178ddeaeb91a9b40e7f0433334e5c1f357964bf8e11d0077f1.wasm",
"vp_implicit.wasm": "vp_implicit.17f5c2af947ccfadce22d0fffecde1a1b4bc4ca3acd5dd8b459c3dce4afcb4e8.wasm",
"vp_masp.wasm": "vp_masp.5620cb6e555161641337d308851c760fbab4f9d3693cfd378703aa55e285249d.wasm",
"vp_testnet_faucet.wasm": "vp_testnet_faucet.362584b063cc4aaf8b72af0ed8af8d05a179ebefec596b6ab65e0ca255ec3c80.wasm",
"vp_token.wasm": "vp_token.a289723dd182fe0206e6c4cf1f426a6100787b20e2653d2fad6031e8106157f3.wasm",
"vp_user.wasm": "vp_user.b83b2d0616bb2244c8a92021665a0be749282a53fe1c493e98c330a6ed983833.wasm",
"vp_validator.wasm": "vp_validator.59e3e7729e14eeacc17d76b736d1760d59a1a6e9d6acbc9a870e1835438f524a.wasm"
"tx_vote_proposal.wasm": "tx_vote_proposal.37269505f1526de9680b619413478a071ed2f92b22924e6fbb3b7127f88da41a.wasm",
"tx_withdraw.wasm": "tx_withdraw.e5affdbd26cdd08aff6dfc37c5b3d92a8784547e28d039b863a6a95d5ac1cc97.wasm",
"vp_implicit.wasm": "vp_implicit.2f0b200b9e0f3db5151e0b86f5e66ae1b7e43e01d8cdc852db1337c744fac4b6.wasm",
"vp_masp.wasm": "vp_masp.da15ab8670750f400fc12616921dc3c959386bdb5d2df4f455f2299847c257ee.wasm",
"vp_testnet_faucet.wasm": "vp_testnet_faucet.13f1911794bc69e4d7dcebd30b048740398b5d45f7efee95a07a627b1a46fa47.wasm",
"vp_token.wasm": "vp_token.497a346ebcc1b7e7b844a8aab644a8d43ab9399006a95c7ca411035b8966b05e.wasm",
"vp_user.wasm": "vp_user.59c397bd2356d01cea5379de64882423cf1e2bb361301651573c1e3619d43551.wasm",
"vp_validator.wasm": "vp_validator.0b13e2f48407640ca35414c5b855f3e20f3393f60ff987aaa3b0febbb0d64e51.wasm"
}
2 changes: 1 addition & 1 deletion wasm/tx_template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ edition = "2021"
license = "GPL-3.0"
name = "tx_template"
resolver = "2"
version = "0.12.0"
version = "0.12.1"

[lib]
crate-type = ["cdylib"]
Expand Down
2 changes: 1 addition & 1 deletion wasm/vp_template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ edition = "2021"
license = "GPL-3.0"
name = "vp_template"
resolver = "2"
version = "0.12.0"
version = "0.12.1"

[lib]
crate-type = ["cdylib"]
Expand Down
Loading

0 comments on commit 914da00

Please sign in to comment.