fix(solc): use empty bytecode as default instead unlinked (#1743)
* fix(solc): use empty bytecode as default instead unlinked * chore: fmt Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
This commit is contained in:
parent
7888aaecde
commit
d8791482d5
|
@ -352,10 +352,10 @@ impl BytecodeObject {
|
|||
}
|
||||
}
|
||||
|
||||
// Returns a not deployable bytecode by default as empty
|
||||
// Returns an empty bytecode object
|
||||
impl Default for BytecodeObject {
|
||||
fn default() -> Self {
|
||||
BytecodeObject::Unlinked("".to_string())
|
||||
BytecodeObject::Bytecode(Default::default())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -457,3 +457,31 @@ impl From<CompactDeployedBytecode> for DeployedBytecode {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::{artifacts::ContractBytecode, ConfigurableContractArtifact};
|
||||
|
||||
#[test]
|
||||
fn test_empty_bytecode() {
|
||||
let empty = r#"
|
||||
{
|
||||
"abi": [],
|
||||
"bytecode": {
|
||||
"object": "0x",
|
||||
"linkReferences": {}
|
||||
},
|
||||
"deployedBytecode": {
|
||||
"object": "0x",
|
||||
"linkReferences": {}
|
||||
}
|
||||
}
|
||||
"#;
|
||||
|
||||
let artifact: ConfigurableContractArtifact = serde_json::from_str(empty).unwrap();
|
||||
let contract = artifact.into_contract_bytecode();
|
||||
let bytecode: ContractBytecode = contract.into();
|
||||
let bytecode = bytecode.unwrap();
|
||||
assert!(!bytecode.bytecode.object.is_unlinked());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue