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

WIP: CosmWasm v1 IBC Receive Hooks #966

Merged
merged 48 commits into from
Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 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
94b816a
parse the message correctly
Aug 18, 2022
18abe47
Create IBC tests suite
Aug 19, 2022
2152373
Fix compilation
Aug 20, 2022
f512b1c
Fix possible null dref in tests
Aug 22, 2022
68b8a00
Fix second optional null dref
Aug 22, 2022
32afa88
Merge pull request #1083 from scrtlabs/lior-fix-null-dref2
assafmo Aug 23, 2022
c87d153
Fix the majority of linting problems
Aug 24, 2022
c77d2c5
Merge pull request #1093 from scrtlabs/lior-fix-warnings
assafmo Aug 24, 2022
0d91925
Fix relay
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
9f70972
IBC Channel Connect WIP
Aug 28, 2022
4c43604
Channel connect is now workins (Including submessages)
Aug 28, 2022
4058c9e
Channel close tests
Aug 28, 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
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"./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/test-contract/Cargo.toml",
"./x/compute/internal/keeper/testdata/ibc/Cargo.toml",
"./cosmwasm/enclaves/shared/cosmwasm-v1-types/Cargo.toml",
"./cosmwasm/enclaves/shared/cosmwasm-v010-types/Cargo.toml"
],
"rust-analyzer.diagnostics.experimental.enable": true,
"rust-analyzer.rustfmt.rangeFormatting.enable": true,
Expand Down
1 change: 1 addition & 0 deletions 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 Down
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,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 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 := ioutil.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