You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

418 lines
13 KiB

8 years ago
new pubsub package comment out failing consensus tests for now rewrite rpc httpclient to use new pubsub package import pubsub as tmpubsub, query as tmquery make event IDs constants EventKey -> EventTypeKey rename EventsPubsub to PubSub mempool does not use pubsub rename eventsSub to pubsub new subscribe API fix channel size issues and consensus tests bugs refactor rpc client add missing discardFromChan method add mutex rename pubsub to eventBus remove IsRunning from WSRPCConnection interface (not needed) add a comment in broadcastNewRoundStepsAndVotes rename registerEventCallbacks to broadcastNewRoundStepsAndVotes See https://dave.cheney.net/2014/03/19/channel-axioms stop eventBuses after reactor tests remove unnecessary Unsubscribe return subscribe helper function move discardFromChan to where it is used subscribe now returns an err this gives us ability to refuse to subscribe if pubsub is at its max capacity. use context for control overflow cache queries handle err when subscribing in replay_test rename testClientID to testSubscriber extract var set channel buffer capacity to 1 in replay_file fix byzantine_test unsubscribe from single event, not all events refactor httpclient to return events to appropriate channels return failing testReplayCrashBeforeWriteVote test fix TestValidatorSetChanges refactor code a bit fix testReplayCrashBeforeWriteVote add comment fix TestValidatorSetChanges fixes from Bucky's review update comment [ci skip] test TxEventBuffer update changelog fix TestValidatorSetChanges (2nd attempt) only do wg.Done when no errors benchmark event bus create pubsub server inside NewEventBus only expose config params (later if needed) set buffer capacity to 0 so we are not testing cache new tx event format: key = "Tx" plus a tag {"tx.hash": XYZ} This should allow to subscribe to all transactions! or a specific one using a query: "tm.events.type = Tx and tx.hash = '013ABF99434...'" use TimeoutCommit instead of afterPublishEventNewBlockTimeout TimeoutCommit is the time a node waits after committing a block, before it goes into the next height. So it will finish everything from the last block, but then wait a bit. The idea is this gives it time to hear more votes from other validators, to strengthen the commit it includes in the next block. But it also gives it time to hear about new transactions. waitForBlockWithUpdatedVals rewrite WAL crash tests Task: test that we can recover from any WAL crash. Solution: the old tests were relying on event hub being run in the same thread (we were injecting the private validator's last signature). when considering a rewrite, we considered two possible solutions: write a "fuzzy" testing system where WAL is crashing upon receiving a new message, or inject failures and trigger them in tests using something like https://github.com/coreos/gofail. remove sleep no cs.Lock around wal.Save test different cases (empty block, non-empty block, ...) comments add comments test 4 cases: empty block, non-empty block, non-empty block with smaller part size, many blocks fixes as per Bucky's last review reset subscriptions on UnsubscribeAll use a simple counter to track message for which we panicked also, set a smaller part size for all test cases
8 years ago
8 years ago
8 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
new pubsub package comment out failing consensus tests for now rewrite rpc httpclient to use new pubsub package import pubsub as tmpubsub, query as tmquery make event IDs constants EventKey -> EventTypeKey rename EventsPubsub to PubSub mempool does not use pubsub rename eventsSub to pubsub new subscribe API fix channel size issues and consensus tests bugs refactor rpc client add missing discardFromChan method add mutex rename pubsub to eventBus remove IsRunning from WSRPCConnection interface (not needed) add a comment in broadcastNewRoundStepsAndVotes rename registerEventCallbacks to broadcastNewRoundStepsAndVotes See https://dave.cheney.net/2014/03/19/channel-axioms stop eventBuses after reactor tests remove unnecessary Unsubscribe return subscribe helper function move discardFromChan to where it is used subscribe now returns an err this gives us ability to refuse to subscribe if pubsub is at its max capacity. use context for control overflow cache queries handle err when subscribing in replay_test rename testClientID to testSubscriber extract var set channel buffer capacity to 1 in replay_file fix byzantine_test unsubscribe from single event, not all events refactor httpclient to return events to appropriate channels return failing testReplayCrashBeforeWriteVote test fix TestValidatorSetChanges refactor code a bit fix testReplayCrashBeforeWriteVote add comment fix TestValidatorSetChanges fixes from Bucky's review update comment [ci skip] test TxEventBuffer update changelog fix TestValidatorSetChanges (2nd attempt) only do wg.Done when no errors benchmark event bus create pubsub server inside NewEventBus only expose config params (later if needed) set buffer capacity to 0 so we are not testing cache new tx event format: key = "Tx" plus a tag {"tx.hash": XYZ} This should allow to subscribe to all transactions! or a specific one using a query: "tm.events.type = Tx and tx.hash = '013ABF99434...'" use TimeoutCommit instead of afterPublishEventNewBlockTimeout TimeoutCommit is the time a node waits after committing a block, before it goes into the next height. So it will finish everything from the last block, but then wait a bit. The idea is this gives it time to hear more votes from other validators, to strengthen the commit it includes in the next block. But it also gives it time to hear about new transactions. waitForBlockWithUpdatedVals rewrite WAL crash tests Task: test that we can recover from any WAL crash. Solution: the old tests were relying on event hub being run in the same thread (we were injecting the private validator's last signature). when considering a rewrite, we considered two possible solutions: write a "fuzzy" testing system where WAL is crashing upon receiving a new message, or inject failures and trigger them in tests using something like https://github.com/coreos/gofail. remove sleep no cs.Lock around wal.Save test different cases (empty block, non-empty block, ...) comments add comments test 4 cases: empty block, non-empty block, non-empty block with smaller part size, many blocks fixes as per Bucky's last review reset subscriptions on UnsubscribeAll use a simple counter to track message for which we panicked also, set a smaller part size for all test cases
8 years ago
new pubsub package comment out failing consensus tests for now rewrite rpc httpclient to use new pubsub package import pubsub as tmpubsub, query as tmquery make event IDs constants EventKey -> EventTypeKey rename EventsPubsub to PubSub mempool does not use pubsub rename eventsSub to pubsub new subscribe API fix channel size issues and consensus tests bugs refactor rpc client add missing discardFromChan method add mutex rename pubsub to eventBus remove IsRunning from WSRPCConnection interface (not needed) add a comment in broadcastNewRoundStepsAndVotes rename registerEventCallbacks to broadcastNewRoundStepsAndVotes See https://dave.cheney.net/2014/03/19/channel-axioms stop eventBuses after reactor tests remove unnecessary Unsubscribe return subscribe helper function move discardFromChan to where it is used subscribe now returns an err this gives us ability to refuse to subscribe if pubsub is at its max capacity. use context for control overflow cache queries handle err when subscribing in replay_test rename testClientID to testSubscriber extract var set channel buffer capacity to 1 in replay_file fix byzantine_test unsubscribe from single event, not all events refactor httpclient to return events to appropriate channels return failing testReplayCrashBeforeWriteVote test fix TestValidatorSetChanges refactor code a bit fix testReplayCrashBeforeWriteVote add comment fix TestValidatorSetChanges fixes from Bucky's review update comment [ci skip] test TxEventBuffer update changelog fix TestValidatorSetChanges (2nd attempt) only do wg.Done when no errors benchmark event bus create pubsub server inside NewEventBus only expose config params (later if needed) set buffer capacity to 0 so we are not testing cache new tx event format: key = "Tx" plus a tag {"tx.hash": XYZ} This should allow to subscribe to all transactions! or a specific one using a query: "tm.events.type = Tx and tx.hash = '013ABF99434...'" use TimeoutCommit instead of afterPublishEventNewBlockTimeout TimeoutCommit is the time a node waits after committing a block, before it goes into the next height. So it will finish everything from the last block, but then wait a bit. The idea is this gives it time to hear more votes from other validators, to strengthen the commit it includes in the next block. But it also gives it time to hear about new transactions. waitForBlockWithUpdatedVals rewrite WAL crash tests Task: test that we can recover from any WAL crash. Solution: the old tests were relying on event hub being run in the same thread (we were injecting the private validator's last signature). when considering a rewrite, we considered two possible solutions: write a "fuzzy" testing system where WAL is crashing upon receiving a new message, or inject failures and trigger them in tests using something like https://github.com/coreos/gofail. remove sleep no cs.Lock around wal.Save test different cases (empty block, non-empty block, ...) comments add comments test 4 cases: empty block, non-empty block, non-empty block with smaller part size, many blocks fixes as per Bucky's last review reset subscriptions on UnsubscribeAll use a simple counter to track message for which we panicked also, set a smaller part size for all test cases
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. package state
  2. import (
  3. "bytes"
  4. "errors"
  5. "fmt"
  6. fail "github.com/ebuchman/fail-test"
  7. abci "github.com/tendermint/abci/types"
  8. crypto "github.com/tendermint/go-crypto"
  9. "github.com/tendermint/tendermint/proxy"
  10. "github.com/tendermint/tendermint/types"
  11. "github.com/tendermint/tmlibs/log"
  12. )
  13. //--------------------------------------------------
  14. // Execute the block
  15. // ValExecBlock executes the block, but does NOT mutate State.
  16. // + validates the block
  17. // + executes block.Txs on the proxyAppConn
  18. func (s *State) ValExecBlock(txEventPublisher types.TxEventPublisher, proxyAppConn proxy.AppConnConsensus, block *types.Block) (*ABCIResponses, error) {
  19. // Validate the block.
  20. if err := s.validateBlock(block); err != nil {
  21. return nil, ErrInvalidBlock(err)
  22. }
  23. // Execute the block txs
  24. abciResponses, err := execBlockOnProxyApp(txEventPublisher, proxyAppConn, block, s.logger, s.LastValidators)
  25. if err != nil {
  26. // There was some error in proxyApp
  27. // TODO Report error and wait for proxyApp to be available.
  28. return nil, ErrProxyAppConn(err)
  29. }
  30. return abciResponses, nil
  31. }
  32. // Executes block's transactions on proxyAppConn.
  33. // Returns a list of transaction results and updates to the validator set
  34. // TODO: Generate a bitmap or otherwise store tx validity in state.
  35. func execBlockOnProxyApp(txEventPublisher types.TxEventPublisher, proxyAppConn proxy.AppConnConsensus, block *types.Block, logger log.Logger, lastValidators *types.ValidatorSet) (*ABCIResponses, error) {
  36. var validTxs, invalidTxs = 0, 0
  37. txIndex := 0
  38. abciResponses := NewABCIResponses(block)
  39. // Execute transactions and get hash
  40. proxyCb := func(req *abci.Request, res *abci.Response) {
  41. switch r := res.Value.(type) {
  42. case *abci.Response_DeliverTx:
  43. // TODO: make use of res.Log
  44. // TODO: make use of this info
  45. // Blocks may include invalid txs.
  46. txRes := r.DeliverTx
  47. if txRes.Code == abci.CodeTypeOK {
  48. validTxs++
  49. } else {
  50. logger.Debug("Invalid tx", "code", txRes.Code, "log", txRes.Log)
  51. invalidTxs++
  52. }
  53. // NOTE: if we count we can access the tx from the block instead of
  54. // pulling it from the req
  55. tx := types.Tx(req.GetDeliverTx().Tx)
  56. txEventPublisher.PublishEventTx(types.EventDataTx{types.TxResult{
  57. Height: block.Height,
  58. Index: uint32(txIndex),
  59. Tx: tx,
  60. Result: *txRes,
  61. }})
  62. abciResponses.DeliverTx[txIndex] = txRes
  63. txIndex++
  64. }
  65. }
  66. proxyAppConn.SetResponseCallback(proxyCb)
  67. // determine which validators did not sign last block
  68. absentVals := make([]int32, 0)
  69. for valI, vote := range block.LastCommit.Precommits {
  70. if vote == nil {
  71. absentVals = append(absentVals, int32(valI))
  72. }
  73. }
  74. // TODO: determine which validators were byzantine
  75. // Begin block
  76. _, err := proxyAppConn.BeginBlockSync(abci.RequestBeginBlock{
  77. Hash: block.Hash(),
  78. Header: types.TM2PB.Header(block.Header),
  79. AbsentValidators: absentVals,
  80. ByzantineValidators: nil,
  81. })
  82. if err != nil {
  83. logger.Error("Error in proxyAppConn.BeginBlock", "err", err)
  84. return nil, err
  85. }
  86. // Run txs of block
  87. for _, tx := range block.Txs {
  88. proxyAppConn.DeliverTxAsync(tx)
  89. if err := proxyAppConn.Error(); err != nil {
  90. return nil, err
  91. }
  92. }
  93. // End block
  94. abciResponses.EndBlock, err = proxyAppConn.EndBlockSync(abci.RequestEndBlock{block.Height})
  95. if err != nil {
  96. logger.Error("Error in proxyAppConn.EndBlock", "err", err)
  97. return nil, err
  98. }
  99. logger.Info("Executed block", "height", block.Height, "validTxs", validTxs, "invalidTxs", invalidTxs)
  100. valUpdates := abciResponses.EndBlock.ValidatorUpdates
  101. if len(valUpdates) > 0 {
  102. logger.Info("Updates to validators", "updates", abci.ValidatorsString(valUpdates))
  103. }
  104. return abciResponses, nil
  105. }
  106. func updateValidators(currentSet *types.ValidatorSet, updates []*abci.Validator) error {
  107. // If more or equal than 1/3 of total voting power changed in one block, then
  108. // a light client could never prove the transition externally. See
  109. // ./lite/doc.go for details on how a light client tracks validators.
  110. vp23, err := changeInVotingPowerMoreOrEqualToOneThird(currentSet, updates)
  111. if err != nil {
  112. return err
  113. }
  114. if vp23 {
  115. return errors.New("the change in voting power must be strictly less than 1/3")
  116. }
  117. for _, v := range updates {
  118. pubkey, err := crypto.PubKeyFromBytes(v.PubKey) // NOTE: expects go-wire encoded pubkey
  119. if err != nil {
  120. return err
  121. }
  122. address := pubkey.Address()
  123. power := int64(v.Power)
  124. // mind the overflow from int64
  125. if power < 0 {
  126. return fmt.Errorf("Power (%d) overflows int64", v.Power)
  127. }
  128. _, val := currentSet.GetByAddress(address)
  129. if val == nil {
  130. // add val
  131. added := currentSet.Add(types.NewValidator(pubkey, power))
  132. if !added {
  133. return fmt.Errorf("Failed to add new validator %X with voting power %d", address, power)
  134. }
  135. } else if v.Power == 0 {
  136. // remove val
  137. _, removed := currentSet.Remove(address)
  138. if !removed {
  139. return fmt.Errorf("Failed to remove validator %X", address)
  140. }
  141. } else {
  142. // update val
  143. val.VotingPower = power
  144. updated := currentSet.Update(val)
  145. if !updated {
  146. return fmt.Errorf("Failed to update validator %X with voting power %d", address, power)
  147. }
  148. }
  149. }
  150. return nil
  151. }
  152. func changeInVotingPowerMoreOrEqualToOneThird(currentSet *types.ValidatorSet, updates []*abci.Validator) (bool, error) {
  153. threshold := currentSet.TotalVotingPower() * 1 / 3
  154. acc := int64(0)
  155. for _, v := range updates {
  156. pubkey, err := crypto.PubKeyFromBytes(v.PubKey) // NOTE: expects go-wire encoded pubkey
  157. if err != nil {
  158. return false, err
  159. }
  160. address := pubkey.Address()
  161. power := int64(v.Power)
  162. // mind the overflow from int64
  163. if power < 0 {
  164. return false, fmt.Errorf("Power (%d) overflows int64", v.Power)
  165. }
  166. _, val := currentSet.GetByAddress(address)
  167. if val == nil {
  168. acc += power
  169. } else {
  170. np := val.VotingPower - power
  171. if np < 0 {
  172. np = -np
  173. }
  174. acc += np
  175. }
  176. if acc >= threshold {
  177. return true, nil
  178. }
  179. }
  180. return false, nil
  181. }
  182. // return a bit array of validators that signed the last commit
  183. // NOTE: assumes commits have already been authenticated
  184. /* function is currently unused
  185. func commitBitArrayFromBlock(block *types.Block) *cmn.BitArray {
  186. signed := cmn.NewBitArray(len(block.LastCommit.Precommits))
  187. for i, precommit := range block.LastCommit.Precommits {
  188. if precommit != nil {
  189. signed.SetIndex(i, true) // val_.LastCommitHeight = block.Height - 1
  190. }
  191. }
  192. return signed
  193. }
  194. */
  195. //-----------------------------------------------------
  196. // Validate block
  197. // ValidateBlock validates the block against the state.
  198. func (s *State) ValidateBlock(block *types.Block) error {
  199. return s.validateBlock(block)
  200. }
  201. // MakeBlock builds a block with the given txs and commit from the current state.
  202. func (s *State) MakeBlock(height int64, txs []types.Tx, commit *types.Commit) (*types.Block, *types.PartSet) {
  203. // build base block
  204. block := types.MakeBlock(height, txs, commit)
  205. // fill header with state data
  206. block.ChainID = s.ChainID
  207. block.TotalTxs = s.LastBlockTotalTx + block.NumTxs
  208. block.LastBlockID = s.LastBlockID
  209. block.ValidatorsHash = s.Validators.Hash()
  210. block.AppHash = s.AppHash
  211. block.ConsensusHash = s.ConsensusParams.Hash()
  212. block.LastResultsHash = s.LastResultsHash
  213. return block, block.MakePartSet(s.ConsensusParams.BlockGossip.BlockPartSizeBytes)
  214. }
  215. func (s *State) validateBlock(b *types.Block) error {
  216. // validate internal consistency
  217. if err := b.ValidateBasic(); err != nil {
  218. return err
  219. }
  220. // validate basic info
  221. if b.ChainID != s.ChainID {
  222. return fmt.Errorf("Wrong Block.Header.ChainID. Expected %v, got %v", s.ChainID, b.ChainID)
  223. }
  224. if b.Height != s.LastBlockHeight+1 {
  225. return fmt.Errorf("Wrong Block.Header.Height. Expected %v, got %v", s.LastBlockHeight+1, b.Height)
  226. }
  227. /* TODO: Determine bounds for Time
  228. See blockchain/reactor "stopSyncingDurationMinutes"
  229. if !b.Time.After(lastBlockTime) {
  230. return errors.New("Invalid Block.Header.Time")
  231. }
  232. */
  233. // validate prev block info
  234. if !b.LastBlockID.Equals(s.LastBlockID) {
  235. return fmt.Errorf("Wrong Block.Header.LastBlockID. Expected %v, got %v", s.LastBlockID, b.LastBlockID)
  236. }
  237. newTxs := int64(len(b.Data.Txs))
  238. if b.TotalTxs != s.LastBlockTotalTx+newTxs {
  239. return fmt.Errorf("Wrong Block.Header.TotalTxs. Expected %v, got %v", s.LastBlockTotalTx+newTxs, b.TotalTxs)
  240. }
  241. // validate app info
  242. if !bytes.Equal(b.AppHash, s.AppHash) {
  243. return fmt.Errorf("Wrong Block.Header.AppHash. Expected %X, got %v", s.AppHash, b.AppHash)
  244. }
  245. if !bytes.Equal(b.ConsensusHash, s.ConsensusParams.Hash()) {
  246. return fmt.Errorf("Wrong Block.Header.ConsensusHash. Expected %X, got %v", s.ConsensusParams.Hash(), b.ConsensusHash)
  247. }
  248. if !bytes.Equal(b.LastResultsHash, s.LastResultsHash) {
  249. return fmt.Errorf("Wrong Block.Header.LastResultsHash. Expected %X, got %v", s.LastResultsHash, b.LastResultsHash)
  250. }
  251. if !bytes.Equal(b.ValidatorsHash, s.Validators.Hash()) {
  252. return fmt.Errorf("Wrong Block.Header.ValidatorsHash. Expected %X, got %v", s.Validators.Hash(), b.ValidatorsHash)
  253. }
  254. // Validate block LastCommit.
  255. if b.Height == 1 {
  256. if len(b.LastCommit.Precommits) != 0 {
  257. return errors.New("Block at height 1 (first block) should have no LastCommit precommits")
  258. }
  259. } else {
  260. if len(b.LastCommit.Precommits) != s.LastValidators.Size() {
  261. return fmt.Errorf("Invalid block commit size. Expected %v, got %v",
  262. s.LastValidators.Size(), len(b.LastCommit.Precommits))
  263. }
  264. err := s.LastValidators.VerifyCommit(
  265. s.ChainID, s.LastBlockID, b.Height-1, b.LastCommit)
  266. if err != nil {
  267. return err
  268. }
  269. }
  270. for _, ev := range b.Evidence.Evidence {
  271. if _, err := s.VerifyEvidence(ev); err != nil {
  272. return types.NewEvidenceInvalidErr(ev, err)
  273. }
  274. }
  275. return nil
  276. }
  277. //-----------------------------------------------------------------------------
  278. // ApplyBlock validates & executes the block, updates state w/ ABCI responses,
  279. // then commits and updates the mempool atomically, then saves state.
  280. // ApplyBlock validates the block against the state, executes it against the app,
  281. // commits it, and saves the block and state. It's the only function that needs to be called
  282. // from outside this package to process and commit an entire block.
  283. func (s *State) ApplyBlock(txEventPublisher types.TxEventPublisher, proxyAppConn proxy.AppConnConsensus,
  284. block *types.Block, partsHeader types.PartSetHeader,
  285. mempool types.Mempool, evpool types.EvidencePool) error {
  286. abciResponses, err := s.ValExecBlock(txEventPublisher, proxyAppConn, block)
  287. if err != nil {
  288. return fmt.Errorf("Exec failed for application: %v", err)
  289. }
  290. fail.Fail() // XXX
  291. // save the results before we commit
  292. s.SaveABCIResponses(block.Height, abciResponses)
  293. fail.Fail() // XXX
  294. // now update the block and validators
  295. err = s.SetBlockAndValidators(block.Header, partsHeader, abciResponses)
  296. if err != nil {
  297. return fmt.Errorf("Commit failed for application: %v", err)
  298. }
  299. // lock mempool, commit state, update mempoool
  300. err = s.CommitStateUpdateMempool(proxyAppConn, block, mempool)
  301. if err != nil {
  302. return fmt.Errorf("Commit failed for application: %v", err)
  303. }
  304. fail.Fail() // XXX
  305. evpool.MarkEvidenceAsCommitted(block.Evidence.Evidence)
  306. // save the state and the validators
  307. s.Save()
  308. return nil
  309. }
  310. // CommitStateUpdateMempool locks the mempool, runs the ABCI Commit message, and updates the mempool.
  311. // The Mempool must be locked during commit and update because state is typically reset on Commit and old txs must be replayed
  312. // against committed state before new txs are run in the mempool, lest they be invalid.
  313. func (s *State) CommitStateUpdateMempool(proxyAppConn proxy.AppConnConsensus, block *types.Block, mempool types.Mempool) error {
  314. mempool.Lock()
  315. defer mempool.Unlock()
  316. // Commit block, get hash back
  317. res, err := proxyAppConn.CommitSync()
  318. if err != nil {
  319. s.logger.Error("Client error during proxyAppConn.CommitSync", "err", err)
  320. return err
  321. }
  322. if res.IsErr() {
  323. s.logger.Error("Error in proxyAppConn.CommitSync", "err", res)
  324. return res
  325. }
  326. if res.Log != "" {
  327. s.logger.Debug("Commit.Log: " + res.Log)
  328. }
  329. s.logger.Info("Committed state", "height", block.Height, "txs", block.NumTxs, "hash", res.Data)
  330. // Set the state's new AppHash
  331. s.AppHash = res.Data
  332. // Update mempool.
  333. return mempool.Update(block.Height, block.Txs)
  334. }
  335. // ExecCommitBlock executes and commits a block on the proxyApp without validating or mutating the state.
  336. // It returns the application root hash (result of abci.Commit).
  337. func ExecCommitBlock(appConnConsensus proxy.AppConnConsensus, block *types.Block, logger log.Logger, lastValidators *types.ValidatorSet) ([]byte, error) {
  338. _, err := execBlockOnProxyApp(types.NopEventBus{}, appConnConsensus, block, logger, lastValidators)
  339. if err != nil {
  340. logger.Error("Error executing block on proxy app", "height", block.Height, "err", err)
  341. return nil, err
  342. }
  343. // Commit block, get hash back
  344. res, err := appConnConsensus.CommitSync()
  345. if err != nil {
  346. logger.Error("Client error during proxyAppConn.CommitSync", "err", res)
  347. return nil, err
  348. }
  349. if res.IsErr() {
  350. logger.Error("Error in proxyAppConn.CommitSync", "err", res)
  351. return nil, res
  352. }
  353. if res.Log != "" {
  354. logger.Info("Commit.Log: " + res.Log)
  355. }
  356. return res.Data, nil
  357. }