Skip to content

Commit

Permalink
update proptest
Browse files Browse the repository at this point in the history
  • Loading branch information
simonjiao committed Dec 4, 2024
1 parent d1e5cd1 commit 2dc3f29
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions scripts/nextest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ cargo nextest run \
-p starcoin-genesis \
-p starcoin-node \
-p starcoin-config \
-p starcoin-txpool \
--retries 2 --build-jobs 8 --test-threads 12 --no-fail-fast --failure-output immediate-final


Expand Down
3 changes: 2 additions & 1 deletion vm/types/src/proptest_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use starcoin_crypto::{ed25519, HashValue, SigningKey};
use starcoin_time_service::{MockTimeService, TimeService};
use std::ops::Deref;
use std::sync::Arc;
use vm::file_format_common::VERSION_MAX;
use vm::CompiledModule;

/// Wrapper for `proptest`'s [`Index`][proptest::sample::Index] that allows `AsRef` to work.
Expand Down Expand Up @@ -483,7 +484,7 @@ impl Package {
(compiled_module_strategy, script_strategy).prop_map(|(compile_module, script)| {
let mut vec_bytes: Vec<u8> = vec![];
compile_module
.serialize(&mut vec_bytes)
.serialize_for_version(Some(VERSION_MAX), &mut vec_bytes)
.expect("compile module serialize must success");
let first_module = Module::new(vec_bytes);
let module_vec = vec![first_module];
Expand Down
5 changes: 4 additions & 1 deletion vm/types/src/transaction/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ use bcs_ext::Sample;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use starcoin_crypto::hash::{CryptoHash, CryptoHasher};
use vm::deserializer::DeserializerConfig;
use vm::errors::Location;
use vm::file_format_common::{IDENTIFIER_SIZE_MAX, VERSION_MAX};

#[derive(
Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize, CryptoHasher, CryptoHash, JsonSchema,
Expand Down Expand Up @@ -57,7 +59,8 @@ impl Package {
}

fn parse_module_address(module: &Module) -> Result<AccountAddress> {
let compiled_module = CompiledModule::deserialize(module.code())
let config = DeserializerConfig::new(VERSION_MAX, IDENTIFIER_SIZE_MAX);
let compiled_module = CompiledModule::deserialize_with_config(module.code(), &config)
.map_err(|e| e.finish(Location::Undefined).into_vm_status())?;
Ok(*compiled_module.address())
}
Expand Down

0 comments on commit 2dc3f29

Please sign in to comment.