1818import client .response_parser as ResponseParser
1919from client .utils import recover_transaction
2020from client .tx_simu import TxSimu
21+ from client .gating import Gating
22+ from client .proxy_info import ProxyInfo
2123
2224
2325BIP32_PATH = "m/44'/60'/0'/0/0"
@@ -70,7 +72,8 @@ def common_blind_sign(scenario_navigator: NavigateWithScenario,
7072 test_name : str ,
7173 app_client : EthAppClient ,
7274 tx_params : dict ,
73- reject : bool = False ):
75+ reject : bool = False ,
76+ nb_warnings : int = 1 ) -> None :
7477 try :
7578 with app_client .sign (BIP32_PATH , tx_params ):
7679 if reject :
@@ -80,9 +83,9 @@ def common_blind_sign(scenario_navigator: NavigateWithScenario,
8083 test_name += "_nonzero"
8184
8285 if reject :
83- scenario_navigator .review_reject_with_warning (test_name = test_name )
86+ scenario_navigator .review_reject_with_warning (test_name = test_name , nb_warnings = nb_warnings )
8487 else :
85- scenario_navigator .review_approve_with_warning (test_name = test_name )
88+ scenario_navigator .review_approve_with_warning (test_name = test_name , nb_warnings = nb_warnings )
8689
8790 except ExceptionRAPDU as e :
8891 assert reject
@@ -101,7 +104,9 @@ def test_blind_sign(navigator: Navigator,
101104 test_name : str ,
102105 reject : bool ,
103106 amount : float ,
104- simu_params : Optional [TxSimu ] = None ):
107+ simu_params : Optional [TxSimu ] = None ,
108+ gating_params : Optional [Gating ] = None ,
109+ with_proxy : bool = False ):
105110 if reject and amount > 0.0 :
106111 pytest .skip ()
107112
@@ -115,6 +120,30 @@ def test_blind_sign(navigator: Navigator,
115120
116121 tx_params = common_tx_params (amount )
117122
123+ if with_proxy :
124+ # Change address to a proxy contract
125+ tx_params ["to" ] = bytes .fromhex ("CcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC" )
126+ # Set proxy implementation address
127+ address = bytes .fromhex ("6b175474e89094c44da98b954eedeac495271d0f" )
128+ if gating_params is not None :
129+ # Override gating address to match proxy implementation
130+ gating_params .address = address
131+ proxy_info = ProxyInfo (
132+ ResponseParser .challenge (app_client .get_challenge ().data ),
133+ address ,
134+ tx_params ["chainId" ],
135+ tx_params ["to" ],
136+ selector = None ,
137+ )
138+ response = app_client .provide_proxy_info (proxy_info .serialize ())
139+ assert response .status == StatusWord .OK
140+
141+ nb_warnings = 1
142+ if gating_params is not None :
143+ response = app_client .provide_gating (gating_params )
144+ assert response .status == StatusWord .OK
145+ nb_warnings += 1
146+
118147 if not reject and simu_params is not None :
119148 _ , tx_hash = app_client .serialize_tx (tx_params )
120149 simu_params .tx_hash = tx_hash
@@ -127,7 +156,8 @@ def test_blind_sign(navigator: Navigator,
127156 test_name ,
128157 app_client ,
129158 tx_params ,
130- reject )
159+ reject ,
160+ nb_warnings )
131161
132162
133163# Token approval, would require providing the token metadata from the CAL
0 commit comments