@@ -371,12 +371,12 @@ fn handle_net_peer_count() -> ResponseData<U64> {
371
371
372
372
async fn handle_sign (
373
373
node : Arc < Node > ,
374
- address : & Address ,
375
- message : & ZeroXPrefixedBytes ,
374
+ address : Address ,
375
+ message : ZeroXPrefixedBytes ,
376
376
) -> ResponseData < Signature > {
377
377
event ! ( Level :: INFO , "eth_sign({address:?}, {message:?})" ) ;
378
378
379
- match node. sign ( address, message) . await {
379
+ match node. sign ( & address, message) . await {
380
380
Ok ( signature) => ResponseData :: Success { result : signature } ,
381
381
Err ( error) => match error {
382
382
NodeError :: UnknownAddress { .. } => {
@@ -437,15 +437,15 @@ fn handle_web3_sha3(message: ZeroXPrefixedBytes) -> ResponseData<B256> {
437
437
438
438
async fn handle_request (
439
439
node : Arc < Node > ,
440
- request : & RpcRequest < MethodInvocation > ,
440
+ request : RpcRequest < MethodInvocation > ,
441
441
) -> Result < serde_json:: Value , String > {
442
- fn response < T > ( id : & jsonrpc:: Id , data : ResponseData < T > ) -> Result < serde_json:: Value , String >
442
+ fn response < T > ( id : jsonrpc:: Id , data : ResponseData < T > ) -> Result < serde_json:: Value , String >
443
443
where
444
444
T : serde:: Serialize ,
445
445
{
446
446
let response: Response < T > = Response {
447
447
jsonrpc : jsonrpc:: Version :: V2_0 ,
448
- id : id . clone ( ) ,
448
+ id,
449
449
data,
450
450
} ;
451
451
serde_json:: to_value ( response) . map_err ( |e| {
@@ -460,7 +460,7 @@ async fn handle_request(
460
460
version,
461
461
id,
462
462
method : _,
463
- } if * version != jsonrpc:: Version :: V2_0 => response (
463
+ } if version != jsonrpc:: Version :: V2_0 => response (
464
464
id,
465
465
error_response_data :: < serde_json:: Value > (
466
466
0 ,
@@ -486,42 +486,39 @@ async fn handle_request(
486
486
response ( id, handle_coinbase ( node) . await )
487
487
}
488
488
MethodInvocation :: Eth ( EthMethodInvocation :: EvmIncreaseTime ( increment) ) => {
489
- response ( id, handle_evm_increase_time ( node, increment. clone ( ) ) . await )
489
+ response ( id, handle_evm_increase_time ( node, increment) . await )
490
490
}
491
491
MethodInvocation :: Eth ( EthMethodInvocation :: EvmMine ( timestamp) ) => {
492
- response ( id, handle_evm_mine ( node, timestamp. clone ( ) ) . await )
492
+ response ( id, handle_evm_mine ( node, timestamp) . await )
493
493
}
494
494
MethodInvocation :: Eth ( EthMethodInvocation :: EvmSetNextBlockTimestamp ( timestamp) ) => {
495
495
response (
496
496
id,
497
- handle_evm_set_next_block_timestamp ( node, timestamp. clone ( ) ) . await ,
497
+ handle_evm_set_next_block_timestamp ( node, timestamp) . await ,
498
498
)
499
499
}
500
500
MethodInvocation :: Eth ( EthMethodInvocation :: GetBalance ( address, block) ) => {
501
- response ( id, handle_get_balance ( node, * address, block. clone ( ) ) . await )
501
+ response ( id, handle_get_balance ( node, address, block) . await )
502
502
}
503
503
MethodInvocation :: Eth ( EthMethodInvocation :: GetCode ( address, block) ) => {
504
- response ( id, handle_get_code ( node, * address, block. clone ( ) ) . await )
504
+ response ( id, handle_get_code ( node, address, block) . await )
505
505
}
506
506
MethodInvocation :: Eth ( EthMethodInvocation :: GetFilterChanges ( filter_id) ) => {
507
- response ( id, handle_get_filter_changes ( node, * filter_id) . await )
507
+ response ( id, handle_get_filter_changes ( node, filter_id) . await )
508
508
}
509
509
MethodInvocation :: Eth ( EthMethodInvocation :: GetFilterLogs ( filter_id) ) => {
510
- response ( id, handle_get_filter_logs ( node, * filter_id) . await )
510
+ response ( id, handle_get_filter_logs ( node, filter_id) . await )
511
511
}
512
512
MethodInvocation :: Eth ( EthMethodInvocation :: GetStorageAt (
513
513
address,
514
514
position,
515
515
block,
516
516
) ) => response (
517
517
id,
518
- handle_get_storage_at ( node, * address, * position, block. clone ( ) ) . await ,
518
+ handle_get_storage_at ( node, address, position, block) . await ,
519
519
) ,
520
520
MethodInvocation :: Eth ( EthMethodInvocation :: GetTransactionCount ( address, block) ) => {
521
- response (
522
- id,
523
- handle_get_transaction_count ( node, * address, block. clone ( ) ) . await ,
524
- )
521
+ response ( id, handle_get_transaction_count ( node, address, block) . await )
525
522
}
526
523
MethodInvocation :: Eth ( EthMethodInvocation :: NetListening ( ) ) => {
527
524
response ( id, handle_net_listening ( ) )
@@ -545,38 +542,38 @@ async fn handle_request(
545
542
response ( id, handle_web3_sha3 ( message. clone ( ) ) )
546
543
}
547
544
MethodInvocation :: Eth ( EthMethodInvocation :: UninstallFilter ( filter_id) ) => {
548
- response ( id, handle_uninstall_filter ( node, * filter_id) . await )
545
+ response ( id, handle_uninstall_filter ( node, filter_id) . await )
549
546
}
550
547
MethodInvocation :: Eth ( EthMethodInvocation :: Unsubscribe ( subscription_id) ) => {
551
- response ( id, handle_unsubscribe ( node, * subscription_id) . await )
548
+ response ( id, handle_unsubscribe ( node, subscription_id) . await )
552
549
}
553
550
MethodInvocation :: Hardhat ( HardhatMethodInvocation :: ImpersonateAccount ( address) ) => {
554
- response ( id, handle_impersonate_account ( node, * address) . await )
551
+ response ( id, handle_impersonate_account ( node, address) . await )
555
552
}
556
553
MethodInvocation :: Hardhat ( HardhatMethodInvocation :: IntervalMine ( ) ) => {
557
554
response ( id, handle_interval_mine ( node) . await )
558
555
}
559
556
MethodInvocation :: Hardhat ( HardhatMethodInvocation :: SetBalance (
560
557
address,
561
558
balance,
562
- ) ) => response ( id, handle_set_balance ( node, * address, * balance) . await ) ,
559
+ ) ) => response ( id, handle_set_balance ( node, address, balance) . await ) ,
563
560
MethodInvocation :: Hardhat ( HardhatMethodInvocation :: SetCode ( address, code) ) => {
564
- response ( id, handle_set_code ( node, * address, code. clone ( ) ) . await )
561
+ response ( id, handle_set_code ( node, address, code) . await )
565
562
}
566
563
MethodInvocation :: Hardhat ( HardhatMethodInvocation :: SetNonce ( address, nonce) ) => {
567
- response ( id, handle_set_nonce ( node, * address, * nonce) . await )
564
+ response ( id, handle_set_nonce ( node, address, nonce) . await )
568
565
}
569
566
MethodInvocation :: Hardhat ( HardhatMethodInvocation :: SetStorageAt (
570
567
address,
571
568
position,
572
569
value,
573
570
) ) => response (
574
571
id,
575
- handle_set_storage_at ( node, * address, * position, * value) . await ,
572
+ handle_set_storage_at ( node, address, position, value) . await ,
576
573
) ,
577
574
MethodInvocation :: Hardhat ( HardhatMethodInvocation :: StopImpersonatingAccount (
578
575
address,
579
- ) ) => response ( id, handle_stop_impersonating_account ( node, * address) . await ) ,
576
+ ) ) => response ( id, handle_stop_impersonating_account ( node, address) . await ) ,
580
577
// TODO: after adding all the methods here, eliminate this
581
578
// catch-all match arm:
582
579
_ => {
@@ -614,7 +611,7 @@ async fn router(node: Arc<Node>) -> Router {
614
611
let responses = {
615
612
let mut responses: Vec < serde_json:: Value > =
616
613
Vec :: with_capacity ( requests. len ( ) ) ;
617
- for request in requests. iter ( ) {
614
+ for request in requests {
618
615
match handle_request ( Arc :: clone ( & node) , request) . await {
619
616
Ok ( response) => responses. push ( response) ,
620
617
Err ( s) => {
0 commit comments