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

REST-API: Performing a deposit with total_deposit less than current total_deposit returns 200 response #2630

Closed
Dominik1999 opened this issue Sep 28, 2018 · 5 comments
Assignees
Labels
Component / API Issues that relate the the APIs Raiden provides. Component / Scenario Player Issues that involve the raiden scenario player testing Severity / Minor

Comments

@Dominik1999
Copy link
Contributor

Raiden node returns 200 SUCCESS when setting total_deposit to something smaller than current total_deposit (withdrawing)

This test runs successfully with a Raiden node.


scenario:
  serial:
         name: Scenario F11 (Depositing negative amount II)
         tasks:
           - open_channel: {from: 0, to: 1, total_deposit: 99_000_000_000_000_000_000}
           - assert: {from: 0, to: 1, total_deposit: 99_000_000_000_000_000_000, balance: 99_000_000_000_000_000_000, state: "opened"} 
           - deposit: {from: 0, to: 1, total_deposit: 1, expected_http_status: 200}
           - assert: {from: 0, to: 1, total_deposit: 99_000_000_000_000_000_000, balance: 99_000_000_000_000_000_000, state: "opened"}

Therefore, it is possible to set total_deposit to 1 token (the Raiden Node returns code 200) without changing the status of total_deposit.

I used my own token with 18 decimals.

@ulope ulope removed their assignment Sep 28, 2018
@ulope ulope added Component / API Issues that relate the the APIs Raiden provides. Component / Scenario Player Issues that involve the raiden scenario player testing labels Sep 28, 2018
@ulope ulope changed the title Red Eyes Release - Depositing total_amount less than current total_amount leads to 200 code SUCCESS REST-API: Performing a deposit with total_deposit less than current total_deposit returns 200 response Sep 28, 2018
@ulope
Copy link
Collaborator

ulope commented Sep 28, 2018

The reason is this:

raiden/raiden/api/python.py

Lines 399 to 401 in 49832df

if total_deposit <= channel_state.our_state.contract_balance:
# no action required
return

@Dominik1999
Copy link
Contributor Author

ok then, this is no bug and the return code 200 is what we expect? Then I close this again

@palango
Copy link
Contributor

palango commented Sep 28, 2018

ok then, this is no bug and the return code 200 is what we expect?

From my understanding we should return 409 CONFLICT in this case

@ulope
Copy link
Collaborator

ulope commented Sep 28, 2018

Yes, this is definitely a bug IMO.

Esp. since we catch the DepositMismatch in the rest api layer:

raiden/raiden/api/rest.py

Lines 1046 to 1050 in 49832df

except DepositMismatch as e:
return api_error(
errors=str(e),
status_code=HTTPStatus.CONFLICT,
)

which describes exactly the case you're testing:

class DepositMismatch(RaidenRecoverableError):
""" Raised when the requested deposit is lower than actual channel deposit
Used when a *user* tries to deposit a given amount of token in a channel,
but the on-chain amount is already higher.
"""
pass

@Dominik1999
Copy link
Contributor Author

ok nice, I found my first bug then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component / API Issues that relate the the APIs Raiden provides. Component / Scenario Player Issues that involve the raiden scenario player testing Severity / Minor
Projects
None yet
Development

No branches or pull requests

4 participants