Skip to content

Commit

Permalink
Release v1.2.2 (#306)
Browse files Browse the repository at this point in the history
* chore(deps): bump semver from 5.7.1 to 5.7.2 in /docs

Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md)
- [Commits](npm/node-semver@v5.7.1...v5.7.2)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update image versions to latest version.

* fix: Show command error when using containers tags (#300)

* test: add new show command test case

* fix: show command error when using containers tag

* chore: update changelog

---------

Co-authored-by: Marcos Antonio Maceo <35319980+stdevMac@users.noreply.github.com>

* Fix Chiado checkpoint sync (#298)

* fix: chiado env templates

* chore: update changelog

---------

Co-authored-by: Marcos Antonio Maceo <35319980+stdevMac@users.noreply.github.com>
Co-authored-by: Miguel Tenorio <46824157+AntiD2ta@users.noreply.github.com>

* [docs] Update documentation and Changelog

* [docs] Update documentation and Changelog

* [fix] typo on doc

* [fix] typo on doc

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: stdevMac <stdevMac@users.noreply.github.com>
Co-authored-by: Carlos Bermudez Porto <43155355+cbermudez97@users.noreply.github.com>
Co-authored-by: Miguel Tenorio <46824157+AntiD2ta@users.noreply.github.com>
  • Loading branch information
5 people committed Jul 24, 2023
1 parent e14e3cb commit e585a03
Show file tree
Hide file tree
Showing 11 changed files with 349 additions and 127 deletions.
22 changes: 18 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [v1.2.2] - 2023-07-24

### Changed

- Update client images to Shapella-ready version for Gnosis.

### Fixed

- Issue in Chiado templates with checkpoint sync
- Fix show error when using containers tags.
- Fix chiado checkpoint sync url.

## [v1.2.1] - 2023-06-22

### Changed
Expand All @@ -33,8 +45,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Change validator blocker container image to [busybox](https://hub.docker.com/_/busybox).
- Erigon command line flags.
- Erigon command line flags.

## [v1.1.0] - 2023-04-07

### Added
Expand Down Expand Up @@ -81,8 +93,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Rename sedge data directory name to `sedge-data` instead of `docker-compose-scripts`.
- Update mev-boost relay URLs.
- Fixed validator restart failure. Validator never restarts, but has a better and safer start-up method:
- Validator waits a grace period (2 epochs) before starting.
- Validator waits for the consensus sync to finish: verifying that the `/eth/v1/node/health` consensus endpoint returns with the HTTP code 200 in the newly added `validator-blocker` docker-compose service. This replace the older track sync method.
- Validator waits a grace period (2 epochs) before starting.
- Validator waits for the consensus sync to finish: verifying that the `/eth/v1/node/health` consensus endpoint
returns with the HTTP code 200 in the newly added `validator-blocker` docker-compose service. This replace the
older track sync method.
- Updated installation script for docker and docker compose in Linux flavours.
- Updated Checkpoint Sync Url for Goerli.
- Use new created action for JWT secret handling.
Expand Down
11 changes: 9 additions & 2 deletions cli/actions/getContainers.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ package actions
import (
"context"
"fmt"
"strings"

"github.com/NethermindEth/sedge/internal/pkg/generate"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/network"
log "github.com/sirupsen/logrus"
)

Expand Down Expand Up @@ -93,8 +95,13 @@ type ContainerData struct {
func getContainerData(containerData types.ContainerJSON) (ContainerData, error) {
data := ContainerData{}

sedgeNetwork, ok := containerData.NetworkSettings.Networks["sedge-network"] // FIXME: fix in case of network data renaming
if !ok {
var sedgeNetwork *network.EndpointSettings = nil
for networkName, networkSettings := range containerData.NetworkSettings.Networks {
if strings.HasPrefix(networkName, "sedge-network") {
sedgeNetwork = networkSettings
}
}
if sedgeNetwork == nil {
return ContainerData{}, fmt.Errorf("failed to get sedge-network for container %s", containerData.Name)
}

Expand Down
118 changes: 84 additions & 34 deletions cli/actions/getContainers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"errors"
"os"
"path/filepath"
"strings"
"testing"

"github.com/NethermindEth/sedge/cli/actions"
Expand Down Expand Up @@ -65,11 +66,20 @@ type getContainersTestCase struct {
logsOutput bytes.Buffer
isErr bool
expectedErrMsg string
containersTag string
}

func nameWithTag(
name,
tag string,
) string {
return strings.Join([]string{name, tag}, "-")
}

func buildGetContainersDataTestCase(
t *testing.T,
name string,
name,
containersTag,
caseDataDir string,
isErr bool,
expectedErrMsg string,
Expand All @@ -92,17 +102,23 @@ func buildGetContainersDataTestCase(
getContainersDataOptions: actions.GetContainersDataOptions{
DockerComposePath: testCaseFinalDockerComposeFilePath,
},
expected: expected,
logsOutput: bytes.Buffer{},
isErr: isErr,
expected: expected,
logsOutput: bytes.Buffer{},
isErr: isErr,
containersTag: containersTag,
}
}

func buildInspectResults(
containersTag,
containerName,
containerImage,
containerIp string,
) types.ContainerJSON {
networkName := "sedge-network" // May change in templates
if containersTag != "" {
networkName = nameWithTag(networkName, containersTag)
}
return types.ContainerJSON{
ContainerJSONBase: &types.ContainerJSONBase{
Name: containerName,
Expand All @@ -112,15 +128,18 @@ func buildInspectResults(
},
NetworkSettings: &types.NetworkSettings{
Networks: map[string]*network.EndpointSettings{
"sedge-network": { // FIXME: fix in case of network data renaming
networkName: {
IPAddress: containerIp,
},
},
},
}
}

func getMockActions(t *testing.T) actions.SedgeActions {
func getMockActions(
t *testing.T,
tc getContainersTestCase,
) actions.SedgeActions {
ctrl := gomock.NewController(t)
dockerClient := sedge_mocks.NewMockAPIClient(ctrl)
t.Cleanup(
Expand All @@ -129,30 +148,18 @@ func getMockActions(t *testing.T) actions.SedgeActions {
},
)

// execution container
dockerClient.EXPECT().ContainerInspect(gomock.Any(), executionContainerName).Return(buildInspectResults(
executionContainerName,
executionContainerImage,
executionContainerIp,
), nil).AnyTimes()
// consensus container
dockerClient.EXPECT().ContainerInspect(gomock.Any(), consensusContainerName).Return(buildInspectResults(
consensusContainerName,
consensusContainerImage,
consensusContainerIp,
), nil).AnyTimes()
// validator container
dockerClient.EXPECT().ContainerInspect(gomock.Any(), validatorContainerName).Return(buildInspectResults(
validatorContainerName,
validatorContainerImage,
validatorContainerIp,
), nil).AnyTimes()
// mev boost container
dockerClient.EXPECT().ContainerInspect(gomock.Any(), mevBoostContainerName).Return(buildInspectResults(
mevBoostContainerName,
mevBoostContainerImage,
mevBoostContainerIp,
), nil).AnyTimes()
for _, container := range tc.expected.Containers {
dockerClient.EXPECT().ContainerInspect(gomock.Any(), container.Name).Return(
buildInspectResults(
tc.containersTag,
container.Name,
container.Image,
container.Ip,
),
nil,
).Times(1)
}

// not found containers
dockerClient.EXPECT().ContainerInspect(gomock.Any(), executionNotFoundContainerName).Return(types.ContainerJSON{}, errors.New(executionNotFoundErrorMsg)).AnyTimes()
dockerClient.EXPECT().ContainerInspect(gomock.Any(), consensusNotFoundContainerName).Return(types.ContainerJSON{}, errors.New(consensusNotFoundErrorMsg)).AnyTimes()
Expand All @@ -173,6 +180,7 @@ func TestGetContainersData(t *testing.T) {
buildGetContainersDataTestCase(
t,
"Full Node",
"",
"case_fullNode",
false,
"",
Expand Down Expand Up @@ -201,9 +209,42 @@ func TestGetContainersData(t *testing.T) {
},
},
),
buildGetContainersDataTestCase(
t,
"Full Node with Tags",
"tag",
"case_fullNodeTag",
false,
"",
actions.ContainersData{
Containers: []actions.ContainerData{
{
Name: nameWithTag(executionContainerName, "tag"),
Image: executionContainerImage,
Ip: executionContainerIp,
},
{
Name: nameWithTag(mevBoostContainerName, "tag"),
Image: mevBoostContainerImage,
Ip: mevBoostContainerIp,
},
{
Name: nameWithTag(consensusContainerName, "tag"),
Image: consensusContainerImage,
Ip: consensusContainerIp,
},
{
Name: nameWithTag(validatorContainerName, "tag"),
Image: validatorContainerImage,
Ip: validatorContainerIp,
},
},
},
),
buildGetContainersDataTestCase(
t,
"Execution Only",
"",
"case_executionOnly",
false,
"",
Expand All @@ -220,6 +261,7 @@ func TestGetContainersData(t *testing.T) {
buildGetContainersDataTestCase(
t,
"Consensus Only",
"",
"case_consensusOnly",
false,
"",
Expand All @@ -236,6 +278,7 @@ func TestGetContainersData(t *testing.T) {
buildGetContainersDataTestCase(
t,
"Validator Only",
"",
"case_validatorOnly",
false,
"",
Expand All @@ -252,6 +295,7 @@ func TestGetContainersData(t *testing.T) {
buildGetContainersDataTestCase(
t,
"No Execution",
"",
"case_noExecution",
false,
"",
Expand All @@ -278,6 +322,7 @@ func TestGetContainersData(t *testing.T) {
buildGetContainersDataTestCase(
t,
"No Consensus",
"",
"case_noConsensus",
false,
"",
Expand All @@ -304,6 +349,7 @@ func TestGetContainersData(t *testing.T) {
buildGetContainersDataTestCase(
t,
"No Mev Boost",
"",
"case_noMev",
false,
"",
Expand All @@ -330,6 +376,7 @@ func TestGetContainersData(t *testing.T) {
buildGetContainersDataTestCase(
t,
"No Validator",
"",
"case_noValidator",
false,
"",
Expand All @@ -356,32 +403,35 @@ func TestGetContainersData(t *testing.T) {
buildGetContainersDataTestCase(
t,
"Execution Not Found",
"",
"case_executionNF",
true,
executionNotFoundErrorMsg,
actions.ContainersData{Containers: []actions.ContainerData{{}}},
actions.ContainersData{Containers: []actions.ContainerData{}},
),
buildGetContainersDataTestCase(
t,
"Consensus Not Found",
"",
"case_consensusNF",
true,
consensusNotFoundErrorMsg,
actions.ContainersData{Containers: []actions.ContainerData{{}}},
actions.ContainersData{Containers: []actions.ContainerData{}},
),
buildGetContainersDataTestCase(
t,
"Validator Not Found",
"",
"case_validatorNF",
true,
validatorNotFoundErrorMsg,
actions.ContainersData{Containers: []actions.ContainerData{{}}},
actions.ContainersData{Containers: []actions.ContainerData{}},
),
}

actions := getMockActions(t)
for _, tc := range tcs {
t.Run(tc.name, func(t *testing.T) {
actions := getMockActions(t, tc)
log.SetOutput(&tc.logsOutput)
containersData, err := actions.GetContainersData(tc.getContainersDataOptions)
if tc.isErr {
Expand Down

0 comments on commit e585a03

Please sign in to comment.