Skip to content

Commit

Permalink
[cmd] dev package auto convert module to Move file format version 3. (
Browse files Browse the repository at this point in the history
  • Loading branch information
jolestar authored Feb 23, 2022
1 parent c8e80a0 commit 028ce89
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
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

0 comments on commit 028ce89

Please sign in to comment.