From c1a946d4e51abe27b26e04b7f3796738f764b007 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Sun, 19 Feb 2017 13:52:02 -0500 Subject: [PATCH] some doc fixes --- docs/guide/basecoin-design.md | 2 +- docs/guide/plugin-design.md | 4 ++-- docs/guide/src/example-plugin/cmd.go | 30 ++++++++++++++-------------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/guide/basecoin-design.md b/docs/guide/basecoin-design.md index b35a6e529..a9bf5d503 100644 --- a/docs/guide/basecoin-design.md +++ b/docs/guide/basecoin-design.md @@ -55,7 +55,7 @@ type TxInput struct { Coins Coins `json:"coins"` // Sequence int `json:"sequence"` // Must be 1 greater than the last committed TxInput Signature crypto.Signature `json:"signature"` // Depends on the PubKey type and the whole Tx - PubKey crypto.PubKey `json:"pub_key"` // Is present if Sequence == 0 + PubKey crypto.PubKey `json:"pub_key"` // Is present iff Sequence == 0 } type TxOutput struct { diff --git a/docs/guide/plugin-design.md b/docs/guide/plugin-design.md index 17cb20010..f59ce736c 100644 --- a/docs/guide/plugin-design.md +++ b/docs/guide/plugin-design.md @@ -67,8 +67,8 @@ One could imagine going so far as to implement the Ethereum Virtual Machine as a Any required plugin initialization should be constructed within `SetOption`. `SetOption` may be called during genesis of basecoin and can be used to set initial plugin parameters. Within genesis.json file entries are made in -the format: "/", "" Where is the plugin name, -and and are the strings passed into the plugin SetOption function. +the format: `"/", ""`, where `` is the plugin name, +and `` and `` are the strings passed into the plugin SetOption function. This function is intended to be used to set plugin specific information such as the plugin state. diff --git a/docs/guide/src/example-plugin/cmd.go b/docs/guide/src/example-plugin/cmd.go index f9a3ff6af..6d7c29a79 100644 --- a/docs/guide/src/example-plugin/cmd.go +++ b/docs/guide/src/example-plugin/cmd.go @@ -41,26 +41,26 @@ func cmdExamplePluginTx(c *cli.Context) error { //Retrieve any flag results exampleFlag := c.Bool("valid") - // Create a transaction object with flag results - // This object is responsible for passing on custom plugin information + // Create a transaction using the flag. + // The tx passes on custom information to the plugin exampleTx := ExamplePluginTx{exampleFlag} - // The custom plugin object is passed to the plugin in the form of - // a byte array. This is achieved serializing the object using go-wire. + // The tx is passed to the plugin in the form of + // a byte array. This is achieved by serializing the object using go-wire. // Once received in the plugin, these exampleTxBytes are decoded back - // into the original object struct ExamplePluginTx + // into the original ExamplePluginTx struct exampleTxBytes := wire.BinaryBytes(exampleTx) // Send the transaction and return any errors. - // Here exampleTxBytes will be passed on to the plugin through the - // following series of function calls: - // - commands.AppTx as data (cmd/commands/tx.go) - // - commands.broadcastTx as tx.Data (cmd/commands/tx.go) - // - after being broadcast the Tendermint transaction - // will be run through app.CheckTx, and if successful DeliverTx, - // let's assume app.CheckTx passes - // - app.DeliverTx serialized within txBytes as tx.Data (app/app.go) - // - state.ExecTx as tx.Data (state/execution.go) - // - plugin.RunTx as txBytes (docs/guide/src/example-plugin/plugin.go) + // Here exampleTxBytes is packaged in the `tx.Data` field of an AppTx, + // and passed on to the plugin through the following sequence: + // - passed as `data` to `commands.AppTx` (cmd/commands/tx.go) + // - set as the `tx.Data` field of an AppTx, which is then passed to commands.broadcastTx (cmd/commands/tx.go) + // - the tx is broadcast to Tendermint, which runs it through app.CheckTx (app/app.go) + // - after passing CheckTx, it will eventually be included in a block and run through app.DeliverTx (app/app.go) + // - DeliverTx receives txBytes, which is the serialization of the full AppTx (app/app.go) + // - Once deserialized, the tx is passed to `state.ExecTx` (state/execution.go) + // - If the tx passes various checks, the `tx.Data` is forwarded as `txBytes` to `plugin.RunTx` (docs/guide/src/example-plugin/plugin.go) + // - Finally, it deserialized back to the ExamplePluginTx return commands.AppTx(c, "example-plugin", exampleTxBytes) }