Skip to content

Commit

Permalink
Work around race condition.
Browse files Browse the repository at this point in the history
  • Loading branch information
lcwik committed Oct 25, 2023
1 parent f2150de commit b25fc58
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion protocol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ replace (
// Use dYdX fork of CometBFT
github.com/cometbft/cometbft => github.com/dydxprotocol/cometbft v0.37.3-0.20230908230338-65f7a2f25c18
// Use dYdX fork of Cosmos SDK
github.com/cosmos/cosmos-sdk => github.com/dydxprotocol/cosmos-sdk v0.47.5-0.20231025180353-ae924e1b73a2
github.com/cosmos/cosmos-sdk => github.com/dydxprotocol/cosmos-sdk v0.47.5-0.20231025201005-bef8a051e94f
// Cosmos SDK 0.47.x upgrade guide (https://github.com/cosmos/cosmos-sdk/blob/main/UPGRADING.md#replaces) mentions
// that there are stability issues. See https://github.com/cosmos/cosmos-sdk/issues/14949 and
// https://github.com/ethereum/go-ethereum/pull/25413 for further context.
Expand Down
4 changes: 2 additions & 2 deletions protocol/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,8 @@ github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQx
github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU=
github.com/dydxprotocol/cometbft v0.37.3-0.20230908230338-65f7a2f25c18 h1:1RIco92QcPS24BeNCNWJC4zXza4GEHHuoviWIQEQ/NI=
github.com/dydxprotocol/cometbft v0.37.3-0.20230908230338-65f7a2f25c18/go.mod h1:cpghf0+1GJpJvrqpTHE6UyTcD05m/xllo0xpufL3PgA=
github.com/dydxprotocol/cosmos-sdk v0.47.5-0.20231025180353-ae924e1b73a2 h1:6rsHwImoXXeMswCzJOl4znD9iVX8hRIorwO8VD0NyOU=
github.com/dydxprotocol/cosmos-sdk v0.47.5-0.20231025180353-ae924e1b73a2/go.mod h1:iaAXVu5Jcd//vREctLTuxLqj5ScUP4psgqW7M6XsaQ8=
github.com/dydxprotocol/cosmos-sdk v0.47.5-0.20231025201005-bef8a051e94f h1:q1WhMJ0EjcF2Tj7MBPd+nacxmj3juiRwz11MZ+m6WAE=
github.com/dydxprotocol/cosmos-sdk v0.47.5-0.20231025201005-bef8a051e94f/go.mod h1:iaAXVu5Jcd//vREctLTuxLqj5ScUP4psgqW7M6XsaQ8=
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
github.com/eapache/go-resiliency v1.3.0 h1:RRL0nge+cWGlxXbUzJ7yMcq6w2XBEr19dCN6HECGaT0=
github.com/eapache/go-resiliency v1.3.0/go.mod h1:5yPzW0MIvSe0JDsv0v+DvcjEv2FyD6iZYSs1ZI+iQho=
Expand Down
9 changes: 6 additions & 3 deletions protocol/testutil/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,11 @@ func (tApp *TestApp) initChainIfNeeded() {
tApp.genesis = tApp.builder.genesisDocFn()

// Prevent Cosmos SDK code from waiting for 5 seconds on each start-up.
originalServerStartTime := srvtypes.ServerStartTime
srvtypes.ServerStartTime = time.Millisecond * 10
// TODO(CORE-538): Remove this during the upgrade since 0.50 Cosmos SDK no longer relies on this.
// There is a benign race here where another instance of the app running at the same time might use the shared
// value which will lead to possibly using the wrong server start time.
originalServerStartTime := srvtypes.ServerStartTime.Load()
srvtypes.ServerStartTime.Store(int64(time.Millisecond * 10))

// Create the validators home directory as a temporary directory and fill it with:
// - config/priv_validator_key.json
Expand Down Expand Up @@ -416,7 +419,7 @@ func (tApp *TestApp) initChainIfNeeded() {
}

// Restore the original server time.
srvtypes.ServerStartTime = originalServerStartTime
srvtypes.ServerStartTime.Store(originalServerStartTime)

if doneErr != nil {
tApp.builder.t.Fatal(doneErr)
Expand Down

0 comments on commit b25fc58

Please sign in to comment.