Skip to content

Commit 3e6464b

Browse files
authored
chore: renaming API fns (#786)
1 parent 8dfbc9c commit 3e6464b

File tree

13 files changed

+43
-43
lines changed

13 files changed

+43
-43
lines changed

docs/app-modules/interchain-accounts/auth-modules.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -145,21 +145,21 @@ func (im IBCModule) OnRecvPacket(
145145
}
146146
```
147147

148-
## `InitInterchainAccount`
148+
## `RegisterInterchainAccount`
149149

150-
The authentication module can begin registering interchain accounts by calling `InitInterchainAccount`:
150+
The authentication module can begin registering interchain accounts by calling `RegisterInterchainAccount`:
151151

152152
```go
153-
if err := keeper.icaControllerKeeper.InitInterchainAccount(ctx, connectionID, owner.String()); err != nil {
153+
if err := keeper.icaControllerKeeper.RegisterInterchainAccount(ctx, connectionID, owner.String()); err != nil {
154154
return err
155155
}
156156

157157
return nil
158158
```
159159

160-
## `TrySendTx`
160+
## `SendTx`
161161

162-
The authentication module can attempt to send a packet by calling `TrySendTx`:
162+
The authentication module can attempt to send a packet by calling `SendTx`:
163163
```go
164164

165165
// Authenticate owner
@@ -204,7 +204,7 @@ packetData := icatypes.InterchainAccountPacketData{
204204
timeoutTimestamp := obtainTimeoutTimestamp()
205205

206206
// Send the interchain accounts packet, returning the packet sequence
207-
seq, err = keeper.icaControllerKeeper.TrySendTx(ctx, chanCap, portID, packetData, timeoutTimestamp)
207+
seq, err = keeper.icaControllerKeeper.SendTx(ctx, chanCap, portID, packetData, timeoutTimestamp)
208208
```
209209

210210
The data within an `InterchainAccountPacketData` must be serialized using a format supported by the host chain.

docs/app-modules/interchain-accounts/transactions.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ Learn about Interchain Accounts transaction execution {synopsis}
1010

1111
As described in [Authentication Modules](./auth-modules.md#trysendtx) transactions are executed using the interchain accounts controller API and require a `Base Application` as outlined in [ICS30 IBC Middleware](https://github.com/cosmos/ibc/tree/master/spec/app/ics-030-middleware) to facilitate authentication. The method of authentication remains unspecified to provide flexibility for the authentication module developer.
1212

13-
Transactions are executed via the ICS27 [`TrySendTx` API](./auth-modules.md#trysendtx). This must be invoked through an Interchain Accounts authentication module and follows the outlined path of execution below. Packet relaying semantics provided by the IBC core transport, authentication, and ordering (IBC/TAO) layer are omitted for brevity.
13+
Transactions are executed via the ICS27 [`SendTx` API](./auth-modules.md#trysendtx). This must be invoked through an Interchain Accounts authentication module and follows the outlined path of execution below. Packet relaying semantics provided by the IBC core transport, authentication, and ordering (IBC/TAO) layer are omitted for brevity.
1414

1515
![send-tx-flow](../../assets/send-interchain-tx.png "Transaction Execution")
1616

1717
## Atomicity
1818

1919
As the Interchain Accounts module supports the execution of multiple transactions using the Cosmos SDK `Msg` interface, it provides the same atomicity guarantees as Cosmos SDK-based applications, leveraging the [`CacheMultiStore`](https://docs.cosmos.network/master/core/store.html#cachemultistore) architecture provided by the [`Context`](https://docs.cosmos.network/master/core/context.html) type.
2020

21-
This provides atomic execution of transactions when using Interchain Accounts, where state changes are only committed if all `Msg`s succeed.
21+
This provides atomic execution of transactions when using Interchain Accounts, where state changes are only committed if all `Msg`s succeed.

modules/apps/27-interchain-accounts/controller/ibc_module_test.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ func NewICAPath(chainA, chainB *ibctesting.TestChain) *ibctesting.Path {
7070
return path
7171
}
7272

73-
func InitInterchainAccount(endpoint *ibctesting.Endpoint, owner string) error {
73+
func RegisterInterchainAccount(endpoint *ibctesting.Endpoint, owner string) error {
7474
portID, err := icatypes.NewControllerPortID(owner)
7575
if err != nil {
7676
return err
7777
}
7878

7979
channelSequence := endpoint.Chain.App.GetIBCKeeper().ChannelKeeper.GetNextChannelSequence(endpoint.Chain.GetContext())
8080

81-
if err := endpoint.Chain.GetSimApp().ICAControllerKeeper.InitInterchainAccount(endpoint.Chain.GetContext(), endpoint.ConnectionID, owner); err != nil {
81+
if err := endpoint.Chain.GetSimApp().ICAControllerKeeper.RegisterInterchainAccount(endpoint.Chain.GetContext(), endpoint.ConnectionID, owner); err != nil {
8282
return err
8383
}
8484

@@ -95,7 +95,7 @@ func InitInterchainAccount(endpoint *ibctesting.Endpoint, owner string) error {
9595

9696
// SetupICAPath invokes the InterchainAccounts entrypoint and subsequent channel handshake handlers
9797
func SetupICAPath(path *ibctesting.Path, owner string) error {
98-
if err := InitInterchainAccount(path.EndpointA, owner); err != nil {
98+
if err := RegisterInterchainAccount(path.EndpointA, owner); err != nil {
9999
return err
100100
}
101101

@@ -216,11 +216,11 @@ func (suite *InterchainAccountsTestSuite) TestChanOpenTry() {
216216
path := NewICAPath(suite.chainA, suite.chainB)
217217
suite.coordinator.SetupConnections(path)
218218

219-
err := InitInterchainAccount(path.EndpointA, TestOwnerAddress)
219+
err := RegisterInterchainAccount(path.EndpointA, TestOwnerAddress)
220220
suite.Require().NoError(err)
221221

222222
// chainB also creates a controller port
223-
err = InitInterchainAccount(path.EndpointB, TestOwnerAddress)
223+
err = RegisterInterchainAccount(path.EndpointB, TestOwnerAddress)
224224
suite.Require().NoError(err)
225225

226226
path.EndpointA.UpdateClient()
@@ -297,7 +297,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenAck() {
297297
path = NewICAPath(suite.chainA, suite.chainB)
298298
suite.coordinator.SetupConnections(path)
299299

300-
err := InitInterchainAccount(path.EndpointA, TestOwnerAddress)
300+
err := RegisterInterchainAccount(path.EndpointA, TestOwnerAddress)
301301
suite.Require().NoError(err)
302302

303303
err = path.EndpointB.ChanOpenTry()
@@ -334,7 +334,7 @@ func (suite *InterchainAccountsTestSuite) TestChanOpenConfirm() {
334334
path := NewICAPath(suite.chainA, suite.chainB)
335335
suite.coordinator.SetupConnections(path)
336336

337-
err := InitInterchainAccount(path.EndpointA, TestOwnerAddress)
337+
err := RegisterInterchainAccount(path.EndpointA, TestOwnerAddress)
338338
suite.Require().NoError(err)
339339

340340
err = path.EndpointB.ChanOpenTry()

modules/apps/27-interchain-accounts/controller/keeper/account.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import (
99
host "github.com/cosmos/ibc-go/v3/modules/core/24-host"
1010
)
1111

12-
// InitInterchainAccount is the entry point to registering an interchain account.
12+
// RegisterInterchainAccount is the entry point to registering an interchain account.
1313
// It generates a new port identifier using the owner address, connection identifier,
1414
// and counterparty connection identifier. It will bind to the port identifier and
1515
// call 04-channel 'ChanOpenInit'. An error is returned if the port identifier is
1616
// already in use. Gaining access to interchain accounts whose channels have closed
1717
// cannot be done with this function. A regular MsgChanOpenInit must be used.
18-
func (k Keeper) InitInterchainAccount(ctx sdk.Context, connectionID, owner string) error {
18+
func (k Keeper) RegisterInterchainAccount(ctx sdk.Context, connectionID, owner string) error {
1919
portID, err := icatypes.NewControllerPortID(owner)
2020
if err != nil {
2121
return err

modules/apps/27-interchain-accounts/controller/keeper/account_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
ibctesting "github.com/cosmos/ibc-go/v3/testing"
77
)
88

9-
func (suite *KeeperTestSuite) TestInitInterchainAccount() {
9+
func (suite *KeeperTestSuite) TestRegisterInterchainAccount() {
1010
var (
1111
owner string
1212
path *ibctesting.Path
@@ -70,7 +70,7 @@ func (suite *KeeperTestSuite) TestInitInterchainAccount() {
7070

7171
tc.malleate() // malleate mutates test data
7272

73-
err = suite.chainA.GetSimApp().ICAControllerKeeper.InitInterchainAccount(suite.chainA.GetContext(), path.EndpointA.ConnectionID, owner)
73+
err = suite.chainA.GetSimApp().ICAControllerKeeper.RegisterInterchainAccount(suite.chainA.GetContext(), path.EndpointA.ConnectionID, owner)
7474

7575
if tc.expPass {
7676
suite.Require().NoError(err)

modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ func (suite *KeeperTestSuite) TestOnChanOpenAck() {
258258
path = NewICAPath(suite.chainA, suite.chainB)
259259
suite.coordinator.SetupConnections(path)
260260

261-
err := InitInterchainAccount(path.EndpointA, TestOwnerAddress)
261+
err := RegisterInterchainAccount(path.EndpointA, TestOwnerAddress)
262262
suite.Require().NoError(err)
263263

264264
err = path.EndpointB.ChanOpenTry()

modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func NewICAPath(chainA, chainB *ibctesting.TestChain) *ibctesting.Path {
6666

6767
// SetupICAPath invokes the InterchainAccounts entrypoint and subsequent channel handshake handlers
6868
func SetupICAPath(path *ibctesting.Path, owner string) error {
69-
if err := InitInterchainAccount(path.EndpointA, owner); err != nil {
69+
if err := RegisterInterchainAccount(path.EndpointA, owner); err != nil {
7070
return err
7171
}
7272

@@ -85,16 +85,16 @@ func SetupICAPath(path *ibctesting.Path, owner string) error {
8585
return nil
8686
}
8787

88-
// InitInterchainAccount is a helper function for starting the channel handshake
89-
func InitInterchainAccount(endpoint *ibctesting.Endpoint, owner string) error {
88+
// RegisterInterchainAccount is a helper function for starting the channel handshake
89+
func RegisterInterchainAccount(endpoint *ibctesting.Endpoint, owner string) error {
9090
portID, err := icatypes.NewControllerPortID(owner)
9191
if err != nil {
9292
return err
9393
}
9494

9595
channelSequence := endpoint.Chain.App.GetIBCKeeper().ChannelKeeper.GetNextChannelSequence(endpoint.Chain.GetContext())
9696

97-
if err := endpoint.Chain.GetSimApp().ICAControllerKeeper.InitInterchainAccount(endpoint.Chain.GetContext(), endpoint.ConnectionID, owner); err != nil {
97+
if err := endpoint.Chain.GetSimApp().ICAControllerKeeper.RegisterInterchainAccount(endpoint.Chain.GetContext(), endpoint.ConnectionID, owner); err != nil {
9898
return err
9999
}
100100

modules/apps/27-interchain-accounts/controller/keeper/relay.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import (
1010
channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types"
1111
)
1212

13-
// TrySendTx takes pre-built packet data containing messages to be executed on the host chain from an authentication module and attempts to send the packet.
13+
// SendTx takes pre-built packet data containing messages to be executed on the host chain from an authentication module and attempts to send the packet.
1414
// The packet sequence for the outgoing packet is returned as a result.
1515
// If the base application has the capability to send on the provided portID. An appropriate
1616
// absolute timeoutTimestamp must be provided. If the packet is timed out, the channel will be closed.
1717
// In the case of channel closure, a new channel may be reopened to reconnect to the host chain.
18-
func (k Keeper) TrySendTx(ctx sdk.Context, chanCap *capabilitytypes.Capability, portID string, icaPacketData icatypes.InterchainAccountPacketData, timeoutTimestamp uint64) (uint64, error) {
18+
func (k Keeper) SendTx(ctx sdk.Context, chanCap *capabilitytypes.Capability, portID string, icaPacketData icatypes.InterchainAccountPacketData, timeoutTimestamp uint64) (uint64, error) {
1919
// Check for the active channel
2020
activeChannelID, found := k.GetActiveChannelID(ctx, portID)
2121
if !found {

modules/apps/27-interchain-accounts/controller/keeper/relay_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
ibctesting "github.com/cosmos/ibc-go/v3/testing"
1313
)
1414

15-
func (suite *KeeperTestSuite) TestTrySendTx() {
15+
func (suite *KeeperTestSuite) TestSendTx() {
1616
var (
1717
path *ibctesting.Path
1818
packetData icatypes.InterchainAccountPacketData
@@ -160,7 +160,7 @@ func (suite *KeeperTestSuite) TestTrySendTx() {
160160

161161
tc.malleate() // malleate mutates test data
162162

163-
_, err = suite.chainA.GetSimApp().ICAControllerKeeper.TrySendTx(suite.chainA.GetContext(), chanCap, path.EndpointA.ChannelConfig.PortID, packetData, timeoutTimestamp)
163+
_, err = suite.chainA.GetSimApp().ICAControllerKeeper.SendTx(suite.chainA.GetContext(), chanCap, path.EndpointA.ChannelConfig.PortID, packetData, timeoutTimestamp)
164164

165165
if tc.expPass {
166166
suite.Require().NoError(err)

modules/apps/27-interchain-accounts/host/ibc_module_test.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ func NewICAPath(chainA, chainB *ibctesting.TestChain) *ibctesting.Path {
7272
return path
7373
}
7474

75-
func InitInterchainAccount(endpoint *ibctesting.Endpoint, owner string) error {
75+
func RegisterInterchainAccount(endpoint *ibctesting.Endpoint, owner string) error {
7676
portID, err := icatypes.NewControllerPortID(owner)
7777
if err != nil {
7878
return err
7979
}
8080

8181
channelSequence := endpoint.Chain.App.GetIBCKeeper().ChannelKeeper.GetNextChannelSequence(endpoint.Chain.GetContext())
8282

83-
if err := endpoint.Chain.GetSimApp().ICAControllerKeeper.InitInterchainAccount(endpoint.Chain.GetContext(), endpoint.ConnectionID, owner); err != nil {
83+
if err := endpoint.Chain.GetSimApp().ICAControllerKeeper.RegisterInterchainAccount(endpoint.Chain.GetContext(), endpoint.ConnectionID, owner); err != nil {
8484
return err
8585
}
8686

@@ -97,7 +97,7 @@ func InitInterchainAccount(endpoint *ibctesting.Endpoint, owner string) error {
9797

9898
// SetupICAPath invokes the InterchainAccounts entrypoint and subsequent channel handshake handlers
9999
func SetupICAPath(path *ibctesting.Path, owner string) error {
100-
if err := InitInterchainAccount(path.EndpointA, owner); err != nil {
100+
if err := RegisterInterchainAccount(path.EndpointA, owner); err != nil {
101101
return err
102102
}
103103

@@ -179,7 +179,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenTry() {
179179
path = NewICAPath(suite.chainA, suite.chainB)
180180
suite.coordinator.SetupConnections(path)
181181

182-
err := InitInterchainAccount(path.EndpointA, TestOwnerAddress)
182+
err := RegisterInterchainAccount(path.EndpointA, TestOwnerAddress)
183183
suite.Require().NoError(err)
184184
path.EndpointB.ChannelID = ibctesting.FirstChannelID
185185

@@ -230,7 +230,7 @@ func (suite *InterchainAccountsTestSuite) TestChanOpenAck() {
230230
path := NewICAPath(suite.chainA, suite.chainB)
231231
suite.coordinator.SetupConnections(path)
232232

233-
err := InitInterchainAccount(path.EndpointA, TestOwnerAddress)
233+
err := RegisterInterchainAccount(path.EndpointA, TestOwnerAddress)
234234
suite.Require().NoError(err)
235235

236236
err = path.EndpointB.ChanOpenTry()
@@ -294,7 +294,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenConfirm() {
294294
path := NewICAPath(suite.chainA, suite.chainB)
295295
suite.coordinator.SetupConnections(path)
296296

297-
err := InitInterchainAccount(path.EndpointA, TestOwnerAddress)
297+
err := RegisterInterchainAccount(path.EndpointA, TestOwnerAddress)
298298
suite.Require().NoError(err)
299299

300300
err = path.EndpointB.ChanOpenTry()
@@ -641,7 +641,7 @@ func (suite *InterchainAccountsTestSuite) TestControlAccountAfterChannelClose()
641641
chanCap, ok := suite.chainA.GetSimApp().ScopedICAMockKeeper.GetCapability(path.EndpointA.Chain.GetContext(), host.ChannelCapabilityPath(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID))
642642
suite.Require().True(ok)
643643

644-
_, err = suite.chainA.GetSimApp().ICAControllerKeeper.TrySendTx(suite.chainA.GetContext(), chanCap, path.EndpointA.ChannelConfig.PortID, icaPacketData, ^uint64(0))
644+
_, err = suite.chainA.GetSimApp().ICAControllerKeeper.SendTx(suite.chainA.GetContext(), chanCap, path.EndpointA.ChannelConfig.PortID, icaPacketData, ^uint64(0))
645645
suite.Require().NoError(err)
646646
path.EndpointB.UpdateClient()
647647

@@ -673,7 +673,7 @@ func (suite *InterchainAccountsTestSuite) TestControlAccountAfterChannelClose()
673673
chanCap, ok = suite.chainA.GetSimApp().ScopedICAMockKeeper.GetCapability(path.EndpointA.Chain.GetContext(), host.ChannelCapabilityPath(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID))
674674
suite.Require().True(ok)
675675

676-
_, err = suite.chainA.GetSimApp().ICAControllerKeeper.TrySendTx(suite.chainA.GetContext(), chanCap, path.EndpointA.ChannelConfig.PortID, icaPacketData, ^uint64(0))
676+
_, err = suite.chainA.GetSimApp().ICAControllerKeeper.SendTx(suite.chainA.GetContext(), chanCap, path.EndpointA.ChannelConfig.PortID, icaPacketData, ^uint64(0))
677677
suite.Require().NoError(err)
678678
path.EndpointB.UpdateClient()
679679

modules/apps/27-interchain-accounts/host/keeper/account_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func (suite *KeeperTestSuite) TestRegisterInterchainAccount() {
1212
path := NewICAPath(suite.chainA, suite.chainB)
1313
suite.coordinator.SetupConnections(path)
1414

15-
// InitInterchainAccount
15+
//RegisterInterchainAccount
1616
err := SetupICAPath(path, TestOwnerAddress)
1717
suite.Require().NoError(err)
1818

modules/apps/27-interchain-accounts/host/keeper/handshake_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func (suite *KeeperTestSuite) TestOnChanOpenTry() {
122122
path = NewICAPath(suite.chainA, suite.chainB)
123123
suite.coordinator.SetupConnections(path)
124124

125-
err := InitInterchainAccount(path.EndpointA, TestOwnerAddress)
125+
err := RegisterInterchainAccount(path.EndpointA, TestOwnerAddress)
126126
suite.Require().NoError(err)
127127

128128
// set the channel id on host
@@ -187,7 +187,7 @@ func (suite *KeeperTestSuite) TestOnChanOpenConfirm() {
187187
path = NewICAPath(suite.chainA, suite.chainB)
188188
suite.coordinator.SetupConnections(path)
189189

190-
err := InitInterchainAccount(path.EndpointA, TestOwnerAddress)
190+
err := RegisterInterchainAccount(path.EndpointA, TestOwnerAddress)
191191
suite.Require().NoError(err)
192192

193193
err = path.EndpointB.ChanOpenTry()

modules/apps/27-interchain-accounts/host/keeper/keeper_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func NewICAPath(chainA, chainB *ibctesting.TestChain) *ibctesting.Path {
6666

6767
// SetupICAPath invokes the InterchainAccounts entrypoint and subsequent channel handshake handlers
6868
func SetupICAPath(path *ibctesting.Path, owner string) error {
69-
if err := InitInterchainAccount(path.EndpointA, owner); err != nil {
69+
if err := RegisterInterchainAccount(path.EndpointA, owner); err != nil {
7070
return err
7171
}
7272

@@ -85,16 +85,16 @@ func SetupICAPath(path *ibctesting.Path, owner string) error {
8585
return nil
8686
}
8787

88-
// InitInterchainAccount is a helper function for starting the channel handshake
89-
func InitInterchainAccount(endpoint *ibctesting.Endpoint, owner string) error {
88+
// RegisterInterchainAccount is a helper function for starting the channel handshake
89+
func RegisterInterchainAccount(endpoint *ibctesting.Endpoint, owner string) error {
9090
portID, err := icatypes.NewControllerPortID(owner)
9191
if err != nil {
9292
return err
9393
}
9494

9595
channelSequence := endpoint.Chain.App.GetIBCKeeper().ChannelKeeper.GetNextChannelSequence(endpoint.Chain.GetContext())
9696

97-
if err := endpoint.Chain.GetSimApp().ICAControllerKeeper.InitInterchainAccount(endpoint.Chain.GetContext(), endpoint.ConnectionID, owner); err != nil {
97+
if err := endpoint.Chain.GetSimApp().ICAControllerKeeper.RegisterInterchainAccount(endpoint.Chain.GetContext(), endpoint.ConnectionID, owner); err != nil {
9898
return err
9999
}
100100

0 commit comments

Comments
 (0)