@agoric/cosmos 0.35.0-u19.2 → 0.35.0-u21.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/.clang-format +116 -0
- package/CHANGELOG.md +18 -18
- package/Makefile +38 -67
- package/ante/ante.go +2 -2
- package/ante/inbound_test.go +1 -1
- package/app/app.go +173 -142
- package/app/export.go +6 -6
- package/app/genesis.go +4 -0
- package/app/sim_test.go +299 -50
- package/app/upgrade.go +142 -96
- package/app/upgrade_test.go +63 -0
- package/cmd/agd/agvm.go +1 -1
- package/cmd/agd/main.go +1 -1
- package/cmd/libdaemon/main.go +34 -1
- package/daemon/cmd/root.go +26 -35
- package/daemon/cmd/root_test.go +5 -4
- package/daemon/cmd/testnet.go +221 -95
- package/daemon/main.go +1 -0
- package/git-revision.txt +1 -1
- package/go.mod +93 -58
- package/go.sum +148 -95
- package/package.json +6 -3
- package/proto/agoric/swingset/genesis.proto +7 -11
- package/proto/agoric/swingset/msgs.proto +56 -75
- package/proto/agoric/swingset/query.proto +7 -10
- package/proto/agoric/swingset/swingset.proto +79 -108
- package/proto/agoric/vbank/genesis.proto +5 -5
- package/proto/agoric/vbank/msgs.proto +1 -2
- package/proto/agoric/vbank/vbank.proto +42 -52
- package/proto/agoric/vibc/msgs.proto +8 -11
- package/proto/agoric/vstorage/genesis.proto +6 -9
- package/proto/agoric/vstorage/query.proto +19 -48
- package/proto/agoric/vstorage/vstorage.proto +4 -10
- package/proto/agoric/vtransfer/genesis.proto +7 -7
- package/proto/buf.gen.gogo.yaml +8 -0
- package/proto/buf.gen.pulsar.yaml +17 -0
- package/proto/buf.gen.swagger.yaml +5 -0
- package/proto/buf.yaml +10 -0
- package/scripts/protocgen.sh +14 -21
- package/third_party/proto/amino/amino.proto +79 -0
- package/third_party/proto/cosmos/base/v1beta1/coin.proto +7 -2
- package/third_party/proto/cosmos/ics23/v1/proofs.proto +243 -0
- package/third_party/proto/cosmos/msg/v1/msg.proto +30 -0
- package/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto +17 -5
- package/third_party/proto/cosmos_proto/cosmos.proto +16 -1
- package/third_party/proto/gogoproto/gogo.proto +2 -2
- package/third_party/proto/google/protobuf/any.proto +6 -3
- package/third_party/proto/ibc/core/channel/v1/channel.proto +1 -1
- package/third_party/proto/ibc/core/client/v1/client.proto +4 -2
- package/types/address_hooks.go +5 -12
- package/types/address_hooks_test.go +34 -34
- package/types/codec.go +23 -0
- package/types/ibc_packet.go +64 -0
- package/types/ibc_packet_test.go +117 -0
- package/vm/client.go +32 -7
- package/vm/proto_json.go +2 -2
- package/x/swingset/abci.go +1 -1
- package/x/swingset/alias.go +0 -1
- package/x/swingset/config.go +1 -1
- package/x/swingset/keeper/extension_snapshotter.go +1 -1
- package/x/swingset/keeper/extension_snapshotter_test.go +1 -1
- package/x/swingset/keeper/keeper.go +1 -1
- package/x/swingset/keeper/keeper_test.go +1 -1
- package/x/swingset/keeper/querier.go +1 -30
- package/x/swingset/keeper/swing_store_exports_handler.go +1 -1
- package/x/swingset/keeper/swing_store_exports_handler_test.go +1 -1
- package/x/swingset/module.go +1 -14
- package/x/swingset/types/default-params.go +24 -16
- package/x/swingset/types/genesis.pb.go +2 -2
- package/x/swingset/types/msgs.pb.go +4 -3
- package/x/swingset/types/msgs_test.go +1 -1
- package/x/swingset/types/query.pb.go +4 -3
- package/x/swingset/types/swingset.pb.go +2 -2
- package/x/vbank/genesis.go +1 -1
- package/x/vbank/keeper/querier.go +1 -21
- package/x/vbank/module.go +1 -16
- package/x/vbank/types/genesis.pb.go +2 -2
- package/x/vbank/types/msgs.pb.go +3 -2
- package/x/vbank/types/query.pb.go +4 -3
- package/x/vbank/types/vbank.pb.go +2 -2
- package/x/vbank/vbank_test.go +95 -16
- package/x/vibc/keeper/keeper.go +8 -5
- package/x/vibc/keeper/migrations.go +36 -0
- package/x/vibc/keeper/triggers.go +6 -32
- package/x/vibc/module.go +9 -17
- package/x/vibc/types/expected_keepers.go +6 -10
- package/x/vibc/types/ibc_module.go +30 -20
- package/x/vibc/types/msgs.go +1 -1
- package/x/vibc/types/msgs.pb.go +5 -4
- package/x/vibc/types/receiver.go +17 -17
- package/x/vlocalchain/keeper/keeper.go +3 -3
- package/x/vlocalchain/types/vlocalchain.pb.go +1 -1
- package/x/vlocalchain/vlocalchain_test.go +6 -6
- package/x/vstorage/README.md +0 -8
- package/x/vstorage/alias.go +0 -1
- package/x/vstorage/client/cli/query.go +1 -1
- package/x/vstorage/genesis.go +1 -1
- package/x/vstorage/keeper/keeper.go +40 -5
- package/x/vstorage/keeper/keeper_test.go +24 -24
- package/x/vstorage/keeper/querier.go +1 -32
- package/x/vstorage/keeper/querier_test.go +41 -6
- package/x/vstorage/module.go +1 -14
- package/x/vstorage/types/genesis.pb.go +2 -2
- package/x/vstorage/types/path_keys.go +7 -8
- package/x/vstorage/types/query.pb.go +8 -5
- package/x/vstorage/types/vstorage.pb.go +2 -2
- package/x/vstorage/vstorage_test.go +3 -3
- package/x/vtransfer/genesis.go +1 -1
- package/x/vtransfer/handler.go +4 -2
- package/x/vtransfer/ibc_middleware.go +4 -4
- package/x/vtransfer/ibc_middleware_test.go +14 -16
- package/x/vtransfer/keeper/keeper.go +38 -48
- package/x/vtransfer/module.go +1 -14
- package/x/vtransfer/types/expected_keepers.go +2 -18
- package/x/vtransfer/types/genesis.pb.go +2 -2
- package/x/vtransfer/utils_test.go +15 -15
- package/daemon/cmd/genaccounts.go +0 -195
- package/e2e_test/Makefile +0 -29
- package/e2e_test/README.md +0 -100
- package/e2e_test/go.mod +0 -239
- package/e2e_test/go.sum +0 -1323
- package/e2e_test/ibc_conformance_test.go +0 -56
- package/e2e_test/pfm_test.go +0 -613
- package/e2e_test/util.go +0 -271
package/types/codec.go
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
package types
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"github.com/cosmos/cosmos-sdk/codec"
|
|
5
|
+
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
var (
|
|
9
|
+
// packageCdc is the codec used for proto3 JSON serialization of proto.Message
|
|
10
|
+
// data structures that wouldn't otherwise survive round-tripping via a
|
|
11
|
+
// regular "encoding/json" Marshal->JSON.parse.
|
|
12
|
+
//
|
|
13
|
+
// The naïve json.Marshal output for an int64 (64-bit precision) is a JSON
|
|
14
|
+
// number, which is subject to rounding errors when parsed by JavaScript
|
|
15
|
+
// (whose numbers are IEEE 754 binary64 values with only 53-bit precision).
|
|
16
|
+
// The codec.ProtoCodec uses a custom JSON marshaller that converts each int64
|
|
17
|
+
// to and from a string with no loss of precision.
|
|
18
|
+
//
|
|
19
|
+
// The current package's IBCPacket was one such affected data structure, which
|
|
20
|
+
// now implements Marshaler and Unmarshaler interfaces for "encoding/json" to
|
|
21
|
+
// take advantage of the packageCdc.
|
|
22
|
+
packageCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry())
|
|
23
|
+
)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
package types
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"encoding/json"
|
|
5
|
+
|
|
6
|
+
clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
|
|
7
|
+
channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
|
|
8
|
+
"github.com/cosmos/ibc-go/v7/modules/core/exported"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
var _ json.Marshaler = IBCPacket{}
|
|
12
|
+
var _ json.Unmarshaler = (*IBCPacket)(nil)
|
|
13
|
+
var _ exported.PacketI = IBCPacket{}
|
|
14
|
+
|
|
15
|
+
type IBCPacket struct {
|
|
16
|
+
channeltypes.Packet
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
func (p IBCPacket) MarshalJSON() ([]byte, error) {
|
|
20
|
+
return packageCdc.MarshalJSON(&p.Packet)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
func (p *IBCPacket) UnmarshalJSON(bz []byte) error {
|
|
24
|
+
return packageCdc.UnmarshalJSON(bz, &p.Packet)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
func MakeIBCPacket(
|
|
28
|
+
data []byte,
|
|
29
|
+
sequence uint64,
|
|
30
|
+
sourcePort string,
|
|
31
|
+
sourceChannel string,
|
|
32
|
+
destPort string,
|
|
33
|
+
destChannel string,
|
|
34
|
+
timeoutHeight clienttypes.Height,
|
|
35
|
+
timeoutTimestamp uint64,
|
|
36
|
+
) IBCPacket {
|
|
37
|
+
cp := channeltypes.NewPacket(
|
|
38
|
+
data, sequence,
|
|
39
|
+
sourcePort, sourceChannel,
|
|
40
|
+
destPort, destChannel,
|
|
41
|
+
timeoutHeight, timeoutTimestamp,
|
|
42
|
+
)
|
|
43
|
+
return IBCPacket{Packet: cp}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
func CopyToChannelPacket(packet exported.PacketI) channeltypes.Packet {
|
|
47
|
+
timeoutHeight := clienttypes.MustParseHeight(packet.GetTimeoutHeight().String())
|
|
48
|
+
return channeltypes.NewPacket(
|
|
49
|
+
packet.GetData(), packet.GetSequence(),
|
|
50
|
+
packet.GetSourcePort(), packet.GetSourceChannel(),
|
|
51
|
+
packet.GetDestPort(), packet.GetDestChannel(),
|
|
52
|
+
timeoutHeight, packet.GetTimeoutTimestamp(),
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
func CopyToIBCPacket(packet exported.PacketI) IBCPacket {
|
|
57
|
+
timeoutHeight := clienttypes.MustParseHeight(packet.GetTimeoutHeight().String())
|
|
58
|
+
return MakeIBCPacket(
|
|
59
|
+
packet.GetData(), packet.GetSequence(),
|
|
60
|
+
packet.GetSourcePort(), packet.GetSourceChannel(),
|
|
61
|
+
packet.GetDestPort(), packet.GetDestChannel(),
|
|
62
|
+
timeoutHeight, packet.GetTimeoutTimestamp(),
|
|
63
|
+
)
|
|
64
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
package types_test
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"bytes"
|
|
5
|
+
"encoding/json"
|
|
6
|
+
fmt "fmt"
|
|
7
|
+
"reflect"
|
|
8
|
+
"testing"
|
|
9
|
+
|
|
10
|
+
agtypes "github.com/Agoric/agoric-sdk/golang/cosmos/types"
|
|
11
|
+
"github.com/stretchr/testify/assert"
|
|
12
|
+
"github.com/stretchr/testify/require"
|
|
13
|
+
|
|
14
|
+
clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
|
|
15
|
+
channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
|
|
16
|
+
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
func CreateTestChannelPacket() channeltypes.Packet {
|
|
20
|
+
return channeltypes.NewPacket(
|
|
21
|
+
[]byte("data"),
|
|
22
|
+
987654321098765432,
|
|
23
|
+
"port-src", "channel-13",
|
|
24
|
+
"port-dst", "channel-42",
|
|
25
|
+
clienttypes.Height{},
|
|
26
|
+
123456789012345678,
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
func TestPacket(t *testing.T) {
|
|
31
|
+
testCases := []struct {
|
|
32
|
+
name string
|
|
33
|
+
packet ibcexported.PacketI
|
|
34
|
+
}{
|
|
35
|
+
{
|
|
36
|
+
name: "ibc-go channel Packet",
|
|
37
|
+
packet: CreateTestChannelPacket(),
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "agoric-sdk IBCPacket",
|
|
41
|
+
packet: agtypes.CopyToIBCPacket(CreateTestChannelPacket()),
|
|
42
|
+
},
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Check that the packets have the expected values
|
|
46
|
+
for _, tc := range testCases {
|
|
47
|
+
t.Run(tc.name, func(t *testing.T) {
|
|
48
|
+
pi := tc.packet
|
|
49
|
+
assert.Equal(t, "port-src", pi.GetSourcePort())
|
|
50
|
+
assert.Equal(t, "channel-13", pi.GetSourceChannel())
|
|
51
|
+
assert.Equal(t, "port-dst", pi.GetDestPort())
|
|
52
|
+
assert.Equal(t, "channel-42", pi.GetDestChannel())
|
|
53
|
+
assert.Equal(t, uint64(987654321098765432), pi.GetSequence())
|
|
54
|
+
assert.Equal(t, uint64(123456789012345678), pi.GetTimeoutTimestamp())
|
|
55
|
+
assert.Equal(t, []byte("data"), pi.GetData())
|
|
56
|
+
assert.Equal(t, clienttypes.Height{}, pi.GetTimeoutHeight())
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
func TestPacketJSON(t *testing.T) {
|
|
62
|
+
testCases := []struct {
|
|
63
|
+
name string
|
|
64
|
+
packet ibcexported.PacketI
|
|
65
|
+
quoted bool
|
|
66
|
+
}{
|
|
67
|
+
{
|
|
68
|
+
name: "ibc-go channel Packet",
|
|
69
|
+
packet: CreateTestChannelPacket(),
|
|
70
|
+
quoted: false,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: "agoric-sdk IBCPacket",
|
|
74
|
+
packet: agtypes.CopyToIBCPacket(CreateTestChannelPacket()),
|
|
75
|
+
quoted: true,
|
|
76
|
+
},
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
for _, tc := range testCases {
|
|
80
|
+
t.Run(tc.name, func(t *testing.T) {
|
|
81
|
+
bz, err := json.Marshal(tc.packet)
|
|
82
|
+
require.NoError(t, err)
|
|
83
|
+
|
|
84
|
+
seqStr := fmt.Sprintf("%d", tc.packet.GetSequence())
|
|
85
|
+
if !bytes.Contains(bz, []byte(seqStr)) {
|
|
86
|
+
assert.Failf(t, "packet sequence should be present in JSON", "sequence %s, json %s", seqStr, string(bz))
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if bytes.Contains(bz, []byte(`"`+seqStr+`"`)) != tc.quoted {
|
|
90
|
+
if tc.quoted {
|
|
91
|
+
assert.Failf(t, "packet sequence should be quoted in JSON", "sequence %s, json %s", seqStr, string(bz))
|
|
92
|
+
} else {
|
|
93
|
+
assert.Failf(t, "packet sequence should not be quoted in JSON", "sequence %s, json %s", seqStr, string(bz))
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
var packet2 ibcexported.PacketI
|
|
98
|
+
switch p := tc.packet.(type) {
|
|
99
|
+
case channeltypes.Packet:
|
|
100
|
+
var p2 channeltypes.Packet
|
|
101
|
+
err = json.Unmarshal(bz, &p2)
|
|
102
|
+
packet2 = p2
|
|
103
|
+
case agtypes.IBCPacket:
|
|
104
|
+
var p2 agtypes.IBCPacket
|
|
105
|
+
err = json.Unmarshal(bz, &p2)
|
|
106
|
+
packet2 = p2
|
|
107
|
+
default:
|
|
108
|
+
t.Fatalf("unexpected packet type %T", p)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
require.NoError(t, err)
|
|
112
|
+
if !reflect.DeepEqual(tc.packet, packet2) {
|
|
113
|
+
assert.Failf(t, "nested packet not equal after JSON round trip", "src %q, dst %q", tc.packet, packet2)
|
|
114
|
+
}
|
|
115
|
+
})
|
|
116
|
+
}
|
|
117
|
+
}
|
package/vm/client.go
CHANGED
|
@@ -4,6 +4,7 @@ import (
|
|
|
4
4
|
"context"
|
|
5
5
|
"fmt"
|
|
6
6
|
"net/rpc"
|
|
7
|
+
"sync"
|
|
7
8
|
)
|
|
8
9
|
|
|
9
10
|
// ReceiveMessageMethod is the name of the method we call in order to have the
|
|
@@ -34,12 +35,21 @@ var _ rpc.ClientCodec = (*ClientCodec)(nil)
|
|
|
34
35
|
// having the WriteRequest() method fabricate a Receive() call to clear the rpc
|
|
35
36
|
// state.
|
|
36
37
|
type ClientCodec struct {
|
|
37
|
-
ctx
|
|
38
|
-
send
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
ctx context.Context
|
|
39
|
+
send func(port, rPort int, msg string)
|
|
40
|
+
inbound chan *rpc.Response
|
|
41
|
+
|
|
42
|
+
// reqMutex protects outbound requests.
|
|
43
|
+
reqMutex sync.Mutex
|
|
44
|
+
outbound map[int]rpc.Request
|
|
45
|
+
|
|
46
|
+
// Scratch space to communicate between ReadResponseHeader and
|
|
47
|
+
// ReadResponseBody (protected by mutex in "net/rpc" implementation).
|
|
42
48
|
replyToRead uint64
|
|
49
|
+
|
|
50
|
+
// mutex protects replies map
|
|
51
|
+
mutex sync.Mutex
|
|
52
|
+
replies map[uint64]string
|
|
43
53
|
}
|
|
44
54
|
|
|
45
55
|
// NewClientCodec creates a new ClientCodec.
|
|
@@ -64,7 +74,11 @@ func (cc *ClientCodec) WriteRequest(r *rpc.Request, body interface{}) error {
|
|
|
64
74
|
return fmt.Errorf("body %T is not a Message", body)
|
|
65
75
|
}
|
|
66
76
|
rPort := int(r.Seq + 1) // rPort is 1-indexed to indicate it's required
|
|
77
|
+
|
|
78
|
+
cc.reqMutex.Lock()
|
|
67
79
|
cc.outbound[rPort] = *r
|
|
80
|
+
cc.reqMutex.Unlock()
|
|
81
|
+
|
|
68
82
|
var senderReplyPort int
|
|
69
83
|
if msg.NeedsReply {
|
|
70
84
|
senderReplyPort = rPort
|
|
@@ -85,18 +99,27 @@ func (cc *ClientCodec) ReadResponseHeader(r *rpc.Response) error {
|
|
|
85
99
|
}
|
|
86
100
|
|
|
87
101
|
// ReadResponseBody decodes a response body (currently just string) from the VM.
|
|
102
|
+
// and will always be called immediately after ReadResponseHeader (cf.
|
|
103
|
+
// https://pkg.go.dev/net/rpc#ClientCodec ).
|
|
88
104
|
func (cc *ClientCodec) ReadResponseBody(body interface{}) error {
|
|
105
|
+
cc.mutex.Lock()
|
|
106
|
+
reply := cc.replies[cc.replyToRead]
|
|
107
|
+
delete(cc.replies, cc.replyToRead)
|
|
108
|
+
cc.mutex.Unlock()
|
|
109
|
+
|
|
89
110
|
if body != nil {
|
|
90
|
-
*body.(*string) =
|
|
111
|
+
*body.(*string) = reply
|
|
91
112
|
}
|
|
92
|
-
delete(cc.replies, cc.replyToRead)
|
|
93
113
|
return nil
|
|
94
114
|
}
|
|
95
115
|
|
|
96
116
|
// Receive is called by the VM to send a response to the client.
|
|
97
117
|
func (cc *ClientCodec) Receive(rPort int, isError bool, data string) error {
|
|
118
|
+
cc.reqMutex.Lock()
|
|
98
119
|
outb := cc.outbound[rPort]
|
|
99
120
|
delete(cc.outbound, rPort)
|
|
121
|
+
cc.reqMutex.Unlock()
|
|
122
|
+
|
|
100
123
|
resp := &rpc.Response{
|
|
101
124
|
ServiceMethod: outb.ServiceMethod,
|
|
102
125
|
Seq: outb.Seq,
|
|
@@ -104,7 +127,9 @@ func (cc *ClientCodec) Receive(rPort int, isError bool, data string) error {
|
|
|
104
127
|
if isError {
|
|
105
128
|
resp.Error = data
|
|
106
129
|
} else {
|
|
130
|
+
cc.mutex.Lock()
|
|
107
131
|
cc.replies[resp.Seq] = data
|
|
132
|
+
cc.mutex.Unlock()
|
|
108
133
|
}
|
|
109
134
|
cc.inbound <- resp
|
|
110
135
|
return nil
|
package/vm/proto_json.go
CHANGED
package/x/swingset/abci.go
CHANGED
|
@@ -6,9 +6,9 @@ import (
|
|
|
6
6
|
"fmt"
|
|
7
7
|
"time"
|
|
8
8
|
|
|
9
|
+
abci "github.com/cometbft/cometbft/abci/types"
|
|
9
10
|
"github.com/cosmos/cosmos-sdk/telemetry"
|
|
10
11
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
11
|
-
abci "github.com/tendermint/tendermint/abci/types"
|
|
12
12
|
|
|
13
13
|
"github.com/Agoric/agoric-sdk/golang/cosmos/vm"
|
|
14
14
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/types"
|
package/x/swingset/alias.go
CHANGED
package/x/swingset/config.go
CHANGED
|
@@ -7,9 +7,9 @@ import (
|
|
|
7
7
|
"github.com/spf13/viper"
|
|
8
8
|
|
|
9
9
|
"github.com/cosmos/cosmos-sdk/client/flags"
|
|
10
|
-
pruningtypes "github.com/cosmos/cosmos-sdk/pruning/types"
|
|
11
10
|
serverconfig "github.com/cosmos/cosmos-sdk/server/config"
|
|
12
11
|
servertypes "github.com/cosmos/cosmos-sdk/server/types"
|
|
12
|
+
pruningtypes "github.com/cosmos/cosmos-sdk/store/pruning/types"
|
|
13
13
|
|
|
14
14
|
"github.com/Agoric/agoric-sdk/golang/cosmos/util"
|
|
15
15
|
)
|
|
@@ -9,9 +9,9 @@ import (
|
|
|
9
9
|
|
|
10
10
|
agoric "github.com/Agoric/agoric-sdk/golang/cosmos/types"
|
|
11
11
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/types"
|
|
12
|
+
"github.com/cometbft/cometbft/libs/log"
|
|
12
13
|
"github.com/cosmos/cosmos-sdk/baseapp"
|
|
13
14
|
snapshots "github.com/cosmos/cosmos-sdk/snapshots/types"
|
|
14
|
-
"github.com/tendermint/tendermint/libs/log"
|
|
15
15
|
)
|
|
16
16
|
|
|
17
17
|
// This module implements a Cosmos ExtensionSnapshotter to capture and restore
|
|
@@ -2,9 +2,8 @@ package keeper
|
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
4
|
"fmt"
|
|
5
|
-
"strings"
|
|
6
5
|
|
|
7
|
-
abci "github.com/
|
|
6
|
+
abci "github.com/cometbft/cometbft/abci/types"
|
|
8
7
|
|
|
9
8
|
sdkioerrors "cosmossdk.io/errors"
|
|
10
9
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
@@ -22,34 +21,6 @@ const (
|
|
|
22
21
|
LegacyQueryKeys = "keys"
|
|
23
22
|
)
|
|
24
23
|
|
|
25
|
-
// NewQuerier is the module level router for state queries
|
|
26
|
-
func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier {
|
|
27
|
-
return func(ctx sdk.Context, path []string, req abci.RequestQuery) (res []byte, err error) {
|
|
28
|
-
var queryType string
|
|
29
|
-
if len(path) > 0 {
|
|
30
|
-
queryType = path[0]
|
|
31
|
-
}
|
|
32
|
-
switch queryType {
|
|
33
|
-
case QueryEgress:
|
|
34
|
-
if len(path) < 2 || path[1] == "" {
|
|
35
|
-
return nil, sdkioerrors.Wrap(sdkerrors.ErrInvalidRequest, "missing egress address")
|
|
36
|
-
}
|
|
37
|
-
return queryEgress(ctx, path[1], req, keeper, legacyQuerierCdc)
|
|
38
|
-
case QueryMailbox:
|
|
39
|
-
if len(path) < 2 || path[1] == "" {
|
|
40
|
-
return nil, sdkioerrors.Wrap(sdkerrors.ErrInvalidRequest, "missing mailbox peer")
|
|
41
|
-
}
|
|
42
|
-
return queryMailbox(ctx, path[1], req, keeper, legacyQuerierCdc)
|
|
43
|
-
case LegacyQueryStorage:
|
|
44
|
-
return legacyQueryStorage(ctx, strings.Join(path[1:], "/"), req, keeper, legacyQuerierCdc)
|
|
45
|
-
case LegacyQueryKeys:
|
|
46
|
-
return legacyQueryKeys(ctx, strings.Join(path[1:], "/"), req, keeper, legacyQuerierCdc)
|
|
47
|
-
default:
|
|
48
|
-
return nil, sdkioerrors.Wrap(sdkerrors.ErrUnknownRequest, "unknown swingset query path")
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
24
|
// nolint: unparam
|
|
54
25
|
func queryEgress(ctx sdk.Context, bech32 string, req abci.RequestQuery, keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) {
|
|
55
26
|
acc, err := sdk.AccAddressFromBech32(bech32)
|
|
@@ -13,7 +13,7 @@ import (
|
|
|
13
13
|
agoric "github.com/Agoric/agoric-sdk/golang/cosmos/types"
|
|
14
14
|
"github.com/Agoric/agoric-sdk/golang/cosmos/vm"
|
|
15
15
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/types"
|
|
16
|
-
"github.com/
|
|
16
|
+
"github.com/cometbft/cometbft/libs/log"
|
|
17
17
|
)
|
|
18
18
|
|
|
19
19
|
// This module abstracts the generation and handling of swing-store exports,
|
package/x/swingset/module.go
CHANGED
|
@@ -16,8 +16,8 @@ import (
|
|
|
16
16
|
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
|
|
17
17
|
"github.com/cosmos/cosmos-sdk/types/module"
|
|
18
18
|
|
|
19
|
+
abci "github.com/cometbft/cometbft/abci/types"
|
|
19
20
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
20
|
-
abci "github.com/tendermint/tendermint/abci/types"
|
|
21
21
|
)
|
|
22
22
|
|
|
23
23
|
// type check to ensure the interface is properly implemented
|
|
@@ -115,19 +115,6 @@ func (am *AppModule) SetSwingStoreExportDir(dir string) {
|
|
|
115
115
|
|
|
116
116
|
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {}
|
|
117
117
|
|
|
118
|
-
func (am AppModule) Route() sdk.Route {
|
|
119
|
-
return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper))
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
func (am AppModule) QuerierRoute() string {
|
|
123
|
-
return ModuleName
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// LegacyQuerierHandler returns the sdk.Querier for deployment module
|
|
127
|
-
func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier {
|
|
128
|
-
return keeper.NewQuerier(am.keeper, legacyQuerierCdc)
|
|
129
|
-
}
|
|
130
|
-
|
|
131
118
|
func (am AppModule) RegisterServices(cfg module.Configurator) {
|
|
132
119
|
types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
|
|
133
120
|
querier := keeper.Querier{Keeper: am.keeper}
|
|
@@ -11,15 +11,16 @@ import (
|
|
|
11
11
|
// experience if they don't.
|
|
12
12
|
|
|
13
13
|
const (
|
|
14
|
+
BeansPerBlockComputeLimit = "blockComputeLimit"
|
|
15
|
+
BeansPerVatCreation = "vatCreation"
|
|
16
|
+
BeansPerXsnapComputron = "xsnapComputron"
|
|
17
|
+
|
|
14
18
|
BeansPerFeeUnit = "feeUnit"
|
|
15
19
|
BeansPerInboundTx = "inboundTx"
|
|
16
|
-
BeansPerBlockComputeLimit = "blockComputeLimit"
|
|
17
20
|
BeansPerMessage = "message"
|
|
18
21
|
BeansPerMessageByte = "messageByte"
|
|
19
22
|
BeansPerMinFeeDebit = "minFeeDebit"
|
|
20
23
|
BeansPerStorageByte = "storageByte"
|
|
21
|
-
BeansPerVatCreation = "vatCreation"
|
|
22
|
-
BeansPerXsnapComputron = "xsnapComputron"
|
|
23
24
|
BeansPerSmartWalletProvision = "smartWalletProvision"
|
|
24
25
|
|
|
25
26
|
// PowerFlags.
|
|
@@ -52,18 +53,24 @@ var (
|
|
|
52
53
|
// observed: 0.385 sec
|
|
53
54
|
DefaultBeansPerVatCreation = sdk.NewUint(300000).Mul(DefaultBeansPerXsnapComputron)
|
|
54
55
|
|
|
55
|
-
// Fees are
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
// Fees are represented as integer "beans", where each bean is a uniform
|
|
57
|
+
// fraction of this `fee_unit_price` as controlled by the below
|
|
58
|
+
// `beans_per_unit` "feeUnit".
|
|
58
59
|
// TODO: create the cost model we want, and update these to be more principled.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
DefaultFeeUnitPrice = sdk.NewCoins(sdk.NewInt64Coin("ubld", 1_000_000)) // 1 BLD
|
|
61
|
+
|
|
62
|
+
// The count of "beans" into which `fee_unit_price` is divided.
|
|
63
|
+
// Larger numbers make for smaller beans, and we expect values to be rather
|
|
64
|
+
// large for representing fees precisely in beans that each approximate
|
|
65
|
+
// a "picoUSD"--one trillionth of a USD.
|
|
66
|
+
DefaultBeansPerFeeUnit = sdk.NewUint(1_000_000_000_000) // 1e12 (assumes $1 per BLD)
|
|
67
|
+
|
|
68
|
+
DefaultBeansPerInboundTx = DefaultBeansPerFeeUnit.Quo(sdk.NewUint(100)) // 10e09, ~$0.01
|
|
69
|
+
DefaultBeansPerMessage = DefaultBeansPerFeeUnit.Quo(sdk.NewUint(1_000)) // 1e09, ~$0.001
|
|
70
|
+
DefaultBeansPerMessageByte = DefaultBeansPerFeeUnit.Quo(sdk.NewUint(50_000)) // 20e06, ~$0.00002
|
|
71
|
+
DefaultBeansPerMinFeeDebit = DefaultBeansPerFeeUnit.Quo(sdk.NewUint(5)) // 200e09, ~$0.2
|
|
72
|
+
DefaultBeansPerStorageByte = DefaultBeansPerFeeUnit.Quo(sdk.NewUint(500)) // 2e09, ~$0.002
|
|
73
|
+
DefaultBeansPerSmartWalletProvision = DefaultBeansPerFeeUnit // 1e12, ~$1
|
|
67
74
|
|
|
68
75
|
DefaultBootstrapVatConfig = "@agoric/vm-config/decentral-core-config.json"
|
|
69
76
|
|
|
@@ -97,15 +104,16 @@ var (
|
|
|
97
104
|
// move DefaultBeansPerUnit to a function to allow for boot overriding of the Default params
|
|
98
105
|
func DefaultBeansPerUnit() []StringBeans {
|
|
99
106
|
return []StringBeans{
|
|
107
|
+
NewStringBeans(BeansPerXsnapComputron, DefaultBeansPerXsnapComputron),
|
|
100
108
|
NewStringBeans(BeansPerBlockComputeLimit, DefaultBeansPerBlockComputeLimit),
|
|
109
|
+
NewStringBeans(BeansPerVatCreation, DefaultBeansPerVatCreation),
|
|
110
|
+
|
|
101
111
|
NewStringBeans(BeansPerFeeUnit, DefaultBeansPerFeeUnit),
|
|
102
112
|
NewStringBeans(BeansPerInboundTx, DefaultBeansPerInboundTx),
|
|
103
113
|
NewStringBeans(BeansPerMessage, DefaultBeansPerMessage),
|
|
104
114
|
NewStringBeans(BeansPerMessageByte, DefaultBeansPerMessageByte),
|
|
105
115
|
NewStringBeans(BeansPerMinFeeDebit, DefaultBeansPerMinFeeDebit),
|
|
106
116
|
NewStringBeans(BeansPerStorageByte, DefaultBeansPerStorageByte),
|
|
107
|
-
NewStringBeans(BeansPerVatCreation, DefaultBeansPerVatCreation),
|
|
108
|
-
NewStringBeans(BeansPerXsnapComputron, DefaultBeansPerXsnapComputron),
|
|
109
117
|
NewStringBeans(BeansPerSmartWalletProvision, DefaultBeansPerSmartWalletProvision),
|
|
110
118
|
}
|
|
111
119
|
}
|
|
@@ -7,9 +7,9 @@ import (
|
|
|
7
7
|
context "context"
|
|
8
8
|
fmt "fmt"
|
|
9
9
|
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
|
|
10
|
-
_ "github.com/
|
|
11
|
-
grpc1 "github.com/
|
|
12
|
-
proto "github.com/
|
|
10
|
+
_ "github.com/cosmos/gogoproto/gogoproto"
|
|
11
|
+
grpc1 "github.com/cosmos/gogoproto/grpc"
|
|
12
|
+
proto "github.com/cosmos/gogoproto/proto"
|
|
13
13
|
grpc "google.golang.org/grpc"
|
|
14
14
|
codes "google.golang.org/grpc/codes"
|
|
15
15
|
status "google.golang.org/grpc/status"
|
|
@@ -811,6 +811,7 @@ func _Msg_Provision_Handler(srv interface{}, ctx context.Context, dec func(inter
|
|
|
811
811
|
return interceptor(ctx, in, info, handler)
|
|
812
812
|
}
|
|
813
813
|
|
|
814
|
+
var Msg_serviceDesc = _Msg_serviceDesc
|
|
814
815
|
var _Msg_serviceDesc = grpc.ServiceDesc{
|
|
815
816
|
ServiceName: "agoric.swingset.Msg",
|
|
816
817
|
HandlerType: (*MsgServer)(nil),
|
|
@@ -7,9 +7,9 @@ import (
|
|
|
7
7
|
context "context"
|
|
8
8
|
fmt "fmt"
|
|
9
9
|
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
|
|
10
|
-
_ "github.com/
|
|
11
|
-
grpc1 "github.com/
|
|
12
|
-
proto "github.com/
|
|
10
|
+
_ "github.com/cosmos/gogoproto/gogoproto"
|
|
11
|
+
grpc1 "github.com/cosmos/gogoproto/grpc"
|
|
12
|
+
proto "github.com/cosmos/gogoproto/proto"
|
|
13
13
|
_ "google.golang.org/genproto/googleapis/api/annotations"
|
|
14
14
|
grpc "google.golang.org/grpc"
|
|
15
15
|
codes "google.golang.org/grpc/codes"
|
|
@@ -476,6 +476,7 @@ func _Query_Mailbox_Handler(srv interface{}, ctx context.Context, dec func(inter
|
|
|
476
476
|
return interceptor(ctx, in, info, handler)
|
|
477
477
|
}
|
|
478
478
|
|
|
479
|
+
var Query_serviceDesc = _Query_serviceDesc
|
|
479
480
|
var _Query_serviceDesc = grpc.ServiceDesc{
|
|
480
481
|
ServiceName: "agoric.swingset.Query",
|
|
481
482
|
HandlerType: (*QueryServer)(nil),
|
|
@@ -7,8 +7,8 @@ import (
|
|
|
7
7
|
fmt "fmt"
|
|
8
8
|
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
|
|
9
9
|
types "github.com/cosmos/cosmos-sdk/types"
|
|
10
|
-
_ "github.com/
|
|
11
|
-
proto "github.com/
|
|
10
|
+
_ "github.com/cosmos/gogoproto/gogoproto"
|
|
11
|
+
proto "github.com/cosmos/gogoproto/proto"
|
|
12
12
|
io "io"
|
|
13
13
|
math "math"
|
|
14
14
|
math_bits "math/bits"
|
package/x/vbank/genesis.go
CHANGED
|
@@ -4,8 +4,8 @@ import (
|
|
|
4
4
|
"fmt"
|
|
5
5
|
|
|
6
6
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vbank/types"
|
|
7
|
+
abci "github.com/cometbft/cometbft/abci/types"
|
|
7
8
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
8
|
-
abci "github.com/tendermint/tendermint/abci/types"
|
|
9
9
|
)
|
|
10
10
|
|
|
11
11
|
func NewGenesisState() *types.GenesisState {
|