fix: reschedule waker if receipt is immediately available (#103)
* fix: reschedule waker if receipt is immediately available * chore: update minor deps `cargo update` * chore: make clippy happy
This commit is contained in:
parent
873cf099b6
commit
b0bfd550fb
File diff suppressed because it is too large
Load Diff
|
@ -17,10 +17,10 @@ ethabi = { package = "ethabi-next", version = "12.0.0", default-features = false
|
||||||
arrayvec = { version = "0.5.1", default-features = false }
|
arrayvec = { version = "0.5.1", default-features = false }
|
||||||
|
|
||||||
# crypto
|
# crypto
|
||||||
ecdsa = { version = "0.8.0", features = ["std"] }
|
ecdsa = { version = "0.9.0", features = ["std"] }
|
||||||
elliptic-curve = { version = "0.6.1", features = ["arithmetic"] }
|
elliptic-curve = { version = "0.7.1", features = ["arithmetic"] }
|
||||||
generic-array = "0.14.4"
|
generic-array = "0.14.4"
|
||||||
k256 = { version = "0.5.2", features = ["keccak256", "ecdsa"] }
|
k256 = { version = "0.6.0", default-features = false, features = ["keccak256", "ecdsa"] }
|
||||||
rand = "0.7.2"
|
rand = "0.7.2"
|
||||||
tiny-keccak = { version = "2.0.2", default-features = false }
|
tiny-keccak = { version = "2.0.2", default-features = false }
|
||||||
|
|
||||||
|
|
|
@ -105,8 +105,8 @@ impl Signature {
|
||||||
recoverable_sig.recover_verify_key_from_digest_bytes(message_hash.as_ref().into())?;
|
recoverable_sig.recover_verify_key_from_digest_bytes(message_hash.as_ref().into())?;
|
||||||
|
|
||||||
let uncompressed_pub_key = K256PublicKey::from(&verify_key).decompress();
|
let uncompressed_pub_key = K256PublicKey::from(&verify_key).decompress();
|
||||||
if uncompressed_pub_key.is_some().into() {
|
if let Some(public_key) = uncompressed_pub_key {
|
||||||
let public_key = uncompressed_pub_key.unwrap().to_bytes();
|
let public_key = public_key.to_bytes();
|
||||||
debug_assert_eq!(public_key[0], 0x04);
|
debug_assert_eq!(public_key[0], 0x04);
|
||||||
let hash = crate::utils::keccak256(&public_key[1..]);
|
let hash = crate::utils::keccak256(&public_key[1..]);
|
||||||
Ok(Address::from_slice(&hash[12..]))
|
Ok(Address::from_slice(&hash[12..]))
|
||||||
|
|
|
@ -75,6 +75,7 @@ impl<'a, P: JsonRpcClient> Future for PendingTransaction<'a, P> {
|
||||||
PendingTxState::GettingReceipt(fut) => {
|
PendingTxState::GettingReceipt(fut) => {
|
||||||
if let Ok(receipt) = futures_util::ready!(fut.as_mut().poll(ctx)) {
|
if let Ok(receipt) = futures_util::ready!(fut.as_mut().poll(ctx)) {
|
||||||
if let Some(receipt) = receipt {
|
if let Some(receipt) = receipt {
|
||||||
|
ctx.waker().wake_by_ref();
|
||||||
*this.state = PendingTxState::CheckingReceipt(Box::new(receipt))
|
*this.state = PendingTxState::CheckingReceipt(Box::new(receipt))
|
||||||
} else {
|
} else {
|
||||||
*this.state = PendingTxState::PausedGettingReceipt
|
*this.state = PendingTxState::PausedGettingReceipt
|
||||||
|
|
|
@ -23,16 +23,15 @@ serde = { version = "1.0.112", default-features = false }
|
||||||
coins-ledger = { git = "https://github.com/summa-tx/bitcoins-rs", optional = true }
|
coins-ledger = { git = "https://github.com/summa-tx/bitcoins-rs", optional = true }
|
||||||
rustc-hex = { version = "2.1.0" }
|
rustc-hex = { version = "2.1.0" }
|
||||||
async-trait = "0.1.40"
|
async-trait = "0.1.40"
|
||||||
elliptic-curve = { version = "0.6.1", features = ["arithmetic"] }
|
elliptic-curve = { version = "0.7.1", features = ["arithmetic"] }
|
||||||
sha2 = { version = "0.9.1" }
|
sha2 = { version = "0.9.1" }
|
||||||
rand = "0.7.3"
|
rand = "0.7.3"
|
||||||
|
|
||||||
# todo: update to latest once published
|
yubihsm = { version = "0.36.0", features = ["secp256k1", "http", "usb"], optional = true }
|
||||||
yubihsm = { git = "https://github.com/iqlusioninc/yubihsm.rs.git", branch = "develop", features = ["secp256k1", "http", "usb"], optional = true }
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
ethers = { version = "0.1.3", path = "../ethers" }
|
ethers = { version = "0.1.3", path = "../ethers" }
|
||||||
yubihsm = { git = "https://github.com/iqlusioninc/yubihsm.rs.git", branch = "develop", features = ["secp256k1", "usb", "mockhsm"] }
|
yubihsm = { version = "0.36.0", features = ["secp256k1", "usb", "mockhsm"] }
|
||||||
|
|
||||||
tokio = { version = "0.2.21", features = ["macros"] }
|
tokio = { version = "0.2.21", features = ["macros"] }
|
||||||
serde_json = "1.0.55"
|
serde_json = "1.0.55"
|
||||||
|
|
|
@ -16,7 +16,7 @@ impl Clone for Wallet<SigningKey> {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
Self {
|
Self {
|
||||||
// TODO: Can we have a better way to clone here?
|
// TODO: Can we have a better way to clone here?
|
||||||
signer: SigningKey::new(&*self.signer.to_bytes()).unwrap(),
|
signer: SigningKey::from_bytes(&*self.signer.to_bytes()).unwrap(),
|
||||||
address: self.address,
|
address: self.address,
|
||||||
chain_id: self.chain_id,
|
chain_id: self.chain_id,
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ use ethers_core::k256::SecretKey as K256SecretKey;
|
||||||
|
|
||||||
impl From<K256SecretKey> for Wallet<SigningKey> {
|
impl From<K256SecretKey> for Wallet<SigningKey> {
|
||||||
fn from(key: K256SecretKey) -> Self {
|
fn from(key: K256SecretKey) -> Self {
|
||||||
let signer = SigningKey::new(&*key.to_bytes())
|
let signer = SigningKey::from_bytes(&*key.to_bytes())
|
||||||
.expect("private key should always be convertible to signing key");
|
.expect("private key should always be convertible to signing key");
|
||||||
let address = key_to_address(&signer);
|
let address = key_to_address(&signer);
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ impl FromStr for Wallet<SigningKey> {
|
||||||
let src = src
|
let src = src
|
||||||
.from_hex::<Vec<u8>>()
|
.from_hex::<Vec<u8>>()
|
||||||
.expect("invalid hex when reading PrivateKey");
|
.expect("invalid hex when reading PrivateKey");
|
||||||
let sk = SigningKey::new(&src).unwrap(); // TODO
|
let sk = SigningKey::from_bytes(&src).unwrap(); // TODO
|
||||||
Ok(sk.into())
|
Ok(sk.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue