Repository: gakonst/ethers-rs
Pull request #1238 (2022-05-09 03:19:04)

chore(deps): bump spki from 0.5.4 to 0.6.0
Bumps [spki](https://github.com/RustCrypto/formats) from 0.5.4 to 0.6.0.
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/RustCrypto/formats/commit/5eee0cdf4b46807dd8105129239ca7d5ef878e1a"><code>5eee0cd</code></a> spki v0.6.0 (<a href="https://github-redirect.dependabot.com/RustCrypto/formats/issues/654">#654</a>)</li>
<li><a href="https://github.com/RustCrypto/formats/commit/4fdb849b3faaf5adf923c832caa8c86a7fd68403"><code>4fdb849</code></a> der v0.6.0 (<a href="https://github-redirect.dependabot.com/RustCrypto/formats/issues/653">#653</a>)</li>
<li><a href="https://github.com/RustCrypto/formats/commit/3d75c334273997d7527df2865ada5e607525e6f2"><code>3d75c33</code></a> der_derive v0.6.0 (<a href="https://github-redirect.dependabot.com/RustCrypto/formats/issues/652">#652</a>)</li>
<li><a href="https://github.com/RustCrypto/formats/commit/911bfc4e36352f0b559ad63abcc740f99646a9c6"><code>911bfc4</code></a> der: variable name fixup</li>
<li><a href="https://github.com/RustCrypto/formats/commit/2d43fe8d20c352dd6a952622524d7343152b98b0"><code>2d43fe8</code></a> der: rename <code>SliceReader</code>/<code>SliceWriter</code> (<a href="https://github-redirect.dependabot.com/RustCrypto/formats/issues/651">#651</a>)</li>
<li><a href="https://github.com/RustCrypto/formats/commit/c428ebad348c012089aa0845c9502ec220515602"><code>c428eba</code></a> sec1 v0.3.0-pre.4 (<a href="https://github-redirect.dependabot.com/RustCrypto/formats/issues/650">#650</a>)</li>
<li><a href="https://github.com/RustCrypto/formats/commit/86c5b9d98eb446a8a72b54db3f67f591949a811c"><code>86c5b9d</code></a> x509-cert: rename directory from <code>x509</code> (<a href="https://github-redirect.dependabot.com/RustCrypto/formats/issues/649">#649</a>)</li>
<li><a href="https://github.com/RustCrypto/formats/commit/64ea1faaf26cd09c8981e25b16e508d4ab0ab5c8"><code>64ea1fa</code></a> sec1: use <code>base16ct</code> and <code>serdect</code> crates (<a href="https://github-redirect.dependabot.com/RustCrypto/formats/issues/648">#648</a>)</li>
<li><a href="https://github.com/RustCrypto/formats/commit/d053d254b288918cef688db0a6241443381e5b31"><code>d053d25</code></a> x509-ocsp: initial crate (<a href="https://github-redirect.dependabot.com/RustCrypto/formats/issues/639">#639</a>)</li>
<li><a href="https://github.com/RustCrypto/formats/commit/f0f245790af13b3f8c0959a65979cc94d5bbd63c"><code>f0f2457</code></a> sec1 v0.3.0-pre.3 (<a href="https://github-redirect.dependabot.com/RustCrypto/formats/issues/647">#647</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/RustCrypto/formats/compare/spki/v0.5.4...spki/v0.6.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=spki&package-manager=cargo&previous-version=0.5.4&new-version=0.6.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/Cargo.lock b/Cargo.lock
index 3d5770f6..2bae1a9c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -648,6 +648,12 @@ version = "0.7.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3"
 
+[[package]]
+name = "const-oid"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "722e23542a15cea1f65d4a1419c4cfd7a26706c70871a13a04238ca3f40f1661"
+
 [[package]]
 name = "constant_time_eq"
 version = "0.1.5"
@@ -894,7 +900,16 @@ version = "0.5.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c"
 dependencies = [
- "const-oid",
+ "const-oid 0.7.1",
+]
+
+[[package]]
+name = "der"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13dd2ae565c0a381dde7fade45fce95984c568bdcb4700a4fdbe3175e0380b2f"
+dependencies = [
+ "const-oid 0.9.0",
 ]
 
 [[package]]
@@ -977,7 +992,7 @@ version = "0.13.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9"
 dependencies = [
- "der",
+ "der 0.5.1",
  "elliptic-curve",
  "rfc6979",
  "signature",
@@ -1020,7 +1035,7 @@ checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6"
 dependencies = [
  "base16ct",
  "crypto-bigint",
- "der",
+ "der 0.5.1",
  "ff",
  "generic-array 0.14.5",
  "group",
@@ -1369,7 +1384,7 @@ dependencies = [
  "semver",
  "serde_json",
  "sha2 0.9.9",
- "spki",
+ "spki 0.6.0",
  "tempfile",
  "thiserror",
  "tokio",
@@ -2663,8 +2678,8 @@ version = "0.8.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0"
 dependencies = [
- "der",
- "spki",
+ "der 0.5.1",
+ "spki 0.5.4",
  "zeroize",
 ]
 
@@ -3273,7 +3288,7 @@ version = "0.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1"
 dependencies = [
- "der",
+ "der 0.5.1",
  "generic-array 0.14.5",
  "pkcs8",
  "subtle",
@@ -3587,7 +3602,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27"
 dependencies = [
  "base64ct",
- "der",
+ "der 0.5.1",
+]
+
+[[package]]
+name = "spki"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b"
+dependencies = [
+ "der 0.6.0",
 ]
 
 [[package]]
diff --git a/ethers-signers/Cargo.toml b/ethers-signers/Cargo.toml
index 5c157163..25ec3bf3 100644
--- a/ethers-signers/Cargo.toml
+++ b/ethers-signers/Cargo.toml
@@ -34,7 +34,7 @@ trezor-client = { version = "0.0.5", optional = true, default-features = false,
 rusoto_core = { version = "0.48.0", optional = true }
 rusoto_kms = { version = "0.48.0", optional = true }
 tracing = { version = "0.1.34", optional = true }
-spki = { version = "0.5.4", optional = true }
+spki = { version = "0.6.0", optional = true }
 
 [target.'cfg(not(target_arch = "wasm32"))'.dependencies]
 eth-keystore = { version = "0.4.1" }


Test patch:
diff --git a/ethers-contract/tests/abigen.rs b/ethers-contract/tests/abigen.rs
index 1c5cd110..aef9f2f6 100644
--- a/ethers-contract/tests/abigen.rs
+++ b/ethers-contract/tests/abigen.rs
@@ -4,8 +4,11 @@ use ethers_contract::{abigen, EthCall, EthEvent};
 use ethers_core::{
     abi::{AbiDecode, AbiEncode, Address, Tokenizable},
     types::{transaction::eip2718::TypedTransaction, Eip1559TransactionRequest, U256},
+    utils::Ganache,
 };
+use ethers_middleware::SignerMiddleware;
 use ethers_providers::{MockProvider, Provider};
+use ethers_signers::{LocalWallet, Signer};
 use ethers_solc::Solc;
 use std::{convert::TryFrom, sync::Arc};
 
@@ -566,3 +569,24 @@ fn can_handle_overloaded_events() {
     };
     let _ev2 = ActionPaused2Filter { action: "action".to_string(), pause_state: false };
 }
+
+#[tokio::test]
+#[cfg(not(feature = "celo"))]
+async fn can_send_struct_param() {
+    abigen!(StructContract, "./tests/solidity-contracts/StructContract.json");
+
+    let server = Ganache::default().spawn();
+    let wallet: LocalWallet = server.keys()[0].clone().into();
+    let provider = Provider::try_from(server.endpoint()).unwrap();
+    let client = Arc::new(SignerMiddleware::new(provider, wallet.with_chain_id(1337u64)));
+
+    let contract = StructContract::deploy(client, ()).unwrap().legacy().send().await.unwrap();
+
+    let point = Point { x: 1337u64.into(), y: 0u64.into() };
+    let tx = contract.submit_point(point).legacy();
+    let tx = tx.send().await.unwrap().await.unwrap().unwrap();
+    assert_eq!(tx.logs.len(), 1);
+
+    let logs: Vec<NewPointFilter> = contract.event().from_block(0u64).query().await.unwrap();
+    assert_eq!(logs.len(), 1);
+}
diff --git a/ethers-contract/tests/solidity-contracts/StructContract.json b/ethers-contract/tests/solidity-contracts/StructContract.json
new file mode 100644
index 00000000..23679f81
--- /dev/null
+++ b/ethers-contract/tests/solidity-contracts/StructContract.json
@@ -0,0 +1,55 @@
+{
+  "abi": [
+    {
+      "anonymous": false,
+      "inputs": [
+        {
+          "components": [
+            {
+              "internalType": "uint256",
+              "name": "x",
+              "type": "uint256"
+            },
+            {
+              "internalType": "uint256",
+              "name": "y",
+              "type": "uint256"
+            }
+          ],
+          "indexed": false,
+          "internalType": "struct MyContract.Point",
+          "name": "x",
+          "type": "tuple"
+        }
+      ],
+      "name": "NewPoint",
+      "type": "event"
+    },
+    {
+      "inputs": [
+        {
+          "components": [
+            {
+              "internalType": "uint256",
+              "name": "x",
+              "type": "uint256"
+            },
+            {
+              "internalType": "uint256",
+              "name": "y",
+              "type": "uint256"
+            }
+          ],
+          "internalType": "struct MyContract.Point",
+          "name": "_point",
+          "type": "tuple"
+        }
+      ],
+      "name": "submitPoint",
+      "outputs": [],
+      "stateMutability": "nonpayable",
+      "type": "function"
+    }
+  ],
+  "bin": "608060405234801561001057600080fd5b50610268806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063b3c67bb814610030575b600080fd5b61004a600480360381019061004591906101ac565b61004c565b005b7f0a10caaea7ac3c68834bca5fb5f42a10cb68bc3866ed86e6379d62bea6d591668160405161007b9190610217565b60405180910390a150565b6000604051905090565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6100e38261009a565b810181811067ffffffffffffffff82111715610102576101016100ab565b5b80604052505050565b6000610115610086565b905061012182826100da565b919050565b6000819050919050565b61013981610126565b811461014457600080fd5b50565b60008135905061015681610130565b92915050565b60006040828403121561017257610171610095565b5b61017c604061010b565b9050600061018c84828501610147565b60008301525060206101a084828501610147565b60208301525092915050565b6000604082840312156101c2576101c1610090565b5b60006101d08482850161015c565b91505092915050565b6101e281610126565b82525050565b6040820160008201516101fe60008501826101d9565b50602082015161021160208501826101d9565b50505050565b600060408201905061022c60008301846101e8565b9291505056fea2646970667358221220ca9c95aa57bcabfe8405dcd5d993ab0920ed1e768884cae607c1b47d5c127f9564736f6c634300080a0033"
+}
diff --git a/ethers-contract/tests/solidity-contracts/StructContract.sol b/ethers-contract/tests/solidity-contracts/StructContract.sol
new file mode 100644
index 00000000..2a617991
--- /dev/null
+++ b/ethers-contract/tests/solidity-contracts/StructContract.sol
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: UNLICENSED
+pragma solidity >=0.8.10;
+
+contract MyContract {
+    struct Point {
+        uint256 x;
+        uint256 y;
+    }
+
+    event NewPoint(Point x);
+
+    function submitPoint(Point memory _point) public {
+        emit NewPoint(_point);
+    }
+}
\ No newline at end of file