bump version to 0.4.1, release notes, small fixes

This commit is contained in:
Larry Ruane 2020-06-05 16:59:42 -06:00 committed by Larry Ruane
parent 57d10eece3
commit ead5415693
4 changed files with 132 additions and 42 deletions

View File

@ -46,6 +46,7 @@ var rootCmd = &cobra.Command{
LogFile: viper.GetString("log-file"), LogFile: viper.GetString("log-file"),
ZcashConfPath: viper.GetString("zcash-conf-path"), ZcashConfPath: viper.GetString("zcash-conf-path"),
NoTLSVeryInsecure: viper.GetBool("no-tls-very-insecure"), NoTLSVeryInsecure: viper.GetBool("no-tls-very-insecure"),
GenCertVeryInsecure: viper.GetBool("gen-cert-very-insecure"),
DataDir: viper.GetString("data-dir"), DataDir: viper.GetString("data-dir"),
Redownload: viper.GetBool("redownload"), Redownload: viper.GetBool("redownload"),
Darkside: viper.GetBool("darkside-very-insecure"), Darkside: viper.GetBool("darkside-very-insecure"),
@ -55,8 +56,6 @@ var rootCmd = &cobra.Command{
common.Log.Debugf("Options: %#v\n", opts) common.Log.Debugf("Options: %#v\n", opts)
filesThatShouldExist := []string{ filesThatShouldExist := []string{
opts.TLSCertPath,
opts.TLSKeyPath,
opts.LogFile, opts.LogFile,
} }
if !fileExists(opts.LogFile) { if !fileExists(opts.LogFile) {
@ -65,14 +64,15 @@ var rootCmd = &cobra.Command{
if !opts.Darkside { if !opts.Darkside {
filesThatShouldExist = append(filesThatShouldExist, opts.ZcashConfPath) filesThatShouldExist = append(filesThatShouldExist, opts.ZcashConfPath)
} }
if !opts.NoTLSVeryInsecure && !opts.GenCertVeryInsecure {
filesThatShouldExist = append(filesThatShouldExist,
opts.TLSCertPath, opts.TLSKeyPath)
}
for _, filename := range filesThatShouldExist { for _, filename := range filesThatShouldExist {
if opts.NoTLSVeryInsecure && (filename == opts.TLSCertPath || filename == opts.TLSKeyPath) {
continue
}
if !fileExists(filename) { if !fileExists(filename) {
os.Stderr.WriteString(fmt.Sprintf("\n ** File does not exist: %s\n\n", filename)) os.Stderr.WriteString(fmt.Sprintf("\n ** File does not exist: %s\n\n", filename))
os.Exit(1) common.Log.Fatal("required file ", filename, " does not exist")
} }
} }
@ -120,7 +120,7 @@ func startServer(opts *common.Options) error {
var server *grpc.Server var server *grpc.Server
if opts.NoTLSVeryInsecure { if opts.NoTLSVeryInsecure {
common.Log.Warningln("Starting insecure server") common.Log.Warningln("Starting insecure no-TLS (plaintext) server")
fmt.Println("Starting insecure server") fmt.Println("Starting insecure server")
server = grpc.NewServer( server = grpc.NewServer(
grpc.StreamInterceptor( grpc.StreamInterceptor(
@ -132,7 +132,15 @@ func startServer(opts *common.Options) error {
grpc_prometheus.UnaryServerInterceptor), grpc_prometheus.UnaryServerInterceptor),
)) ))
} else { } else {
transportCreds, err := credentials.NewServerTLSFromFile(opts.TLSCertPath, opts.TLSKeyPath) var transportCreds credentials.TransportCredentials
if opts.GenCertVeryInsecure {
common.Log.Warning("Certificate and key not provided, generating self signed values")
fmt.Println("Starting insecure self-certificate server")
tlsCert := common.GenerateCerts()
transportCreds = credentials.NewServerTLSFromCert(tlsCert)
} else {
var err error
transportCreds, err = credentials.NewServerTLSFromFile(opts.TLSCertPath, opts.TLSKeyPath)
if err != nil { if err != nil {
common.Log.WithFields(logrus.Fields{ common.Log.WithFields(logrus.Fields{
"cert_file": opts.TLSCertPath, "cert_file": opts.TLSCertPath,
@ -140,6 +148,7 @@ func startServer(opts *common.Options) error {
"error": err, "error": err,
}).Fatal("couldn't load TLS credentials") }).Fatal("couldn't load TLS credentials")
} }
}
server = grpc.NewServer( server = grpc.NewServer(
grpc.Creds(transportCreds), grpc.Creds(transportCreds),
grpc.StreamInterceptor(grpc_middleware.ChainStreamServer( grpc.StreamInterceptor(grpc_middleware.ChainStreamServer(
@ -279,6 +288,7 @@ func init() {
rootCmd.Flags().String("log-file", "./server.log", "log file to write to") rootCmd.Flags().String("log-file", "./server.log", "log file to write to")
rootCmd.Flags().String("zcash-conf-path", "./zcash.conf", "conf file to pull RPC creds from") rootCmd.Flags().String("zcash-conf-path", "./zcash.conf", "conf file to pull RPC creds from")
rootCmd.Flags().Bool("no-tls-very-insecure", false, "run without the required TLS certificate, only for debugging, DO NOT use in production") rootCmd.Flags().Bool("no-tls-very-insecure", false, "run without the required TLS certificate, only for debugging, DO NOT use in production")
rootCmd.Flags().Bool("gen-cert-very-insecure", false, "run with self-signed TLS certificate, only for debugging, DO NOT use in production")
rootCmd.Flags().Bool("redownload", false, "re-fetch all blocks from zcashd; reinitialize local cache files") rootCmd.Flags().Bool("redownload", false, "re-fetch all blocks from zcashd; reinitialize local cache files")
rootCmd.Flags().String("data-dir", "/var/lib/lightwalletd", "data directory (such as db)") rootCmd.Flags().String("data-dir", "/var/lib/lightwalletd", "data directory (such as db)")
rootCmd.Flags().Bool("darkside-very-insecure", false, "run with GRPC-controllable mock zcashd for integration testing (shuts down after 30 minutes)") rootCmd.Flags().Bool("darkside-very-insecure", false, "run with GRPC-controllable mock zcashd for integration testing (shuts down after 30 minutes)")
@ -300,6 +310,8 @@ func init() {
viper.SetDefault("zcash-conf-path", "./zcash.conf") viper.SetDefault("zcash-conf-path", "./zcash.conf")
viper.BindPFlag("no-tls-very-insecure", rootCmd.Flags().Lookup("no-tls-very-insecure")) viper.BindPFlag("no-tls-very-insecure", rootCmd.Flags().Lookup("no-tls-very-insecure"))
viper.SetDefault("no-tls-very-insecure", false) viper.SetDefault("no-tls-very-insecure", false)
viper.BindPFlag("gen-cert-very-insecure", rootCmd.Flags().Lookup("gen-cert-very-insecure"))
viper.SetDefault("gen-cert-very-insecure", false)
viper.BindPFlag("redownload", rootCmd.Flags().Lookup("redownload")) viper.BindPFlag("redownload", rootCmd.Flags().Lookup("redownload"))
viper.SetDefault("redownload", false) viper.SetDefault("redownload", false)
viper.BindPFlag("data-dir", rootCmd.Flags().Lookup("data-dir")) viper.BindPFlag("data-dir", rootCmd.Flags().Lookup("data-dir"))

View File

@ -1,6 +1,8 @@
// Copyright (c) 2019-2020 The Zcash developers // Copyright (c) 2019-2020 The Zcash developers
// Distributed under the MIT software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or https://www.opensource.org/licenses/mit-license.php . // file COPYING or https://www.opensource.org/licenses/mit-license.php .
// Package common contains utilities that are shared by other packages.
package common package common
import ( import (
@ -28,12 +30,14 @@ type BlockCache struct {
mutex sync.RWMutex mutex sync.RWMutex
} }
// GetNextHeight returns the height of the lowest unobtained block.
func (c *BlockCache) GetNextHeight() int { func (c *BlockCache) GetNextHeight() int {
c.mutex.RLock() c.mutex.RLock()
defer c.mutex.RUnlock() defer c.mutex.RUnlock()
return c.nextBlock return c.nextBlock
} }
// GetLatestHash returns the hash (block ID) of the most recent (highest) known block.
func (c *BlockCache) GetLatestHash() []byte { func (c *BlockCache) GetLatestHash() []byte {
c.mutex.RLock() c.mutex.RLock()
defer c.mutex.RUnlock() defer c.mutex.RUnlock()
@ -171,6 +175,7 @@ func (c *BlockCache) setLatestHash() {
} }
} }
// Reset is used only for darkside testing.
func (c *BlockCache) Reset(startHeight int) { func (c *BlockCache) Reset(startHeight int) {
c.setDbFiles(c.firstBlock) // empty the cache c.setDbFiles(c.firstBlock) // empty the cache
c.firstBlock = startHeight c.firstBlock = startHeight
@ -367,6 +372,7 @@ func (c *BlockCache) GetLatestHeight() int {
return c.nextBlock - 1 return c.nextBlock - 1
} }
// Sync ensures that the db files are flushed to disk, can be called unnecessarily.
func (c *BlockCache) Sync() { func (c *BlockCache) Sync() {
c.lengthsFile.Sync() c.lengthsFile.Sync()
c.blocksFile.Sync() c.blocksFile.Sync()

View File

@ -18,10 +18,12 @@ import (
) )
// 'make build' will overwrite this string with the output of git-describe (tag) // 'make build' will overwrite this string with the output of git-describe (tag)
var Version = "v0.0.0.0-dev" var (
var GitCommit = "" Version = "v0.0.0.0-dev"
var BuildDate = "" GitCommit = ""
var BuildUser = "" BuildDate = ""
BuildUser = ""
)
type Options struct { type Options struct {
GRPCBindAddr string `json:"grpc_bind_address,omitempty"` GRPCBindAddr string `json:"grpc_bind_address,omitempty"`
@ -32,10 +34,11 @@ type Options struct {
LogFile string `json:"log_file,omitempty"` LogFile string `json:"log_file,omitempty"`
ZcashConfPath string `json:"zcash_conf,omitempty"` ZcashConfPath string `json:"zcash_conf,omitempty"`
NoTLSVeryInsecure bool `json:"no_tls_very_insecure,omitempty"` NoTLSVeryInsecure bool `json:"no_tls_very_insecure,omitempty"`
GenCertVeryInsecure bool `json:"gen_cert_very_insecure,omitempty"`
Redownload bool `json:"redownload"` Redownload bool `json:"redownload"`
DataDir string `json:"data-dir"` DataDir string `json:"data_dir"`
Darkside bool `json:"darkside"` Darkside bool `json:"darkside"`
DarksideTimeout uint64 `json:"darkside-timeout"` DarksideTimeout uint64 `json:"darkside_timeout"`
} }
// RawRequest points to the function to send a an RPC request to zcashd; // RawRequest points to the function to send a an RPC request to zcashd;

View File

@ -0,0 +1,69 @@
0.4.1 Release Notes
===============================
Lightwalletd version 0.4.1 is now available from:
<https://github.com/zcash/lightwalletd/releases/tag/v0.4.1>
Or cloned from:
<https://github.com/zcash/lightwalletd/tree/v0.4.1>
Lightwalletd must be built from source code (there are no binary releases
at this time).
This minor release includes various bug fixes, performance
improvements, and test code improvements.
Please report bugs using the issue tracker at GitHub:
<https://github.com/zcash/lightwalletd/issues>
How to Upgrade
==============
If you are running an older version, shut it down. Run `make` to generate
the `./lightwalletd` executable. Run `./lightwalletd version` to verify
that you're running the correct version (v0.4.0). Some of the command-line
arguments (options) have changed since the previous release; please
run `./lightwalletd help` to view them.
Compatibility
==============
Lightwalletd is supported and extensively tested on operating systems using
the Linux kernel, and to a lesser degree macOS. It is not recommended
to use Lightwalletd on unsupported systems.
0.4.1 change log
=================
### Infrastructure
- #161 Add docker-compose
- #227 Added tekton for Docker image build
- #236 Add http endpoint and prometheus metrics framework
### Tests and QA
- #234 darksidewalletd
### Documentation
- #107 Reorg documents for updates and upcoming new details
- #188 add documentation for lightwalletd APIs and data types
- #195 add simple gRPC test client
- #270 add issue and PR templates
Credits
=======
Thanks to everyone who directly contributed to this release:
- adityapk00
- Marshall Gaucher
- Kevin Gorhan
- Taylor Hornby
- Linda Lee
- Brad Miller
- Charlie O'Keefe
- Larry Ruane
- Za Wilcox
- Ben Wilson