Skip to content

Commit

Permalink
Merge branch 'dev' into fk/promote-ropsten
Browse files Browse the repository at this point in the history
  • Loading branch information
furkhat authored Apr 17, 2020
2 parents c736289 + 7ffb0dd commit 5a0616b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 5 additions & 5 deletions core/server/src/eth_watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub enum EthWatchRequest {
},
CheckEIP1271Signature {
address: Address,
data: Vec<u8>,
message: Vec<u8>,
signature: EIP1271Signature,
resp: oneshot::Sender<Result<bool, failure::Error>>,
},
Expand Down Expand Up @@ -305,14 +305,14 @@ impl<T: Transport> EthWatch<T> {
async fn is_eip1271_signature_correct(
&self,
address: Address,
data: Vec<u8>,
message: Vec<u8>,
signature: EIP1271Signature,
) -> Result<bool, failure::Error> {
let received: [u8; 4] = self
.get_eip1271_contract(address)
.query(
"isValidSignature",
(data, signature.0),
(message, signature.0),
None,
Options::default(),
None,
Expand Down Expand Up @@ -399,12 +399,12 @@ impl<T: Transport> EthWatch<T> {
}
EthWatchRequest::CheckEIP1271Signature {
address,
data,
message,
signature,
resp,
} => {
let signature_correct = self
.is_eip1271_signature_correct(address, data, signature)
.is_eip1271_signature_correct(address, message, signature)
.await;

resp.send(signature_correct).unwrap_or_default();
Expand Down
4 changes: 3 additions & 1 deletion core/server/src/signature_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,14 @@ async fn verify_eth_signature(
}
}
TxEthSignature::EIP1271Signature(signature) => {
let message = format!("\x19Ethereum Signed Message:\n{}{}", message.len(), message);

let eth_watch_resp = oneshot::channel();
eth_watch_req
.clone()
.send(EthWatchRequest::CheckEIP1271Signature {
address: request.tx.account(),
data: message.as_bytes().to_vec(),
message: message.into_bytes(),
signature: signature.clone(),
resp: eth_watch_resp.0,
})
Expand Down

0 comments on commit 5a0616b

Please sign in to comment.