Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2E: Failed token transfer receiver address is not valid #1996

Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
bb44e68
add successful transfer test
colin-axner Aug 10, 2022
c37c716
add back start relayer
colin-axner Aug 10, 2022
4a56830
use one wallet, fix various bugs
colin-axner Aug 10, 2022
f7de720
fix various bugs, except last issue
colin-axner Aug 10, 2022
dad0435
chore: using single registry for all images
chatton Aug 11, 2022
acda77b
fix test
colin-axner Aug 11, 2022
0abc9de
Merge branch 'main' into cian/use-single-registry-for-simd
chatton Aug 11, 2022
f288a87
chore: updating readme to use main tag
chatton Aug 11, 2022
1eced8d
chore: refactor e2e.yml to use reusable workflow
chatton Aug 11, 2022
0f54059
chore: adding import for clienttypes
chatton Aug 11, 2022
732a91d
Merge branch 'cian/fix-e2e-build' into cian/issue#1980-update-our-e2e…
chatton Aug 11, 2022
eab0ce5
chore: correcting workflow syntax
chatton Aug 11, 2022
afdcecb
chore: adding test-entry-point param
chatton Aug 11, 2022
db5ef23
chore: correcting reference format
chatton Aug 11, 2022
b1ff186
merge main
chatton Aug 11, 2022
d135760
merge main
chatton Aug 11, 2022
6f565b1
chore: moving workflow to subdirectory
chatton Aug 11, 2022
b8a5a77
Merge branch 'main' into cian/issue#1980-update-our-e2e-ci-to-use-reu…
chatton Aug 11, 2022
cdb5ed6
Merge branch 'main' of github.com:cosmos/ibc-go into colin/1963-e2e-t…
colin-axner Aug 11, 2022
62cb63d
moved out of separate folder
chatton Aug 11, 2022
a0c53c7
Merge branch 'cian/issue#1980-update-our-e2e-ci-to-use-reusable-workf…
chatton Aug 11, 2022
44a47ee
add packet relayed assertion
colin-axner Aug 11, 2022
5f6f0c5
chore: correctly pass rly tag
chatton Aug 11, 2022
c3ba717
chore: merge main
chatton Aug 11, 2022
fe15b89
chore: skipping individual steps instead of full job
chatton Aug 11, 2022
e9d0ff3
chore: skip checkout
chatton Aug 11, 2022
2090a2d
chore: renamed to add -workflow-call.yml
chatton Aug 11, 2022
16660bb
add transfer test suite as option to e2e manual
colin-axner Aug 11, 2022
bf392b3
chore: E2E TestMsgTransfer_InvalidAddress_UnescrowsTokens
chatton Aug 12, 2022
cb58310
chore: renaming test
chatton Aug 12, 2022
4ce723a
Merge branch 'main' into cian/issue#1964-e2e-failed-token-transfer---…
chatton Aug 12, 2022
5b642ad
Merge branch 'main' into cian/issue#1964-e2e-failed-token-transfer---…
chatton Aug 12, 2022
5ed063c
Merge branch 'cian/issue#1980-update-our-e2e-ci-to-use-reusable-workf…
chatton Aug 12, 2022
2b98885
chore: merge main
chatton Aug 15, 2022
b489d00
merge conflicts
chatton Aug 15, 2022
8bc35bf
Merge branch 'main' into cian/issue#1964-e2e-failed-token-transfer---…
chatton Aug 15, 2022
cce5533
Merge branch 'main' into cian/issue#1964-e2e-failed-token-transfer---…
chatton Aug 16, 2022
04e7335
Merge branch 'main' into cian/issue#1964-e2e-failed-token-transfer---…
chatton Aug 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/e2e-manual.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
default: main
options:
- main
- v4.0.0-rc3
- v4.0.0
- v3.0.0
- v2.2.0
- v2.1.0
Expand All @@ -41,7 +41,7 @@ on:
type: choice
options:
- main
- v4.0.0-rc3
- v4.0.0
- v3.0.0
- v2.2.0
- v2.1.0
Expand Down
2 changes: 1 addition & 1 deletion e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export CHAIN_A_SIMD_TAG="main"
# We can also specify different values for the chains if needed.
# they will default to the same as chain a.
# export CHAIN_B_SIMD_IMAGE="ghcr.io/cosmos/ibc-go-simd"
# export CHAIN_B_SIMD_TAG="pr-1650"
# export CHAIN_B_SIMD_TAG="main"

export RLY_TAG="v2.0.0-rc2"
make e2e-test suite=FeeMiddlewareTestSuite test=TestMultiMsg_MsgPayPacketFeeSingleSender
Expand Down
6 changes: 3 additions & 3 deletions e2e/scripts/run-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ set -euo pipefail

SUITE="${1}"
TEST="${2}"
export SIMD_TAG="${CHAIN_A_SIMD_TAG:-latest}"
export SIMD_IMAGE="${CHAIN_A_SIMD_IMAGE:-ibc-go-simd}"
export CHAIN_A_SIMD_TAG="${CHAIN_A_SIMD_TAG:-latest}"
export CHAIN_A_SIMD_IMAGE="${CHAIN_A_SIMD_IMAGE:-ibc-go-simd}"
Comment on lines +7 to +8
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed changing these env vars in a previous PR.


# In CI, the docker images will be built separately.
# context for building the image is one directory up.
if [ "${CI:-}" != "true" ]
then
(cd ..; docker build . -t "${SIMD_IMAGE}:${SIMD_TAG}")
(cd ..; docker build . -t "${CHAIN_A_SIMD_IMAGE}:${CHAIN_A_SIMD_TAG}")
fi

go test -v ./ --run ${SUITE} -testify.m ^${TEST}$
47 changes: 47 additions & 0 deletions e2e/transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,53 @@ func (s *TransferTestSuite) TestMsgTransfer_Succeeds_Nonincentivized() {
})
}

// TestMsgTransfer_Fails_InvalidAddress attempts to send an IBC transfer to an invalid address and ensures
// that the tokens on the sending chain are unescrowed.
func (s *TransferTestSuite) TestMsgTransfer_Fails_InvalidAddress() {
t := s.T()
ctx := context.TODO()

relayer, channelA := s.SetupChainsRelayerAndChannel(ctx, transferChannelOptions())
chainA, chainB := s.GetChains()

chainADenom := chainA.Config().Denom

chainAWallet := s.CreateUserOnChainA(ctx, testvalues.StartingTokenAmount)
chainAAddress := chainAWallet.Bech32Address(chainA.Config().Bech32Prefix)

s.Require().NoError(test.WaitForBlocks(ctx, 1, chainA, chainB), "failed to wait for blocks")

t.Run("native IBC token transfer from chainA to invalid address", func(t *testing.T) {
transferTxResp, err := s.Transfer(ctx, chainA, chainAWallet, channelA.PortID, channelA.ChannelID, testvalues.DefaultTransferAmount(chainADenom), chainAAddress, testvalues.InvalidAddress, s.GetTimeoutHeight(ctx, chainB), 0)
s.Require().NoError(err)
s.AssertValidTxResponse(transferTxResp)
})

t.Run("tokens are escrowed", func(t *testing.T) {
actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet)
s.Require().NoError(err)

expected := testvalues.StartingTokenAmount - testvalues.IBCTransferAmount
s.Require().Equal(expected, actualBalance)
})

t.Run("start relayer", func(t *testing.T) {
s.StartRelayer(relayer)
})

t.Run("packets are relayed", func(t *testing.T) {
s.AssertPacketRelayed(ctx, chainA, channelA.PortID, channelA.ChannelID, 1)
})

t.Run("token transfer amount unescrowed", func(t *testing.T) {
actualBalance, err := s.GetChainANativeBalance(ctx, chainAWallet)
s.Require().NoError(err)

expected := testvalues.StartingTokenAmount
s.Require().Equal(expected, actualBalance)
})
}

// transferChannelOptions configures both of the chains to have non-incentivized transfer channels.
func transferChannelOptions() func(options *ibc.CreateChannelOptions) {
return func(opts *ibc.CreateChannelOptions) {
Expand Down