@agoric/cosmos 0.34.2-orchestration-dev-096c4e8.0 → 0.34.2-other-dev-3eb1a1d.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MAINTAINERS.md +3 -0
- package/Makefile +38 -34
- package/ante/ante.go +1 -4
- package/ante/inbound_test.go +2 -2
- package/app/app.go +198 -137
- package/app/upgrade.go +248 -0
- package/cmd/agd/agvm.go +3 -3
- package/cmd/agd/find_binary.go +2 -2
- package/cmd/agd/main.go +9 -10
- package/cmd/libdaemon/main.go +13 -13
- package/daemon/cmd/root.go +235 -92
- package/daemon/cmd/root_test.go +189 -1
- package/daemon/main.go +3 -2
- package/git-revision.txt +1 -1
- package/go.mod +14 -11
- package/go.sum +20 -19
- package/index.cjs +1 -1
- package/package.json +4 -3
- package/proto/agoric/swingset/genesis.proto +4 -0
- package/proto/agoric/swingset/swingset.proto +26 -1
- package/proto/agoric/vbank/vbank.proto +7 -0
- package/proto/agoric/vtransfer/genesis.proto +18 -0
- package/scripts/protocgen.sh +7 -8
- package/types/kv_entry_helpers.go +42 -0
- package/upgradegaia.sh +8 -8
- package/util/util.go +21 -0
- package/vm/action.go +1 -1
- package/vm/client.go +15 -13
- package/vm/client_test.go +34 -36
- package/vm/controller.go +3 -38
- package/vm/core_proposals.go +22 -2
- package/vm/proto_json.go +38 -0
- package/vm/proto_json_test.go +103 -0
- package/vm/server.go +106 -5
- package/x/swingset/alias.go +2 -0
- package/x/swingset/config.go +234 -0
- package/x/swingset/genesis.go +178 -40
- package/x/swingset/keeper/extension_snapshotter.go +2 -2
- package/x/swingset/keeper/keeper.go +24 -27
- package/x/swingset/keeper/swing_store_exports_handler.go +14 -3
- package/x/swingset/keeper/test_utils.go +16 -0
- package/x/swingset/module.go +24 -9
- package/x/swingset/testing/queue.go +17 -0
- package/x/swingset/types/default-params.go +31 -5
- package/x/swingset/types/expected_keepers.go +2 -2
- package/x/swingset/types/genesis.pb.go +78 -25
- package/x/swingset/types/msgs.go +53 -12
- package/x/swingset/types/params.go +53 -43
- package/x/swingset/types/params_test.go +75 -9
- package/x/swingset/types/swingset.pb.go +387 -57
- package/x/vbank/README.md +6 -1
- package/x/vbank/genesis.go +0 -2
- package/x/vbank/keeper/keeper.go +4 -9
- package/x/vbank/keeper/migrations.go +30 -0
- package/x/vbank/module.go +8 -7
- package/x/vbank/types/key.go +3 -3
- package/x/vbank/types/msgs.go +0 -12
- package/x/vbank/types/params.go +43 -2
- package/x/vbank/types/vbank.pb.go +105 -36
- package/x/vbank/vbank.go +8 -13
- package/x/vbank/vbank_test.go +14 -9
- package/x/vibc/alias.go +1 -1
- package/x/vibc/module.go +2 -7
- package/x/vibc/types/ibc_module.go +9 -3
- package/x/vibc/types/receiver.go +17 -7
- package/x/vlocalchain/handler.go +2 -1
- package/x/vlocalchain/keeper/keeper.go +24 -8
- package/x/vlocalchain/keeper/keeper_test.go +65 -1
- package/x/vlocalchain/types/expected_keepers.go +12 -0
- package/x/vlocalchain/vlocalchain.go +27 -22
- package/x/vlocalchain/vlocalchain_test.go +163 -8
- package/x/vstorage/keeper/grpc_query.go +0 -1
- package/x/vstorage/keeper/keeper.go +9 -17
- package/x/vstorage/module.go +0 -5
- package/x/vstorage/testing/queue.go +28 -0
- package/x/vtransfer/alias.go +13 -0
- package/x/vtransfer/genesis.go +39 -0
- package/x/vtransfer/genesis_test.go +12 -0
- package/x/vtransfer/handler.go +20 -0
- package/x/vtransfer/ibc_middleware.go +186 -0
- package/x/vtransfer/ibc_middleware_test.go +449 -0
- package/x/vtransfer/keeper/keeper.go +282 -0
- package/x/vtransfer/module.go +124 -0
- package/x/vtransfer/types/baseaddr.go +156 -0
- package/x/vtransfer/types/baseaddr_test.go +167 -0
- package/x/vtransfer/types/expected_keepers.go +38 -0
- package/x/vtransfer/types/genesis.pb.go +328 -0
- package/x/vtransfer/types/key.go +9 -0
- package/x/vtransfer/types/msgs.go +9 -0
- package/ante/fee.go +0 -97
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
package testing
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"fmt"
|
|
5
|
+
|
|
6
|
+
keeper "github.com/Agoric/agoric-sdk/golang/cosmos/x/vstorage/keeper"
|
|
7
|
+
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
func GetQueueItems(ctx sdk.Context, vstorageKeeper keeper.Keeper, queuePath string) ([]string, error) {
|
|
11
|
+
unlimitedCtx := ctx.WithGasMeter(sdk.NewInfiniteGasMeter())
|
|
12
|
+
head, err := vstorageKeeper.GetIntValue(unlimitedCtx, queuePath+".head")
|
|
13
|
+
if err != nil {
|
|
14
|
+
return nil, err
|
|
15
|
+
}
|
|
16
|
+
tail, err := vstorageKeeper.GetIntValue(unlimitedCtx, queuePath+".tail")
|
|
17
|
+
if err != nil {
|
|
18
|
+
return nil, err
|
|
19
|
+
}
|
|
20
|
+
length := tail.Sub(head).Int64()
|
|
21
|
+
values := make([]string, length)
|
|
22
|
+
var i int64
|
|
23
|
+
for i = 0; i < length; i++ {
|
|
24
|
+
path := fmt.Sprintf("%s.%s", queuePath, head.Add(sdk.NewInt(i)).String())
|
|
25
|
+
values[i] = vstorageKeeper.GetEntry(unlimitedCtx, path).StringValue()
|
|
26
|
+
}
|
|
27
|
+
return values, nil
|
|
28
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
package vtransfer
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vtransfer/keeper"
|
|
5
|
+
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vtransfer/types"
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
const (
|
|
9
|
+
ModuleName = types.ModuleName
|
|
10
|
+
StoreKey = types.StoreKey
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
type Keeper = keeper.Keeper
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
package vtransfer
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"fmt"
|
|
5
|
+
|
|
6
|
+
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vtransfer/types"
|
|
7
|
+
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
8
|
+
abci "github.com/tendermint/tendermint/abci/types"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
func NewGenesisState() *types.GenesisState {
|
|
12
|
+
return &types.GenesisState{}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
func ValidateGenesis(data *types.GenesisState) error {
|
|
16
|
+
if data == nil {
|
|
17
|
+
return fmt.Errorf("vtransfer genesis data cannot be nil")
|
|
18
|
+
}
|
|
19
|
+
return nil
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
func DefaultGenesisState() *types.GenesisState {
|
|
23
|
+
return &types.GenesisState{}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
func InitGenesis(ctx sdk.Context, keeper Keeper, data *types.GenesisState) []abci.ValidatorUpdate {
|
|
27
|
+
keeper.SetWatchedAddresses(ctx, data.GetWatchedAddresses())
|
|
28
|
+
return []abci.ValidatorUpdate{}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
func ExportGenesis(ctx sdk.Context, k Keeper) *types.GenesisState {
|
|
32
|
+
var gs types.GenesisState
|
|
33
|
+
addresses, err := k.GetWatchedAddresses(ctx)
|
|
34
|
+
if err != nil {
|
|
35
|
+
panic(err)
|
|
36
|
+
}
|
|
37
|
+
gs.WatchedAddresses = addresses
|
|
38
|
+
return &gs
|
|
39
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
package vtransfer
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"testing"
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
func TestDefaultGenesis(t *testing.T) {
|
|
8
|
+
defaultGenesisState := DefaultGenesisState()
|
|
9
|
+
if err := ValidateGenesis(defaultGenesisState); err != nil {
|
|
10
|
+
t.Errorf("DefaultGenesisState did not validate %v: %e", defaultGenesisState, err)
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
package vtransfer
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"fmt"
|
|
5
|
+
|
|
6
|
+
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vtransfer/keeper"
|
|
7
|
+
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
8
|
+
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
// NewHandler returns a handler for "vtransfer" type messages.
|
|
12
|
+
func NewHandler(keeper keeper.Keeper) sdk.Handler {
|
|
13
|
+
return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) {
|
|
14
|
+
switch msg := msg.(type) {
|
|
15
|
+
default:
|
|
16
|
+
errMsg := fmt.Sprintf("Unrecognized vtransfer Msg type: %T", msg)
|
|
17
|
+
return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
package vtransfer
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vtransfer/keeper"
|
|
5
|
+
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
6
|
+
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
|
7
|
+
clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
|
|
8
|
+
channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types"
|
|
9
|
+
porttypes "github.com/cosmos/ibc-go/v6/modules/core/05-port/types"
|
|
10
|
+
"github.com/cosmos/ibc-go/v6/modules/core/exported"
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
// IBCMiddleware (https://ibc.cosmos.network/main/ibc/apps/ibcmodule) forwards
|
|
14
|
+
// most of its methods to the next layer in the stack (which may be the ibc-go
|
|
15
|
+
// transfer application or another middleware), but hooks the packet-related
|
|
16
|
+
// methods and sends them to vtransferKeeper for async interception by the
|
|
17
|
+
// associated VM:
|
|
18
|
+
//
|
|
19
|
+
// 1. IBCModule channel handshake callbacks (OnChanOpenInit, OnChanOpenTry,
|
|
20
|
+
// OnChanOpenAck, and OnChanOpenConfirm)—handled by the wrapped IBCModule.
|
|
21
|
+
//
|
|
22
|
+
// 2. IBCModule channel closing callbacks (OnChanCloseInit and
|
|
23
|
+
// OnChanCloseConfirm)—handled by the wrapped IBCModule.
|
|
24
|
+
//
|
|
25
|
+
// 3. IBCModule packet callbacks (OnRecvPacket, OnAcknowledgementPacket, and
|
|
26
|
+
// OnTimeoutPacket)—intercepted by vtransfer.
|
|
27
|
+
//
|
|
28
|
+
// 4. ICS4Wrapper packet initiation methods (SendPacket, WriteAcknowledgement
|
|
29
|
+
// and GetAppVersion)—delegated by vtransfer to vibc.
|
|
30
|
+
|
|
31
|
+
var _ porttypes.Middleware = (*IBCMiddleware)(nil)
|
|
32
|
+
|
|
33
|
+
// IBCMiddleware implements the ICS26 callbacks for the middleware given the
|
|
34
|
+
// underlying IBCModule and the keeper.
|
|
35
|
+
type IBCMiddleware struct {
|
|
36
|
+
ibcModule porttypes.IBCModule
|
|
37
|
+
vtransferKeeper keeper.Keeper
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// NewIBCMiddleware creates a new IBCMiddleware given the underlying IBCModule and keeper.
|
|
41
|
+
func NewIBCMiddleware(ibcModule porttypes.IBCModule, vtransferKeeper keeper.Keeper) IBCMiddleware {
|
|
42
|
+
return IBCMiddleware{
|
|
43
|
+
ibcModule: ibcModule,
|
|
44
|
+
vtransferKeeper: vtransferKeeper,
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
///////////////////////////////////
|
|
49
|
+
// The following channel handshake events are all directly forwarded to the
|
|
50
|
+
// wrapped IBCModule. They are not performed in the context of a packet, and so
|
|
51
|
+
// do not need to be intercepted.
|
|
52
|
+
|
|
53
|
+
// OnChanOpenInit implements the IBCModule interface.
|
|
54
|
+
func (im IBCMiddleware) OnChanOpenInit(
|
|
55
|
+
ctx sdk.Context,
|
|
56
|
+
order channeltypes.Order,
|
|
57
|
+
connectionHops []string,
|
|
58
|
+
portID string,
|
|
59
|
+
channelID string,
|
|
60
|
+
chanCap *capabilitytypes.Capability,
|
|
61
|
+
counterparty channeltypes.Counterparty,
|
|
62
|
+
version string,
|
|
63
|
+
) (string, error) {
|
|
64
|
+
return im.ibcModule.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, version)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// OnChanOpenTry implements the IBCModule interface.
|
|
68
|
+
func (im IBCMiddleware) OnChanOpenTry(
|
|
69
|
+
ctx sdk.Context,
|
|
70
|
+
order channeltypes.Order,
|
|
71
|
+
connectionHops []string,
|
|
72
|
+
portID,
|
|
73
|
+
channelID string,
|
|
74
|
+
chanCap *capabilitytypes.Capability,
|
|
75
|
+
counterparty channeltypes.Counterparty,
|
|
76
|
+
counterpartyVersion string,
|
|
77
|
+
) (string, error) {
|
|
78
|
+
return im.ibcModule.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, counterpartyVersion)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// OnChanOpenAck implements the IBCModule interface.
|
|
82
|
+
func (im IBCMiddleware) OnChanOpenAck(
|
|
83
|
+
ctx sdk.Context,
|
|
84
|
+
portID,
|
|
85
|
+
channelID string,
|
|
86
|
+
counterpartyChannelID string,
|
|
87
|
+
counterpartyVersion string,
|
|
88
|
+
) error {
|
|
89
|
+
return im.ibcModule.OnChanOpenAck(ctx, portID, channelID, counterpartyChannelID, counterpartyVersion)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// OnChanOpenConfirm implements the IBCModule interface.
|
|
93
|
+
func (im IBCMiddleware) OnChanOpenConfirm(
|
|
94
|
+
ctx sdk.Context,
|
|
95
|
+
portID,
|
|
96
|
+
channelID string,
|
|
97
|
+
) error {
|
|
98
|
+
return im.ibcModule.OnChanOpenConfirm(ctx, portID, channelID)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// OnChanCloseInit implements the IBCModule interface.
|
|
102
|
+
func (im IBCMiddleware) OnChanCloseInit(
|
|
103
|
+
ctx sdk.Context,
|
|
104
|
+
portID,
|
|
105
|
+
channelID string,
|
|
106
|
+
) error {
|
|
107
|
+
return im.ibcModule.OnChanCloseInit(ctx, portID, channelID)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// OnChanCloseConfirm implements the IBCModule interface.
|
|
111
|
+
func (im IBCMiddleware) OnChanCloseConfirm(
|
|
112
|
+
ctx sdk.Context,
|
|
113
|
+
portID,
|
|
114
|
+
channelID string,
|
|
115
|
+
) error {
|
|
116
|
+
return im.ibcModule.OnChanCloseConfirm(ctx, portID, channelID)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
///////////////////////////////////
|
|
120
|
+
// The following packet methods are all implemented by
|
|
121
|
+
// im.vtransferKeeper.Intercept*, so named because those methods are "tee"s
|
|
122
|
+
// combining the middleware stack with an interception of the packet event
|
|
123
|
+
// (On*Packet) or packet method (WriteAcknowledgment) by the async VM.
|
|
124
|
+
|
|
125
|
+
// OnRecvPacket implements the IBCModule interface.
|
|
126
|
+
func (im IBCMiddleware) OnRecvPacket(
|
|
127
|
+
ctx sdk.Context,
|
|
128
|
+
packet channeltypes.Packet,
|
|
129
|
+
relayer sdk.AccAddress,
|
|
130
|
+
) exported.Acknowledgement {
|
|
131
|
+
return im.vtransferKeeper.InterceptOnRecvPacket(ctx, im.ibcModule, packet, relayer)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// OnAcknowledgementPacket implements the IBCModule interface.
|
|
135
|
+
func (im IBCMiddleware) OnAcknowledgementPacket(
|
|
136
|
+
ctx sdk.Context,
|
|
137
|
+
packet channeltypes.Packet,
|
|
138
|
+
acknowledgement []byte,
|
|
139
|
+
relayer sdk.AccAddress,
|
|
140
|
+
) error {
|
|
141
|
+
return im.vtransferKeeper.InterceptOnAcknowledgementPacket(ctx, im.ibcModule, packet, acknowledgement, relayer)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// OnTimeoutPacket implements the IBCModule interface.
|
|
145
|
+
func (im IBCMiddleware) OnTimeoutPacket(
|
|
146
|
+
ctx sdk.Context,
|
|
147
|
+
packet channeltypes.Packet,
|
|
148
|
+
relayer sdk.AccAddress,
|
|
149
|
+
) error {
|
|
150
|
+
return im.vtransferKeeper.InterceptOnTimeoutPacket(ctx, im.ibcModule, packet, relayer)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// WriteAcknowledgement implements the ICS4 Wrapper interface.
|
|
154
|
+
// Unlike implementations of IBCModule interface methods, implementations of
|
|
155
|
+
// ICS4 Wrapper interface methods do not pass along the wrapped IBC module
|
|
156
|
+
// because they support packet initiation.
|
|
157
|
+
func (im IBCMiddleware) WriteAcknowledgement(
|
|
158
|
+
ctx sdk.Context,
|
|
159
|
+
chanCap *capabilitytypes.Capability,
|
|
160
|
+
packet exported.PacketI,
|
|
161
|
+
ack exported.Acknowledgement,
|
|
162
|
+
) error {
|
|
163
|
+
return im.vtransferKeeper.InterceptWriteAcknowledgement(ctx, chanCap, packet, ack)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
///////////////////////////////////
|
|
167
|
+
// The following methods are directly implemented by the ICS4Wrapper outside of
|
|
168
|
+
// us, whether the ibc-go stack or another middleware.
|
|
169
|
+
|
|
170
|
+
// SendPacket implements the ICS4 Wrapper interface.
|
|
171
|
+
func (im IBCMiddleware) SendPacket(
|
|
172
|
+
ctx sdk.Context,
|
|
173
|
+
chanCap *capabilitytypes.Capability,
|
|
174
|
+
sourcePort string,
|
|
175
|
+
sourceChannel string,
|
|
176
|
+
timeoutHeight clienttypes.Height,
|
|
177
|
+
timeoutTimestamp uint64,
|
|
178
|
+
data []byte,
|
|
179
|
+
) (uint64, error) {
|
|
180
|
+
return im.vtransferKeeper.SendPacket(ctx, chanCap, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// GetAppVersion implements the ICS4 Wrapper interface.
|
|
184
|
+
func (im IBCMiddleware) GetAppVersion(ctx sdk.Context, portID, channelID string) (string, bool) {
|
|
185
|
+
return im.vtransferKeeper.GetAppVersion(ctx, portID, channelID)
|
|
186
|
+
}
|