Skip to content

Commit

Permalink
fix: upgrade Cosmos SDK to fix x/capability nondeterminism
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed May 3, 2020
1 parent 28e6166 commit 1870d5e
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 31 deletions.
4 changes: 2 additions & 2 deletions packages/cosmic-swingset/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
codecstd "github.com/cosmos/cosmos-sdk/codec/std"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/std"
codecstd "github.com/cosmos/cosmos-sdk/std"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/version"
Expand Down Expand Up @@ -321,7 +321,7 @@ func NewAgoricApp(
genutil.NewAppModule(app.accountKeeper, app.stakingKeeper, app.BaseApp.DeliverTx),
auth.NewAppModule(appCodec, app.accountKeeper),
bank.NewAppModule(appCodec, app.bankKeeper, app.accountKeeper),
capability.NewAppModule(*app.capabilityKeeper),
capability.NewAppModule(appCodec, *app.capabilityKeeper),
crisis.NewAppModule(&app.crisisKeeper),
gov.NewAppModule(appCodec, app.govKeeper, app.accountKeeper, app.bankKeeper),
mint.NewAppModule(appCodec, app.mintKeeper, app.accountKeeper),
Expand Down
2 changes: 1 addition & 1 deletion packages/cosmic-swingset/app/benchmarks/txsize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/tendermint/tendermint/crypto/secp256k1"

codecstd "github.com/cosmos/cosmos-sdk/codec/std"
codecstd "github.com/cosmos/cosmos-sdk/std"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/bank"
Expand Down
2 changes: 1 addition & 1 deletion packages/cosmic-swingset/app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package app
import (
"encoding/json"

codecstd "github.com/cosmos/cosmos-sdk/codec/std"
codecstd "github.com/cosmos/cosmos-sdk/std"
)

// GenesisState defines a type alias for the Agoric genesis application state.
Expand Down
5 changes: 3 additions & 2 deletions packages/cosmic-swingset/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ module github.com/Agoric/agoric-sdk/packages/cosmic-swingset
go 1.14

require (
github.com/99designs/keyring v1.1.4 // indirect
github.com/Agoric/agoric-sdk v0.0.0-00010101000000-000000000000 // indirect
github.com/bartekn/go-bip39 v0.0.0-20171116152956-a05967ea095d // indirect
github.com/cosmos/cosmos-sdk v0.34.4-0.20200423194215-1cd1d088df05
github.com/cosmos/cosmos-sdk v0.34.4-0.20200502230752-7557f0eda346
github.com/gibson042/canonicaljson-go v1.0.3 // indirect
github.com/golang/mock v1.4.3 // indirect
github.com/gorilla/handlers v1.4.2 // indirect
Expand All @@ -32,3 +31,5 @@ require (
replace github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4

replace github.com/Agoric/agoric-sdk => ../..

replace github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.34.4-0.20200502230752-7557f0eda346
2 changes: 2 additions & 0 deletions packages/cosmic-swingset/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ github.com/cosmos/cosmos-sdk v0.34.4-0.20200422222342-f6e9ee762358 h1:ZsII2yECeL
github.com/cosmos/cosmos-sdk v0.34.4-0.20200422222342-f6e9ee762358/go.mod h1:Kcgs8c2WWtO2Q+KmDogvGRw+sdEqpvHYXFhj/QiAoOg=
github.com/cosmos/cosmos-sdk v0.34.4-0.20200423194215-1cd1d088df05 h1:jaV9iTBaiYmNAMaDEhvWukIQWQ/NfBoHbgSqPgdKFmM=
github.com/cosmos/cosmos-sdk v0.34.4-0.20200423194215-1cd1d088df05/go.mod h1:Kcgs8c2WWtO2Q+KmDogvGRw+sdEqpvHYXFhj/QiAoOg=
github.com/cosmos/cosmos-sdk v0.34.4-0.20200502230752-7557f0eda346 h1:8zSHAaoImyObcijcfmAxiRRfYR65IW/i3SkQKE+b2d8=
github.com/cosmos/cosmos-sdk v0.34.4-0.20200502230752-7557f0eda346/go.mod h1:tvCen72hkJxkYT1/CsOaKHjZ4PouX4Isp4w9aRL2K4c=
github.com/cosmos/cosmos-sdk v0.38.3 h1:qIBTiw+2T9POaSUJ5rvbBbXeq8C8btBlJxnSegPBd3Y=
github.com/cosmos/cosmos-sdk v0.38.3/go.mod h1:rzWOofbKfRt3wxiylmYWEFHnxxGj0coyqgWl2I9obAw=
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU=
Expand Down
23 changes: 14 additions & 9 deletions packages/cosmic-swingset/lib/ag-solo/vats/ibc.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,11 @@ export function makeIBCProtocolHandler(
let h = match[1];
while (h) {
const m = h.match(/^\/ibc-hop\/([^/]+)/);
if (!m) {
throw Error(
`internal: ${JSON.stringify(h)} did not begin with "/ibc-hop/XXX"`,
);
}
h = h.substr(m[0].length);
hops.push(m[1]);
}
Expand Down Expand Up @@ -383,8 +388,9 @@ export function makeIBCProtocolHandler(
waiterList.push({ channelID, rChannelID, connected });
}

// TODO: Will need to change to dispatch (without sending)
// a ChanOpenInit to get a passive relayer flowing.
if (false) {
// TODO: Try sending a ChanOpenInit to get a passive relayer flowing.
const packet = {
source_channel: channelID,
source_port: portID,
Expand Down Expand Up @@ -419,24 +425,24 @@ export function makeIBCProtocolHandler(
return rchandler.promise;
}

// We explain to the user how to configure an naive relayer.
// We explain to the user how to configure a naive relayer.
E(chandler)
.infoMessage(
`\
# Set up the relayer for this path:
paths:
XXX-PATH-ID:
src:
chain-id: XXX-THIS-CHAIN
client-id: XXX-THIS-CLIENT
connection-id: XXX-THIS-CONNECTION
chain-id: XXX-SRC-CHAIN
client-id: YYY-DST-CLIENT
connection-id: ${hops[0]}
channel-id: ${channelID}
port-id: ${portID}
order: ${order}
dst:
chain-id: YYY-OTHER-CHAIN
client-id: YYY-OTHER-CLIENT
connection-id: ${hops[0]}
chain-id: YYY-DST-CHAIN
client-id: XXX-SRC-CLIENT
connection-id: XXX-SRC-CONNECTION
channel-id: ${rChannelID}
port-id: ${rPortID}
order: ${order}
Expand Down Expand Up @@ -544,7 +550,6 @@ paths:
connectionHops: hops,
} = obj;

// Try to see hops from my perspective.
const channelKey = `${channelID}:${portID}`;
const waiter = getWaiter(
hops,
Expand Down
2 changes: 1 addition & 1 deletion packages/cosmic-swingset/lib/daemon/genaccounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"github.com/tendermint/tendermint/libs/cli"

"github.com/cosmos/cosmos-sdk/client/flags"
codecstd "github.com/cosmos/cosmos-sdk/codec/std"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/server"
codecstd "github.com/cosmos/cosmos-sdk/std"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
authexported "github.com/cosmos/cosmos-sdk/x/auth/exported"
Expand Down
2 changes: 1 addition & 1 deletion packages/cosmic-swingset/lib/daemon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client/debug"
"github.com/cosmos/cosmos-sdk/client/flags"
codecstd "github.com/cosmos/cosmos-sdk/codec/std"
"github.com/cosmos/cosmos-sdk/server"
codecstd "github.com/cosmos/cosmos-sdk/std"
"github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/bank"
Expand Down
2 changes: 1 addition & 1 deletion packages/cosmic-swingset/lib/helper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/cosmos/cosmos-sdk/client/keys"
"github.com/cosmos/cosmos-sdk/client/lcd"
"github.com/cosmos/cosmos-sdk/client/rpc"
codecstd "github.com/cosmos/cosmos-sdk/codec/std"
codecstd "github.com/cosmos/cosmos-sdk/std"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/auth"
Expand Down
23 changes: 10 additions & 13 deletions packages/cosmic-swingset/x/swingset/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
chanTypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
)

type deliverInboundAction struct {
Expand Down Expand Up @@ -84,22 +83,20 @@ func handleMsgDeliverInbound(ctx sdk.Context, keeper Keeper, msg MsgDeliverInbou
}

type sendPacketAction struct {
Type string `json:"type"` // IBC_EVENT
Event string `json:"event"` // sendPacket
Packet chanTypes.Packet `json:"packet"`
Sender sdk.AccAddress `json:"sender"`
BlockHeight int64 `json:"blockHeight"`
BlockTime int64 `json:"blockTime"`
MsgSendPacket
Type string `json:"type"` // IBC_EVENT
Event string `json:"event"` // sendPacket
BlockHeight int64 `json:"blockHeight"`
BlockTime int64 `json:"blockTime"`
}

func handleMsgSendPacket(ctx sdk.Context, keeper Keeper, msg MsgSendPacket) (*sdk.Result, error) {
action := &sendPacketAction{
Type: "IBC_EVENT",
Event: "sendPacket",
Packet: msg.Packet,
Sender: msg.Sender,
BlockHeight: ctx.BlockHeight(),
BlockTime: ctx.BlockTime().Unix(),
MsgSendPacket: msg,
Type: "IBC_EVENT",
Event: "sendPacket",
BlockHeight: ctx.BlockHeight(),
BlockTime: ctx.BlockTime().Unix(),
}
// fmt.Fprintf(os.Stderr, "Context is %+v\n", ctx)
b, err := json.Marshal(action)
Expand Down

0 comments on commit 1870d5e

Please sign in to comment.