Skip to content

Commit 0d0cf24

Browse files
committed
fix(rebase): align skipNonce signatures and regression tests
1 parent c49a1bf commit 0d0cf24

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

lighter/signer_client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,6 +1159,7 @@ async def create_tp_market_order_limited_slippage(
11591159
integrator_taker_fee: int = 0,
11601160
integrator_maker_fee: int = 0,
11611161
ideal_price=None,
1162+
skip_nonce: int = SKIP_NONCE_OFF,
11621163
nonce: int = DEFAULT_NONCE,
11631164
api_key_index: int = DEFAULT_API_KEY_INDEX
11641165
) -> Union[Tuple[CreateOrder, RespSendTx, None], Tuple[None, None, str]]:
@@ -1296,6 +1297,7 @@ async def create_sl_market_order_limited_slippage(
12961297
integrator_taker_fee: int = 0,
12971298
integrator_maker_fee: int = 0,
12981299
ideal_price=None,
1300+
skip_nonce: int = SKIP_NONCE_OFF,
12991301
nonce: int = DEFAULT_NONCE,
13001302
api_key_index: int = DEFAULT_API_KEY_INDEX
13011303
) -> Union[Tuple[CreateOrder, RespSendTx, None], Tuple[None, None, str]]:

test/test_issue_regressions.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def SignUpdateLeverage(self, *args):
230230
finally:
231231
SignerClient._SignerClient__decode_tx_info = original_decode
232232

233-
assert fake_signer.captured_args == (3, 500, SignerClient.ISOLATED_MARGIN_MODE, 17, 9, 42)
233+
assert fake_signer.captured_args == (3, 500, SignerClient.ISOLATED_MARGIN_MODE, SignerClient.SKIP_NONCE_OFF, 17, 9, 42)
234234

235235

236236
def test_update_leverage_keeps_public_margin_mode_and_fraction_mapping():
@@ -240,8 +240,8 @@ def test_update_leverage_keeps_public_margin_mode_and_fraction_mapping():
240240

241241
captured = {}
242242

243-
def fake_sign_update_leverage(market_index, fraction, margin_mode, nonce, api_key_index):
244-
captured["args"] = (market_index, fraction, margin_mode, nonce, api_key_index)
243+
def fake_sign_update_leverage(market_index, fraction, margin_mode, skip_nonce, nonce, api_key_index):
244+
captured["args"] = (market_index, fraction, margin_mode, skip_nonce, nonce, api_key_index)
245245
return 1, '{"MarginMode":1}', '0xabc', None
246246

247247
client.sign_update_leverage = fake_sign_update_leverage
@@ -257,7 +257,7 @@ def fake_sign_update_leverage(market_index, fraction, margin_mode, nonce, api_ke
257257
)
258258
)
259259

260-
assert captured["args"] == (3, 500, SignerClient.ISOLATED_MARGIN_MODE, 17, 9)
260+
assert captured["args"] == (3, 500, SignerClient.ISOLATED_MARGIN_MODE, SignerClient.SKIP_NONCE_OFF, 17, 9)
261261

262262

263263
def test_package_version_matches_distribution_metadata_when_installed():
@@ -445,6 +445,7 @@ def SignWithdraw(self, *args):
445445
SignerClient.ASSET_ID_USDC,
446446
SignerClient.ROUTE_SPOT,
447447
123456,
448+
SignerClient.SKIP_NONCE_OFF,
448449
9,
449450
7,
450451
42,
@@ -617,9 +618,10 @@ def test_sign_create_grouped_orders_forwards_grouping_type_and_order_count():
617618
captured = {}
618619

619620
class FakeSigner:
620-
def SignCreateGroupedOrders(self, grouping_type, orders_arr, count, nonce, api_key_index, account_index):
621+
def SignCreateGroupedOrders(self, grouping_type, orders_arr, count, integrator_account_index, integrator_taker_fee, integrator_maker_fee, skip_nonce, nonce, api_key_index, account_index):
621622
captured["grouping_type"] = grouping_type
622623
captured["count"] = count
624+
captured["skip_nonce"] = skip_nonce
623625
captured["nonce"] = nonce
624626
captured["api_key_index"] = api_key_index
625627
# return a SignedTxResponse-like object with null fields so decode works
@@ -656,6 +658,7 @@ def SignCreateGroupedOrders(self, grouping_type, orders_arr, count, nonce, api_k
656658

657659
assert captured["grouping_type"] == SignerClient.GROUPING_TYPE_ONE_CANCELS_THE_OTHER
658660
assert captured["count"] == 2
661+
assert captured["skip_nonce"] == SignerClient.SKIP_NONCE_OFF
659662
assert captured["nonce"] == 42
660663
assert captured["api_key_index"] == 7
661664

0 commit comments

Comments
 (0)