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

Remove Tx Broadcast and Commit Support #3954

Merged
merged 19 commits into from
Mar 26, 2019

Conversation

alexanderbez
Copy link
Contributor

@alexanderbez alexanderbez commented Mar 20, 2019

  • Replace --async flag with --broadcast-mode flag. This flag defaults to sync which returns once CheckTx execution is finished. This is inline with the way nearly any other blockchain operates (e.g. broadcast and keep checking when it's included in a block).
    • The flag still supports block (commit) mode but this is mainly due to unit/integration tests. A doc entry has been added to stipulate this mode should not be used.
  • Add a Raw Log entry to the TxResponse. This is not JSON-encoded, but will allow getting a log entry when a tx fails pre message execution.

closes: #3875
closes: #3941


  • Targeted PR against correct branch (see CONTRIBUTING.md)

  • Linked to github-issue with discussion and accepted design OR link to spec that describes this work.

  • Wrote tests

  • Updated relevant documentation (docs/)

  • Added a relevant changelog entry: sdkch add [section] [stanza] [message]

  • rereviewed Files changed in the github PR explorer


For Admin Use:

  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)
  • Reviewers Assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@alexanderbez alexanderbez added WIP T: API Breaking Breaking changes that impact APIs and the SDK only (not state machine). labels Mar 20, 2019
@codecov
Copy link

codecov bot commented Mar 21, 2019

Codecov Report

Merging #3954 into develop will decrease coverage by 0.12%.
The diff coverage is 20%.

@@             Coverage Diff             @@
##           develop    #3954      +/-   ##
===========================================
- Coverage    60.33%   60.21%   -0.13%     
===========================================
  Files          196      196              
  Lines        14533    14557      +24     
===========================================
- Hits          8768     8765       -3     
- Misses        5181     5208      +27     
  Partials       584      584

@alexanderbez alexanderbez marked this pull request as ready for review March 21, 2019 14:42
Copy link
Collaborator

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

utACK

@@ -68,6 +68,7 @@ type TxResponse struct {
TxHash string `json:"txhash"`
Code uint32 `json:"code,omitempty"`
Data []byte `json:"data,omitempty"`
RawLog string `json:"raw_log,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

++

func NewResponseFormatBroadcastTxCommit(res *ctypes.ResultBroadcastTxCommit) TxResponse {
if !res.CheckTx.IsOK() {
Copy link
Member

Choose a reason for hiding this comment

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

++ much better here.

}
return
}
switch ctx.BroadcastMode {
Copy link
Member

Choose a reason for hiding this comment

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

++

@jackzampolin
Copy link
Member

Left a few comments. Would really like to see the ability to set this via gaiacli config but not stuck on it (could be another PR). Otherwise LGTM!

@jackzampolin
Copy link
Member

jackzampolin commented Mar 25, 2019

Another item bordering on this that might want to be a separate PR as well is short flags for --account-number --sequence- and --chain-id

@alexanderbez
Copy link
Contributor Author

Another item bordering on this that might want to be a separate PR as well is short flags for --account-number --sequence- and --chain-id

yup, that's addressed in #3970.

@alexanderbez alexanderbez merged commit 2b43e25 into develop Mar 26, 2019
@alexanderbez alexanderbez deleted the bez/3875-remove-tx-broadcast-commit branch March 26, 2019 00:54
@Onefox
Copy link

Onefox commented Apr 12, 2019

The swagger doc is not up to date here:
https://cosmos.network/rpc/#/ICS0/post_txs it should be mode now as param instead of return

@alexanderbez
Copy link
Contributor Author

@Onefox

The Swagger doc is updated:

/txs:
get:
tags:
- ICS0
summary: Search transactions
description: Search transactions by tag(s).
produces:
- application/json
parameters:
- in: query
name: tag
type: string
description: "transaction tags such as 'action=submit-proposal' and 'sender=cosmos1g9ahr6xhht5rmqven628nklxluzyv8z9jqjcmc' which results in the following endpoint: 'GET /txs?action=submit-proposal&sender=cosmos1g9ahr6xhht5rmqven628nklxluzyv8z9jqjcmc'"
required: true
x-example: 'TODO'
- in: query
name: page
description: Page number
type: integer
x-example: 1
- in: query
name: limit
description: Maximum number of items per page
type: integer
x-example: 1
responses:
200:
description: All txs matching the provided tags
schema:
type: array
items:
$ref: "#/definitions/TxQuery"
400:
description: Invalid search tags
500:
description: Internal Server Error
post:
tags:
- ICS0
summary: Broadcast a signed tx
description: Broadcast a signed tx to a full node
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: txBroadcast
description: The tx must be a signed StdTx. The supported broadcast modes include `"block"`(return after tx commit), `"sync"`(return afer CheckTx) and `"async"`(return right away).
required: true
schema:
type: object
properties:
tx:
$ref: "#/definitions/StdTx"
mode:
type: string
example: block
responses:
200:
description: Tx broadcasting result
schema:
$ref: "#/definitions/BroadcastTxCommitResult"
500:
description: Internal Server Error

I don't know where that site pulls its docs from though. @fedekunze?

@fedekunze
Copy link
Collaborator

it’s pulled from master

@alexanderbez
Copy link
Contributor Author

Then it looks like it'll be resolved once 0.34 is released!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: API Breaking Breaking changes that impact APIs and the SDK only (not state machine).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No log message output in tx when Out of Gas CLI times out too quickly
4 participants