Skip to content

Commit 7979139

Browse files
authored
Do not panic in the kms::sign() function (#975)
Removes unnecessary `unwrap()` call inside the `kms::sign()` function, which leads to unexpected behavior from the client side. Also, includes workarounds in order to build the project with outdated dependencies.
1 parent c4aea8e commit 7979139

File tree

10 files changed

+20
-17
lines changed

10 files changed

+20
-17
lines changed

.github/workflows/pull-request.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
matrix:
1010
include:
11-
- rust: 1.70.0
11+
- rust: 1.74.0
1212
examples: false
1313
continue-on-error: false
1414
- rust: stable
@@ -36,6 +36,9 @@ jobs:
3636
default: true
3737
- uses: Swatinem/rust-cache@v1
3838
- uses: foundry-rs/foundry-toolchain@v1
39+
- uses: actions/setup-node@v3
40+
with:
41+
node-version: '18'
3942
- run: cargo fmt -- --check
4043
- run: cd examples/truffle && yarn --frozen-lockfile && yarn build
4144
# Can't use --all-features here because web3 has mutually exclusive features.

ethcontract-common/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ethcontract-common"
3-
version = "0.25.7"
3+
version = "0.25.8"
44
authors = ["Gnosis developers <[email protected]>"]
55
edition = "2021"
66
license = "MIT OR Apache-2.0"

ethcontract-common/src/artifact.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ pub struct InsertResult<'a> {
149149
/// but doesn't allow changing its name.
150150
pub struct ContractMut<'a>(&'a mut Contract);
151151

152-
impl<'a> ContractMut<'a> {
152+
impl ContractMut<'_> {
153153
/// Returns mutable reference to contract's abi.
154154
pub fn abi_mut(&mut self) -> &mut Abi {
155155
&mut Arc::make_mut(&mut self.0.interface).abi

ethcontract-common/src/bytecode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ impl<'de> Deserialize<'de> for Bytecode {
163163
/// A serde visitor for deserializing bytecode.
164164
struct BytecodeVisitor;
165165

166-
impl<'de> Visitor<'de> for BytecodeVisitor {
166+
impl Visitor<'_> for BytecodeVisitor {
167167
type Value = Bytecode;
168168

169169
fn expecting(&self, f: &mut Formatter) -> FmtResult {

ethcontract-derive/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ethcontract-derive"
3-
version = "0.25.7"
3+
version = "0.25.8"
44
authors = ["Gnosis developers <[email protected]>"]
55
edition = "2021"
66
license = "MIT OR Apache-2.0"
@@ -20,8 +20,8 @@ proc-macro = true
2020

2121
[dependencies]
2222
anyhow = "1.0"
23-
ethcontract-common = { version = "0.25.7", path = "../ethcontract-common" }
24-
ethcontract-generate = { version = "0.25.7", path = "../ethcontract-generate", default-features = false }
23+
ethcontract-common = { version = "0.25.8", path = "../ethcontract-common" }
24+
ethcontract-generate = { version = "0.25.8", path = "../ethcontract-generate", default-features = false }
2525
proc-macro2 = "1.0"
2626
quote = "1.0"
2727
syn = "2.0"

ethcontract-generate/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ethcontract-generate"
3-
version = "0.25.7"
3+
version = "0.25.8"
44
authors = ["Gnosis developers <[email protected]>"]
55
edition = "2021"
66
license = "MIT OR Apache-2.0"
@@ -18,7 +18,7 @@ http = ["curl"]
1818
[dependencies]
1919
anyhow = "1.0"
2020
curl = { version = "0.4", optional = true }
21-
ethcontract-common = { version = "0.25.7", path = "../ethcontract-common" }
21+
ethcontract-common = { version = "0.25.8", path = "../ethcontract-common" }
2222
Inflector = "0.11"
2323
proc-macro2 = "1.0"
2424
quote = "1.0"

ethcontract-mock/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ethcontract-mock"
3-
version = "0.25.7"
3+
version = "0.25.8"
44
authors = ["Gnosis developers <[email protected]>"]
55
edition = "2021"
66
license = "MIT OR Apache-2.0"
@@ -12,12 +12,12 @@ Tools for mocking ethereum contracts.
1212
"""
1313

1414
[dependencies]
15-
ethcontract = { version = "0.25.7", path = "../ethcontract", default-features = false, features = ["derive"] }
15+
ethcontract = { version = "0.25.8", path = "../ethcontract", default-features = false, features = ["derive"] }
1616
hex = "0.4"
1717
mockall = "0.11"
1818
rlp = "0.5"
1919
predicates = "3.0"
2020

2121
[dev-dependencies]
2222
tokio = { version = "1.6", features = ["macros", "rt"] }
23-
ethcontract-derive = { version = "0.25.7", path = "../ethcontract-derive", default-features = false }
23+
ethcontract-derive = { version = "0.25.8", path = "../ethcontract-derive", default-features = false }

ethcontract/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ethcontract"
3-
version = "0.25.7"
3+
version = "0.25.8"
44
authors = ["Gnosis developers <[email protected]>"]
55
edition = "2021"
66
license = "MIT OR Apache-2.0"
@@ -35,8 +35,8 @@ ws-tokio = ["web3/ws-tokio"]
3535
aws-config = { version = "0.55", optional = true }
3636
aws-sdk-kms = { version = "0.28", optional = true }
3737
arrayvec = "0.7"
38-
ethcontract-common = { version = "0.25.7", path = "../ethcontract-common" }
39-
ethcontract-derive = { version = "0.25.7", path = "../ethcontract-derive", optional = true, default-features = false }
38+
ethcontract-common = { version = "0.25.8", path = "../ethcontract-common" }
39+
ethcontract-derive = { version = "0.25.8", path = "../ethcontract-derive", optional = true, default-features = false }
4040
futures = "0.3"
4141
futures-timer = "3.0"
4242
hex = "0.4"

ethcontract/src/log.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use web3::Transport;
1515
/// The default poll interval to use for polling logs from the block chain.
1616
#[cfg(not(test))]
1717
pub const DEFAULT_POLL_INTERVAL: Duration = Duration::from_secs(5);
18+
/// The default poll interval to be used in tests.
1819
#[cfg(test)]
1920
pub const DEFAULT_POLL_INTERVAL: Duration = Duration::from_secs(0);
2021

ethcontract/src/transaction/kms.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ impl Account {
8686
.signing_algorithm(SigningAlgorithmSpec::EcdsaSha256)
8787
.send()
8888
.await
89-
.map_err(aws_sdk_kms::Error::from)
90-
.unwrap();
89+
.map_err(aws_sdk_kms::Error::from)?;
9190
let signature = secp256k1::ecdsa::Signature::from_der(
9291
output.signature().ok_or(Error::InvalidSignature)?.as_ref(),
9392
)

0 commit comments

Comments
 (0)