-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add migrations for v1.0.7 upgrade * feat: add script for simulation of chain upgrade with 1 validator * feat: add cli command to obtain verification holder by verification id * fix: fix issue with upgrade handler * feat: add hack to deploy Arachnid Proxy * refactor: more meaningful error * feat: add deployment of Arachnid Deterministic Deployer * feat: add is_revoked to QueryVerificationsDetailsResponse * feat: return only non-revoked verification details in x/compliance precompile * refactor: remove redundant line * refactor: return in precompile only verifications with active issuers * refactor: prohibit to convert credential with inactive issuer * feat: add ffi query to revoke verification * feat: add precompile handler to revoke verification * feat: update compliance proxy contract * test: add test for revocation by issuer * feat: provide caller address during credential revocation * feat: add check for caller during credential revocation * fix: fix issue with invalid non-revocation proof * feat: add VT_BIOMETRIC verification type * refactor: remove unused dependencies * feat: add convertCredential function to precompile interface * test: add test for converting credential * feat: add convert credential function signature * feat: add method to encode convert credential request * feat: add precompile handler to convert credential * feat: add cli command to get attached holder public key * chore: intermediate commit * feat: add convertCredential method to precompile * test: fix test for converting v1 verification to v2 * fix: applying fix for pointer problem from CosmWasm/wasmvm#571 * test: add test for non-revocation proof * refactor: remove unused consts and imports * refactor: add index variable * fix: fix build using `make build-docker-local` * ci: use actions/upload-artifact@v4 * fix: add checks in keeper for max sizes of verification data fields * test: add test for x/compliance keeper for case with huge original data * fix: add checks for verification details sizes in compliance_bridge precompile * feat: start refactoring self attestation to DCAP instead of deprecated EPID * feat: add DCAP-based self attestation for mainnet / testnet checks * chore: fix some clippy warnings * chore: run cargo clippy --fix
- Loading branch information
Showing
56 changed files
with
4,758 additions
and
2,117 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
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,5 @@ | ||
package v1_0_7 | ||
|
||
const ( | ||
UpgradeName = "v1.0.7" | ||
) |
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,65 @@ | ||
package v1_0_7 | ||
|
||
import ( | ||
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/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/common/hexutil" | ||
compliancemoduletypes "swisstronik/x/compliance/types" | ||
evmkeeper "swisstronik/x/evm/keeper" | ||
) | ||
|
||
func CreateUpgradeHandler( | ||
mm *module.Manager, | ||
complianceKeeper compliancemoduletypes.ComplianceKeeper, | ||
evmkeeper *evmkeeper.Keeper, | ||
configurator module.Configurator, | ||
) upgradetypes.UpgradeHandler { | ||
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { | ||
ctx.Logger().Info("Starting module migrations...") | ||
|
||
var migrationError error | ||
|
||
// Link verification id -> holder | ||
complianceKeeper.IterateAddressDetails(ctx, func(addr sdk.AccAddress) (continue_ bool) { | ||
addressDetails, err := complianceKeeper.GetAddressDetails(ctx, addr) | ||
if err != nil { | ||
migrationError = err | ||
return false | ||
} | ||
|
||
for _, verification := range addressDetails.Verifications { | ||
if err = complianceKeeper.LinkVerificationToHolder(ctx, addr, verification.VerificationId); err != nil { | ||
migrationError = err | ||
return false | ||
} | ||
} | ||
return true | ||
}) | ||
if migrationError != nil { | ||
return vm, migrationError | ||
} | ||
|
||
// Set bytecode of Arachnid Deterministic Deployment Proxy | ||
// We use this dirty hack since non-EIP-155 transactions are not allowed | ||
// in Swisstronik Network | ||
proxyAddress := common.HexToAddress("0x4e59b44847b379578588920cA78FbF26c0B4956C") | ||
codeBytes, err := hexutil.Decode("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3") | ||
if err != nil { | ||
return vm, err | ||
} | ||
|
||
if err = evmkeeper.SetAccountCode(ctx, proxyAddress, codeBytes); err != nil { | ||
return vm, err | ||
} | ||
|
||
vm, err = mm.RunMigrations(ctx, configurator, vm) | ||
if err != nil { | ||
return vm, err | ||
} | ||
|
||
ctx.Logger().Info("Upgrade complete") | ||
return vm, err | ||
} | ||
} |
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
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
Oops, something went wrong.