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

[cmd] dev package auto convert module to Move file format version 3. #3237

Merged
merged 1 commit into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 2 additions & 4 deletions cmd/starcoin/src/dev/package_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use scmd::{CommandAction, ExecContext};
use serde::{Deserialize, Serialize};
use starcoin_crypto::hash::PlainCryptoHash;
use starcoin_crypto::HashValue;
use starcoin_move_compiler::bytecode_transpose::ModuleBytecodeDowgrader;
use starcoin_move_compiler::dependency_order::sort_by_dependency_order;
use starcoin_rpc_api::types::FunctionIdView;
use starcoin_types::transaction::{parse_transaction_argument, TransactionArgument};
Expand Down Expand Up @@ -101,10 +102,7 @@ impl CommandAction for PackageCmd {
.collect::<Result<Vec<_>, _>>()?;
sort_by_dependency_order(ms.iter())?
.into_iter()
.map(|m| {
let mut data = vec![];
m.serialize(&mut data).map(move |_| Module::new(data))
})
.map(|m| ModuleBytecodeDowgrader::to_v3(&m).map(Module::new))
.collect::<Result<Vec<_>>>()?
};

Expand Down
2 changes: 1 addition & 1 deletion vm/compiler/src/bytecode_transpose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ impl ModuleBytecodeDowgrader {
VERSION_4 => Self::from_v4_to_v3(m),
VERSION_3 => {
let mut bytes = vec![];
m.serialize(&mut bytes)?;
m.serialize_to_version(&mut bytes, VERSION_3)?;
Ok(bytes)
}
_ => anyhow::bail!("unsupport module bytecode version {}", m.version),
Expand Down