diff --git a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/FindNeighborsPacketData.java b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/FindNeighborsPacketData.java index d3a522fbe2..b89593e1d0 100644 --- a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/FindNeighborsPacketData.java +++ b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/FindNeighborsPacketData.java @@ -52,7 +52,7 @@ public static FindNeighborsPacketData readFrom(final RLPInput in) { in.enterList(); final BytesValue target = in.readBytesValue(); final long expiration = in.readLongScalar(); - in.leaveList(); + in.leaveListLenient(); return new FindNeighborsPacketData(target, expiration); } diff --git a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/NeighborsPacketData.java b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/NeighborsPacketData.java index 5842dac623..bc2d1d6e8c 100644 --- a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/NeighborsPacketData.java +++ b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/NeighborsPacketData.java @@ -45,7 +45,7 @@ public static NeighborsPacketData readFrom(final RLPInput in) { in.enterList(); final List peers = in.readList(DiscoveryPeer::readFrom); final long expiration = in.readLongScalar(); - in.leaveList(); + in.leaveListLenient(); return new NeighborsPacketData(peers, expiration); } diff --git a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/PingPacketData.java b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/PingPacketData.java index ea8b3b18fb..eee997ab8c 100644 --- a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/PingPacketData.java +++ b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/PingPacketData.java @@ -13,15 +13,11 @@ package tech.pegasys.pantheon.ethereum.p2p.discovery.internal; import static com.google.common.base.Preconditions.checkArgument; -import static tech.pegasys.pantheon.util.Preconditions.checkGuard; import tech.pegasys.pantheon.ethereum.p2p.discovery.Endpoint; -import tech.pegasys.pantheon.ethereum.p2p.discovery.PeerDiscoveryPacketDecodingException; import tech.pegasys.pantheon.ethereum.rlp.RLPInput; import tech.pegasys.pantheon.ethereum.rlp.RLPOutput; -import java.math.BigInteger; - public class PingPacketData implements PacketData { /* Fixed value that represents we're using v4 of the P2P discovery protocol. */ @@ -53,18 +49,12 @@ public static PingPacketData create(final Endpoint from, final Endpoint to) { public static PingPacketData readFrom(final RLPInput in) { in.enterList(); - final BigInteger version = in.readBigIntegerScalar(); - checkGuard( - version.intValue() == VERSION, - PeerDiscoveryPacketDecodingException::new, - "Version mismatch in ping packet. Expected: %s, got: %s.", - VERSION, - version); - + // The first element signifies the "version", but this value is ignored as of EIP-8 + in.readBigIntegerScalar(); final Endpoint from = Endpoint.decodeStandalone(in); final Endpoint to = Endpoint.decodeStandalone(in); final long expiration = in.readLongScalar(); - in.leaveList(); + in.leaveListLenient(); return new PingPacketData(from, to, expiration); } diff --git a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/PongPacketData.java b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/PongPacketData.java index d2ae1d504e..b26bd3dba8 100644 --- a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/PongPacketData.java +++ b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/PongPacketData.java @@ -44,7 +44,7 @@ public static PongPacketData readFrom(final RLPInput in) { final Endpoint to = Endpoint.decodeStandalone(in); final BytesValue hash = in.readBytesValue(); final long expiration = in.readLongScalar(); - in.leaveList(); + in.leaveListLenient(); return new PongPacketData(to, hash, expiration); } diff --git a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/wire/PeerInfo.java b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/wire/PeerInfo.java index 70fa69af46..98fc06b43c 100644 --- a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/wire/PeerInfo.java +++ b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/wire/PeerInfo.java @@ -61,7 +61,7 @@ public static PeerInfo readFrom(final RLPInput in) { in.nextIsNull() ? Collections.emptyList() : in.readList(Capability::readFrom); final int port = in.readIntScalar(); final BytesValue nodeId = in.readBytesValue(); - in.leaveList(true); + in.leaveListLenient(); return new PeerInfo(version, clientId, caps, port, nodeId); } diff --git a/ethereum/p2p/src/test/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/FindNeighborsPacketDataTest.java b/ethereum/p2p/src/test/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/FindNeighborsPacketDataTest.java new file mode 100644 index 0000000000..9d58ca24df --- /dev/null +++ b/ethereum/p2p/src/test/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/FindNeighborsPacketDataTest.java @@ -0,0 +1,76 @@ +/* + * Copyright 2019 ConsenSys AG. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package tech.pegasys.pantheon.ethereum.p2p.discovery.internal; + +import static org.assertj.core.api.Assertions.assertThat; + +import tech.pegasys.pantheon.ethereum.p2p.peers.Peer; +import tech.pegasys.pantheon.ethereum.rlp.BytesValueRLPOutput; +import tech.pegasys.pantheon.ethereum.rlp.RLP; +import tech.pegasys.pantheon.util.bytes.BytesValue; + +import org.junit.Test; + +public class FindNeighborsPacketDataTest { + @Test + public void serializeDeserialize() { + final long time = System.currentTimeMillis(); + final BytesValue target = Peer.randomId(); + + final FindNeighborsPacketData packet = FindNeighborsPacketData.create(target); + final BytesValue serialized = RLP.encode(packet::writeTo); + final FindNeighborsPacketData deserialized = + FindNeighborsPacketData.readFrom(RLP.input(serialized)); + + assertThat(deserialized.getTarget()).isEqualTo(target); + assertThat(deserialized.getExpiration()).isGreaterThan(time); + } + + @Test + public void readFrom() { + final long time = System.currentTimeMillis(); + final BytesValue target = Peer.randomId(); + + BytesValueRLPOutput out = new BytesValueRLPOutput(); + out.startList(); + out.writeBytesValue(target); + out.writeLongScalar(time); + out.endList(); + final BytesValue encoded = out.encoded(); + + final FindNeighborsPacketData deserialized = + FindNeighborsPacketData.readFrom(RLP.input(encoded)); + assertThat(deserialized.getTarget()).isEqualTo(target); + assertThat(deserialized.getExpiration()).isEqualTo(time); + } + + @Test + public void readFrom_withExtraFields() { + final long time = System.currentTimeMillis(); + final BytesValue target = Peer.randomId(); + + BytesValueRLPOutput out = new BytesValueRLPOutput(); + out.startList(); + out.writeBytesValue(target); + out.writeLongScalar(time); + // Add extra list elements + out.writeLong(123L); + out.endList(); + final BytesValue encoded = out.encoded(); + + final FindNeighborsPacketData deserialized = + FindNeighborsPacketData.readFrom(RLP.input(encoded)); + assertThat(deserialized.getTarget()).isEqualTo(target); + assertThat(deserialized.getExpiration()).isEqualTo(time); + } +} diff --git a/ethereum/p2p/src/test/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/NeighborsPacketDataTest.java b/ethereum/p2p/src/test/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/NeighborsPacketDataTest.java new file mode 100644 index 0000000000..996055131b --- /dev/null +++ b/ethereum/p2p/src/test/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/NeighborsPacketDataTest.java @@ -0,0 +1,79 @@ +/* + * Copyright 2019 ConsenSys AG. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package tech.pegasys.pantheon.ethereum.p2p.discovery.internal; + +import static org.assertj.core.api.Assertions.assertThat; +import static tech.pegasys.pantheon.ethereum.p2p.peers.PeerTestHelper.enode; + +import tech.pegasys.pantheon.ethereum.p2p.discovery.DiscoveryPeer; +import tech.pegasys.pantheon.ethereum.rlp.BytesValueRLPOutput; +import tech.pegasys.pantheon.ethereum.rlp.RLP; +import tech.pegasys.pantheon.util.bytes.BytesValue; + +import java.util.Arrays; +import java.util.List; + +import org.junit.Test; + +public class NeighborsPacketDataTest { + + @Test + public void serializeDeserialize() { + final long time = System.currentTimeMillis(); + final List peers = + Arrays.asList(DiscoveryPeer.fromEnode(enode()), DiscoveryPeer.fromEnode(enode())); + + final NeighborsPacketData packet = NeighborsPacketData.create(peers); + final BytesValue serialized = RLP.encode(packet::writeTo); + final NeighborsPacketData deserialized = NeighborsPacketData.readFrom(RLP.input(serialized)); + + assertThat(deserialized.getNodes()).isEqualTo(peers); + assertThat(deserialized.getExpiration()).isGreaterThan(time); + } + + @Test + public void readFrom() { + final long time = System.currentTimeMillis(); + final List peers = + Arrays.asList(DiscoveryPeer.fromEnode(enode()), DiscoveryPeer.fromEnode(enode())); + + BytesValueRLPOutput out = new BytesValueRLPOutput(); + out.startList(); + out.writeList(peers, DiscoveryPeer::writeTo); + out.writeLongScalar(time); + out.endList(); + BytesValue encoded = out.encoded(); + + final NeighborsPacketData deserialized = NeighborsPacketData.readFrom(RLP.input(encoded)); + assertThat(deserialized.getNodes()).isEqualTo(peers); + assertThat(deserialized.getExpiration()).isEqualTo(time); + } + + @Test + public void readFrom_extraFields() { + final long time = System.currentTimeMillis(); + final List peers = + Arrays.asList(DiscoveryPeer.fromEnode(enode()), DiscoveryPeer.fromEnode(enode())); + + BytesValueRLPOutput out = new BytesValueRLPOutput(); + out.startList(); + out.writeList(peers, DiscoveryPeer::writeTo); + out.writeLongScalar(time); + out.endList(); + BytesValue encoded = out.encoded(); + + final NeighborsPacketData deserialized = NeighborsPacketData.readFrom(RLP.input(encoded)); + assertThat(deserialized.getNodes()).isEqualTo(peers); + assertThat(deserialized.getExpiration()).isEqualTo(time); + } +} diff --git a/ethereum/p2p/src/test/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/PingPacketDataTest.java b/ethereum/p2p/src/test/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/PingPacketDataTest.java new file mode 100644 index 0000000000..4672717b07 --- /dev/null +++ b/ethereum/p2p/src/test/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/PingPacketDataTest.java @@ -0,0 +1,113 @@ +/* + * Copyright 2019 ConsenSys AG. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package tech.pegasys.pantheon.ethereum.p2p.discovery.internal; + +import static org.assertj.core.api.Assertions.assertThat; + +import tech.pegasys.pantheon.ethereum.p2p.discovery.Endpoint; +import tech.pegasys.pantheon.ethereum.rlp.BytesValueRLPOutput; +import tech.pegasys.pantheon.ethereum.rlp.RLP; +import tech.pegasys.pantheon.util.bytes.BytesValue; + +import java.util.OptionalInt; + +import org.junit.Test; + +public class PingPacketDataTest { + + @Test + public void serializeDeserialize() { + final long currentTime = System.currentTimeMillis(); + + final Endpoint from = new Endpoint("127.0.0.1", 30303, OptionalInt.of(30303)); + final Endpoint to = new Endpoint("127.0.0.2", 30303, OptionalInt.empty()); + final PingPacketData packet = PingPacketData.create(from, to); + final BytesValue serialized = RLP.encode(packet::writeTo); + final PingPacketData deserialized = PingPacketData.readFrom(RLP.input(serialized)); + + assertThat(deserialized.getFrom()).isEqualTo(from); + assertThat(deserialized.getTo()).isEqualTo(to); + assertThat(deserialized.getExpiration()).isGreaterThan(currentTime); + } + + @Test + public void readFrom() { + final int version = 4; + final Endpoint from = new Endpoint("127.0.0.1", 30303, OptionalInt.of(30303)); + final Endpoint to = new Endpoint("127.0.0.2", 30303, OptionalInt.empty()); + final long time = System.currentTimeMillis(); + + final BytesValueRLPOutput out = new BytesValueRLPOutput(); + out.startList(); + out.writeIntScalar(version); + from.encodeStandalone(out); + to.encodeStandalone(out); + out.writeLongScalar(time); + out.endList(); + + final BytesValue serialized = out.encoded(); + final PingPacketData deserialized = PingPacketData.readFrom(RLP.input(serialized)); + + assertThat(deserialized.getFrom()).isEqualTo(from); + assertThat(deserialized.getTo()).isEqualTo(to); + assertThat(deserialized.getExpiration()).isEqualTo(time); + } + + @Test + public void readFrom_withExtraFields() { + final int version = 4; + final Endpoint from = new Endpoint("127.0.0.1", 30303, OptionalInt.of(30303)); + final Endpoint to = new Endpoint("127.0.0.2", 30303, OptionalInt.empty()); + final long time = System.currentTimeMillis(); + + final BytesValueRLPOutput out = new BytesValueRLPOutput(); + out.startList(); + out.writeIntScalar(version); + from.encodeStandalone(out); + to.encodeStandalone(out); + out.writeLongScalar(time); + // Add extra field + out.writeLongScalar(11); + out.endList(); + + final BytesValue serialized = out.encoded(); + final PingPacketData deserialized = PingPacketData.readFrom(RLP.input(serialized)); + + assertThat(deserialized.getFrom()).isEqualTo(from); + assertThat(deserialized.getTo()).isEqualTo(to); + assertThat(deserialized.getExpiration()).isEqualTo(time); + } + + @Test + public void readFrom_unknownVersion() { + final int version = 99; + final Endpoint from = new Endpoint("127.0.0.1", 30303, OptionalInt.of(30303)); + final Endpoint to = new Endpoint("127.0.0.2", 30303, OptionalInt.empty()); + final long time = System.currentTimeMillis(); + + final BytesValueRLPOutput out = new BytesValueRLPOutput(); + out.startList(); + out.writeIntScalar(version); + from.encodeStandalone(out); + to.encodeStandalone(out); + out.writeLongScalar(time); + out.endList(); + + final BytesValue serialized = out.encoded(); + final PingPacketData deserialized = PingPacketData.readFrom(RLP.input(serialized)); + + assertThat(deserialized.getFrom()).isEqualTo(from); + assertThat(deserialized.getTo()).isEqualTo(to); + assertThat(deserialized.getExpiration()).isEqualTo(time); + } +} diff --git a/ethereum/p2p/src/test/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/PongPacketDataTest.java b/ethereum/p2p/src/test/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/PongPacketDataTest.java new file mode 100644 index 0000000000..172db39c6b --- /dev/null +++ b/ethereum/p2p/src/test/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/PongPacketDataTest.java @@ -0,0 +1,85 @@ +/* + * Copyright 2019 ConsenSys AG. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package tech.pegasys.pantheon.ethereum.p2p.discovery.internal; + +import static org.assertj.core.api.Assertions.assertThat; + +import tech.pegasys.pantheon.ethereum.p2p.discovery.Endpoint; +import tech.pegasys.pantheon.ethereum.rlp.BytesValueRLPOutput; +import tech.pegasys.pantheon.ethereum.rlp.RLP; +import tech.pegasys.pantheon.util.bytes.Bytes32; +import tech.pegasys.pantheon.util.bytes.BytesValue; + +import java.util.OptionalInt; + +import org.junit.Test; + +public class PongPacketDataTest { + + @Test + public void serializeDeserialize() { + final long currentTime = System.currentTimeMillis(); + final Endpoint to = new Endpoint("127.0.0.2", 30303, OptionalInt.empty()); + final Bytes32 hash = Bytes32.fromHexStringLenient("0x1234"); + + final PongPacketData packet = PongPacketData.create(to, hash); + final BytesValue serialized = RLP.encode(packet::writeTo); + final PongPacketData deserialized = PongPacketData.readFrom(RLP.input(serialized)); + + assertThat(deserialized.getTo()).isEqualTo(to); + assertThat(deserialized.getPingHash()).isEqualTo(hash); + assertThat(deserialized.getExpiration()).isGreaterThan(currentTime); + } + + @Test + public void readFrom() { + final long time = System.currentTimeMillis(); + final Endpoint to = new Endpoint("127.0.0.2", 30303, OptionalInt.empty()); + final Bytes32 hash = Bytes32.fromHexStringLenient("0x1234"); + + BytesValueRLPOutput out = new BytesValueRLPOutput(); + out.startList(); + to.encodeStandalone(out); + out.writeBytesValue(hash); + out.writeLongScalar(time); + out.endList(); + final BytesValue encoded = out.encoded(); + + final PongPacketData deserialized = PongPacketData.readFrom(RLP.input(encoded)); + assertThat(deserialized.getTo()).isEqualTo(to); + assertThat(deserialized.getPingHash()).isEqualTo(hash); + assertThat(deserialized.getExpiration()).isEqualTo(time); + } + + @Test + public void readFrom_withExtraFields() { + final long time = System.currentTimeMillis(); + final Endpoint to = new Endpoint("127.0.0.2", 30303, OptionalInt.empty()); + final Bytes32 hash = Bytes32.fromHexStringLenient("0x1234"); + + BytesValueRLPOutput out = new BytesValueRLPOutput(); + out.startList(); + to.encodeStandalone(out); + out.writeBytesValue(hash); + out.writeLongScalar(time); + // Add random fields + out.writeLong(1234L); + out.endList(); + final BytesValue encoded = out.encoded(); + + final PongPacketData deserialized = PongPacketData.readFrom(RLP.input(encoded)); + assertThat(deserialized.getTo()).isEqualTo(to); + assertThat(deserialized.getPingHash()).isEqualTo(hash); + assertThat(deserialized.getExpiration()).isEqualTo(time); + } +} diff --git a/ethereum/rlp/src/main/java/tech/pegasys/pantheon/ethereum/rlp/AbstractRLPInput.java b/ethereum/rlp/src/main/java/tech/pegasys/pantheon/ethereum/rlp/AbstractRLPInput.java index 8153e71ba0..c053660a8e 100644 --- a/ethereum/rlp/src/main/java/tech/pegasys/pantheon/ethereum/rlp/AbstractRLPInput.java +++ b/ethereum/rlp/src/main/java/tech/pegasys/pantheon/ethereum/rlp/AbstractRLPInput.java @@ -494,7 +494,11 @@ public void leaveList() { } @Override - public void leaveList(final boolean ignoreRest) { + public void leaveListLenient() { + leaveList(true); + } + + private void leaveList(final boolean ignoreRest) { checkState(depth > 0, "Not within an RLP list"); if (!ignoreRest) { diff --git a/ethereum/rlp/src/main/java/tech/pegasys/pantheon/ethereum/rlp/RLPInput.java b/ethereum/rlp/src/main/java/tech/pegasys/pantheon/ethereum/rlp/RLPInput.java index f34ea0fdc2..d7a123cd4a 100644 --- a/ethereum/rlp/src/main/java/tech/pegasys/pantheon/ethereum/rlp/RLPInput.java +++ b/ethereum/rlp/src/main/java/tech/pegasys/pantheon/ethereum/rlp/RLPInput.java @@ -110,9 +110,6 @@ public interface RLPInput { /** * Exits the current list after all its items have been consumed. * - *

This method is equivalent to calling {@link #leaveList(boolean)} with value false - * . - * *

Note that this method technically doesn't consume any input but must be called after having * read the last element of a list. This allow to ensure the structure of the input is indeed the * one expected. @@ -122,18 +119,13 @@ public interface RLPInput { void leaveList(); /** - * Exits the current list, allowing the caller to ignore any remaining unconsumed elements. + * Exits the current list, ignoring any remaining unconsumed elements. * *

Note that this method technically doesn't consume any input but must be called after having * read the last element of a list. This allow to ensure the structure of the input is indeed the * one expected. - * - * @param ignoreRest Whether to ignore any remaining elements in the list. If elements remain and - * this parameter is false, an exception will be thrown. - * @throws RLPException if the current list is not finished (it has more items), if - * ignoreRest is false. */ - void leaveList(boolean ignoreRest); + void leaveListLenient(); /** * Reads a scalar from the input and return is as a long value. diff --git a/ethereum/rlp/src/test/java/tech/pegasys/pantheon/ethereum/rlp/BytesValueRLPInputTest.java b/ethereum/rlp/src/test/java/tech/pegasys/pantheon/ethereum/rlp/BytesValueRLPInputTest.java index a6fff6dc17..d4214030ea 100644 --- a/ethereum/rlp/src/test/java/tech/pegasys/pantheon/ethereum/rlp/BytesValueRLPInputTest.java +++ b/ethereum/rlp/src/test/java/tech/pegasys/pantheon/ethereum/rlp/BytesValueRLPInputTest.java @@ -452,7 +452,7 @@ public void ignoreListTail() { final RLPInput in = RLP.input(h("0xc80102c51112c22122")); assertThat(in.enterList()).isEqualTo(3); assertThat(in.readByte()).isEqualTo((byte) 0x01); - in.leaveList(true); + in.leaveListLenient(); } @Test @@ -460,7 +460,7 @@ public void leaveListEarly() { final RLPInput in = RLP.input(h("0xc80102c51112c22122")); assertThat(in.enterList()).isEqualTo(3); assertThat(in.readByte()).isEqualTo((byte) 0x01); - assertThatThrownBy(() -> in.leaveList(false)) + assertThatThrownBy(() -> in.leaveList()) .isInstanceOf(RLPException.class) .hasMessageStartingWith("Not at the end of the current list"); }