@@ -16,11 +16,6 @@ pub const JSON_RPC_VERSION_STR: &str = "2.0";
1616pub static JSON_RPC_VERSION : once_cell:: sync:: Lazy < Arc < str > > =
1717 once_cell:: sync:: Lazy :: new ( || Arc :: from ( JSON_RPC_VERSION_STR ) ) ;
1818
19- /// The maximum message length in bytes.
20- ///
21- /// See <https://github.com/WalletConnect/walletconnect-docs/blob/main/docs/specs/servers/relay/relay-server-rpc.md>
22- pub const MAX_MESSAGE_LENGTH : usize = 20000 ;
23-
2419/// The maximum number of topics allowed for a batch subscribe request.
2520///
2621/// See <https://github.com/WalletConnect/walletconnect-docs/blob/main/docs/specs/servers/relay/relay-server-rpc.md>
@@ -40,12 +35,6 @@ pub enum ValidationError {
4035 #[ error( "Invalid JSON RPC version" ) ]
4136 JsonRpcVersion ,
4237
43- #[ error(
44- "Message is too long. Maximum message length is {} characters" ,
45- MAX_MESSAGE_LENGTH
46- ) ]
47- MessageLength ,
48-
4938 #[ error(
5039 "The batch contains too many items. Maximum number of subscriptions is {}" ,
5140 MAX_SUBSCRIPTION_BATCH_SIZE
@@ -258,16 +247,7 @@ impl ErrorResponse {
258247 /// Validates the parameters.
259248 pub fn validate ( & self ) -> Result < ( ) , ValidationError > {
260249 if self . jsonrpc . as_ref ( ) != JSON_RPC_VERSION_STR {
261- return Err ( ValidationError :: JsonRpcVersion ) ;
262- }
263-
264- let data_len = self . error . data . as_deref ( ) . map ( str:: len) . unwrap_or ( 0 ) ;
265- let total_len = data_len + self . error . message . len ( ) ;
266-
267- // Make sure the combined length of error message and the optional `data` param
268- // do not exceed the `MAX_MESSAGE_LENGTH` limit.
269- if total_len > MAX_MESSAGE_LENGTH {
270- Err ( ValidationError :: MessageLength )
250+ Err ( ValidationError :: JsonRpcVersion )
271251 } else {
272252 Ok ( ( ) )
273253 }
@@ -487,11 +467,7 @@ impl RequestPayload for Publish {
487467 . decode ( )
488468 . map_err ( ValidationError :: TopicDecoding ) ?;
489469
490- if self . message . len ( ) > MAX_MESSAGE_LENGTH {
491- Err ( ValidationError :: MessageLength )
492- } else {
493- Ok ( ( ) )
494- }
470+ Ok ( ( ) )
495471 }
496472
497473 fn into_params ( self ) -> Params {
@@ -530,11 +506,7 @@ impl RequestPayload for Subscription {
530506 . decode ( )
531507 . map_err ( ValidationError :: TopicDecoding ) ?;
532508
533- if self . data . message . len ( ) > MAX_MESSAGE_LENGTH {
534- Err ( ValidationError :: MessageLength )
535- } else {
536- Ok ( ( ) )
537- }
509+ Ok ( ( ) )
538510 }
539511
540512 fn into_params ( self ) -> Params {
0 commit comments