Skip to content

Commit e315110

Browse files
author
abel
committed
(fix) Changed gas cost of spot orders in general, to solve out of gas issues when using the estimator
1 parent 53496cf commit e315110

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

pyinjective/core/gas_limit_estimator.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@
1212
tx_pb2 as injective_exchange_tx_pb,
1313
)
1414

15-
SPOT_ORDER_CREATION_GAS_LIMIT = 45_000
15+
SPOT_ORDER_CREATION_GAS_LIMIT = 50_000
1616
DERIVATIVE_ORDER_CREATION_GAS_LIMIT = 70_000
1717
SPOT_ORDER_CANCELATION_GAS_LIMIT = 50_000
1818
DERIVATIVE_ORDER_CANCELATION_GAS_LIMIT = 60_000
19-
# POST ONLY orders take around 60% (for spot) and 50% (for derivative) more gas to create than normal orders
20-
# due to the required validations
21-
SPOT_POST_ONLY_ORDER_MULTIPLIER = 0.6
19+
# POST ONLY orders take around 50% more gas to create than normal orders due to the required validations
20+
SPOT_POST_ONLY_ORDER_MULTIPLIER = 0.5
2221
DERIVATIVE_POST_ONLY_ORDER_MULTIPLIER = 0.5
2322

2423

tests/core/test_gas_limit_estimator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_estimation_for_batch_create_spot_limit_orders(self):
4646
message = composer.MsgBatchCreateSpotLimitOrders(sender="sender", orders=orders)
4747
estimator = GasLimitEstimator.for_message(message=message)
4848

49-
expected_order_gas_limit = 45000
49+
expected_order_gas_limit = 50000
5050
expected_message_gas_limit = 15000
5151

5252
assert (expected_order_gas_limit * 2) + expected_message_gas_limit == estimator.gas_limit()
@@ -172,7 +172,7 @@ def test_estimation_for_batch_update_orders_to_create_spot_orders(self):
172172
)
173173
estimator = GasLimitEstimator.for_message(message=message)
174174

175-
expected_order_gas_limit = 45_000
175+
expected_order_gas_limit = 50_000
176176
expected_message_gas_limit = 15_000
177177

178178
assert (expected_order_gas_limit * 2) + expected_message_gas_limit == estimator.gas_limit()
@@ -462,7 +462,7 @@ def test_estimation_for_exec_message(self):
462462

463463
estimator = GasLimitEstimator.for_message(message=message)
464464

465-
expected_order_gas_limit = 45_000
465+
expected_order_gas_limit = 50_000
466466
expected_inner_message_gas_limit = 15_000
467467
expected_exec_message_gas_limit = 8_000
468468

0 commit comments

Comments
 (0)