Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #541 from vegaprotocol/release/v0.14.x
Browse files Browse the repository at this point in the history
Release/v0.14.x
  • Loading branch information
jeremyletang authored Apr 12, 2022
2 parents deed8fa + 9f7764b commit 9e075c6
Show file tree
Hide file tree
Showing 21 changed files with 493 additions and 589 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set docker image tag
id: vars
run: |
Expand All @@ -43,7 +50,7 @@ jobs:
uses: docker/build-push-action@v2
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ secrets.DOCKERHUB_USERNAME }}/vegawallet:${{ steps.vars.outputs.tag }}
tags: ${{ secrets.DOCKERHUB_USERNAME }}/vegawallet:${{ steps.vars.outputs.tag }},ghcr.io/vegaprotocol/vegawallet:${{ steps.vars.outputs.tag }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
14 changes: 11 additions & 3 deletions .github/workflows/search-for-code-offences.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,16 @@ jobs:
name: Run golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
id: go

- name: golangci-lint
uses: golangci/golangci-lint-action@5c56cd6c9dc07901af25baab6f2b0d9f3b7c3018 # hash of v2.5.2
uses: golangci/golangci-lint-action@v3.1.0
with:
version: v1.42.1
version: v1.45.2
10 changes: 10 additions & 0 deletions .golangci.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,25 @@ print-linter-name = true
enable-all = true
disable = [
# To be investigate
"containedctx",
"contextcheck",
"cyclop",
"dupl",
"errchkjson",
"exhaustivestruct",
"funlen",
"gocognit",
"ifshort",
"ireturn",
"maintidx",
"nestif",
"nilnil",
"nolintlint",
"paralleltest",
"predeclared",
"revive",
"tagliatelle",
"varnamelen",
"wrapcheck",
"wsl",
# Deprecated linters
Expand Down
23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## Unreleased (0.14.0)
## Unreleased (0.15.0)

### 🚨 Breaking changes
- [](https://github.com/vegaprotocol/vegawallet/pull/) -
Expand All @@ -18,6 +18,27 @@
- [](https://github.com/vegaprotocol/vegawallet/pull/) -


## 0.14.0

### 🚨 Breaking changes
- [539](https://github.com/vegaprotocol/vegawallet/issues/539) - Add received at timestamp to transaction sign requests
- [497](https://github.com/vegaprotocol/vegawallet/issues/497) - Add ability to confirm the signing of a transaction. To keep running the service with automatic consent, `--automatic-consent` flag is now required.

### 🗑️ Deprecation
- [](https://github.com/vegaprotocol/vegawallet/pull/) -

### 🛠 Improvements
- [](https://github.com/vegaprotocol/vegawallet/pull/) -

### 🔥 Removal
- [](https://github.com/vegaprotocol/vegawallet/pull/) -

### 🐛 Fixes
- [521](https://github.com/vegaprotocol/vegawallet/pull/521) - Update `protos` repository to get last validation updates on commands
- [523](https://github.com/vegaprotocol/vegawallet/pull/521) - Add link in `README` to direct people to desktop wallet app
- [529](https://github.com/vegaprotocol/vegawallet/pull/529) - Ensure log files can be created on Windows.
- [536](https://github.com/vegaprotocol/vegawallet/pull/536) - Docs: replace link for providing feedback

## 0.13.2

### 🚨 Breaking changes
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ pipeline {
stage('LNL System Tests') {
steps {
script {
systemTestsLNL ignoreFailure: true,
systemTestsLNL ignoreFailure: !isPRBuild(),
vegaCore: params.VEGA_CORE_BRANCH,
dataNode: params.DATA_NODE_BRANCH,
vegawallet: commitHash,
Expand Down
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

## Documentation

#### [Getting started with Vega Wallet][vega-documentation-website-create-wallet]
Learn how to install and run the stable version of Vega Wallet.
#### [Getting started with the CLI app for Vega Wallet][vega-documentation-website-create-wallet]
Learn how to install and run the stable version of the Vega Wallet CLI app.

#### [Vega documentation][vega-documentation-website]
Learn more about how Vega works, and explore sample scripts for API trading
Expand All @@ -18,7 +18,9 @@ If you want to know more about Vega Wallet, how it works and how to use it, refe

### I don't know how to set up a Vega Wallet...

If you want to know more about how to create and use a Vega Wallet, refer to the page ["Create a Vega Wallet"][vega-documentation-website-create-wallet].
If you want to know more about how to create and use a Vega Wallet with the CLI app, refer to the page ["Create a Vega Wallet"][vega-documentation-website-create-wallet].

If you'd prefer to use a visual interface to interact with a Vega Wallet, you can use the Vega Wallet desktop app. Refer to the [desktop app documentation][vega-wallet-desktop-getting-started].

### I want to use the latest stable version...

Expand Down Expand Up @@ -98,7 +100,7 @@ Using the API is documented [here](service/README.md).

## Support

#### [Nolt][nolt]
#### [Feedback][feedback]
Raise issues and see what others have raised.

#### [Discord][discord]
Expand All @@ -112,9 +114,10 @@ generally.
Read more at [https://vega.xyz][vega-website].

[vega-website]: https://vega.xyz
[vega-documentation-website]: https://docs.fairground.vega.xyz
[vega-documentation-website-create-wallet]: https://docs.fairground.vega.xyz/docs/vega-wallet/create-wallet/
[vega-wallet-documentation-website]: https://docs.fairground.vega.xyz/docs/vega-wallet/
[nolt]: https://vega-testnet.nolt.io/
[vega-documentation-website]: https://docs.vega.xyz
[vega-documentation-website-create-wallet]: https://docs.vega.xyz/docs/tools/vega-wallet/CLI-wallet/create-wallet
[vega-wallet-documentation-website]: https://docs.vega.xyz/docs/tools/vega-wallet/
[vega-wallet-desktop-getting-started]: https://docs.vega.xyz/docs/tools/vega-wallet/desktop-app/latest/getting-started
[feedback]: https://github.com/vegaprotocol/feedback/discussions/
[discord]: https://vega.xyz/discord
[github-releases]: https://github.com/vegaprotocol/vegawallet/releases
41 changes: 24 additions & 17 deletions cmd/flags/force.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,38 @@ package flags

import (
"bufio"
"errors"
"fmt"
"os"
"strings"
)

var ErrExpectYesOrNo = errors.New("invalid answer, expect \"yes\" or \"no\"")
func AreYouSure() bool {
return YesOrNo("Are you sure?")
}

func DoYouApproveTx() bool {
return YesOrNo("Do you approve this transaction?")
}

func DoYouConfirm() (bool, error) {
func YesOrNo(question string) bool {
reader := bufio.NewReader(os.Stdin)
fmt.Print("Are you sure? (y/n) ") //nolint:forbidigo
answer, err := reader.ReadString('\n')
if err != nil {
return false, fmt.Errorf("couldn't read password input: %w", err)
}
fmt.Println() //nolint:forbidigo
for {
fmt.Print(question + " (y/n) ") //nolint:forbidigo

answer, err := reader.ReadString('\n')
if err != nil {
panic(fmt.Errorf("couldn't read input: %w", err))
}

answer = strings.ToLower(strings.Trim(answer, " \r\n\t"))
answer = strings.ToLower(strings.Trim(answer, " \r\n\t"))

switch answer {
case "yes", "y":
return true, nil
case "no", "n":
return false, nil
default:
return false, ErrExpectYesOrNo
switch answer {
case "yes", "y":
return true
case "no", "n":
return false
default:
fmt.Printf("invalid answer \"%s\", expect \"yes\" or \"no\"\n", answer) //nolint:forbidigo
}
}
}
36 changes: 28 additions & 8 deletions cmd/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package cmd

import (
"fmt"
"net/url"
"os"
"runtime"
"time"

"code.vegaprotocol.io/shared/paths"
Expand Down Expand Up @@ -56,12 +58,12 @@ func DefaultConfig() zap.Config {
}
}

func BuildJSONLogger(level string, logsDir paths.StatePath) (*zap.Logger, error) {
func BuildJSONLogger(level string, vegaPaths paths.Paths, logsDir paths.StatePath) (*zap.Logger, string, error) {
cfg := DefaultConfig()

l, err := getLevel(level)
if err != nil {
return nil, err
return nil, "", err
}

cfg.Level = zap.NewAtomicLevelAt(*l)
Expand All @@ -71,19 +73,28 @@ func BuildJSONLogger(level string, logsDir paths.StatePath) (*zap.Logger, error)
pathSuffix := fmt.Sprintf("%d-%s.log", pid, date)

logFile := paths.JoinStatePath(logsDir, pathSuffix)
appLogPath, err := paths.CreateDefaultStatePathFor(logFile)
appLogPath, err := vegaPaths.CreateStatePathFor(logFile)
if err != nil {
return nil, fmt.Errorf("failed getting path for %s: %w", logFile, err)
return nil, "", fmt.Errorf("failed getting path for %s: %w", logFile, err)
}

zapLogPath := appLogPath
if runtime.GOOS == "windows" {
err := zap.RegisterSink("winfile", newWinFileSink)
if err != nil {
return nil, "", fmt.Errorf("couldn't register the windows file sink: %w", err)
}
zapLogPath = "winfile:///" + appLogPath
}

cfg.OutputPaths = []string{appLogPath}
cfg.ErrorOutputPaths = []string{appLogPath}
cfg.OutputPaths = []string{zapLogPath}
cfg.ErrorOutputPaths = []string{zapLogPath}

log, err := cfg.Build()
if err != nil {
return nil, fmt.Errorf("couldn't create logger: %w", err)
return nil, "", fmt.Errorf("couldn't create logger: %w", err)
}
return log, nil
return log, appLogPath, nil
}

func BuildLogger(output, level string) (*zap.Logger, error) {
Expand Down Expand Up @@ -148,3 +159,12 @@ func isSupportedLogLevel(level string) bool {
}
return false
}

// newWinFileSink creates a log sink on Windows machines as zap, by default,
// doesn't support Windows paths. A workaround is to create a fake winfile
// scheme and register it with zap instead. This workaround is taken from
// the GitHub issue at https://github.com/uber-go/zap/issues/621.
func newWinFileSink(u *url.URL) (zap.Sink, error) {
// Remove leading slash left by url.Parse().
return os.OpenFile(u.Path[1:], os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0o644) // nolint:gomnd
}
6 changes: 1 addition & 5 deletions cmd/network_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,7 @@ func BuildCmdDeleteNetwork(w io.Writer, handler DeleteNetworkHandler, rf *RootFl
}

if !f.Force && vgterm.HasTTY() {
confirm, err := flags.DoYouConfirm()
if err != nil {
return err
}
if !confirm {
if !flags.AreYouSure() {
return nil
}
}
Expand Down
31 changes: 19 additions & 12 deletions cmd/printer/interactive.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,24 @@ import (
)

type InteractivePrinter struct {
writer io.Writer
profile termenv.Profile
checkMark string
bangMark string
crossMark string
arrow termenv.Style
writer io.Writer
profile termenv.Profile
checkMark string
bangMark string
crossMark string
questionMark string
arrow termenv.Style
}

func fancyPrinter(w io.Writer, profile termenv.Profile) *InteractivePrinter {
return &InteractivePrinter{
writer: w,
profile: profile,
checkMark: termenv.String("✓ ").Foreground(profile.Color("2")).String(),
bangMark: termenv.String("! ").Foreground(profile.Color("1")).String(),
crossMark: termenv.String("✗ ").Foreground(profile.Color("1")).String(),
arrow: termenv.String("➜ ").Foreground(profile.Color("2")),
writer: w,
profile: profile,
checkMark: termenv.String("✓ ").Foreground(profile.Color("2")).String(),
bangMark: termenv.String("! ").Foreground(profile.Color("1")).String(),
questionMark: termenv.String("? ").Foreground(profile.Color("2")).String(),
crossMark: termenv.String("✗ ").Foreground(profile.Color("1")).String(),
arrow: termenv.String("➜ ").Foreground(profile.Color("2")),
}
}

Expand Down Expand Up @@ -73,6 +75,11 @@ func (p *InteractivePrinter) BangMark() *InteractivePrinter {
return p
}

func (p *InteractivePrinter) QuestionMark() *InteractivePrinter {
p.printOut(p.questionMark)
return p
}

func (p *InteractivePrinter) CrossMark() *InteractivePrinter {
p.printOut(p.crossMark)
return p
Expand Down
Loading

0 comments on commit 9e075c6

Please sign in to comment.