-
Notifications
You must be signed in to change notification settings - Fork 14
Conversation
42a0f18
to
d68d5c4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @seantking! The testing environment is smooth.
I left some nitpick comments below.
In regards of comments, what do you think about documenting go code as godoc suggests?
The convention is simple: to document a type, variable, constant, function, or even a package, write a regular comment directly preceding its declaration, with no intervening blank line. Godoc will then present that comment as text alongside the item it documents.......
readme.md
Outdated
# Send some assets to $IBC_ACCOUNT. | ||
icad tx bank send val2 $IBC_ACCOUNT 1000stake --chain-id test-2 --home ./data/test-2 --node tcp://localhost:26657 | ||
|
||
# Test sending assets on intetchain account via ibc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
little typo in this comment. intetchain
should be interchain
. Other than that, it is all good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
x/inter-tx/keeper/msg_server.go
Outdated
@@ -30,20 +31,29 @@ func (k msgServer) Register( | |||
// check if an account is already registered | |||
_, err = k.GetIBCAccount(ctx, msg.SourcePort, msg.SourceChannel, acc) | |||
if err == nil { | |||
return &types.MsgRegisterAccountResponse{}, fmt.Errorf("Interchain account is already registered for this account") | |||
err = fmt.Errorf("Interchain account is already registered for this account") | |||
return &types.MsgRegisterAccountResponse{}, sdkerrors.Wrap(err, err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registering an IBC Account on chain test-2
with the same source-port and source-channel returns codespace undefined and code 1. How about handling this with sdkerrors.Wrap(types.ErrIAAccountNotExist, acc.String())
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, do you know what IA stand for? interchain account?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All errors need to be registered otherwise the error message gets wiped downstream. The first error cannot begin with 1 either. Usually these errors are registered in errors.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated this thanks
rm -rf ./data | ||
-@killall icad 2>/dev/null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why switch the order? is there a chance that the process starts writing to that location again and you need to delete all over again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this line was throwing an error if there were no icad processes running. I'm silencing the error now with the -
and the 2>/dev/null
but this is the reason.
@@ -16,24 +16,40 @@ https://github.com/cosmos/relayer.git | |||
cd relayer | |||
make install | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line 10 has old repo name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
# Use relayer to link the chains | ||
make start-rly | ||
# Bootstrap two local chains & start the relayer with development data | ||
make init | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait til you see the chains linked with the clients, connections and channels created. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, although slightly differently. Good idea.
|
||
# Check if the balance has been changed. | ||
icad q bank balances $IBC_ACCOUNT --chain-id test-2 | ||
icad q bank balances $VAL_2 --chain-id test-2 | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TA DAAAAAA
Another feedback I had was to change the |
x/ibc-account/keeper/relay.go
Outdated
// TODO: Add timeout height and timestamp | ||
timeoutHeight := clienttypes.Height{ | ||
RevisionNumber: 2, | ||
RevisionHeight: ^uint64(0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@colin-axner did you say that I can set RevisionHeight
to 0
to stop timeoutHeight
from being used as a timeout? I was getting a relayer error when I did this.
I'm not sure what the best practice is here. @AdityaSripal maybe you have some thoughts also? 🙌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvm updated
d68d5c4
to
e75aa11
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Did a quick pass and will look over any files I missed later this week. Left mostly code convention suggestions
x/inter-tx/keeper/msg_server.go
Outdated
@@ -30,20 +31,29 @@ func (k msgServer) Register( | |||
// check if an account is already registered | |||
_, err = k.GetIBCAccount(ctx, msg.SourcePort, msg.SourceChannel, acc) | |||
if err == nil { | |||
return &types.MsgRegisterAccountResponse{}, fmt.Errorf("Interchain account is already registered for this account") | |||
err = fmt.Errorf("Interchain account is already registered for this account") | |||
return &types.MsgRegisterAccountResponse{}, sdkerrors.Wrap(err, err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All errors need to be registered otherwise the error message gets wiped downstream. The first error cannot begin with 1 either. Usually these errors are registered in errors.go
Good call re: Godoc. I have updated most of the functions in the |
d342e1e
to
2dd27d8
Compare
2dd27d8
to
1fdd98a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The timeout approach here looks good to me 👍
Description
Adding the send command to the
inter-tx
module. We should now have a basic flow for registering an account and sending tokens with the registered interchain account.I also updated the register command to use flags for source port and source channel as well as some general cleanup.
I have removed timeouts as user input and hardcoded a max int64 timeout period. (This should probably be lowered to something like 4 weeks).
I added a command in the Makefile to clear previous data & spin up both test chains & relayer in one command for convenience.
How to run