From 9fddeb3932f90f3c68f4241826f006223fd77017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20M=C3=BCller?= Date: Tue, 13 Feb 2024 10:31:06 -0800 Subject: [PATCH 1/6] Update to Cadence v1.0.0-M6 --- go.mod | 20 ++++++++++---------- go.sum | 30 ++++++++++++++++-------------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/go.mod b/go.mod index 72b081f8..1c6537b8 100644 --- a/go.mod +++ b/go.mod @@ -8,11 +8,11 @@ require ( github.com/gosuri/uilive v0.0.4 github.com/invopop/jsonschema v0.7.0 github.com/lmars/go-slip10 v0.0.0-20190606092855-400ba44fee12 - github.com/onflow/cadence v1.0.0-M4 + github.com/onflow/cadence v1.0.0-M6 github.com/onflow/crypto v0.25.0 - github.com/onflow/flow-emulator v1.0.0-M1 - github.com/onflow/flow-go v0.33.2-0.20240126211806-97279f96695f - github.com/onflow/flow-go-sdk v1.0.0-M1 + github.com/onflow/flow-emulator v1.0.0-M4 + github.com/onflow/flow-go v0.33.2-0.20240213000303-9fb4c62e8291 + github.com/onflow/flow-go-sdk v1.0.0-M3 github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.29.0 github.com/spf13/afero v1.10.0 @@ -120,7 +120,7 @@ require ( github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-runewidth v0.0.14 // indirect + github.com/mattn/go-runewidth v0.0.15 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/minio/sha256-simd v1.0.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect @@ -136,11 +136,11 @@ require ( github.com/multiformats/go-varint v0.0.7 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/onflow/atree v0.6.1-0.20230711151834-86040b30171f // indirect - github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.1-0.20240125214229-b7a95136dd0d // indirect - github.com/onflow/flow-core-contracts/lib/go/templates v0.15.1-0.20240125214229-b7a95136dd0d // indirect - github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20240125205519-2e80d9b4bd01 // indirect - github.com/onflow/flow-nft/lib/go/contracts v1.1.1-0.20240125205553-d2b571fb3fad // indirect - github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231213135419-ae911cc351a2 // indirect + github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240206003101-928bf99024d7 // indirect + github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240206003101-928bf99024d7 // indirect + github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20240205224107-320aa3cf09e0 // indirect + github.com/onflow/flow-nft/lib/go/contracts v1.1.1-0.20240205233530-86ee8c352fa6 // indirect + github.com/onflow/flow/protobuf/go/flow v0.3.7 // indirect github.com/onflow/sdks v0.5.1-0.20230912225508-b35402f12bba // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect diff --git a/go.sum b/go.sum index a97c7ab5..8cdbd8e0 100644 --- a/go.sum +++ b/go.sum @@ -1746,8 +1746,9 @@ github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= +github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.14.5/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI= github.com/mattn/go-sqlite3 v1.14.14/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= @@ -1835,27 +1836,28 @@ github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6 github.com/onflow/atree v0.6.1-0.20230711151834-86040b30171f h1:Z8/PgTqOgOg02MTRpTBYO2k16FE6z4wEOtaC2WBR9Xo= github.com/onflow/atree v0.6.1-0.20230711151834-86040b30171f/go.mod h1:xvP61FoOs95K7IYdIYRnNcYQGf4nbF/uuJ0tHf4DRuM= github.com/onflow/cadence v1.0.0-M3/go.mod h1:odXGZZ/wGNA5mwT8bC9v8u8EXACHllB2ABSZK65TGL8= -github.com/onflow/cadence v1.0.0-M4 h1:/nt3j7vpYDxuI0ghIgAJrb2R01ijvJYZLAkKt+zbpTY= -github.com/onflow/cadence v1.0.0-M4/go.mod h1:odXGZZ/wGNA5mwT8bC9v8u8EXACHllB2ABSZK65TGL8= +github.com/onflow/cadence v1.0.0-M6 h1:3Y5xFrmOGMCAaHKNjEwCbnDFlkwZHDzeOtrcX9beWMA= +github.com/onflow/cadence v1.0.0-M6/go.mod h1:a4mccDU90hmuxCLUFzs9J/ANG/rYbFa36h4Z0bBAqNU= github.com/onflow/crypto v0.25.0 h1:BeWbLsh3ZD13Ej+Uky6kg1PL1ZIVBDVX+2MVBNwqddg= github.com/onflow/crypto v0.25.0/go.mod h1:C8FbaX0x8y+FxWjbkHy0Q4EASCDR9bSPWZqlpCLYyVI= github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.1-0.20240125214229-b7a95136dd0d h1:Afcfk/9jAQZ1v5PLGdP68FG/0yPPM60fn9Eq8ChBGS0= github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.1-0.20240125214229-b7a95136dd0d/go.mod h1:Ts/HN+N0RaYJ6oPCqR1JPaMVFiVaMdKTSUH4OdSjjs0= github.com/onflow/flow-core-contracts/lib/go/templates v0.15.1-0.20240125214229-b7a95136dd0d h1:IQJpP3VLLjT4R8ItBpr+Mmp0IOnC/8iBcM0/67JNB9c= github.com/onflow/flow-core-contracts/lib/go/templates v0.15.1-0.20240125214229-b7a95136dd0d/go.mod h1:MZ2j5YVTQiSE0B99zuaYhxvGG5GcvimWpQK1Fw/1QBg= -github.com/onflow/flow-emulator v1.0.0-M1 h1:0hBEmvm73F+5HhN5ugkOP3UyN+Ea9yGWflEmoeGzgdw= -github.com/onflow/flow-emulator v1.0.0-M1/go.mod h1:JFJCeQVyhCQVD2Tq4QhctIXK6j5U6aU15yoEwMJt5AQ= -github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20240125205519-2e80d9b4bd01 h1:8iKk5RuFvhe7NQyAO3c+xiVvv38RB/yopHdWxp4AbL8= -github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20240125205519-2e80d9b4bd01/go.mod h1:PwsL8fC81cjnUnTfmyL/HOIyHnyaw/JA474Wfj2tl6A= -github.com/onflow/flow-go v0.33.2-0.20240126211806-97279f96695f h1:F1y95CpteZn0i4v0FDGjKiqI13Xlir3hX4x0C1xMRoc= -github.com/onflow/flow-go v0.33.2-0.20240126211806-97279f96695f/go.mod h1:9q+c+fuTpc/emueM/2bI/Ih2jw3V+9WS3Eu+pWBuLW0= -github.com/onflow/flow-go-sdk v1.0.0-M1 h1:mke/ebYwNRRWPZqcwCV56Alx0A8psew43ZbSEUQ4TL8= +github.com/onflow/flow-emulator v1.0.0-M4 h1:w3CygAycA9WEUaICGbbavUW0kh9yNfkmSz0WEnS1tcI= +github.com/onflow/flow-emulator v1.0.0-M4/go.mod h1:G+0/cyxeqsZ3SnJPrl0dnbtBooz05v077pWqHBgpHBU= +github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20240205224107-320aa3cf09e0 h1:u6/YcUvO8jU0f3Evb/6agzXqeOo+VbL2a3mmj/5ifRs= +github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20240205224107-320aa3cf09e0/go.mod h1:PwsL8fC81cjnUnTfmyL/HOIyHnyaw/JA474Wfj2tl6A= +github.com/onflow/flow-go v0.33.2-0.20240213000303-9fb4c62e8291 h1:bQP9/SbnhTL8A9778rCnyyxkpZ43WRteLdfsUG9fYg0= +github.com/onflow/flow-go v0.33.2-0.20240213000303-9fb4c62e8291/go.mod h1:u66wuOAEEo/bc/d4P2Z2QFRXV8xMh5/MVkpuI9MLrDs= github.com/onflow/flow-go-sdk v1.0.0-M1/go.mod h1:TDW0MNuCs4SvqYRUzkbRnRmHQL1h4X8wURsCw9P9beo= -github.com/onflow/flow-nft/lib/go/contracts v1.1.1-0.20240125205553-d2b571fb3fad h1:I6LD9BOsilGbiqhGjP86FIIXJe0YdUz75d/oWdHFzDI= -github.com/onflow/flow-nft/lib/go/contracts v1.1.1-0.20240125205553-d2b571fb3fad/go.mod h1:2gpbza+uzs1k7x31hkpBPlggIRkI53Suo0n2AyA2HcE= +github.com/onflow/flow-go-sdk v1.0.0-M3 h1:8ZWn+dmJGoFJ1jTHxS02rVftGwU+2dJkhXpBzvSBWKs= +github.com/onflow/flow-go-sdk v1.0.0-M3/go.mod h1:MZi3kMUCGDek4Yjlg/g57f2QO3M0tQeDn9GVMFJYReQ= +github.com/onflow/flow-nft/lib/go/contracts v1.1.1-0.20240205233530-86ee8c352fa6 h1:/2vvjKkWG/3cKP3IpgiGNqXi0yskn4GmNTjmeCwMoz8= +github.com/onflow/flow-nft/lib/go/contracts v1.1.1-0.20240205233530-86ee8c352fa6/go.mod h1:2gpbza+uzs1k7x31hkpBPlggIRkI53Suo0n2AyA2HcE= github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231121210617-52ee94b830c2/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= -github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231213135419-ae911cc351a2 h1:+rT+UsfTR39JZO8ht2+4fkaWfHw74SCj1fyz1lWuX8A= -github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231213135419-ae911cc351a2/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= +github.com/onflow/flow/protobuf/go/flow v0.3.7 h1:+6sBdlE/u4ZMTVB9U1lA6Xn2Bd48lOOX96Bv9dNubsk= +github.com/onflow/flow/protobuf/go/flow v0.3.7/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/onflow/sdks v0.5.1-0.20230912225508-b35402f12bba h1:rIehuhO6bj4FkwE4VzwEjX7MoAlOhUJENBJLqDqVxAo= github.com/onflow/sdks v0.5.1-0.20230912225508-b35402f12bba/go.mod h1:F0dj0EyHC55kknLkeD10js4mo14yTdMotnWMslPirrU= github.com/onflow/wal v0.0.0-20230529184820-bc9f8244608d h1:gAEqYPn3DS83rHIKEpsajnppVD1+zwuYPFyeDVFaQvg= From 8d9c6b7855975eaad80024f9d90d93a899ab767c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20M=C3=BCller?= Date: Tue, 13 Feb 2024 10:43:08 -0800 Subject: [PATCH 2/6] test feature branches, cancel in progress --- .github/workflows/ci.yml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c75d408..d9971317 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,21 @@ name: CI -# Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the master branch on: push: - branches: [main] + branches: + - master + - 'feature/**' pull_request: - branches: [main] + branches: + - master + - 'feature/**' + +env: + GO_VERSION: '1.20' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true jobs: test: @@ -17,7 +26,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-go@v4 with: - go-version: "1.20" + go-version: ${{ env.GO_VERSION }} - name: Run tests run: | make install-tools @@ -39,7 +48,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v4 with: - go-version: "1.20" + go-version: ${{ env.GO_VERSION }} - name: generate run: make generate - uses: golangci/golangci-lint-action@v3.7.0 From ce52d50a2158ec9d74ccdd33969fe5101560ab1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20M=C3=BCller?= Date: Tue, 13 Feb 2024 10:43:17 -0800 Subject: [PATCH 3/6] show progress --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index d02e1d0a..0c9c9e39 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ MIXPANEL_PROJECT_TOKEN := 3fae49de272be1ceb8cf34119f747073 .PHONY: test test: - GO111MODULE=on go test -coverprofile=$(COVER_PROFILE) $(if $(JSON_OUTPUT),-json,) ./... + GO111MODULE=on go test -v -coverprofile=$(COVER_PROFILE) $(if $(JSON_OUTPUT),-json,) ./... .PHONY: install-tools install-tools: @@ -35,7 +35,7 @@ generate-schema: .PHONY: check-schema check-schema: - go run ./cmd/flow-schema/flow-schema.go --verify=true ./schema.json + go run ./cmd/flow-schema/flow-schema.go --verify=true ./schema.json .PHONY: check-tidy check-tidy: @@ -58,4 +58,4 @@ ifeq ($(COVER), true) gocov-html cover.json > index.html # coverage.zip will automatically be picked up by teamcity gozip -c coverage.zip index.html -endif \ No newline at end of file +endif From 2c5d415ae9d72dbc75ef1ff006c08e3da61c4097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20M=C3=BCller?= Date: Tue, 13 Feb 2024 10:43:27 -0800 Subject: [PATCH 4/6] remove replace statements --- go.mod | 4 ---- go.sum | 8 ++++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 1c6537b8..956e633a 100644 --- a/go.mod +++ b/go.mod @@ -216,7 +216,3 @@ require ( modernc.org/sqlite v1.28.0 // indirect rsc.io/tmplfunc v0.0.3 // indirect ) - -replace github.com/onflow/flow-core-contracts/lib/go/contracts => github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.1-0.20240125214229-b7a95136dd0d - -replace github.com/onflow/flow-core-contracts/lib/go/templates => github.com/onflow/flow-core-contracts/lib/go/templates v0.15.1-0.20240125214229-b7a95136dd0d diff --git a/go.sum b/go.sum index 8cdbd8e0..e3c09e72 100644 --- a/go.sum +++ b/go.sum @@ -1840,10 +1840,10 @@ github.com/onflow/cadence v1.0.0-M6 h1:3Y5xFrmOGMCAaHKNjEwCbnDFlkwZHDzeOtrcX9beW github.com/onflow/cadence v1.0.0-M6/go.mod h1:a4mccDU90hmuxCLUFzs9J/ANG/rYbFa36h4Z0bBAqNU= github.com/onflow/crypto v0.25.0 h1:BeWbLsh3ZD13Ej+Uky6kg1PL1ZIVBDVX+2MVBNwqddg= github.com/onflow/crypto v0.25.0/go.mod h1:C8FbaX0x8y+FxWjbkHy0Q4EASCDR9bSPWZqlpCLYyVI= -github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.1-0.20240125214229-b7a95136dd0d h1:Afcfk/9jAQZ1v5PLGdP68FG/0yPPM60fn9Eq8ChBGS0= -github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.1-0.20240125214229-b7a95136dd0d/go.mod h1:Ts/HN+N0RaYJ6oPCqR1JPaMVFiVaMdKTSUH4OdSjjs0= -github.com/onflow/flow-core-contracts/lib/go/templates v0.15.1-0.20240125214229-b7a95136dd0d h1:IQJpP3VLLjT4R8ItBpr+Mmp0IOnC/8iBcM0/67JNB9c= -github.com/onflow/flow-core-contracts/lib/go/templates v0.15.1-0.20240125214229-b7a95136dd0d/go.mod h1:MZ2j5YVTQiSE0B99zuaYhxvGG5GcvimWpQK1Fw/1QBg= +github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240206003101-928bf99024d7 h1:OI/4F2NK/X/4x3dTUFFDGtuOsSa9pX+jjBeSEcBrY/M= +github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240206003101-928bf99024d7/go.mod h1:GK+Ik1K3L3v8xmHmRQv5yxJz81lYhdYSNm0PQ63Xrws= +github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240206003101-928bf99024d7 h1:WAx8ftVz1BeXiKvQ9gLKEf1J3NBWK26Pbczd0iH4C6I= +github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240206003101-928bf99024d7/go.mod h1:MZ2j5YVTQiSE0B99zuaYhxvGG5GcvimWpQK1Fw/1QBg= github.com/onflow/flow-emulator v1.0.0-M4 h1:w3CygAycA9WEUaICGbbavUW0kh9yNfkmSz0WEnS1tcI= github.com/onflow/flow-emulator v1.0.0-M4/go.mod h1:G+0/cyxeqsZ3SnJPrl0dnbtBooz05v077pWqHBgpHBU= github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20240205224107-320aa3cf09e0 h1:u6/YcUvO8jU0f3Evb/6agzXqeOo+VbL2a3mmj/5ifRs= From 1e66bc584d7527bb0271e6f50a5fcde8dc9feb32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20M=C3=BCller?= Date: Tue, 13 Feb 2024 10:43:42 -0800 Subject: [PATCH 5/6] adjust test --- flowkit_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flowkit_test.go b/flowkit_test.go index 011652a0..06e4e819 100644 --- a/flowkit_test.go +++ b/flowkit_test.go @@ -706,8 +706,8 @@ func TestBlocksGet_Integration(t *testing.T) { block, err := flowkit.GetBlock(ctx, BlockQuery{Latest: true}) assert.NoError(t, err) - assert.Equal(t, block.Height, uint64(0)) - assert.Equal(t, block.ID.String(), "03d40910037d575d52831647b39814f445bc8cc7ba8653286c0eb1473778c34f") + assert.Equal(t, uint64(0), block.Height) + assert.Equal(t, "a20c602fbee6fe4491e116403e3258e7b7924609696ab2edb9a93eed2c29e445", block.ID.String()) }) } From 426cf466f5dd334e76475d274a7a69eea25d7116 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20M=C3=BCller?= Date: Tue, 13 Feb 2024 10:44:24 -0800 Subject: [PATCH 6/6] fix order of arguments in Equal calls, use Len --- config/account_test.go | 4 ++-- config/config_test.go | 8 ++++---- config/deployment_test.go | 4 ++-- config/loader_test.go | 2 +- config/network_test.go | 4 ++-- flowkit_test.go | 28 ++++++++++++++-------------- state_test.go | 2 +- tests/testnet_test.go | 6 +++--- 8 files changed, 29 insertions(+), 29 deletions(-) diff --git a/config/account_test.go b/config/account_test.go index 9ee8756d..efba19e5 100644 --- a/config/account_test.go +++ b/config/account_test.go @@ -109,11 +109,11 @@ func TestAccounts_Remove(t *testing.T) { accounts := Accounts{acc1, acc2, acc3} accounts.Remove("account2") - assert.Equal(t, len(accounts), 2) + assert.Len(t, accounts, 2) _, err := accounts.ByName("account2") assert.Error(t, err) accounts.Remove("account4") - assert.Equal(t, len(accounts), 2) + assert.Len(t, accounts, 2) } diff --git a/config/config_test.go b/config/config_test.go index 97ca1391..5bf9878e 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -186,8 +186,8 @@ func Test_GetNetworkByNameComplex(t *testing.T) { network, err = conf.Networks.ByName("testnet") assert.NoError(t, err) - assert.Equal(t, network.Host, "access.devnet.nodes.onflow.org:9000") - assert.Equal(t, network.Key, "5000676131ad3e22d853a3f75a5b5d0db4236d08dd6612e2baad771014b5266a242bccecc3522ff7207ac357dbe4f225c709d9b273ac484fed5d13976a39bdcd") + assert.Equal(t, "access.devnet.nodes.onflow.org:9000", network.Host) + assert.Equal(t, "5000676131ad3e22d853a3f75a5b5d0db4236d08dd6612e2baad771014b5266a242bccecc3522ff7207ac357dbe4f225c709d9b273ac484fed5d13976a39bdcd", network.Key) } func TestConfig_Validate(t *testing.T) { @@ -323,8 +323,8 @@ func TestConfig_Validate(t *testing.T) { func Test_DefaultConfig(t *testing.T) { cfg := config.Default() assert.Len(t, cfg.Emulators, 1) - assert.Equal(t, cfg.Emulators[0].Name, "default") - assert.Equal(t, cfg.Emulators[0].ServiceAccount, "emulator-account") + assert.Equal(t, "default", cfg.Emulators[0].Name) + assert.Equal(t, "emulator-account", cfg.Emulators[0].ServiceAccount) assert.Len(t, cfg.Networks, 4) assert.Equal(t, "emulator", cfg.Networks[0].Name) assert.Equal(t, "testing", cfg.Networks[1].Name) diff --git a/config/deployment_test.go b/config/deployment_test.go index 952f6edc..cac50866 100644 --- a/config/deployment_test.go +++ b/config/deployment_test.go @@ -120,8 +120,8 @@ func Test_Deployment(t *testing.T) { network := deployments.ByNetwork("net") assert.Len(t, network, 2) - assert.Equal(t, network[0].Account, "acc") - assert.Equal(t, network[1].Account, "acc2") + assert.Equal(t, "acc", network[0].Account) + assert.Equal(t, "acc2", network[1].Account) }) t.Run("Remove non-existing deployment", func(t *testing.T) { diff --git a/config/loader_test.go b/config/loader_test.go index 16250db6..3909f76f 100644 --- a/config/loader_test.go +++ b/config/loader_test.go @@ -385,7 +385,7 @@ func Test_JSONEnv(t *testing.T) { conf, loadErr := composer.Load([]string{"test2-flow.json"}) assert.NoError(t, loadErr) - assert.Equal(t, 2, len(conf.Accounts)) + assert.Len(t, conf.Accounts, 2) acc1, _ := conf.Accounts.ByName("advanced") assert.Equal(t, fmt.Sprintf("0x%s", key2), acc1.Key.PrivateKey.String()) diff --git a/config/network_test.go b/config/network_test.go index 7cb63bc5..6fad2bac 100644 --- a/config/network_test.go +++ b/config/network_test.go @@ -53,7 +53,7 @@ func TestNetworks_AddOrUpdate(t *testing.T) { // Test adding a new network. networks.AddOrUpdate(Network{Name: "flow-testnet", Host: "localhost:3570", Key: "flow-testnet-key"}) - assert.Equal(t, 2, len(networks)) + assert.Len(t, networks, 2) // Test updating an existing network. networks.AddOrUpdate(Network{Name: "flow-local", Host: "localhost:3580", Key: "flow-local-key-updated"}) @@ -70,7 +70,7 @@ func TestNetworks_Remove(t *testing.T) { // Test removing an existing network. err := networks.Remove("flow-local") assert.NoError(t, err) - assert.Equal(t, 1, len(networks)) + assert.Len(t, networks, 1) // Test removing a non-existent network. err = networks.Remove("flow-mainnet") diff --git a/flowkit_test.go b/flowkit_test.go index 06e4e819..fba8a8c0 100644 --- a/flowkit_test.go +++ b/flowkit_test.go @@ -144,9 +144,9 @@ func TestAccounts(t *testing.T) { ctx, serviceAcc, []accounts.PublicKey{{ - Public: pubKey, - Weight: flow.AccountKeyWeightThreshold, - SigAlgo: crypto.ECDSA_P256, + Public: pubKey, + Weight: flow.AccountKeyWeightThreshold, + SigAlgo: crypto.ECDSA_P256, HashAlgo: crypto.SHA3_256, }}, ) @@ -1526,9 +1526,9 @@ func setupAccount(state *State, flowkit Flowkit, account *accounts.Account) { ctx, srv, []accounts.PublicKey{{ - Public: (*pk).PublicKey(), - Weight: flow.AccountKeyWeightThreshold, - SigAlgo: key.SigAlgo(), + Public: (*pk).PublicKey(), + Weight: flow.AccountKeyWeightThreshold, + SigAlgo: key.SigAlgo(), HashAlgo: key.HashAlgo(), }}, ) @@ -1743,9 +1743,9 @@ func TestTransactions_Integration(t *testing.T) { tx, err := flowkit.BuildTransaction( ctx, transactions.AddressesRoles{ - Proposer: signer, + Proposer: signer, Authorizers: []flow.Address{signer}, - Payer: signer, + Payer: signer, }, srvAcc.Key.Index(), Script{ @@ -1777,9 +1777,9 @@ func TestTransactions_Integration(t *testing.T) { tx, err := flowkit.BuildTransaction( ctx, transactions.AddressesRoles{ - Proposer: a.Address, + Proposer: a.Address, Authorizers: nil, - Payer: a.Address, + Payer: a.Address, }, 0, Script{ @@ -1816,9 +1816,9 @@ func TestTransactions_Integration(t *testing.T) { tx, err := flowkit.BuildTransaction( ctx, transactions.AddressesRoles{ - Proposer: a.Address, + Proposer: a.Address, Authorizers: []flow.Address{a.Address}, - Payer: a.Address, + Payer: a.Address, }, 0, Script{ @@ -1855,9 +1855,9 @@ func TestTransactions_Integration(t *testing.T) { tx, err := flowkit.BuildTransaction( ctx, transactions.AddressesRoles{ - Proposer: a.Address, + Proposer: a.Address, Authorizers: []flow.Address{a.Address}, - Payer: a.Address, + Payer: a.Address, }, 0, Script{ diff --git a/state_test.go b/state_test.go index a66851fd..12202e5e 100644 --- a/state_test.go +++ b/state_test.go @@ -398,7 +398,7 @@ func Test_GetContractsByNameComplex(t *testing.T) { contracts, err := p.DeploymentContractsByNetwork(config.EmulatorNetwork) require.NoError(t, err) - require.Equal(t, 7, len(contracts)) + require.Len(t, contracts, 7) //sort contracts by name so tests are deterministic sort.Slice(contracts, func(i, j int) bool { diff --git a/tests/testnet_test.go b/tests/testnet_test.go index 6bab1af5..23adbfce 100644 --- a/tests/testnet_test.go +++ b/tests/testnet_test.go @@ -147,13 +147,13 @@ func Test_Foo(t *testing.T) { require.NoError(t, err) out, _ := rw.ReadFile("test") - assert.Equal(t, out, []byte("foo")) + assert.Equal(t, []byte("foo"), out) err = rw.WriteFile("test", []byte("bar"), 0644) require.NoError(t, err) out, _ = st.ReadFile("test") - assert.Equal(t, out, []byte("bar")) + assert.Equal(t, []byte("bar"), out) } func Test_Testnet_ProjectDeploy(t *testing.T) { @@ -216,4 +216,4 @@ func Test_Testnet_ProjectDeploy(t *testing.T) { assert.Equal(t, ContractB.Name, contracts[1].Name) assert.Equal(t, ContractB.Source, updated) assert.Equal(t, ContractC.Name, contracts[2].Name) -} \ No newline at end of file +}