@agoric/cosmos 0.34.2-upgrade-17-dev-e67cd91.0 → 0.34.2-upgrade-18-dev-d7c994b.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/app/app.go +1 -0
- package/app/upgrade.go +93 -6
- package/git-revision.txt +1 -1
- package/index.cjs +1 -1
- package/package.json +2 -2
- package/vm/action.go +1 -1
- package/x/vbank/vbank.go +2 -7
- package/x/vlocalchain/keeper/keeper.go +24 -8
- package/x/vlocalchain/keeper/keeper_test.go +10 -11
- package/x/vlocalchain/types/expected_keepers.go +12 -0
- package/x/vlocalchain/vlocalchain_test.go +35 -9
package/app/app.go
CHANGED
package/app/upgrade.go
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
package gaia
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
|
+
"encoding/json"
|
|
4
5
|
"fmt"
|
|
6
|
+
"strings"
|
|
7
|
+
"text/template"
|
|
5
8
|
|
|
6
9
|
"github.com/Agoric/agoric-sdk/golang/cosmos/vm"
|
|
7
10
|
swingsetkeeper "github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/keeper"
|
|
@@ -72,6 +75,76 @@ func isFirstTimeUpgradeOfThisVersion(app *GaiaApp, ctx sdk.Context) bool {
|
|
|
72
75
|
return true
|
|
73
76
|
}
|
|
74
77
|
|
|
78
|
+
func buildProposalStepWithArgs(moduleName string, entrypoint string, opts map[string]any) (vm.CoreProposalStep, error) {
|
|
79
|
+
t := template.Must(template.New("").Parse(`{
|
|
80
|
+
"module": "{{.moduleName}}",
|
|
81
|
+
"entrypoint": "{{.entrypoint}}",
|
|
82
|
+
"args": [ {{.args}} ]
|
|
83
|
+
}`))
|
|
84
|
+
|
|
85
|
+
args, err := json.Marshal(opts)
|
|
86
|
+
if err != nil {
|
|
87
|
+
return nil, err
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
var result strings.Builder
|
|
91
|
+
err = t.Execute(&result, map[string]any{
|
|
92
|
+
"moduleName": moduleName,
|
|
93
|
+
"entrypoint": entrypoint,
|
|
94
|
+
"args": string(args),
|
|
95
|
+
})
|
|
96
|
+
if err != nil {
|
|
97
|
+
return nil, err
|
|
98
|
+
}
|
|
99
|
+
jsonStr := result.String()
|
|
100
|
+
jsonBz := []byte(jsonStr)
|
|
101
|
+
if !json.Valid(jsonBz) {
|
|
102
|
+
return nil, fmt.Errorf("invalid JSON: %s", jsonStr)
|
|
103
|
+
}
|
|
104
|
+
proposal := vm.ArbitraryCoreProposal{Json: jsonBz}
|
|
105
|
+
return vm.CoreProposalStepForModules(proposal), nil
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
func getVariantFromUpgradeName(upgradeName string) string {
|
|
109
|
+
switch upgradeName {
|
|
110
|
+
case "UNRELEASED_A3P_INTEGRATION":
|
|
111
|
+
return "A3P_INTEGRATION"
|
|
112
|
+
case "UNRELEASED_main":
|
|
113
|
+
return "MAINNET"
|
|
114
|
+
case "UNRELEASED_devnet":
|
|
115
|
+
return "DEVNET"
|
|
116
|
+
// Noupgrade for this version.
|
|
117
|
+
case "UNRELEASED_BASIC":
|
|
118
|
+
return ""
|
|
119
|
+
default:
|
|
120
|
+
return ""
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
func replaceElectorateCoreProposalStep(upgradeName string) (vm.CoreProposalStep, error) {
|
|
125
|
+
variant := getVariantFromUpgradeName(upgradeName)
|
|
126
|
+
|
|
127
|
+
return buildProposalStepWithArgs(
|
|
128
|
+
"@agoric/builders/scripts/inter-protocol/replace-electorate-core.js",
|
|
129
|
+
"defaultProposalBuilder",
|
|
130
|
+
map[string]any{
|
|
131
|
+
"variant": variant,
|
|
132
|
+
},
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
func replacePriceFeedsCoreProposal(upgradeName string) (vm.CoreProposalStep, error) {
|
|
137
|
+
variant := getVariantFromUpgradeName(upgradeName)
|
|
138
|
+
|
|
139
|
+
return buildProposalStepWithArgs(
|
|
140
|
+
"@agoric/builders/scripts/inter-protocol/updatePriceFeeds.js",
|
|
141
|
+
"defaultProposalBuilder",
|
|
142
|
+
map[string]any{
|
|
143
|
+
"variant": variant,
|
|
144
|
+
},
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
|
|
75
148
|
// unreleasedUpgradeHandler performs standard upgrade actions plus custom actions for the unreleased upgrade.
|
|
76
149
|
func unreleasedUpgradeHandler(app *GaiaApp, targetUpgrade string) func(sdk.Context, upgradetypes.Plan, module.VersionMap) (module.VersionMap, error) {
|
|
77
150
|
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVm module.VersionMap) (module.VersionMap, error) {
|
|
@@ -89,21 +162,35 @@ func unreleasedUpgradeHandler(app *GaiaApp, targetUpgrade string) func(sdk.Conte
|
|
|
89
162
|
return module.VersionMap{}, fmt.Errorf("cannot run %s as first upgrade", plan.Name)
|
|
90
163
|
}
|
|
91
164
|
|
|
165
|
+
replaceElectorateStep, err := replaceElectorateCoreProposalStep(targetUpgrade)
|
|
166
|
+
if err != nil {
|
|
167
|
+
return nil, err
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
priceFeedUpdate, err := replacePriceFeedsCoreProposal(targetUpgrade)
|
|
171
|
+
if err != nil {
|
|
172
|
+
return nil, err
|
|
173
|
+
}
|
|
174
|
+
|
|
92
175
|
// Each CoreProposalStep runs sequentially, and can be constructed from
|
|
93
176
|
// one or more modules executing in parallel within the step.
|
|
94
177
|
CoreProposalSteps = []vm.CoreProposalStep{
|
|
178
|
+
replaceElectorateStep,
|
|
179
|
+
priceFeedUpdate,
|
|
95
180
|
vm.CoreProposalStepForModules(
|
|
96
|
-
|
|
97
|
-
"@agoric/builders/scripts/vats/upgrade-orch-core.js",
|
|
181
|
+
"@agoric/builders/scripts/vats/add-auction.js",
|
|
98
182
|
),
|
|
99
183
|
vm.CoreProposalStepForModules(
|
|
100
|
-
|
|
101
|
-
"@agoric/builders/scripts/smart-wallet/build-wallet-factory2-upgrade.js",
|
|
184
|
+
"@agoric/builders/scripts/vats/upgradeVaults.js",
|
|
102
185
|
),
|
|
103
186
|
vm.CoreProposalStepForModules(
|
|
104
|
-
//
|
|
105
|
-
"@agoric/builders/scripts/vats/
|
|
187
|
+
// Upgrade Zoe (no new ZCF needed).
|
|
188
|
+
"@agoric/builders/scripts/vats/upgrade-zoe.js",
|
|
106
189
|
),
|
|
190
|
+
// Revive KREAd characters
|
|
191
|
+
vm.CoreProposalStepForModules(
|
|
192
|
+
"@agoric/builders/scripts/vats/revive-kread.js",
|
|
193
|
+
),
|
|
107
194
|
}
|
|
108
195
|
}
|
|
109
196
|
|
package/git-revision.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
d7c994b
|
package/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* eslint-env node */
|
|
2
2
|
module.exports = require('bindings')('agcosmosdaemon.node');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/cosmos",
|
|
3
|
-
"version": "0.34.2-upgrade-
|
|
3
|
+
"version": "0.34.2-upgrade-18-dev-d7c994b.0+d7c994b",
|
|
4
4
|
"description": "Connect JS to the Cosmos blockchain SDK",
|
|
5
5
|
"parsers": {
|
|
6
6
|
"js": "mjs"
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"typeCoverage": {
|
|
40
40
|
"atLeast": 0
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "d7c994b8d33c0cd22b257f3e33b579588ab6c6d8"
|
|
43
43
|
}
|
package/vm/action.go
CHANGED
|
@@ -86,7 +86,7 @@ func PopulateAction(ctx sdk.Context, action Action) Action {
|
|
|
86
86
|
var headerPtr *ActionHeader
|
|
87
87
|
if fieldType.Type == actionHeaderType {
|
|
88
88
|
headerPtr = field.Addr().Interface().(*ActionHeader)
|
|
89
|
-
} else if fieldType.Type == reflect.
|
|
89
|
+
} else if fieldType.Type == reflect.PointerTo(actionHeaderType) {
|
|
90
90
|
if field.IsNil() {
|
|
91
91
|
headerPtr = &ActionHeader{}
|
|
92
92
|
} else {
|
package/x/vbank/vbank.go
CHANGED
|
@@ -144,11 +144,9 @@ func (ch portHandler) Receive(cctx context.Context, str string) (ret string, err
|
|
|
144
144
|
}
|
|
145
145
|
coin := keeper.GetBalance(ctx, addr, msg.Denom)
|
|
146
146
|
packet := coin.Amount.String()
|
|
147
|
+
bytes, err := json.Marshal(&packet)
|
|
147
148
|
if err == nil {
|
|
148
|
-
|
|
149
|
-
if err == nil {
|
|
150
|
-
ret = string(bytes)
|
|
151
|
-
}
|
|
149
|
+
ret = string(bytes)
|
|
152
150
|
}
|
|
153
151
|
|
|
154
152
|
case "VBANK_GRAB":
|
|
@@ -216,9 +214,6 @@ func (ch portHandler) Receive(cctx context.Context, str string) (ret string, err
|
|
|
216
214
|
if err := keeper.StoreRewardCoins(ctx, coins); err != nil {
|
|
217
215
|
return "", fmt.Errorf("cannot store reward %s coins: %s", coins.Sort().String(), err)
|
|
218
216
|
}
|
|
219
|
-
if err != nil {
|
|
220
|
-
return "", err
|
|
221
|
-
}
|
|
222
217
|
state := keeper.GetState(ctx)
|
|
223
218
|
state.RewardPool = state.RewardPool.Add(coins...)
|
|
224
219
|
keeper.SetState(ctx, state)
|
|
@@ -28,6 +28,7 @@ type Keeper struct {
|
|
|
28
28
|
cdc codec.Codec
|
|
29
29
|
msgRouter types.MsgRouter
|
|
30
30
|
queryRouter types.GRPCQueryRouter
|
|
31
|
+
acctKeeper types.AccountKeeper
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
// NewKeeper creates a new dIBC Keeper instance
|
|
@@ -36,12 +37,14 @@ func NewKeeper(
|
|
|
36
37
|
key storetypes.StoreKey,
|
|
37
38
|
msgRouter types.MsgRouter,
|
|
38
39
|
queryRouter types.GRPCQueryRouter,
|
|
40
|
+
acctKeeper types.AccountKeeper,
|
|
39
41
|
) Keeper {
|
|
40
42
|
return Keeper{
|
|
41
43
|
key: key,
|
|
42
44
|
cdc: cdc,
|
|
43
45
|
msgRouter: msgRouter,
|
|
44
46
|
queryRouter: queryRouter,
|
|
47
|
+
acctKeeper: acctKeeper,
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
|
|
@@ -266,14 +269,27 @@ func (k Keeper) AllocateAddress(cctx context.Context) sdk.AccAddress {
|
|
|
266
269
|
localchainModuleAcc := sdkaddress.Module(types.ModuleName, []byte("localchain"))
|
|
267
270
|
header := ctx.BlockHeader()
|
|
268
271
|
|
|
269
|
-
//
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
272
|
+
// Loop until we find an unused address.
|
|
273
|
+
for {
|
|
274
|
+
// Increment our sequence number.
|
|
275
|
+
seq := store.Get(types.KeyLastSequence)
|
|
276
|
+
seq = types.NextSequence(seq)
|
|
277
|
+
store.Set(types.KeyLastSequence, seq)
|
|
273
278
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
279
|
+
buf := seq
|
|
280
|
+
buf = append(buf, header.AppHash...)
|
|
281
|
+
buf = append(buf, header.DataHash...)
|
|
277
282
|
|
|
278
|
-
|
|
283
|
+
addr := sdkaddress.Derive(localchainModuleAcc, buf)
|
|
284
|
+
if k.acctKeeper.HasAccount(ctx, addr) {
|
|
285
|
+
continue
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// We found an unused address, so create an account for it.
|
|
289
|
+
acct := k.acctKeeper.NewAccountWithAddress(ctx, addr)
|
|
290
|
+
k.acctKeeper.SetAccount(ctx, acct)
|
|
291
|
+
|
|
292
|
+
// All good, return the address.
|
|
293
|
+
return addr
|
|
294
|
+
}
|
|
279
295
|
}
|
|
@@ -10,7 +10,6 @@ import (
|
|
|
10
10
|
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
|
11
11
|
)
|
|
12
12
|
|
|
13
|
-
|
|
14
13
|
func TestKeeper_ParseRequestTypeURL(t *testing.T) {
|
|
15
14
|
testCases := []struct {
|
|
16
15
|
name string
|
|
@@ -46,7 +45,7 @@ func TestKeeper_DeserializeTxMessages(t *testing.T) {
|
|
|
46
45
|
|
|
47
46
|
banktypes.RegisterInterfaces(encodingConfig.InterfaceRegistry)
|
|
48
47
|
|
|
49
|
-
keeper := NewKeeper(cdc, nil, nil, nil)
|
|
48
|
+
keeper := NewKeeper(cdc, nil, nil, nil, nil)
|
|
50
49
|
|
|
51
50
|
expectedMsgSend := []sdk.Msg{
|
|
52
51
|
&banktypes.MsgSend{
|
|
@@ -63,22 +62,22 @@ func TestKeeper_DeserializeTxMessages(t *testing.T) {
|
|
|
63
62
|
wantErr bool
|
|
64
63
|
}{
|
|
65
64
|
{
|
|
66
|
-
name:
|
|
67
|
-
json:
|
|
65
|
+
name: "camelCase keys",
|
|
66
|
+
json: `{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","fromAddress":"cosmos1abc","toAddress":"cosmos1xyz","amount":[{"denom":"stake","amount":"100"}]}]}`,
|
|
68
67
|
expected: expectedMsgSend,
|
|
69
|
-
wantErr:
|
|
68
|
+
wantErr: false,
|
|
70
69
|
},
|
|
71
70
|
{
|
|
72
|
-
name:
|
|
73
|
-
json:
|
|
71
|
+
name: "snake_case keys",
|
|
72
|
+
json: `{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"cosmos1abc","to_address":"cosmos1xyz","amount":[{"denom":"stake","amount":"100"}]}]}`,
|
|
74
73
|
expected: expectedMsgSend,
|
|
75
|
-
wantErr:
|
|
74
|
+
wantErr: false,
|
|
76
75
|
},
|
|
77
76
|
{
|
|
78
|
-
name:
|
|
79
|
-
json:
|
|
77
|
+
name: "misspelled key",
|
|
78
|
+
json: `{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_addresss":"cosmos1abc","to_address":"cosmos1xyz","amount":[{"denom":"stake","amount":"100"}]}]}`,
|
|
80
79
|
expected: expectedMsgSend,
|
|
81
|
-
wantErr:
|
|
80
|
+
wantErr: true,
|
|
82
81
|
},
|
|
83
82
|
}
|
|
84
83
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
package types
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
5
|
+
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
type AccountKeeper interface {
|
|
9
|
+
NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI
|
|
10
|
+
HasAccount(ctx sdk.Context, addr sdk.AccAddress) bool
|
|
11
|
+
SetAccount(ctx sdk.Context, acc authtypes.AccountI)
|
|
12
|
+
}
|
|
@@ -16,6 +16,7 @@ import (
|
|
|
16
16
|
"github.com/cosmos/cosmos-sdk/store"
|
|
17
17
|
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
|
18
18
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
19
|
+
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
|
19
20
|
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
|
20
21
|
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
|
21
22
|
transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"
|
|
@@ -36,6 +37,25 @@ const (
|
|
|
36
37
|
msgAllocateAddress = `{"type":"VLOCALCHAIN_ALLOCATE_ADDRESS"}`
|
|
37
38
|
)
|
|
38
39
|
|
|
40
|
+
type mockAccounts struct {
|
|
41
|
+
existing map[string]bool
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var _ types.AccountKeeper = (*mockAccounts)(nil)
|
|
45
|
+
|
|
46
|
+
func (a *mockAccounts) NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI {
|
|
47
|
+
return authtypes.NewBaseAccountWithAddress(addr)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
func (a *mockAccounts) HasAccount(ctx sdk.Context, addr sdk.AccAddress) bool {
|
|
51
|
+
existing := a.existing[addr.String()]
|
|
52
|
+
return existing
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
func (a *mockAccounts) SetAccount(ctx sdk.Context, acc authtypes.AccountI) {
|
|
56
|
+
a.existing[acc.GetAddress().String()] = true
|
|
57
|
+
}
|
|
58
|
+
|
|
39
59
|
type mockBank struct {
|
|
40
60
|
banktypes.UnimplementedQueryServer
|
|
41
61
|
banktypes.UnimplementedMsgServer
|
|
@@ -108,7 +128,7 @@ func (s *mockStaking) UnbondingDelegation(cctx context.Context, req *stakingtype
|
|
|
108
128
|
}
|
|
109
129
|
|
|
110
130
|
// makeTestKit creates a minimal Keeper and Context for use in testing.
|
|
111
|
-
func makeTestKit(bank *mockBank, transfer *mockTransfer, staking *mockStaking) (vm.PortHandler, context.Context) {
|
|
131
|
+
func makeTestKit(bank *mockBank, transfer *mockTransfer, staking *mockStaking, accts *mockAccounts) (vm.PortHandler, context.Context) {
|
|
112
132
|
encodingConfig := params.MakeEncodingConfig()
|
|
113
133
|
cdc := encodingConfig.Marshaler
|
|
114
134
|
|
|
@@ -127,9 +147,8 @@ func makeTestKit(bank *mockBank, transfer *mockTransfer, staking *mockStaking) (
|
|
|
127
147
|
stakingtypes.RegisterMsgServer(txRouter, staking)
|
|
128
148
|
stakingtypes.RegisterQueryServer(queryRouter, staking)
|
|
129
149
|
|
|
130
|
-
|
|
131
150
|
// create a new Keeper
|
|
132
|
-
keeper := vlocalchain.NewKeeper(cdc, vlocalchainStoreKey, txRouter, queryRouter)
|
|
151
|
+
keeper := vlocalchain.NewKeeper(cdc, vlocalchainStoreKey, txRouter, queryRouter, accts)
|
|
133
152
|
|
|
134
153
|
db := dbm.NewMemDB()
|
|
135
154
|
ms := store.NewCommitMultiStore(db)
|
|
@@ -153,13 +172,15 @@ func TestAllocateAddress(t *testing.T) {
|
|
|
153
172
|
bank := &mockBank{}
|
|
154
173
|
transfer := &mockTransfer{}
|
|
155
174
|
staking := &mockStaking{}
|
|
156
|
-
|
|
175
|
+
acct := &mockAccounts{existing: map[string]bool{
|
|
176
|
+
firstAddr: true,
|
|
177
|
+
"cosmos1c5hplwyxk5jr2dsygjqepzfqvfukwduq9c4660aah76krf99m6gs0k7hvl": true,
|
|
178
|
+
}}
|
|
179
|
+
handler, cctx := makeTestKit(bank, transfer, staking, acct)
|
|
157
180
|
|
|
158
181
|
addrs := map[string]bool{
|
|
159
|
-
firstAddr: false,
|
|
160
182
|
"cosmos1yj40fakym8kf4wvgz9tky7k9f3v9msm3t7frscrmkjsdkxkpsfkqgeczkg": false,
|
|
161
183
|
"cosmos1s76vryj7m8k8nm9le65a4plhf5rym5sumtt2n0vwnk5l6k4cwuhsj56ujj": false,
|
|
162
|
-
"cosmos1c5hplwyxk5jr2dsygjqepzfqvfukwduq9c4660aah76krf99m6gs0k7hvl": false,
|
|
163
184
|
"cosmos1ys3a7mtna3cad0wxcs4ddukn37stexjdvns8jfdn4uerlr95y4xqnrypf6": false,
|
|
164
185
|
}
|
|
165
186
|
numToTest := len(addrs)
|
|
@@ -185,6 +206,9 @@ func TestAllocateAddress(t *testing.T) {
|
|
|
185
206
|
t.Fatalf("unexpected duplicate address[%d]: %v", i, addr)
|
|
186
207
|
}
|
|
187
208
|
addrs[addr] = true
|
|
209
|
+
if !acct.existing[addr] {
|
|
210
|
+
t.Fatalf("expected address[%d]: %v to be added to accounts", i, addr)
|
|
211
|
+
}
|
|
188
212
|
}
|
|
189
213
|
}
|
|
190
214
|
|
|
@@ -197,7 +221,8 @@ func TestQuery(t *testing.T) {
|
|
|
197
221
|
}}
|
|
198
222
|
transfer := &mockTransfer{}
|
|
199
223
|
staking := &mockStaking{}
|
|
200
|
-
|
|
224
|
+
accts := &mockAccounts{existing: map[string]bool{}}
|
|
225
|
+
handler, cctx := makeTestKit(bank, transfer, staking, accts)
|
|
201
226
|
|
|
202
227
|
// get balances
|
|
203
228
|
testCases := []struct {
|
|
@@ -338,7 +363,8 @@ func TestExecuteTx(t *testing.T) {
|
|
|
338
363
|
}}
|
|
339
364
|
transfer := &mockTransfer{}
|
|
340
365
|
staking := &mockStaking{}
|
|
341
|
-
|
|
366
|
+
accts := &mockAccounts{existing: map[string]bool{}}
|
|
367
|
+
handler, cctx := makeTestKit(bank, transfer, staking, accts)
|
|
342
368
|
|
|
343
369
|
// create a new message
|
|
344
370
|
msg := `{"type":"VLOCALCHAIN_ALLOCATE_ADDRESS"}`
|
|
@@ -426,7 +452,7 @@ func TestExecuteTx(t *testing.T) {
|
|
|
426
452
|
if len(resp) != 1 {
|
|
427
453
|
t.Fatalf("expected 1 response, got %d", len(resp))
|
|
428
454
|
}
|
|
429
|
-
|
|
455
|
+
|
|
430
456
|
if _, ok := resp[0]["completionTime"]; !ok {
|
|
431
457
|
t.Error("expected 'completionTime' field in response")
|
|
432
458
|
}
|