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

API+ features for Mandel 3.1 #61

Merged
merged 212 commits into from
Apr 28, 2022
Merged

API+ features for Mandel 3.1 #61

merged 212 commits into from
Apr 28, 2022

Conversation

brianjohnson5972
Copy link
Contributor

@brianjohnson5972 brianjohnson5972 commented Mar 16, 2022

Transaction Retry.

When transaction retry is enabled on an API node, it will monitor incoming API transactions and ensure they are resubmitted additional times into the P2P network until they expire or are included in a block.

New configuration args for nodeos

  • transaction-retry-max-storage-size-gb
    • "Maximum size (in GiB) allowed to be allocated for the Transaction Retry feature. Setting above 0 enables this feature."
  • transaction-retry-interval-sec defaults to 20
    • "How often, in seconds, to resend an incoming transaction to the P2P network if not seen in a block."
  • transaction-retry-max-expiration-sec defaults to 90
    • "Maximum allowed transaction expiration for retry transactions, will retry transactions up to this value."
  • p2p-dedup-cache-expire-time-sec
    • "Maximum time in seconds to track transaction for duplicate optimization" Default of 10 seconds

New command line options for cleos

  • --use-old-send-rpc
    • "Use old RPC send_transaction, rather than new RPC /v1/chain/send_transaction2"
  • -t,--return-failure-trace
    • "Return partial traces on failed transactions"
      • This is ignored for now, feature to be added later to Mandel
  • --retry-irreversible
    • "Request node to retry transaction until it is irreversible or expires, blocking call"
  • --retry-num-blocks
    • "Request node to retry transaction until in a block of given height, blocking call"

New chain_api_plugin endpoint

  • /v1/chain/send_transaction2 (send_transaction_params)
struct send_transaction2_params {
      bool return_failure_trace = true; ///< Ignored. Future feature.
      bool retry_trx = false; ///< request transaction retry on validated transaction
      std::optional<uint16_t> retry_trx_num_blocks{}; ///< if retry_trx, report trace at specified blocks from executed or lib if not specified
      fc::variant transaction; ///< same format as send_transaction
   };

Transaction Finality Status

When transaction finality status is enabled, the status of a transaction in the node, as well as a snapshot of the current chain state, can be queried. If a transaction is not found for the given transaction id, only the chain status fields and a status of "UNKNOWN" will be provided.

New configuration args for nodeos

  • transaction-finality-status-max-storage-size-gb
    • "Maximum size (in GiB) allowed to be allocated for the Transaction Finality Status feature. Setting above 0 enables this feature."
  • transaction-finality-status-success-duration-sec
    • "Duration (in seconds) a successful transaction's Finality Status will remain available from being first identified."
  • transaction-finality-status-failure-duration-sec
    • "Duration (in seconds) a failed transaction's Finality Status will remain available from being first identified."

New command line options for cleos

  • get transaction-status &lt;id (required)&gt;

    • "Gets current blockchain state and, if available, transaction information given the transaction id"

New chain_api_plugin endpoint

  • /v1/chain/get_transaction_status (get_transaction_status_params )
struct get_transaction_status_params {
      string                       id; //transaction id to status
 };

 struct get_transaction_status_results {
    string                               state;
    std::optional<uint32_t>              block_number;
    std::optional<chain::block_id_type>  block_id;
    std::optional<fc::time_point>        block_timestamp;
    std::optional<fc::time_point>        expiration;
    uint32_t                             head_number;
    chain::block_id_type                 head_id;
    fc::time_point                       head_timestamp;
    uint32_t                             irreversible_number;
    chain::block_id_type                 irreversible_id;
    fc::time_point                       irreversible_timestamp;
    chain::block_id_type                 last_tracked_block_id;
};

PRs

Transaction Resource Cost Estimation

Transactions sent to this endpoint will be executed and create a transaction trace, including resource usage, and then will revert all state changes and will not contribute to the subjective billing for the account. If the transaction has signatures, they will be processed, but any failures will be ignored.

Users with exposed nodes who have enabled the compute_transaction endpoint should implement some sort of throttling to protect from Denial of Service attacks.

New command line options for cleos

  • --read-only
    • "Specify a transaction is read-only"

New chain_api_plugin endpoint

  • compute_transaction
    • uses existing send_transaction_params

PRs

Subjective Billing Improvements

Account max failures: During block production, accounts are permitted a set number of failures before their additional transactions are dropped for a given block. This previously hard-coded limit of 3 is now configurable. Also, disable-subjective-account-billing accounts are no longer subjected to this limit.

Decay time: Users are prevented from abuse of transactions by tracking an account's subjective CPU budget. The budget is returned to an account over a period of time known as subjective account decay. This previously hard-coded decay of 24 hours is now configurable.

New configuration args for nodeos

  • Subjective-account-max-failures (default 3)
    • "Sets the maximum amount of failures that are allowed for an account per block."
  • Subjective-account-decay-time-minutes (default 24 hours)
    • "Sets the time to return full subjective CPU for accounts"

PRs

@brianjohnson5972 brianjohnson5972 marked this pull request as ready for review March 16, 2022 18:11
@heifner heifner changed the title Eventual merge of 4 features for Mandel 3.0 WIP: Eventual merge of 4 features for Mandel 3.0 Mar 17, 2022
@brianjohnson5972 brianjohnson5972 changed the title WIP: Eventual merge of 4 features for Mandel 3.0 WIP: Eventual merge of 4 features for Mandel 3.1 Mar 23, 2022
ClaytonCalabrese and others added 25 commits April 22, 2022 17:44
…saction_resource_cost

Transaction Resource Cost Estimation Docs Update
…_size_variant

Update memory_size() calculation for tracked_transaction
Update finality status to have timestamps and trx expiration

Enable trx finality status processing feature

Update test

Update chain_plugin to make use of actual chain_state and trx_state

Fix unit tests
…ilure-traces

Implement return failure traces.
Callback registration lambdas are now wired fully from the initial stubs.

Updated docs with example transaction status output
…billing-test

Added integration tests for subjective billing
Remove enabling transaction finality status feature from previous feature testing effort.
…t-return-failure-traces

Revert "Implement return failure traces."
…nsaction-status

Add get_transaction_status to chain_plugin
@brianjohnson5972 brianjohnson5972 changed the title WIP: Eventual merge of 4 features for Mandel 3.1 API+ features for Mandel 3.1 Apr 27, 2022
@brianjohnson5972 brianjohnson5972 marked this pull request as ready for review April 27, 2022 19:56
Copy link
Member

@heifner heifner left a comment

Choose a reason for hiding this comment

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

Each individual PRs approved as they went into feature/oci_api_phase1

@heifner heifner merged commit 732dcec into main Apr 28, 2022
@heifner heifner deleted the feature/oci_api_phase1 branch April 28, 2022 01:33
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

Successfully merging this pull request may close these issues.

6 participants