Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade tech.pegasys.discovery:discovery #6414

Merged
merged 4 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- Upgrade `com.fasterxml.jackson` dependencies [#6378](https://github.com/hyperledger/besu/pull/6378)
- Upgrade Guava dependency [#6396](https://github.com/hyperledger/besu/pull/6396)
- Upgrade Mockito [#6397](https://github.com/hyperledger/besu/pull/6397)
- Upgrade `tech.pegasys.discovery:discovery` [#6414](https://github.com/hyperledger/besu/pull/6414)

### Bug fixes
- INTERNAL_ERROR from `eth_estimateGas` JSON/RPC calls [#6344](https://github.com/hyperledger/besu/issues/6344)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import org.hyperledger.besu.ethereum.rlp.RLP;

import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
import org.apache.tuweni.crypto.SECP256K1;
import org.apache.tuweni.units.bigints.UInt64;
import org.ethereum.beacon.discovery.schema.EnrField;
import org.ethereum.beacon.discovery.schema.IdentitySchema;
Expand All @@ -34,8 +36,10 @@ public void serializeDeserialize() {
final Bytes requestHash = Bytes.fromHexStringLenient("0x1234");
final Bytes nodeId =
Bytes.fromHexString("a448f24c6d18e575453db13171562b71999873db5b286df957af199ec94617f7");
final Bytes privateKey =
Bytes.fromHexString("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291");
final SECP256K1.SecretKey privateKey =
SECP256K1.SecretKey.fromBytes(
Bytes32.fromHexString(
"b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291"));

NodeRecord nodeRecord =
NodeRecordFactory.DEFAULT.createFromValues(
Expand All @@ -48,7 +52,8 @@ public void serializeDeserialize() {
new EnrField(EnrField.TCP, 8080),
new EnrField(EnrField.TCP_V6, 8080),
new EnrField(
EnrField.PKEY_SECP256K1, Functions.derivePublicKeyFromPrivate(privateKey)));
EnrField.PKEY_SECP256K1,
Functions.deriveCompressedPublicKeyFromPrivate(privateKey)));
nodeRecord.sign(privateKey);

assertThat(nodeRecord.getNodeId()).isEqualTo(nodeId);
Expand All @@ -72,8 +77,10 @@ public void readFrom() {
final Bytes requestHash = Bytes.fromHexStringLenient("0x1234");
final Bytes nodeId =
Bytes.fromHexString("a448f24c6d18e575453db13171562b71999873db5b286df957af199ec94617f7");
final Bytes privateKey =
Bytes.fromHexString("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291");
final SECP256K1.SecretKey privateKey =
SECP256K1.SecretKey.fromBytes(
Bytes32.fromHexString(
"b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291"));

NodeRecord nodeRecord =
NodeRecordFactory.DEFAULT.createFromValues(
Expand All @@ -82,7 +89,8 @@ public void readFrom() {
new EnrField(EnrField.IP_V4, Bytes.fromHexString("0x7F000001")),
new EnrField(EnrField.UDP, 30303),
new EnrField(
EnrField.PKEY_SECP256K1, Functions.derivePublicKeyFromPrivate(privateKey)));
EnrField.PKEY_SECP256K1,
Functions.deriveCompressedPublicKeyFromPrivate(privateKey)));
nodeRecord.sign(privateKey);

assertThat(nodeRecord.getNodeId()).isEqualTo(nodeId);
Expand All @@ -109,8 +117,10 @@ public void writeTo() {
final Bytes requestHash = Bytes.fromHexStringLenient("0x1234");
final Bytes nodeId =
Bytes.fromHexString("a448f24c6d18e575453db13171562b71999873db5b286df957af199ec94617f7");
final Bytes privateKey =
Bytes.fromHexString("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291");
final SECP256K1.SecretKey privateKey =
SECP256K1.SecretKey.fromBytes(
Bytes32.fromHexString(
"b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291"));

NodeRecord nodeRecord =
NodeRecordFactory.DEFAULT.createFromValues(
Expand All @@ -119,7 +129,8 @@ public void writeTo() {
new EnrField(EnrField.IP_V4, Bytes.fromHexString("0x7F000001")),
new EnrField(EnrField.UDP, 30303),
new EnrField(
EnrField.PKEY_SECP256K1, Functions.derivePublicKeyFromPrivate(privateKey)));
EnrField.PKEY_SECP256K1,
Functions.deriveCompressedPublicKeyFromPrivate(privateKey)));
nodeRecord.sign(privateKey);

assertThat(nodeRecord.getNodeId()).isEqualTo(nodeId);
Expand All @@ -144,16 +155,20 @@ public void readFrom_withExtraFields() {
final Bytes requestHash = Bytes.fromHexStringLenient("0x1234");
final Bytes nodeId =
Bytes.fromHexString("a448f24c6d18e575453db13171562b71999873db5b286df957af199ec94617f7");
final Bytes privateKey =
Bytes.fromHexString("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291");
final SECP256K1.SecretKey privateKey =
SECP256K1.SecretKey.fromBytes(
Bytes32.fromHexString(
"b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291"));

NodeRecord nodeRecord =
NodeRecordFactory.DEFAULT.createFromValues(
UInt64.ONE,
new EnrField(EnrField.ID, IdentitySchema.V4),
new EnrField(EnrField.IP_V4, Bytes.fromHexString("0x7F000001")),
new EnrField(EnrField.UDP, 30303),
new EnrField(EnrField.PKEY_SECP256K1, Functions.derivePublicKeyFromPrivate(privateKey)),
new EnrField(
EnrField.PKEY_SECP256K1,
Functions.deriveCompressedPublicKeyFromPrivate(privateKey)),
new EnrField("foo", Bytes.fromHexString("0x1234")));
nodeRecord.sign(privateKey);

Expand Down Expand Up @@ -181,8 +196,10 @@ public void readFrom_withExtraFields() {
@Test
public void readFrom_invalidSignature() {
final Bytes requestHash = Bytes.fromHexStringLenient("0x1234");
final Bytes privateKey =
Bytes.fromHexString("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f292");
final SECP256K1.SecretKey privateKey =
SECP256K1.SecretKey.fromBytes(
Bytes32.fromHexString(
"b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f292"));

NodeRecord nodeRecord =
NodeRecordFactory.DEFAULT.createFromValues(
Expand All @@ -191,7 +208,8 @@ public void readFrom_invalidSignature() {
new EnrField(EnrField.IP_V4, Bytes.fromHexString("0x7F000001")),
new EnrField(EnrField.UDP, 30303),
new EnrField(
EnrField.PKEY_SECP256K1, Functions.derivePublicKeyFromPrivate(privateKey)));
EnrField.PKEY_SECP256K1,
Functions.deriveCompressedPublicKeyFromPrivate(privateKey)));
nodeRecord.sign(privateKey);
nodeRecord.set(EnrField.UDP, 1234);

Expand Down
5 changes: 5 additions & 0 deletions gradle/allowed-licenses.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@
"moduleVersion": "1.0.3",
"moduleName": "org.reactivestreams:reactive-streams"
},
{
"moduleLicense": "MIT-0",
"moduleVersion": "1.0.4",
"moduleName": "org.reactivestreams:reactive-streams"
},
{
"moduleLicense": "Eclipse Public License - v 1.0",
"moduleVersion": "4.13.2",
Expand Down
86 changes: 47 additions & 39 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2402,15 +2402,15 @@
<sha256 value="42067396968c5056e60ce65fef4f0714679a11564a5180a291d8ac72813ffb97" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="io.projectreactor" name="reactor-core" version="3.4.14">
<artifact name="reactor-core-3.4.14.jar">
<sha256 value="5c82576a5f6142f084331e8b7526bf6cc9415ff013fbdb1b6810955fa2cd62ad" origin="Generated by Gradle"/>
<component group="io.projectreactor" name="reactor-core" version="3.4.24">
<artifact name="reactor-core-3.4.24.jar">
<sha256 value="f5eeb841e70c625831960ccc77bf79d37d01f08cd3d5eb68a2600db5632e3f1e" origin="Generated by Gradle"/>
</artifact>
<artifact name="reactor-core-3.4.14.module">
<sha256 value="bf5311e3e98ce36900612e5b089aeaa28038c7312bf28ecce056f7535a407c0a" origin="Generated by Gradle"/>
<artifact name="reactor-core-3.4.24.module">
<sha256 value="8d653a496e1f6d073fd7c8fb3840b61d2968980043ab3d59a9c24d2335bc1341" origin="Generated by Gradle"/>
</artifact>
<artifact name="reactor-core-3.4.14.pom">
<sha256 value="b79c88f7b8c8a0a8412e914310e61e5ee114b92a4fd440e23572c3ea55d1e0d7" origin="Generated by Gradle"/>
<artifact name="reactor-core-3.4.24.pom">
<sha256 value="b6f2196db9c09301f32a3f0f0913c315ff1d035649b7ce8fb72eb8bfbd7cddd5" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="io.prometheus" name="parent" version="0.15.0">
Expand Down Expand Up @@ -3359,44 +3359,44 @@
<sha256 value="0ee5520d052dd8af104dea3aae575ec468e69b1376edee6776a18538dfd9c0fe" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.apache.tuweni" name="tuweni-bytes" version="2.1.0">
<artifact name="tuweni-bytes-2.1.0.jar">
<sha256 value="283dff752302953b33296a3192774613c8a042c3c68a3c8c3442ea0eda2a6211" origin="Generated by Gradle"/>
<component group="org.apache.tuweni" name="tuweni-bytes" version="2.3.0">
<artifact name="tuweni-bytes-2.3.0.jar">
<sha256 value="062bc7477cd23e06949415b1031ceb39f3c6ebd2b4eaad3849d885e793e06e81" origin="Generated by Gradle"/>
</artifact>
<artifact name="tuweni-bytes-2.1.0.pom">
<sha256 value="1234ac03d16b7521543c07281d71c5638d531bc196a2fa28ad963cb4caafbfc8" origin="Generated by Gradle"/>
<artifact name="tuweni-bytes-2.3.0.pom">
<sha256 value="bce31af8aff6c6e3a962b1c35f80b71c5666e4426b6ef7dc6c7a3cbe1f9efa0d" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.apache.tuweni" name="tuweni-crypto" version="2.1.0">
<artifact name="tuweni-crypto-2.1.0.jar">
<sha256 value="183e434622392a52619b3727f219a42063fd5ef254cdcf9e9930671ff07f62e7" origin="Generated by Gradle"/>
<component group="org.apache.tuweni" name="tuweni-crypto" version="2.3.0">
<artifact name="tuweni-crypto-2.3.0.jar">
<sha256 value="6bf98f78e593fe1cb889a6cb6d25ba08f2a639639a096904d00cc83d65ee5e4d" origin="Generated by Gradle"/>
</artifact>
<artifact name="tuweni-crypto-2.1.0.pom">
<sha256 value="0f7c00fe30d58c5701d28c8b084b5fd084d50f5791d4b0ad8d787f92ea9cd3a6" origin="Generated by Gradle"/>
<artifact name="tuweni-crypto-2.3.0.pom">
<sha256 value="ab1f2c375f601da6dd4241eebb1478eb576b59cb6c844eb7f748405101f32ee4" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.apache.tuweni" name="tuweni-io" version="2.1.0">
<artifact name="tuweni-io-2.1.0.jar">
<sha256 value="476fb1cfb4a9f55ca7be0eeb0c376dc92f19e2dd443df25dd3dfa6ea9696873c" origin="Generated by Gradle"/>
<component group="org.apache.tuweni" name="tuweni-io" version="2.3.0">
<artifact name="tuweni-io-2.3.0.jar">
<sha256 value="07ccd5ee256241700c2a6381381d856bd1e372e2a9b0fd98569813cc91c89647" origin="Generated by Gradle"/>
</artifact>
<artifact name="tuweni-io-2.1.0.pom">
<sha256 value="202d101312d5b41bce0450e3b2e434a202fc0421a9149e8474db030f09bb3ba2" origin="Generated by Gradle"/>
<artifact name="tuweni-io-2.3.0.pom">
<sha256 value="bc51e3c30cd66b7903fe1cbeb64a9eb9335e471e3aa0fd4348e8f3d9819b40a2" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.apache.tuweni" name="tuweni-rlp" version="2.1.0">
<artifact name="tuweni-rlp-2.1.0.jar">
<sha256 value="7999c06f97cfb023886c15b2e3584f13f8777e32b5bcc857afb85b7e26121cb4" origin="Generated by Gradle"/>
<component group="org.apache.tuweni" name="tuweni-rlp" version="2.3.0">
<artifact name="tuweni-rlp-2.3.0.jar">
<sha256 value="aa1452b44697867dd423e73c2797059b11139a6f2ea9942043219e88570b5817" origin="Generated by Gradle"/>
</artifact>
<artifact name="tuweni-rlp-2.1.0.pom">
<sha256 value="be8a49e9f1ab98f49e419819db0e92e63bff9d53e61be9777566c8a7108b80e2" origin="Generated by Gradle"/>
<artifact name="tuweni-rlp-2.3.0.pom">
<sha256 value="b53d3cd729f9c5fb97c207c0cd320fc6a3b0ed3c14b0873f7ffc7e61b94d1d47" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.apache.tuweni" name="tuweni-units" version="2.1.0">
<artifact name="tuweni-units-2.1.0.jar">
<sha256 value="6a792f7d6160ac25053ab45d24de9ab2428e1cad1531c92476f1569d853f4954" origin="Generated by Gradle"/>
<component group="org.apache.tuweni" name="tuweni-units" version="2.3.0">
<artifact name="tuweni-units-2.3.0.jar">
<sha256 value="f9fb9b9e661377918cd1c660f3410756bc4d525d1ad16b7edbde770da1aec721" origin="Generated by Gradle"/>
</artifact>
<artifact name="tuweni-units-2.1.0.pom">
<sha256 value="e2854383a866cf2715b2adeb3353b13d318fcdb5eb8b673c980ce2e1276a7ade" origin="Generated by Gradle"/>
<artifact name="tuweni-units-2.3.0.pom">
<sha256 value="a10d6796edabefa05af3779b2937e55e26545636b34d2251dd14dd0fab934268" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.apiguardian" name="apiguardian-api" version="1.1.0">
Expand Down Expand Up @@ -5551,6 +5551,14 @@
<sha256 value="cced467175f4257833f6cb07510ff97b3c75a06e1a58d882a39d79853d51c602" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.reactivestreams" name="reactive-streams" version="1.0.4">
<artifact name="reactive-streams-1.0.4.jar">
<sha256 value="f75ca597789b3dac58f61857b9ac2e1034a68fa672db35055a8fb4509e325f28" origin="Generated by Gradle"/>
</artifact>
<artifact name="reactive-streams-1.0.4.pom">
<sha256 value="54ba23d87a2d438540c99ef8794a0856fc573a256b498678283c3c67ef18ada8" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.rnorth.duct-tape" name="duct-tape" version="1.0.8">
<artifact name="duct-tape-1.0.8.jar">
<sha256 value="31cef12ddec979d1f86d7cf708c41a17da523d05c685fd6642e9d0b2addb7240" origin="Generated by Gradle"/>
Expand Down Expand Up @@ -5958,15 +5966,15 @@
<sha256 value="0eabc50a504a10b49e6965523e91943d3cbceb0f70cde5962f4a215dcc198f32" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="tech.pegasys.discovery" name="discovery" version="22.2.0">
<artifact name="discovery-22.2.0.jar">
<sha256 value="0da2a8b2928aef595e9a637fa3d6595cecf744a2c63e05b815130ed658f80005" origin="Generated by Gradle"/>
<component group="tech.pegasys.discovery" name="discovery" version="22.12.0">
<artifact name="discovery-22.12.0.jar">
<sha256 value="eee1d301139b1ea22ab91ef8fe282c264da29b8d5212fc036c6024816218a06a" origin="Generated by Gradle"/>
</artifact>
<artifact name="discovery-22.2.0.module">
<sha256 value="2cdd76c6963cf8cb60bf795f539844c7cfadec68706a16379cd748d7eca2fb36" origin="Generated by Gradle"/>
<artifact name="discovery-22.12.0.module">
<sha256 value="be621f71dbfbae934305f49fd9fb25244b35349e0ea8791ff7ff3361b58e986d" origin="Generated by Gradle"/>
</artifact>
<artifact name="discovery-22.2.0.pom">
<sha256 value="3756fb29b2d64540b1fc1bf319916cc30bd7757f7ae2729d4c71bd06890ed527" origin="Generated by Gradle"/>
<artifact name="discovery-22.12.0.pom">
<sha256 value="5190b520a77d9c35a8e80f99d1f560f1827e87426bb20e81a64148e1b596d847" origin="Generated by Gradle"/>
</artifact>
</component>
</components>
Expand Down
2 changes: 1 addition & 1 deletion gradle/versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,6 @@ dependencyManagement {

dependency 'org.yaml:snakeyaml:2.0'

dependency 'tech.pegasys.discovery:discovery:22.2.0'
dependency 'tech.pegasys.discovery:discovery:22.12.0'
}
}
Loading