Skip to content

Commit

Permalink
Merge pull request #1542 from scrtlabs/fix-migrate1to2
Browse files Browse the repository at this point in the history
Hardcoded admins will fit every chain
  • Loading branch information
liorbond authored Sep 23, 2023
2 parents f739659 + 8cd4224 commit d37dfbc
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions x/compute/internal/keeper/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,12 @@ func (m Migrator) Migrate1to2(ctx sdk.Context) error {
var contractInfo types.ContractInfo
m.keeper.cdc.MustUnmarshal(iter.Value(), &contractInfo)

if ctx.ChainID() == "secret-4" {
if hardcodedContractAdmins[contractAddress.String()] != "" {
contractInfo.Admin = hardcodedContractAdmins[contractAddress.String()]
// When the contract has a hardcoded admin via gov, adminProof is ignored inside the enclave.
// Otherwise and if valid, adminProof is a 32 bytes array (output of sha256).
// For future proofing and avoiding passing null pointers to the enclave, we'll set it to a 32 bytes array of 0.
contractInfo.AdminProof = make([]byte, 32)
}
if hardcodedContractAdmins[contractAddress.String()] != "" {
contractInfo.Admin = hardcodedContractAdmins[contractAddress.String()]
// When the contract has a hardcoded admin via gov, adminProof is ignored inside the enclave.
// Otherwise and if valid, adminProof is a 32 bytes array (output of sha256).
// For future proofing and avoiding passing null pointers to the enclave, we'll set it to a 32 bytes array of 0.
contractInfo.AdminProof = make([]byte, 32)
}

// get v1 contract key
Expand Down

0 comments on commit d37dfbc

Please sign in to comment.