@ -272,7 +272,7 @@ public class NewPooledTransactionHashesMessageProcessorTest {
public void shouldEncodeTransactionsCorrectly_Eth68 ( ) {
final String expected =
"0xf87983000102cf8400000001840000000284000000 03f863a00000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000003" ;
"0xf86d83000102c30102 03f863a00000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000003" ;
final List < Hash > hashes =
List . of (
Hash . fromHexString (
@ -291,6 +291,50 @@ public class NewPooledTransactionHashesMessageProcessorTest {
@Test
public void shouldDecodeBytesCorrectly_Eth68 ( ) {
/ *
* [
* "0x0000102" ]
* [ "0x01" , "0x02" , "0x03" ] ,
* [ "0x0000000000000000000000000000000000000000000000000000000000000001" ,
* "0x0000000000000000000000000000000000000000000000000000000000000002" ,
* "0x0000000000000000000000000000000000000000000000000000000000000003" ]
* ]
* /
final Bytes bytes =
Bytes . fromHexString (
"0xf86d83000102c3010203f863a00000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000003" ) ;
final List < TransactionAnnouncement > announcementList =
getDecoder ( EthProtocol . ETH68 ) . decode ( RLP . input ( bytes ) ) ;
final TransactionAnnouncement frontier = announcementList . get ( 0 ) ;
assertThat ( frontier . getHash ( ) )
. isEqualTo (
Hash . fromHexString (
"0x0000000000000000000000000000000000000000000000000000000000000001" ) ) ;
assertThat ( frontier . getType ( ) ) . hasValue ( TransactionType . FRONTIER ) ;
assertThat ( frontier . getSize ( ) ) . hasValue ( 1L ) ;
final TransactionAnnouncement accessList = announcementList . get ( 1 ) ;
assertThat ( accessList . getHash ( ) )
. isEqualTo (
Hash . fromHexString (
"0x0000000000000000000000000000000000000000000000000000000000000002" ) ) ;
assertThat ( accessList . getType ( ) ) . hasValue ( TransactionType . ACCESS_LIST ) ;
assertThat ( accessList . getSize ( ) ) . hasValue ( 2L ) ;
final TransactionAnnouncement eip1559 = announcementList . get ( 2 ) ;
assertThat ( eip1559 . getHash ( ) )
. isEqualTo (
Hash . fromHexString (
"0x0000000000000000000000000000000000000000000000000000000000000003" ) ) ;
assertThat ( eip1559 . getType ( ) ) . hasValue ( TransactionType . EIP1559 ) ;
assertThat ( eip1559 . getSize ( ) ) . hasValue ( 3L ) ;
}
@Test
public void shouldDecodeBytesCorrectly_PreviousImplementations_Eth68 ( ) {
/ *
* [
* "0x0000102" ]
@ -453,9 +497,11 @@ public class NewPooledTransactionHashesMessageProcessorTest {
TransactionAnnouncementDecoder . getDecoder ( EthProtocol . ETH68 )
. decode ( RLP . input ( invalidMessageBytes ) ) ) ;
final String expectedMessage = "Value of size 5 has more than 4 bytes" ;
final String actualMessage = exception . getCause ( ) . getMessage ( ) ;
assertThat ( actualMessage ) . contains ( expectedMessage ) ;
final String expectedMessage = "Expected max 4 bytes for unsigned int, but got 5 bytes" ;
assertThat ( exception )
. hasCauseInstanceOf ( RLPException . class )
. cause ( )
. hasMessage ( expectedMessage ) ;
}
@Test