Merge branch 'master' of https://github.com/ethereum/go-ethereum into ulc/master_2

This commit is contained in:
b00ris 2018-12-03 12:09:17 +03:00
commit 1932f58429
14 changed files with 38 additions and 5504 deletions

View file

@ -168,7 +168,7 @@ HTTP based JSON-RPC API options:
* `--ipcpath` Filename for IPC socket/pipe within the datadir (explicit paths escape it)
You'll need to use your own programming environments' capabilities (libraries, tools, etc) to connect
via HTTP, WS or IPC to a Geth node configured with the above flags and you'll need to speak [JSON-RPC](http://www.jsonrpc.org/specification)
via HTTP, WS or IPC to a Geth node configured with the above flags and you'll need to speak [JSON-RPC](https://www.jsonrpc.org/specification)
on all transports. You can reuse the same connection for multiple requests!
**Note: Please understand the security implications of opening up an HTTP/WS based transport before

View file

@ -33,7 +33,7 @@ func cliFeedUploadAndSync(c *cli.Context) error {
defer func(now time.Time) { log.Info("total time", "time", time.Since(now), "size (kb)", filesize) }(time.Now())
generateEndpoints(scheme, cluster, from, to)
generateEndpoints(scheme, cluster, appName, from, to)
log.Info("generating and uploading feeds to " + endpoints[0] + " and syncing")

View file

@ -29,6 +29,7 @@ var (
endpoints []string
includeLocalhost bool
cluster string
appName string
scheme string
filesize int
from int
@ -49,6 +50,12 @@ func main() {
Usage: "cluster to point to (prod or a given namespace)",
Destination: &cluster,
},
cli.StringFlag{
Name: "app",
Value: "swarm",
Usage: "application to point to (swarm or swarm-private)",
Destination: &appName,
},
cli.IntFlag{
Name: "cluster-from",
Value: 8501,
@ -107,5 +114,6 @@ func main() {
err := app.Run(os.Args)
if err != nil {
log.Error(err.Error())
os.Exit(1)
}
}

View file

@ -33,20 +33,19 @@ import (
"time"
"github.com/ethereum/go-ethereum/log"
colorable "github.com/mattn/go-colorable"
"github.com/pborman/uuid"
cli "gopkg.in/urfave/cli.v1"
)
func generateEndpoints(scheme string, cluster string, from int, to int) {
func generateEndpoints(scheme string, cluster string, app string, from int, to int) {
if cluster == "prod" {
for port := from; port <= to; port++ {
endpoints = append(endpoints, fmt.Sprintf("%s://%v.swarm-gateways.net", scheme, port))
}
} else {
for port := from; port <= to; port++ {
endpoints = append(endpoints, fmt.Sprintf("%s://swarm-%v-%s.stg.swarm-gateways.net", scheme, port, cluster))
endpoints = append(endpoints, fmt.Sprintf("%s://%s-%v-%s.stg.swarm-gateways.net", scheme, app, port, cluster))
}
}
@ -57,11 +56,11 @@ func generateEndpoints(scheme string, cluster string, from int, to int) {
func cliUploadAndSync(c *cli.Context) error {
log.PrintOrigins(true)
log.Root().SetHandler(log.LvlFilterHandler(log.Lvl(verbosity), log.StreamHandler(colorable.NewColorableStderr(), log.TerminalFormat(true))))
log.Root().SetHandler(log.LvlFilterHandler(log.Lvl(verbosity), log.StreamHandler(os.Stdout, log.TerminalFormat(true))))
defer func(now time.Time) { log.Info("total time", "time", time.Since(now), "size (kb)", filesize) }(time.Now())
defer func(now time.Time) { log.Info("total time", "time", time.Since(now), "kb", filesize) }(time.Now())
generateEndpoints(scheme, cluster, from, to)
generateEndpoints(scheme, cluster, appName, from, to)
log.Info("uploading to " + endpoints[0] + " and syncing")

View file

@ -22,7 +22,6 @@ import (
"crypto/ecdsa"
"encoding/hex"
"errors"
"fmt"
"net"
"sort"
"sync"
@ -391,7 +390,7 @@ type sharedUDPConn struct {
func (s *sharedUDPConn) ReadFromUDP(b []byte) (n int, addr *net.UDPAddr, err error) {
packet, ok := <-s.unhandled
if !ok {
return 0, nil, fmt.Errorf("Connection was closed")
return 0, nil, errors.New("Connection was closed")
}
l := len(packet.Data)
if l > len(b) {
@ -425,7 +424,7 @@ func (srv *Server) Start() (err error) {
// static fields
if srv.PrivateKey == nil {
return fmt.Errorf("Server.PrivateKey must be set to a non-nil key")
return errors.New("Server.PrivateKey must be set to a non-nil key")
}
if srv.newTransport == nil {
srv.newTransport = newRLPX
@ -903,7 +902,7 @@ func (srv *Server) setupConn(c *conn, flags connFlag, dialDest *enode.Node) erro
if dialDest != nil {
dialPubkey = new(ecdsa.PublicKey)
if err := dialDest.Load((*enode.Secp256k1)(dialPubkey)); err != nil {
return fmt.Errorf("dial destination doesn't have a secp256k1 public key")
return errors.New("dial destination doesn't have a secp256k1 public key")
}
}
// Run the encryption handshake.
@ -937,7 +936,7 @@ func (srv *Server) setupConn(c *conn, flags connFlag, dialDest *enode.Node) erro
return err
}
if id := c.node.ID(); !bytes.Equal(crypto.Keccak256(phs.ID), id[:]) {
clog.Trace("Wrong devp2p handshake identity", "phsid", fmt.Sprintf("%x", phs.ID))
clog.Trace("Wrong devp2p handshake identity", "phsid", hex.EncodeToString(phs.ID))
return DiscUnexpectedIdentity
}
c.caps, c.name = phs.Caps, phs.Name

View file

@ -82,7 +82,7 @@ type SignerUI interface {
// OnSignerStartup is invoked when the signer boots, and tells the UI info about external API location and version
// information
OnSignerStartup(info StartupInfo)
// OnInputRequried is invoked when clef requires user input, for example master password or
// OnInputRequired is invoked when clef requires user input, for example master password or
// pin-code for unlocking hardware wallets
OnInputRequired(info UserInputRequest) (UserInputResponse, error)
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -164,6 +164,10 @@ func (pssapi *API) SendSym(symkeyhex string, topic Topic, msg hexutil.Bytes) err
return pssapi.Pss.SendSym(symkeyhex, topic, msg[:])
}
func (pssapi *API) SendRaw(addr hexutil.Bytes, topic Topic, msg hexutil.Bytes) error {
return pssapi.Pss.SendRaw(PssAddress(addr), topic, msg[:])
}
func (pssapi *API) GetPeerTopics(pubkeyhex string) ([]Topic, error) {
topics, _, err := pssapi.Pss.GetPublickeyPeers(pubkeyhex)
return topics, err

View file

@ -1064,7 +1064,7 @@ func testSendRaw(t *testing.T) {
// send and verify delivery
lmsg := []byte("plugh")
err = clients[1].Call(nil, "pss_sendRaw", loaddrhex, topic, lmsg)
err = clients[1].Call(nil, "pss_sendRaw", loaddrhex, topic, hexutil.Encode(lmsg))
if err != nil {
t.Fatal(err)
}
@ -1077,7 +1077,7 @@ func testSendRaw(t *testing.T) {
t.Fatalf("test message (left) timed out: %v", cerr)
}
rmsg := []byte("xyzzy")
err = clients[0].Call(nil, "pss_sendRaw", roaddrhex, topic, rmsg)
err = clients[0].Call(nil, "pss_sendRaw", roaddrhex, topic, hexutil.Encode(rmsg))
if err != nil {
t.Fatal(err)
}

View file

@ -22,8 +22,8 @@ environment:
install:
- rmdir C:\go /s /q
- appveyor DownloadFile https://storage.googleapis.com/golang/go1.8.windows-%GOARCH%.zip
- 7z x go1.8.windows-%GOARCH%.zip -y -oC:\ > NUL
- appveyor DownloadFile https://storage.googleapis.com/golang/go1.10.1.windows-%GOARCH%.zip
- 7z x go1.10.1.windows-%GOARCH%.zip -y -oC:\ > NUL
- go version
- gcc --version

View file

@ -36,7 +36,7 @@ func (info DeviceInfo) Open() (*Device, error) {
// Close releases the HID USB device handle. On platforms that this file implements
// the method is just a noop.
func (dev *Device) Close() {}
func (dev *Device) Close() error { return nil }
// Write sends an output report to a HID device. On platforms that this file
// implements the method just returns an error.

View file

@ -41,6 +41,7 @@ package hid
#endif
*/
import "C"
import (
"errors"
"runtime"
@ -57,11 +58,6 @@ import (
// > "subsequent calls will cause the hid manager to release previously enumerated devices"
var enumerateLock sync.Mutex
func init() {
// Initialize the HIDAPI library
C.hid_init()
}
// Supported returns whether this platform is supported by the HID library or not.
// The goal of this method is to allow programatically handling platforms that do
// not support USB HID and not having to fall back to build constraints.
@ -113,6 +109,9 @@ func Enumerate(vendorID uint16, productID uint16) []DeviceInfo {
// Open connects to an HID device by its path name.
func (info DeviceInfo) Open() (*Device, error) {
enumerateLock.Lock()
defer enumerateLock.Unlock()
path := C.CString(info.Path)
defer C.free(unsafe.Pointer(path))
@ -135,7 +134,7 @@ type Device struct {
}
// Close releases the HID USB device handle.
func (dev *Device) Close() {
func (dev *Device) Close() error {
dev.lock.Lock()
defer dev.lock.Unlock()
@ -143,6 +142,7 @@ func (dev *Device) Close() {
C.hid_close(dev.device)
dev.device = nil
}
return nil
}
// Write sends an output report to a HID device.

6
vendor/vendor.json vendored
View file

@ -267,10 +267,10 @@
"revisionTime": "2017-04-30T22:20:11Z"
},
{
"checksumSHA1": "UpjhOUZ1+0zNt+iIvdtECSHXmTs=",
"checksumSHA1": "6XsjAARQFvlW6dS15al0ibTFPOQ=",
"path": "github.com/karalabe/hid",
"revision": "f00545f9f3748e591590be3732d913c77525b10f",
"revisionTime": "2017-08-21T10:38:37Z",
"revision": "d815e0c1a2e2082a287a2806bc90bc8fc7b276a9",
"revisionTime": "2018-11-28T19:21:57Z",
"tree": true
},
{