Skip to content

Commit 2163534

Browse files
authored
Merge pull request #22 from sei-protocol/bweng-huckleberry
Huckleberry patch for v3.0.0
2 parents d632b4c + 943cb13 commit 2163534

File tree

11 files changed

+159
-189
lines changed

11 files changed

+159
-189
lines changed

.github/workflows/check-docs.yml

-26
This file was deleted.

.github/workflows/link-check-config.json

-10
This file was deleted.

.github/workflows/link-check.yml

-10
This file was deleted.

.github/workflows/release.yml

-28
This file was deleted.

.github/workflows/test.yml

+1-66
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,8 @@ jobs:
1515
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
1616
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"
1717

18-
install-tparse:
19-
runs-on: ubuntu-latest
20-
steps:
21-
- uses: actions/[email protected]
22-
with:
23-
go-version: 1.17
24-
- name: Display go version
25-
run: go version
26-
- name: install tparse
27-
run: |
28-
export GO111MODULE="on" && go get github.com/mfridman/[email protected]
29-
- uses: actions/[email protected]
30-
with:
31-
path: ~/go/bin
32-
key: ${{ runner.os }}-go-tparse-binary
33-
3418
build:
3519
runs-on: ubuntu-latest
36-
strategy:
37-
matrix:
38-
go-arch: ["amd64", "arm", "arm64"]
3920
steps:
4021
- uses: actions/[email protected]
4122
- uses: actions/[email protected]
@@ -49,7 +30,7 @@ jobs:
4930
go.mod
5031
go.sum
5132
- name: Build
52-
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make build
33+
run: LEDGER_ENABLED=false make build
5334

5435
split-test-files:
5536
runs-on: ubuntu-latest
@@ -108,49 +89,3 @@ jobs:
10889
name: "${{ github.sha }}-${{ matrix.part }}-coverage"
10990
path: ./${{ matrix.part }}profile.out
11091

111-
upload-coverage-report:
112-
runs-on: ubuntu-latest
113-
needs: tests
114-
steps:
115-
- uses: actions/[email protected]
116-
- uses: technote-space/[email protected]
117-
with:
118-
PATTERNS: |
119-
**/**.go
120-
go.mod
121-
go.sum
122-
- uses: actions/download-artifact@v2
123-
with:
124-
name: "${{ github.sha }}-00-coverage"
125-
if: env.GIT_DIFF
126-
- uses: actions/download-artifact@v2
127-
with:
128-
name: "${{ github.sha }}-01-coverage"
129-
if: env.GIT_DIFF
130-
- uses: actions/download-artifact@v2
131-
with:
132-
name: "${{ github.sha }}-02-coverage"
133-
if: env.GIT_DIFF
134-
- uses: actions/download-artifact@v2
135-
with:
136-
name: "${{ github.sha }}-03-coverage"
137-
if: env.GIT_DIFF
138-
- run: |
139-
cat ./*profile.out | grep -v "mode: atomic" >> coverage.txt
140-
if: env.GIT_DIFF
141-
- name: filter out DONTCOVER
142-
run: |
143-
excludelist="$(find ./ -type f -name '*.go' | xargs grep -l 'DONTCOVER')"
144-
excludelist+=" $(find ./ -type f -name '*.pb.go')"
145-
excludelist+=" $(find ./ -type f -name '*.pb.gw.go')"
146-
excludelist+=" $(find ./ -type f -path './tests/mocks/*.go')"
147-
for filename in ${excludelist}; do
148-
filename=$(echo $filename | sed 's/^./github.com\/cosmos\/cosmos-sdk/g')
149-
echo "Excluding ${filename} from coverage report..."
150-
sed -i.bak "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.txt
151-
done
152-
if: env.GIT_DIFF
153-
- uses: codecov/[email protected]
154-
with:
155-
file: ./coverage.txt
156-
if: env.GIT_DIFF

.goreleaser.yml

-35
This file was deleted.

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@ Ref: https://keepachangelog.com/en/1.0.0/
3434

3535
# Changelog
3636

37+
## [v0.0.1] 2023-05-27
38+
- Huckleberry patch
39+
3740
## [v3.0.0](https://github.com/cosmos/ibc-go/releases/tag/v3.0.0) - 2022-03-15
41+
This was forked from `ibc-go@46e020640e66f9043c14c53a4d215a5b457d6703` in order to apply the huckleberry patch. We can revert back to the OSS ibc-go once we can upgrade to v4+.
42+
43+
Official patch: https://github.com/cosmos/ibc-go/pull/3346
44+
# https://github.com/cosmos/ibc-go/tree/v3.0.0
45+
3846

3947
### Dependencies
4048

go.sum

+4
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIv
466466
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
467467
github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE=
468468
github.com/hashicorp/consul/api v1.11.0/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M=
469+
github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0=
469470
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
470471
github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
471472
github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms=
@@ -800,6 +801,7 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD
800801
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
801802
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
802803
github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig=
804+
github.com/sagikazarmark/crypt v0.4.0/go.mod h1:ALv2SRj7GxYV4HO9elxH9nS6M9gW+xDNxqmyJ6RfDFM=
803805
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
804806
github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4=
805807
github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM=
@@ -1311,6 +1313,7 @@ google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdr
13111313
google.golang.org/api v0.59.0/go.mod h1:sT2boj7M9YJxZzgeZqXogmhfmRWDtPzT31xkieUbuZU=
13121314
google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I=
13131315
google.golang.org/api v0.62.0/go.mod h1:dKmwPCydfsad4qCH08MSdgWjfHOyfpd4VtDGgRFdavw=
1316+
google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo=
13141317
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
13151318
google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
13161319
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -1423,6 +1426,7 @@ google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnD
14231426
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
14241427
google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
14251428
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
1429+
google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
14261430
google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg=
14271431
google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
14281432
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=

modules/core/04-channel/keeper/grpc_query.go

+46-8
Original file line numberDiff line numberDiff line change
@@ -401,18 +401,56 @@ func (q Keeper) UnreceivedPackets(c context.Context, req *types.QueryUnreceivedP
401401

402402
ctx := sdk.UnwrapSDKContext(c)
403403

404-
var unreceivedSequences = []uint64{}
404+
channel, found := q.GetChannel(sdk.UnwrapSDKContext(c), req.PortId, req.ChannelId)
405+
if !found {
406+
return nil, status.Error(
407+
codes.NotFound,
408+
sdkerrors.Wrapf(types.ErrChannelNotFound, "port-id: %s, channel-id %s", req.PortId, req.ChannelId).Error(),
409+
)
410+
}
405411

406-
for i, seq := range req.PacketCommitmentSequences {
407-
if seq == 0 {
408-
return nil, status.Errorf(codes.InvalidArgument, "packet sequence %d cannot be 0", i)
409-
}
412+
var unreceivedSequences []uint64
410413

411-
// if packet receipt exists on the receiving chain, then packet has already been received
412-
if _, found := q.GetPacketReceipt(ctx, req.PortId, req.ChannelId, seq); !found {
413-
unreceivedSequences = append(unreceivedSequences, seq)
414+
switch channel.Ordering {
415+
case types.UNORDERED:
416+
for i, seq := range req.PacketCommitmentSequences {
417+
// filter for invalid sequences to ensure they are not included in the response value.
418+
if seq == 0 {
419+
return nil, status.Errorf(codes.InvalidArgument, "packet sequence %d cannot be 0", i)
420+
}
421+
422+
// if the packet receipt does not exist, then it is unreceived
423+
if _, found := q.GetPacketReceipt(ctx, req.PortId, req.ChannelId, seq); !found {
424+
unreceivedSequences = append(unreceivedSequences, seq)
425+
}
414426
}
427+
case types.ORDERED:
428+
nextSequenceRecv, found := q.GetNextSequenceRecv(ctx, req.PortId, req.ChannelId)
429+
if !found {
430+
return nil, status.Error(
431+
codes.NotFound,
432+
sdkerrors.Wrapf(
433+
types.ErrSequenceReceiveNotFound,
434+
"destination port: %s, destination channel: %s", req.PortId, req.ChannelId,
435+
).Error(),
436+
)
437+
}
438+
439+
for i, seq := range req.PacketCommitmentSequences {
440+
// filter for invalid sequences to ensure they are not included in the response value.
441+
if seq == 0 {
442+
return nil, status.Errorf(codes.InvalidArgument, "packet sequence %d cannot be 0", i)
443+
}
415444

445+
// Any sequence greater than or equal to the next sequence to be received is not received.
446+
if seq >= nextSequenceRecv {
447+
unreceivedSequences = append(unreceivedSequences, seq)
448+
}
449+
}
450+
default:
451+
return nil, status.Error(
452+
codes.InvalidArgument,
453+
sdkerrors.Wrapf(types.ErrInvalidChannelOrdering, "channel order %s is not supported", channel.Ordering.String()).Error())
416454
}
417455

418456
selfHeight := clienttypes.GetSelfHeight(ctx)

0 commit comments

Comments
 (0)