From 9d37df1692cd90cfdac9ad151c17c3bbfa760775 Mon Sep 17 00:00:00 2001 From: Minh Huy Tran Date: Tue, 23 Apr 2024 13:36:28 +0200 Subject: [PATCH] feat: update polkadot node container version Signed-off-by: Minh Huy Tran --- .github/workflows/go.yml | 8 ++++---- README.md | 2 +- channel/pallet/adjudicator_test.go | 2 +- channel/pallet/event_sub.go | 5 +++++ client/appchannel_test.go | 16 ++++++++++++++-- go.mod | 2 -- 6 files changed, 25 insertions(+), 10 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index c9f73ed..a97d380 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -10,13 +10,13 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: 1.17 + go-version: 1.21 - name: Checkout uses: actions/checkout@v3 - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: - version: v1.45 + version: v1.56.2 test: name: Test @@ -25,7 +25,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v2 with: - go-version: 1.17 + go-version: 1.21 - name: Checkout uses: actions/checkout@v2 @@ -40,7 +40,7 @@ jobs: ${{ runner.os }}-go- - name: Start Substrate node - run: docker run --rm -d --name substrate -p 9944:9944 ghcr.io/perun-network/polkadot-test-node:0.2.0 + run: docker run --rm -d --name substrate -p 9944:9944 ghcr.io/perun-network/polkadot-test-node:0.4.0 - name: Wait for Substrate node # Wait for port 9944 to listen. diff --git a/README.md b/README.md index 22e0195..0e01e9b 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ cd perun-polkadot-backend 2. Start a local Substrate node with the Perun Pallet installed. See the [polkadot node] repository for more details. ```sh -docker run --rm -p 9944:9944 ghcr.io/perun-network/polkadot-test-node +docker run --rm -p 9944:9944 ghcr.io/perun-network/polkadot-test-node:0.4.0 ``` 3. Run the tests. This step needs a working [Go distribution](https://golang.org), see [go.mod](go.mod) for the required version. diff --git a/channel/pallet/adjudicator_test.go b/channel/pallet/adjudicator_test.go index 4568f05..815907f 100644 --- a/channel/pallet/adjudicator_test.go +++ b/channel/pallet/adjudicator_test.go @@ -80,7 +80,7 @@ func TestAdjudicator_Walkthrough(t *testing.T) { dSetup := chtest.NewDepositSetup(params, state) adjAlice := pallet.NewAdjudicator(s.Alice.Acc, s.Pallet, s.API, test.PastBlocks) adjBob := pallet.NewAdjudicator(s.Bob.Acc, s.Pallet, s.API, test.PastBlocks) - ctx, cancel := context.WithTimeout(context.Background(), 100*s.BlockTime) + ctx, cancel := context.WithTimeout(context.Background(), 1000*s.BlockTime) defer cancel() // Fund diff --git a/channel/pallet/event_sub.go b/channel/pallet/event_sub.go index be41a4f..aa5b3f7 100644 --- a/channel/pallet/event_sub.go +++ b/channel/pallet/event_sub.go @@ -15,6 +15,8 @@ package pallet import ( + "io" + "github.com/centrifuge/go-substrate-rpc-client/v4/types" "perun.network/go-perun/log" pkgsync "polycry.pt/poly-go/sync" @@ -60,6 +62,9 @@ func NewEventSub(source *substrate.EventSource, meta *types.Metadata, p EventPre select { case set := <-source.Events(): if err = sub.decodeEventRecords(set, meta); err != nil { + if err == io.EOF { + continue + } sub.Log().Errorf("decoding event records: %v", err) break loop } diff --git a/client/appchannel_test.go b/client/appchannel_test.go index 4f85969..90b2dde 100644 --- a/client/appchannel_test.go +++ b/client/appchannel_test.go @@ -23,12 +23,14 @@ import ( "perun.network/go-perun/channel" "perun.network/go-perun/client" clienttest "perun.network/go-perun/client/test" - test "perun.network/go-perun/wallet/test" "perun.network/go-perun/wire" pkgtest "polycry.pt/poly-go/test" + "github.com/ChainSafe/go-schnorrkel" pchannel "github.com/perun-network/perun-polkadot-backend/channel" ptest "github.com/perun-network/perun-polkadot-backend/channel/pallet/test" + dotwallet "github.com/perun-network/perun-polkadot-backend/wallet/sr25519" + "github.com/stretchr/testify/require" ) func TestAppChannel(t *testing.T) { @@ -42,7 +44,17 @@ func TestAppChannel(t *testing.T) { clienttest.NewPaula(t, setups[B]), } - appAddress := test.NewRandomAddress(rng) + byteArray := [32]byte{ + 176, 115, 108, 113, 171, 155, 245, 248, + 27, 234, 80, 36, 30, 145, 56, 217, + 213, 25, 176, 99, 145, 198, 217, 248, + 220, 159, 39, 241, 120, 209, 175, 8, + } + pk, err := schnorrkel.NewPublicKey(byteArray) + require.NoError(t, err) + + appAddress := dotwallet.NewAddressFromPK(pk) + require.NoError(t, err) app := channel.NewMockApp(appAddress) channel.RegisterApp(app) diff --git a/go.mod b/go.mod index 9f9832e..d9a9ea8 100644 --- a/go.mod +++ b/go.mod @@ -2,8 +2,6 @@ module github.com/perun-network/perun-polkadot-backend go 1.21 -toolchain go1.21.4 - require ( github.com/ChainSafe/go-schnorrkel v1.1.0 github.com/centrifuge/go-substrate-rpc-client/v4 v4.2.1