Skip to content
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

IBC + Stargate + wasmd 0.28 #1101

Merged
merged 109 commits into from
Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
b7c439a
WIP: Start to implement IBC receive hooks
assafmo Jul 14, 2022
f769b83
CosmWasm v1 IBC OnOpenChannel
assafmo Jul 19, 2022
26413fd
Parse IBC results in go-cosmwasm
assafmo Jul 25, 2022
d3cda94
Refactor IBC contract calls, lots of shared code
assafmo Jul 25, 2022
bd46776
IBC keeper
assafmo Jul 25, 2022
1277f83
Keeper OnRecvPacket
assafmo Jul 26, 2022
1d80153
WIP: IBC on the enclave side
assafmo Jul 26, 2022
0e412a9
Remove old CosmWasm remnants
assafmo Jul 27, 2022
a60a2cb
secret-contract-optimizer v1.0.8
assafmo Aug 2, 2022
a4a2b1c
Some IBC progress
assafmo Aug 2, 2022
88827c0
WIP: Start to implement IBC receive hooks
assafmo Jul 14, 2022
eb9f617
CosmWasm v1 IBC OnOpenChannel
assafmo Jul 19, 2022
a3e703a
Parse IBC results in go-cosmwasm
assafmo Jul 25, 2022
7929c34
Refactor IBC contract calls, lots of shared code
assafmo Jul 25, 2022
4604b60
IBC keeper
assafmo Jul 25, 2022
73b3e3a
Keeper OnRecvPacket
assafmo Jul 26, 2022
e4ffb9c
WIP: IBC on the enclave side
assafmo Jul 26, 2022
5bee32a
Remove old CosmWasm remnants
assafmo Jul 27, 2022
ee0a8e0
secret-contract-optimizer v1.0.8
assafmo Aug 2, 2022
a921247
Some IBC progress
assafmo Aug 2, 2022
2e60c05
Merge branch 'cw-1-ibc-receive-hooks' of github.com:scrtlabs/SecretNe…
assafmo Aug 11, 2022
d7ee442
Revert a stupid change
assafmo Aug 11, 2022
5c22a98
Decrypt only data from IBC
Aug 11, 2022
752c337
Fix compilation
Aug 11, 2022
05bad14
Parse every IBC submessage
Aug 14, 2022
92772fe
Make IBC handling nicer
Aug 15, 2022
084849d
Encrypt IBC outputs for encrypted inputs
Aug 16, 2022
ede75fa
Finalize output in a function
Aug 16, 2022
86501b0
Finalize plaintext messages
Aug 16, 2022
cc236c7
Support plaintext execute messages
Aug 17, 2022
190a6df
Merge branch 'cosmwasm-v1' into cw-1-ibc-receive-hooks
Aug 17, 2022
28a412a
Correct errors for replies
Aug 17, 2022
214101a
Wire up StargateQuery
assafmo Aug 17, 2022
94b816a
parse the message correctly
Aug 18, 2022
18abe47
Create IBC tests suite
Aug 19, 2022
2152373
Fix compilation
Aug 20, 2022
a359a8e
Fix debugger for go-tests
assafmo Aug 22, 2022
6061640
Add integration tests, enable stargate feature
assafmo Aug 22, 2022
84174bf
Add integration tests to the CI
assafmo Aug 22, 2022
8755a43
Make StargateMsg work (with tests)
assafmo Aug 22, 2022
40c02fe
Implement all missing v1 QueryPlugins
assafmo Aug 22, 2022
9f55427
Continue fixing the v1 querier
assafmo Aug 22, 2022
8b5ff3d
Fix StargateQuery paths
assafmo Aug 22, 2022
f512b1c
Fix possible null dref in tests
Aug 22, 2022
68b8a00
Fix second optional null dref
Aug 22, 2022
2adda1d
Remove unused code
assafmo Aug 23, 2022
dad0b26
LocalSecret: expose LOG_LEVEL as env var
assafmo Aug 23, 2022
ff4250a
StargateQuery test
assafmo Aug 23, 2022
be350cc
Implement all queries for v1 integration tests contract
assafmo Aug 23, 2022
4873d34
Refactored v010/v1 env parsing in the enclave to make it a little mor…
Cashmaney Aug 23, 2022
32afa88
Merge pull request #1083 from scrtlabs/lior-fix-null-dref2
assafmo Aug 23, 2022
0725def
Integration tests: finish implementing v1 contract query
assafmo Aug 23, 2022
3849efb
Verify EIP191 inside the enclave
assafmo Aug 23, 2022
9f333d3
Increase `make go-tests` timeout 20m->40m
assafmo Aug 23, 2022
38c225a
Fix go tests for StargateMsg (Add compute MsgServer)
assafmo Aug 23, 2022
6585e96
Fix Integration-Tests CI
assafmo Aug 23, 2022
bd1f396
Clippy
assafmo Aug 23, 2022
a58ecae
Clippy
assafmo Aug 23, 2022
aa542b2
Fix CI Integration-Tests?
assafmo Aug 23, 2022
0ec3497
Parse protos on reply to extract reply params
assafmo Aug 24, 2022
10dd4e8
More refactoring
Cashmaney Aug 24, 2022
38d7c51
Compute MsgServer refactor
assafmo Aug 24, 2022
c87d153
Fix the majority of linting problems
Aug 24, 2022
c23c6dc
Clippy must be made happy
Cashmaney Aug 24, 2022
c77d2c5
Merge pull request #1093 from scrtlabs/lior-fix-warnings
assafmo Aug 24, 2022
c397862
Use v0.10 MsgRouter for MsgExec & MsgInit
assafmo Aug 24, 2022
eae764e
Try debugging Integration-Tests CI
assafmo Aug 24, 2022
2dbedca
Try debugging Integration-Tests CI
assafmo Aug 24, 2022
9157ddf
CI Go-Tests increase timeout 20m->40m
assafmo Aug 24, 2022
1973545
Merge branch 'cosmwasm-v1' into stargate-query
assafmo Aug 24, 2022
898e375
Fix bug from previous merge
assafmo Aug 24, 2022
229bc81
v1 sanity contract: make ExecuteMsg::GasMeter more efficient because …
assafmo Aug 24, 2022
76b2562
rustfmt v1 sanity contract
assafmo Aug 24, 2022
bb335e0
Fix TestCallbackSanity for wasmd v0.28
assafmo Aug 24, 2022
5185c9a
Fix all go-test that relied on events being ordered
assafmo Aug 24, 2022
0d91925
Fix relay
Aug 28, 2022
33ddf38
Merge branch 'stargate-query' into eshel-ibc
Aug 28, 2022
e83075d
Merge branch 'env-parsing-refactor' into eshel-ibc
Cashmaney Aug 28, 2022
66e3ed2
Merged env refactor changes to latest IBC branch
Cashmaney Aug 28, 2022
22a04de
New contract for ibc tests
Aug 28, 2022
16455f0
New ibc test
Aug 28, 2022
488cf00
Fix ibc
Aug 28, 2022
171e769
Now channel open works
Aug 28, 2022
3648c61
Merge pull request #1095 from scrtlabs/eshel-ibc-env-refactor
Cashmaney Aug 28, 2022
9f70972
IBC Channel Connect WIP
Aug 28, 2022
817d878
Merge branch 'cw-1-ibc-receive-hooks' into eshel-ibc
Aug 28, 2022
5833c68
Fix compilation
Aug 28, 2022
c29e8a6
fixing compilation errors on contract_operations and io.rs
eshelB Aug 28, 2022
4c43604
Channel connect is now workins (Including submessages)
Aug 28, 2022
4058c9e
Channel close tests
Aug 28, 2022
c32ba0b
Merge remote-tracking branch 'origin/cw-1-ibc-receive-hooks' into esh…
Aug 29, 2022
a0b0bba
adding util file that lets me see a transaction more cleanly: convert…
eshelB Aug 29, 2022
b49d664
IBC packet receive tests and bag fixes
Aug 29, 2022
498d961
Merge pull request #1096 from scrtlabs/lior-ibc-tests
liorbond Aug 29, 2022
7d0f85a
IBC ack and timeout should be encrypted
Aug 29, 2022
b058d3c
IBC ack tests
Aug 29, 2022
5b97e6f
Encrypt the output of every reply (Should be changed)
Aug 30, 2022
8152de2
adding util file that lets me see a transaction more cleanly: convert…
eshelB Aug 29, 2022
7d65399
Encrypt plaintext replies only if the original message was encrypted
Aug 30, 2022
b7ab07f
Merge pull request #1097 from scrtlabs/lior-ibc-tests
liorbond Aug 30, 2022
dfd161b
Merge branch 'eshel-ibc' of github.com:scrtlabs/SecretNetwork into es…
eshelB Aug 30, 2022
add2302
Fix gtests
Aug 30, 2022
50551f0
Merge pull request #1098 from scrtlabs/lior-ibc-tests
liorbond Aug 30, 2022
5dfee90
added the v010 integratoin-test for bankMsgSend
eshelB Aug 30, 2022
819352f
Merge branch 'eshel-ibc' of github.com:scrtlabs/SecretNetwork into es…
eshelB Aug 30, 2022
07d51f4
Commented code
Aug 30, 2022
2888b8a
Fix test setup
Cashmaney Aug 30, 2022
b9312c1
Log with "code_id" when storing contract
Aug 30, 2022
30a4318
Merge pull request #1099 from scrtlabs/lior-ibc-tests
liorbond Aug 30, 2022
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
14 changes: 10 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ jobs:
echo "not_a_key" > ias_keys/develop/spid.txt
echo "not_a_key" > ias_keys/develop/api_key.txt
LOG_LEVEL=ERROR go test -v ./x/compute/client/...
LOG_LEVEL=ERROR go test -p 1 -timeout 20m -v ./x/compute/internal/...
LOG_LEVEL=ERROR go test -p 1 -timeout 40m -v ./x/compute/internal/...

Clippy:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -294,15 +294,21 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Build docker testnet
- name: Build LocalSecret
run: |
echo not_a_key | tee {api_key,spid}.txt
DOCKER_TAG=v0.0.0 make build-localsecret
- name: Run integration tests
run: |
cd integration-tests
yarn
docker run -d -p 9091:9091 --name localsecret ghcr.io/scrtlabs/localsecret:v0.0.0
sleep 30
docker logs localsecret
yarn test
- name: Run secret.js tests
run: |
git clone --depth 1 https://github.com/scrtlabs/secret.js
# Copy v1 contract to tests directory
cp ./target/wasm32-unknown-unknown/release/v1_sanity_contract.wasm ./secret.js/test/test_contract_v1.wasm
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/*
Expand Down
1 change: 1 addition & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"request": "launch",
"mode": "debug",
"program": "${file}",
"cwd": "${workspaceFolder}/x/compute/internal/keeper",
"env": { "SGX_MODE": "SW", "RUST_BACKTRACE": "1" },
"args": [
"test",
Expand Down
13 changes: 8 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"rust-analyzer.linkedProjects": [
"./cosmwasm/Cargo.toml",
"./cosmwasm/enclaves/Cargo.toml",
"./x/compute/internal/keeper/testdata/v1-sanity-contract/Cargo.toml",
"./x/compute/internal/keeper/testdata/test-contract/Cargo.toml"
"cosmwasm/Cargo.toml",
"cosmwasm/enclaves/Cargo.toml",
"x/compute/internal/keeper/testdata/v1-sanity-contract/Cargo.toml",
"x/compute/internal/keeper/testdata/test-contract/Cargo.toml",
"./x/compute/internal/keeper/testdata/ibc/Cargo.toml",
"integration-tests/contract-v1/Cargo.toml",
"integration-tests/contract-v0.10/Cargo.toml",
"go-cosmwasm/Cargo.toml"
],
"rust-analyzer.diagnostics.experimental.enable": true,
"rust-analyzer.rustfmt.rangeFormatting.enable": true,
Expand All @@ -20,7 +24,6 @@
"go.useLanguageServer": true,
"go.lintTool": "golangci-lint",
"go.lintOnSave": "workspace",
"go.buildTags": "secretcli",
"gopls": {
"formatting.gofumpt": true
},
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ build-test-contract:
# sudo apt install -y binaryen
$(MAKE) -C ./x/compute/internal/keeper/testdata/test-contract
$(MAKE) -C ./x/compute/internal/keeper/testdata/v1-sanity-contract
$(MAKE) -C ./x/compute/internal/keeper/testdata/ibc


prep-go-tests: build-test-contract
Expand All @@ -361,7 +362,7 @@ go-tests: build-test-contract
cp ./cosmwasm/enclaves/execute/librust_cosmwasm_enclave.signed.so ./x/compute/internal/keeper
rm -rf ./x/compute/internal/keeper/.sgx_secrets
mkdir -p ./x/compute/internal/keeper/.sgx_secrets
GOMAXPROCS=8 SGX_MODE=SW SCRT_SGX_STORAGE='./' go test -failfast -timeout 2400s -v ./x/compute/internal/... $(GO_TEST_ARGS)
GOMAXPROCS=8 SGX_MODE=SW SCRT_SGX_STORAGE='./' go test -failfast -timeout 40m -v ./x/compute/internal/... $(GO_TEST_ARGS)

go-tests-hw: build-test-contract
# empty BUILD_PROFILE means debug mode which compiles faster
Expand Down
7 changes: 4 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,6 @@ func NewSecretNetworkApp(
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.ibcKeeper.ClientKeeper))

// Just re-use the full router - do we want to limit this more?
computeRouter := app.Router()
regRouter := app.Router()

// Replace with bootstrap flag when we figure out how to test properly and everything works
Expand All @@ -419,7 +418,7 @@ func NewSecretNetworkApp(

// The last arguments can contain custom message handlers, and custom query handlers,
// if we want to allow any custom callbacks
supportedFeatures := "staking"
supportedFeatures := "staking,stargate,ibc3"

app.computeKeeper = compute.NewKeeper(
appCodec,
Expand All @@ -435,7 +434,9 @@ func NewSecretNetworkApp(
app.ibcKeeper.PortKeeper,
app.transferKeeper,
app.ibcKeeper.ChannelKeeper,
computeRouter,
app.Router(),
app.MsgServiceRouter(),
app.GRPCQueryRouter(),
computeDir,
computeConfig,
supportedFeatures,
Expand Down
20 changes: 11 additions & 9 deletions cmd/secretd/attestation.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
Expand Down Expand Up @@ -124,8 +123,7 @@ blockchain. Writes the certificate in DER format to ~/attestation_cert
Args: cobra.MaximumNArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
depCdc := clientCtx.Codec
cdc := depCdc.(codec.Codec)
cdc := clientCtx.Codec

serverCtx := server.GetServerContextFromCmd(cmd)
config := serverCtx.Config
Expand Down Expand Up @@ -175,8 +173,8 @@ blockchain. Writes the certificate in DER format to ~/attestation_cert
return err
}

fmt.Println(fmt.Sprintf("%s", hex.EncodeToString(pubkey)))
fmt.Println(fmt.Sprintf("%s", hex.EncodeToString(masterKey)))
fmt.Printf("%s\n", hex.EncodeToString(pubkey))
fmt.Printf("%s\n", hex.EncodeToString(masterKey))

// sanity check - make sure the certificate we're using matches the generated key
if hex.EncodeToString(pubkey) != hex.EncodeToString(masterKey) {
Expand Down Expand Up @@ -239,7 +237,7 @@ func ParseCert() *cobra.Command {
return err
}

fmt.Println(fmt.Sprintf("0x%s", hex.EncodeToString(pubkey)))
fmt.Printf("0x%s\n", hex.EncodeToString(pubkey))
return nil
},
}
Expand Down Expand Up @@ -313,7 +311,7 @@ func HealthCheck() *cobra.Command {
return fmt.Errorf("failed to start enclave. Enclave returned: %s", err)
}

fmt.Println(fmt.Sprintf("SGX enclave health status: %s", res))
fmt.Printf("SGX enclave health status: %s\n", res)
return nil
},
}
Expand Down Expand Up @@ -491,7 +489,11 @@ Please report any issues with this command
"certificate": "%s"
}`, base64.StdEncoding.EncodeToString(cert)))

resp, err := http.Post(fmt.Sprintf(`%s`, regUrl), "application/json", bytes.NewBuffer(data))
resp, err := http.Post(regUrl, "application/json", bytes.NewBuffer(data))
if err != nil {
log.Fatalln(err)
}

defer resp.Body.Close()

body, err := io.ReadAll(resp.Body)
Expand All @@ -515,7 +517,7 @@ Please report any issues with this command
}

seed := details.Details.Value
log.Printf(fmt.Sprintf(`seed: %s`, seed))
log.Printf(`seed: %s\n`, seed)

if len(seed) > 2 {
seed = seed[2:]
Expand Down
6 changes: 2 additions & 4 deletions cmd/secretd/genaccounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/spf13/cobra"

"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/genutil"
Expand Down Expand Up @@ -42,8 +41,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
depCdc := clientCtx.Codec
cdc := depCdc.(codec.Codec)
cdc := clientCtx.Codec

serverCtx := server.GetServerContextFromCmd(cmd)
config := serverCtx.Config
Expand Down Expand Up @@ -161,7 +159,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa

appState[authtypes.ModuleName] = authGenStateBz

bankGenState := banktypes.GetGenesisStateFromAppState(depCdc, appState)
bankGenState := banktypes.GetGenesisStateFromAppState(cdc, appState)
bankGenState.Balances = append(bankGenState.Balances, balances)
bankGenState.Balances = banktypes.SanitizeGenesisBalances(bankGenState.Balances)

Expand Down
Loading