Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applying several breaking changes to the WASM interface from backlog #2199

Merged
merged 15 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Changed

#### Breaking
- [2199](https://github.com/FuelLabs/fuel-core/pull/2199): Applying several breaking changes to the WASM interface from backlog:
- Get the module to execute WASM byte code from the storage first, an fallback to the built-in version in the case of the `FUEL_ALWAYS_USE_WASM`.
- Added `host_v1` with a new `peek_next_txs_size` method, that accepts `tx_number_limit` and `size_limit`.
- Added new variant of the return type to pass the validation result. It removes block serialization and deserialization and should improve performance.
- Added a V1 execution result type that uses `JSONError` instead of postcard serialized error. It adds flexibility of how variants of the error can be managed. More information about it in https://github.com/FuelLabs/fuel-vm/issues/797. The change also moves `TooManyOutputs` error to the top. It shows that `JSONError` works as expected.
- [2145](https://github.com/FuelLabs/fuel-core/pull/2145): feat: Introduce time port in PoA service.
- [2155](https://github.com/FuelLabs/fuel-core/pull/2155): Added trait declaration for block committer data
- [2142](https://github.com/FuelLabs/fuel-core/pull/2142): Added benchmarks for varied forms of db lookups to assist in optimizations.
Expand Down
67 changes: 42 additions & 25 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ postcard = "1.0"
tracing-attributes = "0.1"
tracing-subscriber = "0.3"
serde = "1.0"
serde_json = "1.0"
serde_json = { version = "1.0", default-features = false }
serde_with = { version = "3.4", default-features = false }
strum = { version = "0.25" }
strum_macros = "0.25"
Expand Down
14 changes: 7 additions & 7 deletions bin/e2e-test-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ publish = true

[dependencies]
anyhow = { workspace = true }
fuel-core = { workspace = true, default-features = false, optional = true }
fuel-core-chain-config = { workspace = true, features = ["default"] }
fuel-core-client = { workspace = true }
fuel-core-types = { workspace = true, features = ["test-helpers"] }
Expand All @@ -31,14 +30,15 @@ toml = { version = "0.5" }

[dev-dependencies]
assert_cmd = "2.0"
fuel-core-e2e-client = { path = ".", features = [
"dev-deps",
], default-features = false }
fuel-core = { workspace = true, features = [
"rocksdb",
"wasm-executor",
"p2p",
"test-helpers",
] }
fuel-core-trace = { path = "../../crates/trace" }
insta = { workspace = true }
tempfile = { workspace = true }

[features]
default = ["fuel-core?/default"]
p2p = ["fuel-core?/p2p"]
dev-deps = ["fuel-core/test-helpers"]
default = []
8 changes: 4 additions & 4 deletions bin/e2e-test-client/src/tests/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub async fn dry_run(ctx: &TestContext) -> Result<(), Failed> {
)
.await??;

_dry_runs(ctx, &[transaction], 1000, DryRunResult::Successful).await
_dry_runs(ctx, &[transaction], 100, DryRunResult::Successful).await
}

// Dry run multiple transactions
Expand All @@ -97,7 +97,7 @@ pub async fn dry_run_multiple_txs(ctx: &TestContext) -> Result<(), Failed> {
_dry_runs(
ctx,
&[transaction1, transaction2],
1000,
100,
DryRunResult::Successful,
)
.await
Expand Down Expand Up @@ -140,7 +140,7 @@ pub async fn run_contract_large_state(ctx: &TestContext) -> Result<(), Failed> {
timeout(Duration::from_secs(20), deployment_request).await??;
}

_dry_runs(ctx, &[dry_run], 1000, DryRunResult::MayFail).await
_dry_runs(ctx, &[dry_run], 100, DryRunResult::MayFail).await
}

pub async fn arbitrary_transaction(ctx: &TestContext) -> Result<(), Failed> {
Expand Down Expand Up @@ -172,7 +172,7 @@ pub async fn arbitrary_transaction(ctx: &TestContext) -> Result<(), Failed> {

assert_eq!(dry_run_tx_from_raw, dry_run_tx_from_json);

_dry_runs(ctx, &[dry_run_tx_from_json], 1000, DryRunResult::MayFail).await
_dry_runs(ctx, &[dry_run_tx_from_json], 100, DryRunResult::MayFail).await
}

async fn _dry_runs(
Expand Down
2 changes: 2 additions & 0 deletions bin/e2e-test-client/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ fn dev_config() -> Config {
.consensus_parameters
.set_tx_params(tx_parameters);
chain_config.consensus_parameters.set_fee_params(fee_params);
chain_config.state_transition_bytecode =
fuel_core::upgradable_executor::WASM_BYTECODE.to_vec();
let reader = reader.with_chain_config(chain_config);

let mut config = Config::local_node_with_reader(reader);
Expand Down
Binary file not shown.
10 changes: 6 additions & 4 deletions bin/fuel-core/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use clap::Parser;
use fuel_core::ShutdownListener;
use fuel_core::{
upgradable_executor,
ShutdownListener,
};
use fuel_core_chain_config::{
ChainConfig,
SnapshotReader,
Expand Down Expand Up @@ -148,11 +151,10 @@ pub async fn run_cli() -> anyhow::Result<()> {
pub fn local_testnet_chain_config() -> ChainConfig {
const TESTNET_CHAIN_CONFIG: &[u8] =
include_bytes!("../chainspec/local-testnet/chain_config.json");
const TESTNET_CHAIN_CONFIG_STATE_BYTECODE: &[u8] =
include_bytes!("../chainspec/local-testnet/state_transition_bytecode.wasm");

let mut config: ChainConfig = serde_json::from_slice(TESTNET_CHAIN_CONFIG).unwrap();
config.state_transition_bytecode = TESTNET_CHAIN_CONFIG_STATE_BYTECODE.to_vec();
config.state_transition_bytecode = upgradable_executor::WASM_BYTECODE.to_vec();

config
}

Expand Down
4 changes: 2 additions & 2 deletions crates/fuel-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ hyper = { workspace = true }
indicatif = { workspace = true, default-features = true }
itertools = { workspace = true }
num_cpus = { version = "1.16.0", optional = true }
postcard = { workspace = true }
postcard = { workspace = true, optional = true }
rand = { workspace = true }
rocksdb = { version = "0.21", default-features = false, features = [
"lz4",
Expand Down Expand Up @@ -89,7 +89,7 @@ smt = [
]
p2p = ["dep:fuel-core-p2p", "dep:fuel-core-sync"]
relayer = ["dep:fuel-core-relayer"]
rocksdb = ["dep:rocksdb", "dep:tempfile", "dep:num_cpus"]
rocksdb = ["dep:rocksdb", "dep:tempfile", "dep:num_cpus", "dep:postcard"]
test-helpers = [
"fuel-core-database/test-helpers",
"fuel-core-p2p?/test-helpers",
Expand Down
2 changes: 2 additions & 0 deletions crates/fuel-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ pub use fuel_core_sync as sync;
pub use fuel_core_txpool as txpool;
#[doc(no_inline)]
pub use fuel_core_types as types;
#[doc(no_inline)]
pub use fuel_core_upgradable_executor as upgradable_executor;

pub mod coins_query;
pub mod combined_database;
Expand Down
Loading
Loading