Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1358 from gregdhill/hotfix-first-touch
Browse files Browse the repository at this point in the history
hotfix for concurrency bug in callSim
  • Loading branch information
Greg Hill authored Mar 13, 2020
2 parents efdc55d + 21fb374 commit 8a98ad0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# [Hyperledger Burrow](https://github.com/hyperledger/burrow) Changelog
## [0.30.2] - 2020-03-13
### Fixed
- [RPC] add mutex to callSim and callCode


## [0.30.1] - 2020-03-06
### Fixed
- [CLI/Tx] Unbond formulation now specifies amount
Expand Down Expand Up @@ -641,6 +646,7 @@ This release marks the start of Eris-DB as the full permissioned blockchain node
- [Blockchain] Fix getBlocks to respect block height cap.


[0.30.2]: https://github.com/hyperledger/burrow/compare/v0.30.1...v0.30.2
[0.30.1]: https://github.com/hyperledger/burrow/compare/v0.30.0...v0.30.1
[0.30.0]: https://github.com/hyperledger/burrow/compare/v0.29.8...v0.30.0
[0.29.8]: https://github.com/hyperledger/burrow/compare/v0.29.7...v0.29.8
Expand Down
2 changes: 1 addition & 1 deletion NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
### Fixed
- [CLI/Tx] Unbond formulation now specifies amount
- [RPC] add mutex to callSim and callCode

4 changes: 4 additions & 0 deletions project/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ func FullVersion() string {
// release tagging script: ./scripts/tag_release.sh
var History relic.ImmutableHistory = relic.NewHistory("Hyperledger Burrow", "https://github.com/hyperledger/burrow").
MustDeclareReleases(
"0.30.2 - 2020-03-13",
`### Fixed
- [RPC] add mutex to callSim and callCode
`,
"0.30.1 - 2020-03-06",
`### Fixed
- [CLI/Tx] Unbond formulation now specifies amount
Expand Down
7 changes: 7 additions & 0 deletions rpc/rpctransact/transact_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package rpctransact

import (
"fmt"
"sync"
"time"

"github.com/hyperledger/burrow/logging"
Expand All @@ -25,6 +26,7 @@ type transactServer struct {
transactor *execution.Transactor
txCodec txs.Codec
logger *logging.Logger
lock *sync.Mutex
}

func NewTransactServer(state acmstate.Reader, blockchain bcm.BlockchainInfo, transactor *execution.Transactor,
Expand All @@ -35,6 +37,7 @@ func NewTransactServer(state acmstate.Reader, blockchain bcm.BlockchainInfo, tra
transactor: transactor,
txCodec: txCodec,
logger: logger.WithScope("NewTransactServer()"),
lock: &sync.Mutex{},
}
}

Expand Down Expand Up @@ -100,10 +103,14 @@ func (ts *transactServer) CallTxSim(ctx context.Context, param *payload.CallTx)
if param.Address == nil {
return nil, fmt.Errorf("CallSim requires a non-nil address from which to retrieve code")
}
ts.lock.Lock()
defer ts.lock.Unlock()
return execution.CallSim(ts.state, ts.blockchain, param.Input.Address, *param.Address, param.Data, ts.logger)
}

func (ts *transactServer) CallCodeSim(ctx context.Context, param *CallCodeParam) (*exec.TxExecution, error) {
ts.lock.Lock()
defer ts.lock.Unlock()
return execution.CallCodeSim(ts.state, ts.blockchain, param.FromAddress, param.FromAddress, param.Code, param.Data,
ts.logger)
}
Expand Down

0 comments on commit 8a98ad0

Please sign in to comment.