Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dependency issue #308

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sirEven
Copy link
Contributor

@sirEven sirEven commented Dec 22, 2024

This PR updates the v4-proto dependency to 7.0.5 which hopefully fixes the dependency issue due to the version 5.2.1 being yanked.

…bsocket subscriptions by using a simple thread an wrapping the problematic async call.
@sirEven sirEven requested review from a team as code owners December 22, 2024 17:50
@sirEven
Copy link
Contributor Author

sirEven commented Dec 22, 2024

#308

@sirEven sirEven force-pushed the fix-dependency-issue branch from dddffa0 to 99547ee Compare December 22, 2024 18:52
@sirEven
Copy link
Contributor Author

sirEven commented Dec 22, 2024

At least locally i get a FLAKY error on the test test_order(). I would appreciate some help, or collaborating effort to solve this, as I am not familiar with those parts of the client.

here is the output of the failing test.

test_order():
node_client = NodeClient(channel=<grpc._channel.Channel object at 0x109a45110>, builder=Builder(chain_id='dydx-testnet-4', denominat...t Example'), sequence_manager=<dydx_v4_client.node.client.SequenceManager object at 0x109d4b090>, manage_sequence=True)
test_order = order_id {
subaccount_id {
owner: "dydx14zzueazeh0hj67cghhf9jypslcf9sh2n5k6art"
}
client_id: 691618829
order_flags: 64
}
side: SIDE_BUY
quantums: 10000000
subticks: 40000000000
good_til_block_time: 1734895889
client_metadata: 2

test_order_id = subaccount_id {
owner: "dydx14zzueazeh0hj67cghhf9jypslcf9sh2n5k6art"
}
client_id: 691618829
order_flags: 64

test_address = 'dydx14zzueazeh0hj67cghhf9jypslcf9sh2n5k6art', private_key = <ecdsa.keys.SigningKey object at 0x109dacd50>
wallet = Wallet(key=<ecdsa.keys.SigningKey object at 0x109dacd50>, account_number=380, sequence=6719)

@pytest.mark.asyncio
async def test_order(
    node_client, test_order, test_order_id, test_address, private_key, wallet
):
    try:
        placed = await node_client.place_order(
            wallet,
            test_order,
        )
        assert_successful_broadcast(placed)

        # If the time is too short the result of cancel order is sequence error:
        # codespace: "sdk"\n  code: 32\n  raw_log: "account sequence mismatch, expected 1460, got 1459: incorrect account sequence"
        # If the time is too long the result is:
        # codespace: "clob"\n  code:...hj67cghhf9jypslcf9sh2n5k6art Number:0} ClientId:13850897 OrderFlags:64 ClobPairId:0}: Stateful order does not exist"
        time.sleep(1.5)

        wallet = await get_wallet(node_client, private_key, test_address)

        canceled = await node_client.cancel_order(
            wallet,
            test_order_id,
            good_til_block_time=test_order.good_til_block_time,
        )
        assert_successful_broadcast(canceled)
    except Exception as e:
        if "StillUndercollateralized" in str(e) or "NewlyUndercollateralized" in str(e):
            pytest.skip("Account is undercollateralized. Skipping the test.")
        else:
          raise e

tests/test_mutating_node_client.py:104:


tests/test_mutating_node_client.py:99: in test_order
assert_successful_broadcast(canceled)


response = tx_response {
txhash: "210B57A9838E14D515FDAA6A86F16AB76CC96C3B216EF38FDA2D5D81946741FE"
codespace: "sdk"
code: 32
raw_log: "account sequence mismatch, expected 6720, got 6719: incorrect account sequence"
}

def assert_successful_broadcast(response):
    assert type(response) == v4_proto.cosmos.tx.v1beta1.service_pb2.BroadcastTxResponse
  assert is_successful(response)

E assert False
E + where False = is_successful(tx_response {\n txhash: "210B57A9838E14D515FDAA6A86F16AB76CC96C3B216EF38FDA2D5D81946741FE"\n codespace: "sdk"\n code: 32\n raw_log: "account sequence mismatch, expected 6720, got 6719: incorrect account sequence"\n}\n)

tests/test_mutating_node_client.py:30: AssertionError

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant