@@ -28,7 +28,7 @@ const CONTEXT_BYTES_LEN: usize = 4;
2828
2929/* Inbound Codec */
3030
31- pub struct SSZSnappyInboundCodec < E > {
31+ pub struct SSZSnappyInboundCodec < E : EthSpec > {
3232 protocol : ProtocolId ,
3333 inner : Uvi < usize > ,
3434 len : Option < usize > ,
@@ -143,7 +143,7 @@ impl<E: EthSpec> Encoder<RpcResponse<E>> for SSZSnappyInboundCodec<E> {
143143
144144// Decoder for inbound streams: Decodes RPC requests from peers
145145impl < E : EthSpec > Decoder for SSZSnappyInboundCodec < E > {
146- type Item = RequestType ;
146+ type Item = RequestType < E > ;
147147 type Error = RPCError ;
148148
149149 fn decode ( & mut self , src : & mut BytesMut ) -> Result < Option < Self :: Item > , Self :: Error > {
@@ -195,7 +195,7 @@ impl<E: EthSpec> Decoder for SSZSnappyInboundCodec<E> {
195195}
196196
197197/* Outbound Codec: Codec for initiating RPC requests */
198- pub struct SSZSnappyOutboundCodec < E > {
198+ pub struct SSZSnappyOutboundCodec < E : EthSpec > {
199199 inner : Uvi < usize > ,
200200 len : Option < usize > ,
201201 protocol : ProtocolId ,
@@ -322,10 +322,10 @@ impl<E: EthSpec> SSZSnappyOutboundCodec<E> {
322322}
323323
324324// Encoder for outbound streams: Encodes RPC Requests to peers
325- impl < E : EthSpec > Encoder < RequestType > for SSZSnappyOutboundCodec < E > {
325+ impl < E : EthSpec > Encoder < RequestType < E > > for SSZSnappyOutboundCodec < E > {
326326 type Error = RPCError ;
327327
328- fn encode ( & mut self , item : RequestType , dst : & mut BytesMut ) -> Result < ( ) , Self :: Error > {
328+ fn encode ( & mut self , item : RequestType < E > , dst : & mut BytesMut ) -> Result < ( ) , Self :: Error > {
329329 let bytes = match item {
330330 RequestType :: Status ( req) => req. as_ssz_bytes ( ) ,
331331 RequestType :: Goodbye ( req) => req. as_ssz_bytes ( ) ,
@@ -549,11 +549,11 @@ fn handle_length(
549549/// Decodes an `InboundRequest` from the byte stream.
550550/// `decoded_buffer` should be an ssz-encoded bytestream with
551551// length = length-prefix received in the beginning of the stream.
552- fn handle_rpc_request (
552+ fn handle_rpc_request < E : EthSpec > (
553553 versioned_protocol : SupportedProtocol ,
554554 decoded_buffer : & [ u8 ] ,
555555 spec : & ChainSpec ,
556- ) -> Result < Option < RequestType > , RPCError > {
556+ ) -> Result < Option < RequestType < E > > , RPCError > {
557557 match versioned_protocol {
558558 SupportedProtocol :: StatusV1 => Ok ( Some ( RequestType :: Status (
559559 StatusMessage :: from_ssz_bytes ( decoded_buffer) ?,
@@ -1035,7 +1035,6 @@ mod tests {
10351035 BlobsByRangeRequest {
10361036 start_slot : 0 ,
10371037 count : 10 ,
1038- max_blobs_per_block : Spec :: max_blobs_per_block ( ) ,
10391038 }
10401039 }
10411040
@@ -1181,7 +1180,7 @@ mod tests {
11811180 }
11821181
11831182 /// Verifies that requests we send are encoded in a way that we would correctly decode too.
1184- fn encode_then_decode_request ( req : RequestType , fork_name : ForkName , spec : & ChainSpec ) {
1183+ fn encode_then_decode_request ( req : RequestType < Spec > , fork_name : ForkName , spec : & ChainSpec ) {
11851184 let fork_context = Arc :: new ( fork_context ( fork_name) ) ;
11861185 let max_packet_size = max_rpc_size ( & fork_context, spec. max_chunk_size as usize ) ;
11871186 let protocol = ProtocolId :: new ( req. versioned_protocol ( ) , Encoding :: SSZSnappy ) ;
@@ -1778,7 +1777,7 @@ mod tests {
17781777 fn test_encode_then_decode_request ( ) {
17791778 let chain_spec = Spec :: default_spec ( ) ;
17801779
1781- let requests: & [ RequestType ] = & [
1780+ let requests: & [ RequestType < Spec > ] = & [
17821781 RequestType :: Ping ( ping_message ( ) ) ,
17831782 RequestType :: Status ( status_message ( ) ) ,
17841783 RequestType :: Goodbye ( GoodbyeReason :: Fault ) ,
0 commit comments