MCPcopy Create free account
hub / github.com/ChainSafe/Delorean-Protocol / verify_eth_method

Function verify_eth_method

fendermint/vm/message/src/signed.rs:289–305  ·  view source on GitHub ↗

Verify that the method ID and the recipient are one of the allowed combination, which for example is set by [from_eth::to_fvm_message]. The method ID is not part of the signature, so someone could modify it, which is why we have to check explicitly that there is nothing untowards going on.

(msg: &Message)

Source from the content-addressed store, hash-verified

287/// The method ID is not part of the signature, so someone could modify it, which is
288/// why we have to check explicitly that there is nothing untowards going on.
289fn verify_eth_method(msg: &Message) -> Result<(), SignedMessageError> {
290 if msg.to == eam::EAM_ACTOR_ADDR {
291 if msg.method_num != eam::Method::CreateExternal as u64 {
292 return Err(SignedMessageError::Ethereum(anyhow!(
293 "The EAM actor can only be called with CreateExternal; got {}",
294 msg.method_num
295 )));
296 }
297 } else if msg.method_num != evm::Method::InvokeContract as u64 {
298 return Err(SignedMessageError::Ethereum(anyhow!(
299 "An EVM actor can only be called with InvokeContract; got {} - {}",
300 msg.to,
301 msg.method_num
302 )));
303 }
304 Ok(())
305}
306
307/// Sign a hash using the secret key.
308pub fn sign_secp256k1(sk: &SecretKey, hash: &[u8; 32]) -> Signature {

Callers 1

verify_signatureMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected