Skip to content

Commit

Permalink
remove some proxima-compatible codes (#4115)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonjiao authored May 27, 2024
1 parent 8438ed4 commit 3180971
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
6 changes: 1 addition & 5 deletions chain/open-block/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,7 @@ impl OpenedBlock {
}
/// Run blockmeta first
fn initialize(&mut self) -> Result<()> {
let block_metadata_txn = if self.chain_id.is_proxima() {
Transaction::BlockMetadata(self.block_meta.to_legacy())
} else {
Transaction::BlockMetadata(self.block_meta.clone())
};
let block_metadata_txn = Transaction::BlockMetadata(self.block_meta.clone());
let block_meta_txn_hash = block_metadata_txn.id();
let mut results = execute_transactions(
&self.state,
Expand Down
16 changes: 8 additions & 8 deletions vm/transaction-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,24 +347,24 @@ pub fn create_signed_txn_with_association_account(
.expect("Sign txn should work.")
}

pub fn build_stdlib_package(net: &ChainNetwork, stdlib_option: StdLibOptions) -> Result<Package> {
let init_script = match net.genesis_config().stdlib_version {
fn build_init_script(net: &ChainNetwork) -> ScriptFunction {
match net.genesis_config().stdlib_version {
StdlibVersion::Version(1) => build_init_script_v1(net),
version if version < StdlibVersion::Version(12) => build_init_script_v2(net),
_ => build_init_script_v3(net),
};
}
}

pub fn build_stdlib_package(net: &ChainNetwork, stdlib_option: StdLibOptions) -> Result<Package> {
let init_script = build_init_script(net);
stdlib_package(stdlib_option, Some(init_script))
}

pub fn build_stdlib_package_with_modules(
net: &ChainNetwork,
modules: Vec<Vec<u8>>,
) -> Result<Package> {
let init_script = match net.genesis_config().stdlib_version {
StdlibVersion::Version(1) => build_init_script_v1(net),
version if version < StdlibVersion::Version(12) => build_init_script_v2(net),
_ => build_init_script_v3(net),
};
let init_script = build_init_script(net);
module_to_package(modules, Some(init_script))
}

Expand Down
4 changes: 0 additions & 4 deletions vm/types/src/block_metadata/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,6 @@ impl BlockMetadata {
pub fn author(&self) -> AccountAddress {
self.author
}
pub fn to_legacy(&self) -> Self {
let meta: legacy::BlockMetadata = self.clone().into();
meta.into()
}
}

impl<'de> Deserialize<'de> for BlockMetadata {
Expand Down

0 comments on commit 3180971

Please sign in to comment.