Skip to content

Secret 1.18 #1709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 154 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
154 commits
Select commit Hold shift + click to select a range
21ee616
added antehandler logic for mrenclave upgrade
cboh4 Sep 10, 2024
508b718
Refactor AnteHandler logic for upgrade proposal verification
cboh4 Sep 12, 2024
95271dd
change errors handling, use range for iterating through proposals
cboh4 Sep 18, 2024
4f1a10c
updated prod validator whitelist
Oct 23, 2024
ce4e8bd
added save_attestation_combined
Jul 2, 2024
f397f6d
ecall_get_attestation_report - option for migration report
Jul 2, 2024
74a0624
KeyPair: misc
Jul 2, 2024
dd0cea1
migration keypair derivation
Jul 2, 2024
9513db7
added command "export_sealing"
Jul 3, 2024
b900865
export_sealing WIP(1)
Jul 4, 2024
11121b1
export_sealing WIP(2)
Jul 4, 2024
d00f9f8
export_sealing WIP(3)
Jul 14, 2024
52d02a3
clippy fixes
Jul 14, 2024
600c54d
mrenclave migration WIP(1)
Sep 6, 2024
dc4ae98
offchain-migration, WIP(2)
Sep 9, 2024
bcebfbf
added emergency_approve_upgrade command
Oct 14, 2024
d1379e2
Implemented emergency_approve_upgrade
Oct 14, 2024
f3ae7e6
added --migration flag support to init-enclave
Oct 14, 2024
b36b2ec
emergency_approve_upgrade fixes (mr_enclave size, shorter serialization)
Oct 14, 2024
5e162db
enclave emergency upgrade verification WIP(1)
Oct 14, 2024
c8a6671
printing self report paramts during attestation (not only trace)
Oct 14, 2024
ee9d211
ValidatorList - using HashSet rather than Vec (faster contains())
Oct 15, 2024
91be67e
emergency upgrade: using whitelisted validators (hardcoded)
Oct 15, 2024
af8d479
lock file updated
Oct 27, 2024
3cf353d
Merge pull request #1676 from scrtlabs/chb19/cosmod-sdk-0.50.x-anteha…
valdok Oct 28, 2024
6d88495
mrenclave migration: restriction to the enclaves signed by the curren…
Oct 28, 2024
e3db56d
fixed node registration
Oct 30, 2024
8c9bbb9
forwarding ecall_onchain_approve_upgrade to the enclave
Oct 30, 2024
88aebcc
UpgradeProposalPassed msg changed mrenclave to 32 byte (no inherent h…
Oct 30, 2024
104bb9f
implemented handling upgrade proposal in enclave
Oct 30, 2024
d623cc2
upgrade proposal ante handler fix
Oct 30, 2024
0759997
off-chain upgrade approve: according to the header virification logic
Nov 3, 2024
fefde6f
build fixes
Nov 3, 2024
5c388e9
build fix (2)
Nov 3, 2024
05b8f1d
added ecalls from tm-secret-enclave
Nov 6, 2024
a3de040
moved tm-secret-enclave functionality into our enclave
Nov 6, 2024
c4d1ed8
removed MRSIGNER constant
Nov 7, 2024
817edd6
consolidating sealed files WIP(1)
Nov 7, 2024
04a2c70
misc
Nov 11, 2024
493005b
moved make_sgx_secret_path into shared/crypto/
Nov 12, 2024
d27015b
KeyChain: creating unified sealed file
Nov 12, 2024
283e4a1
KeyChain: seeds in the unified sealed file
Nov 12, 2024
5205344
file name consts renamed
Nov 12, 2024
fcf8960
removed rek.sealed, irs.sealed
Nov 12, 2024
5db3dab
put all .sealed filename consts in one place
Nov 12, 2024
188edc5
moved key_manager into shared/utils
Nov 12, 2024
c4122c2
moved validator set into unified sealed file
Nov 12, 2024
2eb07ec
node init/reset - wrt unified sealed file instead of regkey file
Nov 13, 2024
b30e321
migration approval in unified sealed file
Nov 13, 2024
974df57
key_manager serialization fix
Nov 13, 2024
ecdd27b
sealing migration WIP(1)
Nov 13, 2024
3b77e0d
sealing migration WIP(2)
Nov 13, 2024
336291b
sealing migration WIP(3)
Nov 13, 2024
b672182
clippy fixes
Nov 13, 2024
6c9402f
clippy fixes (2)
Nov 13, 2024
dcd6f36
build fix
Nov 14, 2024
4a319d6
Fixed sealed export/import scheme
Nov 14, 2024
3d39688
build fix(2)
Nov 14, 2024
9948269
build fix(3)
Nov 14, 2024
6190455
build fix(4)
Nov 17, 2024
66b07a2
supporting local attestation for migration
Nov 18, 2024
cd6afea
clippy fixes
Nov 18, 2024
eb2ebdd
build fix
Nov 19, 2024
4ecfa31
build fix (2)
Nov 20, 2024
6b9ba39
check_hw: added migrate_op
Nov 20, 2024
b2bacde
build fix(3)
Nov 20, 2024
ed69187
build fix(4)
Nov 21, 2024
0d17196
build fix(5)
Nov 21, 2024
2e3d8b0
build fix(6)
Nov 21, 2024
a5b590a
build fix(7)
Nov 21, 2024
6a50b2d
using ephemeral migration key
Nov 24, 2024
0ebf9b8
builf dix (revive)
Nov 24, 2024
5df5250
removed tendermint-enclave from deb
Nov 25, 2024
ab6c7bf
key_manager: added encrypt_hash
Dec 12, 2024
ab500f3
SubmitBlockSignatures returns next validator set evidence
Dec 12, 2024
3a9d449
Passing initial validatorset evidence on start, WIP
Dec 12, 2024
f07f10a
Passing validator set evidence on start (2)
Dec 15, 2024
d0314d4
KEY_MANAGER optimization, no redundant re-reading
Dec 15, 2024
f2edf9e
warning fix
Dec 15, 2024
8de112a
build fix
Dec 15, 2024
71e2119
warning fix (golang)
Dec 16, 2024
aa97878
verify_quote_ecdsa -> verify_quote_sgx
Jan 29, 2025
e6ec1ce
moved verify_quote_any from attestation into crypto/dcap
Jan 30, 2025
a63ca89
contract-engine: added env.dcap_quote_verify
Jan 30, 2025
e9e91f4
env.dcap_verify_auote - using current block timestamp
Jan 30, 2025
ecf04e6
warning fix
Jan 30, 2025
a0c7771
dcap/verify_quote_any - impl regardless to SGX mode
Jan 30, 2025
4b54c86
warning fix
Jan 30, 2025
691ebd4
warning fix (2)
Jan 30, 2025
d7ebeaf
Merge branch 'mrenclave3' into mrenclave4
Feb 6, 2025
831d03b
upgrade handler for v1.17
Feb 7, 2025
5e38f80
initial validator set: more strict criterias
Feb 7, 2025
676f043
whitelist fix (removed endl for last address)
Feb 7, 2025
e2d2b55
sealed file name is unique, includes mrenclave (to prevent accidental…
Feb 7, 2025
df3985d
defined emergency whitelist validator threshold for emergency upgrade
Feb 8, 2025
f53a324
allow-plaintext-msg-in-init-function
cboh4 Feb 21, 2025
cd1a59f
Fix build issues
iKapitonau Mar 2, 2025
8924f50
Remove tendermint_enclave from Dockerfile.2004
iKapitonau Mar 2, 2025
3e148cd
fix bug in contract_validation; add new snip20 contracts to code hash…
cboh4 Mar 5, 2025
f7359e3
Remove crisis module
iKapitonau Mar 11, 2025
828cc8c
Add circuit module
iKapitonau Mar 11, 2025
cfe9ace
Remove legacy gov v1beta1
iKapitonau Mar 11, 2025
ed9baff
Remove MacOS-secretcli build from ci.yaml
iKapitonau Mar 11, 2025
a140403
Update go-lint workflow version
iKapitonau Mar 11, 2025
8a91d2e
Add golangci-lint v6 to allowed action for scrtlabs
iKapitonau Mar 11, 2025
5c4f449
Update golangci.yml
iKapitonau Mar 11, 2025
66e700b
Fix linter errors
iKapitonau Mar 11, 2025
4c720aa
Simplify golangci.yml
iKapitonau Mar 11, 2025
7308f77
Revert "Remove legacy gov v1beta1"
iKapitonau Mar 11, 2025
69ae35d
Merge pull request #1700 from scrtlabs/allow-plaintext-msg-in-init-fu…
iKapitonau Mar 12, 2025
2f21685
Merge pull request #1702 from scrtlabs/update-allowed-list-of-the-cod…
iKapitonau Mar 12, 2025
12154c1
Remove unneeded test
iKapitonau Mar 12, 2025
cfb198f
dcap verification potential bug fix
Feb 21, 2025
59c3710
fixed text (misc)
Mar 10, 2025
0d039ca
Merge branch 'mrenclave4' into secret-1.18
iKapitonau Mar 12, 2025
2cdb5ae
Fix deprecated action version
iKapitonau Mar 12, 2025
0a2d8d8
Revert "Fix build issues"
iKapitonau Mar 12, 2025
c6b937e
Remove unneeded sed
iKapitonau Mar 12, 2025
9a177de
Remove unused nolint tags
iKapitonau Mar 12, 2025
1ea1d55
add 2 contracts for testing snip upgrade on testnet
cboh4 Mar 12, 2025
b726797
Merge remote-tracking branch 'origin/add-877-contracts-for-testing-up…
iKapitonau Mar 12, 2025
eda920f
Update secret.js
iKapitonau Mar 12, 2025
ae98408
Update secret.js in ci.yaml
iKapitonau Mar 12, 2025
7cdff07
Merge branch 'master' into secret-1.18
iKapitonau Mar 13, 2025
d4e5049
Add secretcli tests to ci.yaml
iKapitonau Mar 13, 2025
b947994
Azure pipeline fixes
iKapitonau Dec 12, 2024
e0875e4
Modify 1.18 upgrade handler to remove store of crisis and add store o…
iKapitonau Mar 13, 2025
6180d8f
TESTNET: remove mainnet builds
iKapitonau Mar 13, 2025
104809b
Comment out unused function in tests
iKapitonau Mar 14, 2025
5cdc0e8
Add debug output
iKapitonau Mar 14, 2025
aa438d9
Update tm-secret-enclave and cometbft version
iKapitonau Mar 17, 2025
d0976f2
minor change in enclave enforced
Mar 25, 2025
4225356
added upgrade handler v1.18.1
Mar 25, 2025
b5e948a
Revert "added upgrade handler v1.18.1"
Mar 25, 2025
88d6bd3
Revert "minor change in enclave enforced"
Mar 25, 2025
d552585
fixed whitelist for testnet (merge artifact)
Mar 25, 2025
1182e8e
minor change in enclave enforced
Mar 25, 2025
d01d114
added upgrade handler v1.18.1
Mar 25, 2025
02780f9
fixed upgrade handler 18.1
Mar 26, 2025
b2aa86f
key_manager: removed potentially unsafe traces
Mar 31, 2025
79cff47
move admins
cboh4 Apr 6, 2025
1ad3809
add new admin to shade contracts
cboh4 Apr 6, 2025
8bcc087
Merge pull request #1708 from scrtlabs/secret-v1.18-shade-update-hard…
cboh4 Apr 8, 2025
f34af2b
defined separate whitelist and parameters for emergency upgrade
Apr 8, 2025
cd86196
added upgrade handler v1.18.2
Apr 8, 2025
6884a50
Update tendermint and tendermint-rs
iKapitonau Apr 9, 2025
ce134cf
Update tendermint 2
iKapitonau Apr 9, 2025
cc0794b
Enable check-hw build
iKapitonau Apr 9, 2025
da1faf9
TESTNET: remove downloading mainnet enclave
iKapitonau Apr 9, 2025
a7e1da3
fixed check-hw --migrate_op
Apr 9, 2025
4317667
fixed whitelist declaration
Apr 9, 2025
e622ca3
Revert "TESTNET: remove downloading mainnet enclave"
iKapitonau Apr 10, 2025
97cafd3
Revert "TESTNET: remove mainnet builds"
iKapitonau Apr 10, 2025
a4d8a6b
Remove testnet upgrade handlers
iKapitonau Apr 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 8 additions & 24 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ jobs:
docker run -v $PWD:/opt/mount --rm --entrypoint cp ghcr.io/scrtlabs/localsecret:v0.0.0 /usr/lib/libgo_cosmwasm.so /opt/mount/libgo_cosmwasm.so
docker run -v $PWD:/opt/mount --rm --entrypoint cp ghcr.io/scrtlabs/localsecret:v0.0.0 /usr/lib/librust_cosmwasm_enclave.signed.so /opt/mount/librust_cosmwasm_enclave.signed.so
docker run -v $PWD:/opt/mount --rm --entrypoint cp ghcr.io/scrtlabs/localsecret:v0.0.0 /usr/lib/librandom_api.so /opt/mount/librandom_api.so
docker run -v $PWD:/opt/mount --rm --entrypoint cp ghcr.io/scrtlabs/localsecret:v0.0.0 /usr/lib/tendermint_enclave.signed.so /opt/mount/tendermint_enclave.signed.so
- uses: actions/download-artifact@v4
with:
name: contract.wasm
Expand Down Expand Up @@ -196,7 +195,6 @@ jobs:
source "$HOME/.sgxsdk/sgxsdk/environment"
export SGX_MODE=SW
cp librust_cosmwasm_enclave.signed.so ./x/compute/internal/keeper
# cp tendermint_enclave.signed.so ./x/compute/internal/keeper
mkdir -p ias_keys/develop
mkdir -p /opt/secret/.sgx_secrets/
echo "not_a_key" > ias_keys/develop/spid.txt
Expand Down Expand Up @@ -254,27 +252,6 @@ jobs:
SGX_MODE=SW make clippy
SGX_MODE=HW make clippy

MacOS-ARM64-CLI:
runs-on: macos-12-large
strategy:
fail-fast: false
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
with:
name: checkout
submodules: recursive
- uses: actions/setup-go@v5
with:
name: set up go
go-version: 1.21 # The Go version to download (if necessary) and use.
- name: Build macos darwin/arm64
run: SGX_MODE=SW make build_cli
- uses: actions/upload-artifact@v4
with:
name: secretcli-macos-arm64
path: secretcli

Build-LocalSecret:
runs-on: ubuntu-22.04
steps:
Expand Down Expand Up @@ -354,6 +331,13 @@ jobs:
run: |
docker load --input /tmp/localsecret.tar
docker load --input /tmp/hermes.tar
- name: Run secretcli tests
run: |
docker run -v $(realpath ./integration-tests):/root/integration-tests -d --name localsecret -d ghcr.io/scrtlabs/localsecret:v0.0.0
sleep 10
docker exec localsecret bash -c 'integration-tests/basic-tests.sh secretcli ~/.secretd' || exit 1
docker stop localsecret
docker rm localsecret
- name: Run integration tests
run: |
cd integration-tests
Expand All @@ -364,7 +348,7 @@ jobs:
make kill-localsecret # next step needs the localsecret ports
- name: Run secret.js tests
run: |
git clone --depth 1 --branch v1.15.0-beta.0 https://github.com/scrtlabs/secret.js
git clone --depth 1 --branch v1.18.0-beta.0 https://github.com/scrtlabs/secret.js
cd secret.js
# Use the docker images that we built just a few steps above
perl -i -pe 's/localsecret:.+?"/localsecret:v0.0.0"/' ./test/docker-compose.yml
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/go-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.21
go-version: 1.24
- uses: actions/checkout@v4
- name: make bin-data-sw
run: |
go install github.com/jteeuwen/go-bindata/go-bindata@latest
make bin-data-sw
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
with:
version: v1.61
version: v1.64
skip-cache: true
6 changes: 0 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -467,12 +467,6 @@ jobs:
name: Check Mitigation flags in Cosmwasm Enclave
with:
version: "v1.9.0"
- uses: ./.github/actions/check-objdump
name: Check Mitigation flags in TM Enclave
with:
filename: "tendermint_enclave.signed.so"
min-fence: "1000"
version: "v1.9.0"

Release:
needs: [
Expand Down
49 changes: 2 additions & 47 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,6 @@
run:
tests: false
timeout: 5m
skip-files:
- x/registration/internal/types/reg_keys.go # uses auto generated code
- x/registration/internal/types/ias_bin.*?.go # auto generated

linters:
disable-all: true
enable:
- dogsled
- exportloopref
- errcheck
- goconst
- gocritic
- gofumpt
- gosec
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- staticcheck
- stylecheck
- revive
- typecheck
- unconvert
- misspell
- nolintlint

issues:
exclude-rules:
- text: "var-naming"
linters:
- revive
- text: "ST1003:"
linters:
- stylecheck
- text: "commentFormatting"
linters:
- stylecheck
- gocritic
- text: "dupSubExpr"
linters:
- gocritic
- text: "// nolint` should be written without leading space as `//nolint"
linters:
- nolintlint
- text: "G115:"
linters:
- gosec
exclude-files:
- x/compute/internal/keeper/test_common.go
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ _build-linux:
BUILD_PROFILE=$(BUILD_PROFILE) FEATURES="$(FEATURES)" FEATURES_U="$(FEATURES_U) light-client-validation go-tests" SGX_MODE="$(SGX_MODE)" $(MAKE) -C go-cosmwasm build-rust

build-tm-secret-enclave:
git clone https://github.com/scrtlabs/tm-secret-enclave.git /tmp/tm-secret-enclave || true
git clone --branch mrenclave1 https://github.com/scrtlabs/tm-secret-enclave.git /tmp/tm-secret-enclave || true
cd /tmp/tm-secret-enclave && git checkout main && git submodule init && git submodule update --remote
rustup component add rust-src
SGX_MODE=$(SGX_MODE) $(MAKE) -C /tmp/tm-secret-enclave build
Expand All @@ -190,7 +190,7 @@ deb-no-compile:
chmod +x /tmp/SecretNetwork/deb/$(DEB_BIN_DIR)/secretd /tmp/SecretNetwork/deb/$(DEB_BIN_DIR)/secretcli

mkdir -p /tmp/SecretNetwork/deb/$(DEB_LIB_DIR)
cp -f ./go-cosmwasm/tendermint_enclave.signed.so ./go-cosmwasm/librandom_api.so ./go-cosmwasm/api/libgo_cosmwasm.so ./go-cosmwasm/librust_cosmwasm_enclave.signed.so /tmp/SecretNetwork/deb/$(DEB_LIB_DIR)/
cp -f ./go-cosmwasm/librandom_api.so ./go-cosmwasm/api/libgo_cosmwasm.so ./go-cosmwasm/librust_cosmwasm_enclave.signed.so /tmp/SecretNetwork/deb/$(DEB_LIB_DIR)/
chmod +x /tmp/SecretNetwork/deb/$(DEB_LIB_DIR)/lib*.so

mkdir -p /tmp/SecretNetwork/deb/DEBIAN
Expand Down Expand Up @@ -468,15 +468,13 @@ prep-go-tests: build-test-contracts bin-data-sw

go-tests: build-test-contracts bin-data-sw
# SGX_MODE=SW $(MAKE) build-tm-secret-enclave
# cp /tmp/tm-secret-enclave/tendermint_enclave.signed.so ./x/compute/internal/keeper
SGX_MODE=SW $(MAKE) build-linux
cp ./$(EXECUTE_ENCLAVE_PATH)/librust_cosmwasm_enclave.signed.so ./x/compute/internal/keeper
GOMAXPROCS=8 SGX_MODE=SW SCRT_SGX_STORAGE='./' SKIP_LIGHT_CLIENT_VALIDATION=TRUE go test -count 1 -failfast -timeout 90m -v ./x/compute/internal/... $(GO_TEST_ARGS)

go-tests-hw: build-test-contracts bin-data
# empty BUILD_PROFILE means debug mode which compiles faster
# SGX_MODE=HW $(MAKE) build-tm-secret-enclave
# cp /tmp/tm-secret-enclave/tendermint_enclave.signed.so ./x/compute/internal/keeper
SGX_MODE=HW $(MAKE) build-linux
cp ./$(EXECUTE_ENCLAVE_PATH)/librust_cosmwasm_enclave.signed.so ./x/compute/internal/keeper
GOMAXPROCS=8 SGX_MODE=HW SCRT_SGX_STORAGE='./' SKIP_LIGHT_CLIENT_VALIDATION=TRUE go test -v ./x/compute/internal/... $(GO_TEST_ARGS)
Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ Before you run your dev node, you need to point to the shared libraries needed b
```
export SCRT_ENCLAVE_DIR=~/SecretNetwork/go-cosmwasm
```
In order to run __secretd__ you need to have built _librust_cosmwasm_enclave.signed.so_ and _tendermint_enclave.so_.
In order to run __secretd__ you need to have built _librust_cosmwasm_enclave.signed.so_.
The latter can be built by cloning:
```
git clone git@github.com:scrtlabs/tm-secret-enclave.git ~/tm-secret-enclave
Expand All @@ -212,12 +212,8 @@ This repo also uses submodules:
cd tm-secret-enclave
git submodule init
git submodule update --remote
```
and build _tendermint_enclave.so_:
```
make build-rust
```
You may want to copy _tendermint_enclave.so_ to ~/SecretNetwork/go-cosmwasm

Run `./scripts/start-node.sh`

Expand Down
10 changes: 9 additions & 1 deletion app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ package app

import (
"cosmossdk.io/core/store"
circuitante "cosmossdk.io/x/circuit/ante"

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
"github.com/cosmos/ibc-go/v8/modules/core/keeper"

govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
"github.com/scrtlabs/SecretNetwork/x/compute"
)

Expand All @@ -15,6 +19,9 @@ import (
type HandlerOptions struct {
ante.HandlerOptions

CircuitKeeper circuitante.CircuitBreaker
appCodec codec.Codec
govkeeper govkeeper.Keeper // You'll need the keeper to access stored mrenclave hash
IBCKeeper *keeper.Keeper
WasmConfig *compute.WasmConfig
TXCounterStoreService store.KVStoreService
Expand All @@ -39,8 +46,9 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
}

anteDecorators := []sdk.AnteDecorator{
compute.NewCountTXDecorator(options.TXCounterStoreService),
compute.NewCountTXDecorator(options.appCodec, options.govkeeper, options.TXCounterStoreService),
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
circuitante.NewCircuitBreakerDecorator(options.CircuitKeeper),
ante.NewExtensionOptionsDecorator(nil),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
Expand Down
Loading
Loading