Skip to content

Commit 7b7f1df

Browse files
authored
bump: move (#19)
* bump move to fix cache error & add allow arbitrary update flag on vm config * use store to load check_compat
1 parent d049019 commit 7b7f1df

File tree

7 files changed

+83
-33
lines changed

7 files changed

+83
-33
lines changed

Cargo.toml

+29-29
Original file line numberDiff line numberDiff line change
@@ -105,35 +105,35 @@ bech32 = "0.11"
105105
# Note: the BEGIN and END comments below are required for external tooling. Do not remove.
106106
# BEGIN MOVE DEPENDENCIES
107107

108-
# move-abigen = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
109-
# move-bytecode-utils = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
110-
# move-errmapgen = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
111-
# move-ir-compiler = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
112-
# move-prover-test-utils = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
113-
# move-stackless-bytecode-interpreter = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
114-
# move-transactional-test-runner = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
115-
# read-write-set = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
116-
# read-write-set-dynamic = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
117-
move-binary-format = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
118-
move-bytecode-verifier = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
119-
move-cli = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
120-
move-command-line-common = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
121-
move-compiler = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
122-
move-core-types = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
123-
move-docgen = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
124-
move-model = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
125-
move-package = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
126-
move-prover = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
127-
move-prover-boogie-backend = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
128-
move-prover-bytecode-pipeline = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
129-
move-resource-viewer = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
130-
move-stackless-bytecode = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
131-
move-stdlib = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
132-
move-symbol-pool = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
133-
move-unit-test = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
134-
move-vm-runtime = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
135-
move-vm-test-utils = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
136-
move-vm-types = { git = "https://github.com/initia-labs/move.git", rev = "c05eb67b754fbd97ed1b18c964bd34c1ab34de78" }
108+
# move-abigen = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
109+
# move-bytecode-utils = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
110+
# move-errmapgen = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
111+
# move-ir-compiler = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
112+
# move-prover-test-utils = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
113+
# move-stackless-bytecode-interpreter = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
114+
# move-transactional-test-runner = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
115+
# read-write-set = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
116+
# read-write-set-dynamic = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
117+
move-binary-format = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
118+
move-bytecode-verifier = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
119+
move-cli = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
120+
move-command-line-common = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
121+
move-compiler = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
122+
move-core-types = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
123+
move-docgen = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
124+
move-model = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
125+
move-package = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
126+
move-prover = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
127+
move-prover-boogie-backend = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
128+
move-prover-bytecode-pipeline = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
129+
move-resource-viewer = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
130+
move-stackless-bytecode = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
131+
move-stdlib = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
132+
move-symbol-pool = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
133+
move-unit-test = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
134+
move-vm-runtime = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
135+
move-vm-test-utils = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
136+
move-vm-types = { git = "https://github.com/initia-labs/move.git", rev = "f9e116fbfd9c4c5eaa4b39ee5da83715f0c99367" }
137137

138138
# END MOVE DEPENDENCIES
139139

api/vm.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ func ReleaseVM(vm VM) {
2121
// AllocateVM call ffi(`allocate_vm`) to allocate vm instance
2222
func AllocateVM(moduleCacheCapacity, scriptCacheCapacity uint64) VM {
2323
return VM{
24-
ptr: C.allocate_vm(cusize(moduleCacheCapacity), cusize(scriptCacheCapacity)),
24+
ptr: C.allocate_vm(
25+
cusize(moduleCacheCapacity),
26+
cusize(scriptCacheCapacity),
27+
),
2528
}
2629
}
2730

crates/e2e-move-tests/src/harness.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ impl MoveHarness {
7070
}
7171

7272
pub fn initialize(&mut self) {
73+
self.initialize_with_check_compat(true)
74+
}
75+
76+
pub fn initialize_with_check_compat(&mut self, check_compat: bool) {
7377
let state = self.chain.create_state();
7478
let mut table_state = MockTableState::new(&state);
7579

@@ -93,11 +97,19 @@ impl MoveHarness {
9397
&mut table_resolver,
9498
self.load_precompiled_stdlib()
9599
.expect("Failed to load precompiles"),
96-
false,
100+
!check_compat,
97101
vec![],
98102
)
99103
.expect("Module must load");
100104
self.commit(output, true);
105+
self.assert_check_compat(check_compat);
106+
}
107+
108+
fn assert_check_compat(&self, expected_value: bool) {
109+
let state = self.chain.create_state();
110+
let resolver = StateViewImpl::new(&state);
111+
let check_compat = resolver.check_compat().expect("should not return error");
112+
assert_eq!(check_compat, expected_value);
101113
}
102114

103115
fn load_precompiled_stdlib(&self) -> io::Result<ModuleBundle> {

crates/e2e-move-tests/src/tests/cache.rs

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
use crate::MoveHarness;
22
use move_core_types::account_address::AccountAddress;
33

4+
#[test]
5+
fn test_check_compat() {
6+
let mut h = MoveHarness::new();
7+
h.initialize_with_check_compat(true);
8+
9+
let mut h = MoveHarness::new();
10+
h.initialize_with_check_compat(false);
11+
}
12+
413
#[test]
514
fn test_tx_module_cache() {
615
let mut h = MoveHarness::new();

crates/storage/src/state_view_impl.rs

+11
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ impl<'block, S: StateView> StateViewImpl<'block, S> {
3333
PartialVMError::new(StatusCode::STORAGE_ERROR).with_message(err.to_string())
3434
})
3535
}
36+
37+
pub fn check_compat(&self) -> PartialVMResult<bool> {
38+
self.get_check_compat()
39+
}
3640
}
3741

3842
impl<'block, S: StateView> ModuleResolver for StateViewImpl<'block, S> {
@@ -71,6 +75,13 @@ impl<'block, S: StateView> ModuleResolver for StateViewImpl<'block, S> {
7175
})
7276
})
7377
}
78+
79+
fn get_check_compat(&self) -> PartialVMResult<bool> {
80+
match self.get(&AccessPath::check_compat_path())? {
81+
Some(bytes) => Ok(bytes.starts_with(&[0])),
82+
None => Ok(true),
83+
}
84+
}
7485
}
7586

7687
impl<'block, S: StateView> ResourceResolver for StateViewImpl<'block, S> {

crates/types/src/access_path.rs

+12
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ impl AccessPath {
5959
AccessPath { address, path }
6060
}
6161

62+
pub fn check_compat_path() -> Self {
63+
AccessPath {
64+
address: AccountAddress::ONE,
65+
path: DataPath::Resource(StructTag {
66+
address: AccountAddress::ONE,
67+
module: Identifier::new("code").unwrap(),
68+
name: Identifier::new("ModuleStore").unwrap(),
69+
type_params: vec![],
70+
}),
71+
}
72+
}
73+
6274
pub fn resource_access_path(address: AccountAddress, struct_tag: StructTag) -> Self {
6375
Self::new(address, Self::resource_data_path(struct_tag))
6476
}

crates/vm/src/move_vm.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ impl Default for MoveVM {
9090
}
9191

9292
impl MoveVM {
93-
pub fn new(module_cache_capacity: usize, script_cache_capacity: usize) -> Self {
93+
pub fn new(
94+
module_cache_capacity: usize,
95+
script_cache_capacity: usize,
96+
) -> Self {
9497
let gas_params = NativeGasParameters::initial();
9598
let misc_params = MiscGasParameters::initial();
9699
let runtime = VMRuntime::new(
@@ -176,7 +179,7 @@ impl MoveVM {
176179
let mut traversal_context = TraversalContext::new(&traversal_storage);
177180

178181
let publish_request = PublishRequest {
179-
check_compat: false,
182+
check_compat: true,
180183
destination: AccountAddress::ONE,
181184
expected_modules: None,
182185
module_bundle,

0 commit comments

Comments
 (0)