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

[3.2] Add /v1/chain/get_unapplied_transactions to producer_api_plugin #182

Merged
merged 5 commits into from
Sep 21, 2022

Conversation

heifner
Copy link
Member

@heifner heifner commented Sep 17, 2022

Add /v1/chain/get_unapplied_transactions to producer_api_plugin

Interface:

   get_unapplied_transactions_params {
      string                lower_bound;  /// transaction id
      optional<uint32_t>    limit = 100;
      optional<uint32_t>    time_limit_ms; // defaults to 10ms
   };

   unapplied_trx {
      transaction_id_type       trx_id;
      time_point_sec            expiration;
      string                    trx_type; // eosio::chain::trx_enum_type values or "read_only"
      account_name              first_auth;
      account_name              first_receiver;
      action_name               first_action;
      uint16_t                  total_actions = 0;
      uint32_t                  billed_cpu_time_us = 0;
      size_t                    size = 0;
   };

   get_unapplied_transactions_result {
      size_t                     size = 0;
      size_t                     incoming_size = 0;
      vector<unapplied_trx>      trxs;
      string                     more; ///< fill lower_bound with trx id to fetch next set of transactions
   };

Resolves #109

Example use:

$ curl -s http://127.0.0.1:8888/v1/producer/get_unapplied_transactions -d '{"limit":2}' | jq
{
  "size": 7495,
  "incoming_size": 0,
  "trxs": [
    {
      "trx_id": "fa9692a4bdd688bf889890d972e1d3a2ee00ad636bdd7ce56115ac962760c0d9",
      "expiration": "2022-09-17T16:31:10",
      "trx_type": "aborted",
      "first_auth": "fhjnm.c.wam",
      "first_receiver": "m.federation",
      "first_action": "mine",
      "total_actions": 1,
      "billed_cpu_time_us": 701,
      "size": 934
    },
    {
      "trx_id": "731fc1f6c1e7ed958090fad622cf4f11af97bab44320a42876c38703faadbb59",
      "expiration": "2022-09-17T16:30:16",
      "trx_type": "aborted",
      "first_auth": "a44cg.wam",
      "first_receiver": "m.federation",
      "first_action": "mine",
      "total_actions": 1,
      "billed_cpu_time_us": 746,
      "size": 934
    }
  ],
  "more": "dcd3464938ffc06f8aced1a1706ae0082fdaabc680f58854bfb8932ed822ce2c"
}
$ curl -s http://127.0.0.1:8888/v1/producer/get_unapplied_transactions -d '{"lower_bound":"dcd3464938ffc06f8aced1a1706ae0082fdaabc680f58854bfb8932ed822ce2c","limit":2}' | jq
{
  "size": 12428,
  "incoming_size": 4475,
  "trxs": [
    {
      "trx_id": "dcd3464938ffc06f8aced1a1706ae0082fdaabc680f58854bfb8932ed822ce2c",
      "expiration": "2022-09-17T16:30:16",
      "trx_type": "aborted",
      "first_auth": "jkbsg.wam",
      "first_receiver": "m.federation",
      "first_action": "mine",
      "total_actions": 1,
      "billed_cpu_time_us": 504,
      "size": 934
    },
    {
      "trx_id": "0b1e96b1eb56855d4eeee9f70ca9c623296212304851743c916b65e52ff83999",
      "expiration": "2022-09-17T16:30:16",
      "trx_type": "aborted",
      "first_auth": "kxiik.wam",
      "first_receiver": "m.federation",
      "first_action": "mine",
      "total_actions": 1,
      "billed_cpu_time_us": 545,
      "size": 934
    }
  ],
  "more": "00edb80be7eb903d74970d653cb63489c573d55d867078b794328e13c32e3227"
}

@heifner heifner changed the title [3.2] Add /v1/chain/get_unapplied_transactions to producer_api_plugin [3.2] Add /v1/chain/get_unapplied_transactions to producer_api_plugin Sep 17, 2022
@heifner heifner changed the title [3.2] Add /v1/chain/get_unapplied_transactions to producer_api_plugin [3.2] Add /v1/chain/get_unapplied_transactions to producer_api_plugin Sep 17, 2022
@heifner heifner added the OCI Work exclusive to OCI team label Sep 17, 2022
@ericpassmore
Copy link
Contributor

Updated openapi updates producer.swagger.yaml
fixes #184

result.size = ua.size();
result.incoming_size = ua.incoming_size();

uint32_t remaining = p.limit ? *p.limit : std::numeric_limits<uint32_t>::max();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defaulting to max seems big. Not sure what is typical, I would have made the default a max of short int, uint16. Max should be bigger up to unit32.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is limited by the time_limit_ms, setting limit to max uint32 just means it is limited by time only.

Copy link
Member

@spoonincode spoonincode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah one sec

@heifner heifner merged commit 78aa0b1 into main Sep 21, 2022
@heifner heifner deleted the GH-109-get-unapplied branch September 21, 2022 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCI Work exclusive to OCI team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: Allow inspection of various queues within nodeos
4 participants