-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1364 from scrtlabs/fix-enclave-msg-counter
v1.8 emergency upgrade
- Loading branch information
Showing
5 changed files
with
58 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package v1_8 | ||
|
||
import ( | ||
"fmt" | ||
|
||
store "github.com/cosmos/cosmos-sdk/store/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
"github.com/scrtlabs/SecretNetwork/app/keepers" | ||
"github.com/scrtlabs/SecretNetwork/app/upgrades" | ||
) | ||
|
||
const upgradeName = "v1.8" | ||
|
||
var Upgrade = upgrades.Upgrade{ | ||
UpgradeName: upgradeName, | ||
CreateUpgradeHandler: createUpgradeHandler, | ||
StoreUpgrades: store.StoreUpgrades{}, | ||
} | ||
|
||
func createUpgradeHandler(mm *module.Manager, keepers *keepers.SecretAppKeepers, configurator module.Configurator, | ||
) upgradetypes.UpgradeHandler { | ||
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { | ||
ctx.Logger().Info(` _ _ _____ _____ _____ _____ ______ `) | ||
ctx.Logger().Info(`| | | | __ \ / ____| __ \ /\ | __ \| ____|`) | ||
ctx.Logger().Info(`| | | | |__) | | __| |__) | / \ | | | | |__ `) | ||
ctx.Logger().Info(`| | | | ___/| | |_ | _ / / /\ \ | | | | __| `) | ||
ctx.Logger().Info(`| |__| | | | |__| | | \ \ / ____ \| |__| | |____ `) | ||
ctx.Logger().Info(` \____/|_| \_____|_| \_\/_/ \_\_____/|______|`) | ||
|
||
ctx.Logger().Info(fmt.Sprintf("Running module migrations for %s...", upgradeName)) | ||
return mm.RunMigrations(ctx, configurator, vm) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
This proposal proposes that the chain elect to do an **EMERGENCY** software upgrade to the v1.8 software version of the Secret Network codebase on block **7,760,000**, which is estimated to occur on **Saturday, March 4, 2023 at ~3pm UTC**. Block times have high variance, so please monitor the chain for more precise time estimates. | ||
|
||
## Emergency Upgrade Reason | ||
|
||
After the upgrade to v1.7 on March 1, many node runners experienced node crashes with an apphash error either when starting from state sync or after restarting their node's process. Upon conducting a root cause analysis, SCRT Labs discovered a bug in our v1.7 code. | ||
|
||
The bug was caused by the introduction of a new encryption scheme in v1.7. Specifically, a unique salt was added to the encryption of each storage write, which includes a counter of contract calls within each block. This counter only exists in the enclave's memory, and the bug caused it to never reset when a new block began. As a result, restarting a node or starting from state sync caused the counter to become out of sync with all the nodes that had not been restarted after the v1.7 upgrade. Consequently, this resulted in a different encryption output which is part of consensus. | ||
|
||
While this bug still exists, existing nodes cannot restart their process and new nodes cannot join the network. | ||
|
||
## Upgrade Instructions | ||
|
||
See [docs.scrt.network](https://docs.scrt.network/secret-network-documentation/infrastructure/upgrade-instructions/v1.8) for upgrade instructions. |