-
Notifications
You must be signed in to change notification settings - Fork 956
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! Merge branch 'brent/improve-wasm-build' (#2795)
- Loading branch information
1 parent
d70d49f
commit cb6dcf6
Showing
27 changed files
with
302 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
use namada_tx_prelude::*; | ||
|
||
#[transaction(gas = 1000)] | ||
#[transaction] | ||
fn apply_tx(_ctx: &mut Ctx, _tx_data: Tx) -> TxResult { | ||
Err(Error::SimpleMessage("failed tx")) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[package] | ||
name = "tx_infinite_guest_gas" | ||
description = "Wasm transaction used for testing." | ||
authors.workspace = true | ||
edition.workspace = true | ||
license.workspace = true | ||
version.workspace = true | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
namada_test_utils.workspace = true | ||
namada_tx_prelude.workspace = true | ||
namada_vp_prelude.workspace = true | ||
wee_alloc.workspace = true | ||
getrandom.workspace = true | ||
|
||
[dev-dependencies] | ||
namada_tests = { path = "../../crates/tests", default-features = false, features = [ | ||
"wasm-runtime", | ||
] } | ||
|
||
proptest = "1.4.0" | ||
test-log = {version = "0.2.14", default-features = false, features = ["trace"]} | ||
tracing = "0.1.30" | ||
tracing-subscriber = {version = "0.3.7", default-features = false, features = ["env-filter", "fmt"]} | ||
|
||
[lib] | ||
crate-type = ["cdylib"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use namada_tx_prelude::*; | ||
|
||
/// A tx that endlessly charges gas from the guest environment | ||
#[transaction] | ||
fn apply_tx(_ctx: &mut Ctx, _tx_data: Tx) -> TxResult { | ||
#[allow(clippy::empty_loop)] | ||
loop {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[package] | ||
name = "tx_infinite_host_gas" | ||
description = "Wasm transaction used for testing." | ||
authors.workspace = true | ||
edition.workspace = true | ||
license.workspace = true | ||
version.workspace = true | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
namada_test_utils.workspace = true | ||
namada_tx_prelude.workspace = true | ||
namada_vp_prelude.workspace = true | ||
wee_alloc.workspace = true | ||
getrandom.workspace = true | ||
|
||
[dev-dependencies] | ||
namada_tests = { path = "../../crates/tests", default-features = false, features = [ | ||
"wasm-runtime", | ||
] } | ||
|
||
proptest = "1.4.0" | ||
test-log = {version = "0.2.14", default-features = false, features = ["trace"]} | ||
tracing = "0.1.30" | ||
tracing-subscriber = {version = "0.3.7", default-features = false, features = ["env-filter", "fmt"]} | ||
|
||
[lib] | ||
crate-type = ["cdylib"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use namada_tx_prelude::*; | ||
|
||
/// A tx that endlessly charges gas from the host environment | ||
#[transaction] | ||
fn apply_tx(ctx: &mut Ctx, _tx_data: Tx) -> TxResult { | ||
let target_key = parameters_storage::get_tx_allowlist_storage_key(); | ||
loop { | ||
// NOTE: don't propagate the error to verify that execution abortion | ||
// is done in host and does not require guest cooperation | ||
let _ = ctx.write(&target_key, vec!["hash"]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[package] | ||
name = "tx_invalid_data" | ||
description = "Wasm transaction used for testing." | ||
authors.workspace = true | ||
edition.workspace = true | ||
license.workspace = true | ||
version.workspace = true | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
namada_test_utils.workspace = true | ||
namada_tx_prelude.workspace = true | ||
namada_vp_prelude.workspace = true | ||
wee_alloc.workspace = true | ||
getrandom.workspace = true | ||
|
||
[dev-dependencies] | ||
namada_tests = { path = "../../crates/tests", default-features = false, features = [ | ||
"wasm-runtime", | ||
] } | ||
|
||
proptest = "1.4.0" | ||
test-log = {version = "0.2.14", default-features = false, features = ["trace"]} | ||
tracing = "0.1.30" | ||
tracing-subscriber = {version = "0.3.7", default-features = false, features = ["env-filter", "fmt"]} | ||
|
||
[lib] | ||
crate-type = ["cdylib"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use namada_tx_prelude::*; | ||
|
||
#[transaction] | ||
fn apply_tx(ctx: &mut Ctx, tx_data: Tx) -> TxResult { | ||
let signed = tx_data; | ||
let _data = signed.data().ok_or_err_msg("Missing data").map_err(|err| { | ||
ctx.set_commitment_sentinel(); | ||
err | ||
})?; | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
use namada_tx_prelude::*; | ||
|
||
#[transaction(gas = 1000)] | ||
#[transaction] | ||
fn apply_tx(_ctx: &mut Ctx, _tx_data: Tx) -> TxResult { | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
use namada_tx_prelude::*; | ||
|
||
#[transaction(gas = 1000)] | ||
#[transaction] | ||
fn apply_tx(ctx: &mut Ctx, _tx_data: Tx) -> TxResult { | ||
// governance | ||
let target_key = gov_storage::keys::get_min_proposal_grace_epoch_key(); | ||
let target_key = gov_storage::keys::get_min_proposal_grace_epochs_key(); | ||
ctx.write(&target_key, 9_u64)?; | ||
|
||
// parameters | ||
let target_key = parameters_storage::get_tx_allowlist_storage_key(); | ||
let target_key = parameters_storage::get_vp_allowlist_storage_key(); | ||
ctx.write(&target_key, vec!["hash"])?; | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.