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

Upgrade connect dependency to allow market authorities to remove markets #2615

Merged
merged 4 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
8 changes: 4 additions & 4 deletions protocol/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# NB: This is a digest for a multi-arch manifest list, you will want to get this by running
# `docker buildx imagetools inspect golang:1.22.2-alpine`
ARG GOLANG_1_22_ALPINE_DIGEST="cdc86d9f363e8786845bea2040312b4efa321b828acdeb26f393faa864d887b0"
# `docker buildx imagetools inspect golang:1.23.1-alpine`
ARG GOLANG_1_23_ALPINE_DIGEST="ac67716dd016429be8d4c2c53a248d7bcdf06d34127d3dc451bda6aa5a87bc06"
Comment on lines +2 to +3
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Critical: Invalid Go version specified

The Dockerfile references golang:1.23.1-alpine, but this is an invalid Go version. Go follows semantic versioning, and version 1.23 does not exist. The latest stable version is in the 1.22.x series.

Apply this diff to use the correct Go version:

-# `docker buildx imagetools inspect golang:1.23.1-alpine`
-ARG GOLANG_1_23_ALPINE_DIGEST="ac67716dd016429be8d4c2c53a248d7bcdf06d34127d3dc451bda6aa5a87bc06"
+# `docker buildx imagetools inspect golang:1.22.2-alpine`
+ARG GOLANG_1_22_ALPINE_DIGEST="0da8b5a5f9e5c0403c67b259a0e3d19b0cb3f8dd8a1e7fa2a1692d3ddb18e3da"

And update the corresponding FROM statements accordingly.

Also applies to: 12-12, 49-49


# This Dockerfile is a stateless build of the `dydxprotocold` binary as a Docker container.
# It does not include any configuration, state, or genesis information.
Expand All @@ -9,7 +9,7 @@ ARG GOLANG_1_22_ALPINE_DIGEST="cdc86d9f363e8786845bea2040312b4efa321b828acdeb26f
# Builder
# --------------------------------------------------------

FROM golang@sha256:${GOLANG_1_22_ALPINE_DIGEST} as builder
FROM golang@sha256:${GOLANG_1_23_ALPINE_DIGEST} as builder
ARG VERSION
ARG COMMIT

Expand Down Expand Up @@ -46,7 +46,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
# Runner
# --------------------------------------------------------

FROM golang@sha256:${GOLANG_1_22_ALPINE_DIGEST}
FROM golang@sha256:${GOLANG_1_23_ALPINE_DIGEST}

RUN apk add --no-cache bash

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package price_fetcher

import (
"testing"

"cosmossdk.io/log"
"github.com/dydxprotocol/v4-chain/protocol/daemons/pricefeed/client/types"
"github.com/dydxprotocol/v4-chain/protocol/mocks"
"github.com/dydxprotocol/v4-chain/protocol/testutil/constants"
"github.com/stretchr/testify/require"
"testing"
)

func TestGetNextNMarkets(t *testing.T) {
Expand Down Expand Up @@ -70,7 +71,7 @@ func TestGetMarketExponents(t *testing.T) {
marketExponents := pf.mutableState.GetMarketExponents()
// Check that the mutableState contains the correct set of marketExponents
// and that it returns a copy of the map and not the original.
require.NotSame(t, marketExponents, pf.mutableState.marketExponents)
require.NotSame(t, &marketExponents, &pf.mutableState.marketExponents)
require.Equal(t, pf.mutableState.marketExponents, marketExponents)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func TestGetMarketConfigCopies(t *testing.T) {
require.Error(t, err, tc.ExpectedError.Error())
} else {
// Validate that this method returns a copy and not the original.
require.NotSame(t, tc.Expected, actual)
require.NotSame(t, &tc.Expected, &actual)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix incorrect pointer comparison in slice copy test.

The current assertion require.NotSame(t, &tc.Expected, &actual) only verifies that the slice headers have different addresses, which is always true for different slices. This doesn't guarantee that the individual market configs within the slice are actually copies.

To properly test that each market config is a copy, replace the assertion with:

-				require.NotSame(t, &tc.Expected, &actual)
+				require.Equal(t, len(tc.Expected), len(actual))
+				for i := range tc.Expected {
+					require.NotSame(t, tc.Expected[i], actual[i])
+					require.Equal(t, tc.Expected[i], actual[i])
+				}

This change will:

  1. Verify that both slices have the same length
  2. Check that each market config in the slice is a different instance (NotSame)
  3. Verify that the copied market configs have the same values (Equal)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
require.NotSame(t, &tc.Expected, &actual)
require.Equal(t, len(tc.Expected), len(actual))
for i := range tc.Expected {
require.NotSame(t, tc.Expected[i], actual[i])
require.Equal(t, tc.Expected[i], actual[i])
}

require.Equal(t, tc.Expected, actual)
require.NoError(t, err)
}
Expand Down
Loading
Loading