Skip to content

Buyback orders that fail to place should not show in account history #2691

@abitmore

Description

@abitmore

Bug Description

On Testnet:

>>> get_account_history special-account 3
61978003 2022-11-21T20:41:00 1.11.151387577 Create limit order to sell 10 SPECIALA for 0.0001 SPECIAL   (Fee: 0 TEST) 
61977906 2022-11-21T20:36:00 1.11.151387576 Create limit order to sell 10 SPECIALA for 0.0001 SPECIAL   (Fee: 0 TEST) 
61977809 2022-11-21T20:31:00 1.11.151387575 Create limit order to sell 10 SPECIALA for 0.0001 SPECIAL   (Fee: 0 TEST)

Note that there is no result showing with these orders. A normal limit order looks like this:

61978048 2022-11-21T20:43:24 1.11.151387578 Create limit order to sell 1 TEST for 1000 CONTEST.BTC   (Fee: 0.00100 TEST)   result: 1.7.9085458

Actually the results of those orders are [0,{}] aka void_result():

>>> get_object 1.11.151387577
[{
    "id": "1.11.151387577",
    "op": [
      1,{
        "fee": {
          "amount": 0,
          "asset_id": "1.3.0"
        },
        "seller": "1.2.3564",
        "amount_to_sell": {
          "amount": 100000,
          "asset_id": "1.3.329"
        },
        "min_to_receive": {
          "amount": 1,
          "asset_id": "1.3.330"
        },
        "expiration": "2106-02-07T06:28:15",
        "fill_or_kill": false,
        "extensions": []
      }
    ],
    "result": [
      0,{}
    ],
    "block_num": 61978003,
    "trx_in_block": 0,
    "op_in_trx": 0,
    "virtual_op": 0,
    "is_virtual": true,
    "block_time": "2022-11-21T20:41:00"
  }
]

According to the log messages, there was an error when placing these orders, so no order was successfully placed:

create_buyback_order ] Skipping buyback processing selling 1.3.329 for {"id":"1.3.330","symbol":"SPECIAL","precision":4,"issuer":"1.2.3563","options":{"max_supply":1000000000,"market_fee_percent":0,"max_market_fee":0,"issuer_permissions":79,"flags":0,"core_exchange_rate":{"base":{"amount":100000,"asset_id":"1.3.0"},"quote":{"amount":10000,"asset_id":"1.3.330"}},"whitelist_authorities":[],"blacklist_authorities":[],"whitelist_markets":[],"blacklist_markets":[],"description":"{\"main\":\"\",\"market\":\"\"}","extensions":{}},"dynamic_asset_data_id":"2.3.330","buyback_account":"1.2.3564","creation_block_num":10660593,"creation_time":"2017-09-01T07:44:54"} for buyback account {"id":"1.2.3564","membership_expiration_date":"1970-01-01T00:00:00","registrar":"1.2.17","referrer":"1.2.17","lifetime_referrer":"1.2.17","network_fee_percentage":2000,"lifetime_referrer_fee_percentage":3000,"referrer_rewards_percentage":3,"name":"special-account","owner":{"weight_threshold":1,"account_auths":[["1.2.3",1]],"key_auths":[],"address_auths":[]},"active":{"weight_threshold":1,"account_auths":[["1.2.3",1]],"key_auths":[],"address_auths":[]},"options":{"memo_key":"TEST7H976gDkY4PkUTpLTDNjYL8u7n9fP9X4qgi4rbArYRS7srxUqE","voting_account":"1.2.5","num_witness":0,"num_committee":0,"votes":[],"extensions":[]},"num_committee_voted":0,"statistics":"2.6.3564","whitelisting_accounts":[],"blacklisting_accounts":[],"whitelisted_accounts":[],"blacklisted_accounts":[],"owner_special_authority":[0,{}],"active_special_authority":[0,{}],"top_n_control_flags":0,"allowed_assets":["1.3.329","1.3.330"],"creation_block_num":10660894,"creation_time":"2017-09-01T08:03:45"} at block 61978003; exception was 10 assert_exception: Assert Exception is_authorized_asset( d, *fee_paying_account, *fee_asset ): Account 1.2.3564 'special-account' attempted to pay fee by using asset 1.3.0 'TEST', which is unauthorized due to whitelist / blacklist

Like failed proposals, I think we should not list these orders in account history (see cryptonomex/graphene#481 and 7e0e58f). Note that existing operation history IDs (1.11.x) should remain unchanged (see cryptonomex/graphene#483 and 7cae350).

Strictly speaking, fixing this issue does not change consensus. However, in order to preserve the existing operations history IDs, we need to fix this issue in a consensus upgrade.

Impacts
Describe which portion(s) of BitShares Core may be impacted by this bug. Please tick at least one box.

  • API (the application programming interface)
  • Build (the build process or something prior to compiled code)
  • CLI (the command line wallet)
  • Deployment (the deployment process after building such as Docker, Travis, etc.)
  • DEX (the Decentralized EXchange, market engine, etc.)
  • P2P (the peer-to-peer network for transaction/block propagation)
  • Performance (system or user efficiency, etc.)
  • Protocol (the blockchain logic, consensus, validation, etc.)
  • Security (the security of system or user data, etc.)
  • UX (the User Experience)
  • Other (please add below)

Host Environment
Please provide details about the host environment. Much of this information can be found running: witness_node --version.

  • BitShares Version: test-6.1.2

CORE TEAM TASK LIST

  • Evaluate / Prioritize Bug Report
  • Refine User Stories / Requirements
  • Define Test Cases
  • Design / Develop Solution
  • Perform QA/Testing
  • Update Documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions