Skip to content

Commit 95d4db2

Browse files
committed
nit: reduce indentation
1 parent 4952b9b commit 95d4db2

File tree

1 file changed

+12
-25
lines changed
  • actors/evm/src/interpreter/instructions

1 file changed

+12
-25
lines changed

actors/evm/src/interpreter/instructions/ext.rs

+12-25
Original file line numberDiff line numberDiff line change
@@ -92,31 +92,18 @@ impl CodeCid {
9292
pub fn get_cid_type(rt: &impl Runtime, addr: U256) -> CodeCid {
9393
let addr: EthAddress = addr.into();
9494

95-
if let Ok(addr) = addr.try_into() {
96-
rt.resolve_address(&addr)
97-
.and_then(|id| {
98-
rt.get_actor_code_cid(&id).map(|cid| {
99-
let code_cid = rt
100-
.resolve_builtin_actor_type(&cid)
101-
.map(|t| {
102-
match t {
103-
Type::Account => CodeCid::Account,
104-
// TODO part of current account abstraction hack where emryos are accounts
105-
Type::Embryo => CodeCid::Account,
106-
Type::EVM => CodeCid::EVM(addr),
107-
// remaining builtin actors are native
108-
_ => CodeCid::Native(cid),
109-
}
110-
// not a builtin actor, so it is probably a native actor
111-
})
112-
.unwrap_or(CodeCid::Native(cid));
113-
code_cid
114-
})
115-
})
116-
.unwrap_or(CodeCid::NotFound)
117-
} else {
118-
CodeCid::NotFound
119-
}
95+
addr.try_into()
96+
.ok() // into filecoin address
97+
.and_then(|addr| rt.resolve_address(&addr)) // resolve actor id
98+
.and_then(|id| rt.get_actor_code_cid(&id).map(|cid| (id, cid))) // resolve code cid
99+
.map(|(id, cid)| match rt.resolve_builtin_actor_type(&cid) {
100+
// TODO part of current account abstraction hack where embryos are accounts
101+
Some(Type::Account | Type::Embryo) => CodeCid::Account,
102+
Some(Type::EVM) => CodeCid::EVM(Address::new_id(id)),
103+
// remaining builtin actors are native
104+
_ => CodeCid::Native(cid),
105+
})
106+
.unwrap_or(CodeCid::NotFound)
120107
}
121108

122109
pub fn get_evm_bytecode(rt: &impl Runtime, addr: &Address) -> Result<Vec<u8>, StatusCode> {

0 commit comments

Comments
 (0)