File tree Expand file tree Collapse file tree 5 files changed +46
-1
lines changed Expand file tree Collapse file tree 5 files changed +46
-1
lines changed Original file line number Diff line number Diff line change @@ -689,6 +689,10 @@ pub enum EthRequest {
689
689
/// Set the executor (sponsor) wallet
690
690
#[ serde( rename = "anvil_setExecutor" , with = "sequence" ) ]
691
691
AnvilSetExecutor ( String ) ,
692
+
693
+ /// Enable or disable bypass for authorization list signature checks
694
+ #[ serde( rename = "anvil_setBypassAuthorizationChecks" , with = "sequence" ) ]
695
+ AnvilSetBypassAuthorizationChecks ( bool ) ,
692
696
}
693
697
694
698
/// Represents ethereum JSON-RPC API
Original file line number Diff line number Diff line change @@ -509,6 +509,9 @@ impl EthApi {
509
509
EthRequest :: AnvilSetExecutor ( executor_pk) => {
510
510
self . anvil_set_executor ( executor_pk) . to_rpc_result ( )
511
511
}
512
+ EthRequest :: AnvilSetBypassAuthorizationChecks ( enabled) => {
513
+ self . anvil_set_bypass_authorization_checks ( enabled) . await . to_rpc_result ( )
514
+ }
512
515
} ;
513
516
514
517
if let ResponseResult :: Error ( err) = & response {
@@ -1821,6 +1824,15 @@ impl EthApi {
1821
1824
Ok ( ( ) )
1822
1825
}
1823
1826
1827
+ /// Enables or disables bypass for authorization list signature checks
1828
+ ///
1829
+ /// Handler for ETH RPC call: `anvil_setBypassAuthorizationChecks`
1830
+ pub async fn anvil_set_bypass_authorization_checks ( & self , enabled : bool ) -> Result < ( ) > {
1831
+ node_info ! ( "anvil_setBypassAuthorizationChecks" ) ;
1832
+ self . backend . set_bypass_authorization_checks ( enabled) ;
1833
+ Ok ( ( ) )
1834
+ }
1835
+
1824
1836
/// Returns true if auto mining is enabled, and false.
1825
1837
///
1826
1838
/// Handler for ETH RPC call: `anvil_getAutomine`
Original file line number Diff line number Diff line change @@ -61,6 +61,18 @@ impl CheatsManager {
61
61
pub fn impersonated_accounts ( & self ) -> AddressHashSet {
62
62
self . state . read ( ) . impersonated_accounts . clone ( )
63
63
}
64
+
65
+
66
+ /// Enables or disables bypass for authorization list signature checks
67
+ pub fn set_bypass_authorization_checks ( & self , enabled : bool ) {
68
+ trace ! ( target: "cheats" , "Bypass authorization checks set to {:?}" , enabled) ;
69
+ self . state . write ( ) . bypass_authorization_checks = enabled;
70
+ }
71
+
72
+ /// Returns true if authorization list signature checks should be bypassed
73
+ pub fn bypass_authorization_checks ( & self ) -> bool {
74
+ self . state . read ( ) . bypass_authorization_checks
75
+ }
64
76
}
65
77
66
78
/// Container type for all the state variables
@@ -70,4 +82,6 @@ pub struct CheatsState {
70
82
pub impersonated_accounts : AddressHashSet ,
71
83
/// If set to true will make the `is_impersonated` function always return true
72
84
pub auto_impersonate_accounts : bool ,
85
+ /// If set to true, bypass signature verification on authorization lists
86
+ pub bypass_authorization_checks : bool ,
73
87
}
Original file line number Diff line number Diff line change @@ -509,6 +509,11 @@ impl Backend {
509
509
self . cheats . set_auto_impersonate_account ( enabled) ;
510
510
}
511
511
512
+ /// Sets whether to bypass authorization list signature checks
513
+ pub fn set_bypass_authorization_checks ( & self , enabled : bool ) {
514
+ self . cheats . set_bypass_authorization_checks ( enabled) ;
515
+ }
516
+
512
517
/// Returns the configured fork, if any
513
518
pub fn get_fork ( & self ) -> Option < ClientFork > {
514
519
self . fork . read ( ) . clone ( )
@@ -1584,7 +1589,16 @@ impl Backend {
1584
1589
blob_hashes,
1585
1590
..Default :: default ( )
1586
1591
} ;
1587
- base. set_signed_authorization ( authorization_list. unwrap_or_default ( ) ) ;
1592
+
1593
+ // If bypass is enabled, skip setting authorization list to bypass signature validation
1594
+ match self . cheats . bypass_authorization_checks ( ) {
1595
+ true => {
1596
+ base. set_signed_authorization ( Vec :: new ( ) ) ;
1597
+ }
1598
+ false => {
1599
+ base. set_signed_authorization ( authorization_list. unwrap_or_default ( ) ) ;
1600
+ }
1601
+ }
1588
1602
env. tx = OpTransaction { base, ..Default :: default ( ) } ;
1589
1603
1590
1604
if let Some ( nonce) = nonce {
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ mod proof;
15
15
mod pubsub;
16
16
mod revert;
17
17
mod sign;
18
+ mod signature_bypass;
18
19
mod simulate;
19
20
mod state;
20
21
mod traces;
You can’t perform that action at this time.
0 commit comments