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

Reject invalid ranges #320

Closed
bilthon opened this issue Jul 4, 2024 · 3 comments
Closed

Reject invalid ranges #320

bilthon opened this issue Jul 4, 2024 · 3 comments

Comments

@bilthon
Copy link
Contributor

bilthon commented Jul 4, 2024

While testing ranges I was able to make mostro accept an order in which the min_amount > max_amount. The web client will prevent this from happening, but ideally these kinds of orders should also be rejected by mostrod in case other clients fail to catch this.

Here's a sample event that was accepted by mostro:

[
    "EVENT",
    "kinds:38383-since,au-377",
    {
        "tags":
        [
            [
                "d",
                "a5b58500-b9c7-4fbb-8fb7-a3aadeead498"
            ],
            [
                "k",
                "sell"
            ],
            [
                "f",
                "PEN"
            ],
            [
                "s",
                "pending"
            ],
            [
                "amt",
                "0"
            ],
            [
                "fa",
                "20",
                "12"
            ],
            [
                "pm",
                "Cash"
            ],
            [
                "premium",
                "0"
            ],
            [
                "rating",
                "{\"total_reviews\":2,\"total_rating\":4.0,\"last_rating\":5,\"max_rate\":5,\"min_rate\":1}"
            ],
            [
                "y",
                "mostrop2p"
            ],
            [
                "z",
                "order"
            ],
            [
                "expiration",
                "1720204380"
            ]
        ],
        "content": "",
        "sig": "d7654a114292b0b0a2c9f0e4a979d106e543726926358becc48912ed7ef5478c2af9b28c5738e1bd41dc7a591d78340ac545c63091fde8ffbd5ee5466763d52e",
        "id": "28580844bac22a84bcbe996ee900412d81087115916d12146bbd99eed290b345",
        "pubkey": "2ecbfef3fab5751c09bdc38d45f6bd0d633fa63f1bc252ec1c44c47db45e72d9",
        "created_at": 1720074781,
        "kind": 38383
    }
]
@arkanoider
Copy link
Collaborator

Will fix asap.

arkanoider added a commit that referenced this issue Jul 4, 2024
@arkanoider
Copy link
Collaborator

grunch pushed a commit that referenced this issue Jul 9, 2024
* fix for issue #320

* fix: prevents the creation of an order with inverted min & max amounts (#322)

---------

Co-authored-by: Bilthon <bilthon@gmail.com>
@grunch
Copy link
Member

grunch commented Jul 10, 2024

fixed via #322

@grunch grunch closed this as completed Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants