Skip to content

Commit

Permalink
Set evm.deployedBytecode to the value of evm.bytecode (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
smiasojed authored Oct 24, 2024
1 parent e56feb9 commit cc38c37
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ pub enum Flag {
EVMBC,
#[serde(rename = "evm.deployedBytecode")]
EVMDBC,
/// The assembly code
#[serde(rename = "evm.assembly")]
Assembly,
}

impl From<SolcPipeline> for Flag {
Expand All @@ -66,6 +69,7 @@ impl std::fmt::Display for Flag {
Self::EVMLA => write!(f, "evm.legacyAssembly"),
Self::EVMBC => write!(f, "evm.bytecode"),
Self::EVMDBC => write!(f, "evm.deployedBytecode"),
Self::Assembly => write!(f, "evm.assembly"),
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ pub struct EVM {
/// Is reset by that of PolkaVM before yielding the compiled project artifacts.
#[serde(skip_serializing_if = "Option::is_none")]
pub bytecode: Option<Bytecode>,
/// The contract deployed bytecode.
/// The deployed bytecode of the contract.
/// It is overwritten with the PolkaVM blob before yielding the compiled project artifacts.
/// Hence it will be the same as the runtime code but we keep both for compatibility reasons.
#[serde(skip_serializing_if = "Option::is_none")]
pub deployed_bytecode: Option<DeployedBytecode>,
/// The contract function signatures.
Expand All @@ -44,6 +46,7 @@ impl EVM {
/// Sets the PolkaVM assembly and bytecode.
pub fn modify(&mut self, assembly_text: String, bytecode: String) {
self.assembly_text = Some(assembly_text);
self.bytecode = Some(Bytecode::new(bytecode));
self.bytecode = Some(Bytecode::new(bytecode.clone()));
self.deployed_bytecode = Some(DeployedBytecode::new(bytecode));
}
}

0 comments on commit cc38c37

Please sign in to comment.