all: mega format fixes

This commit is contained in:
Péter Szilágyi 2019-04-10 14:05:59 +03:00
parent f0b878d56d
commit d668176dd0
No known key found for this signature in database
GPG key ID: E9AE538CEDF8293D
331 changed files with 1471 additions and 1615 deletions

View file

@ -257,7 +257,6 @@ func (arguments Arguments) unpackTuple(v interface{}, marshalledValues []interfa
}
}
return nil
}
// UnpackValues can be used to unpack ABI-encoded hexdata according to the ABI-specification,

View file

@ -489,12 +489,15 @@ func (fb *filterBackend) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event.
return nil
})
}
func (fb *filterBackend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription {
return fb.bc.SubscribeChainEvent(ch)
}
func (fb *filterBackend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription {
return fb.bc.SubscribeRemovedLogsEvent(ch)
}
func (fb *filterBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription {
return fb.bc.SubscribeLogsEvent(ch)
}

View file

@ -78,5 +78,4 @@ func TestSimulatedBackend(t *testing.T) {
if isPending {
t.Fatal("transaction should not have pending status")
}
}

View file

@ -47,8 +47,8 @@ func (mc *mockCaller) CallContract(ctx context.Context, call ethereum.CallMsg, b
mc.callContractBlockNumber = blockNumber
return nil, nil
}
func TestPassingBlockNumber(t *testing.T) {
func TestPassingBlockNumber(t *testing.T) {
mc := &mockCaller{}
bc := bind.NewBoundContract(common.HexToAddress("0x0"), abi.ABI{

View file

@ -174,11 +174,11 @@ var bindType = map[Lang]func(kind abi.Type) string{
// Array sizes may also be "", indicating a dynamic array.
func wrapArray(stringKind string, innerLen int, innerMapping string) (string, []string) {
remainder := stringKind[innerLen:]
//find all the sizes
// find all the sizes
matches := regexp.MustCompile(`\[(\d*)\]`).FindAllStringSubmatch(remainder, -1)
parts := make([]string, 0, len(matches))
for _, match := range matches {
//get group 1 from the regex match
// get group 1 from the regex match
parts = append(parts, match[1])
}
return innerMapping, parts
@ -188,7 +188,7 @@ func wrapArray(stringKind string, innerLen int, innerMapping string) (string, []
// Simply returns the inner type if arraySizes is empty.
func arrayBindingGo(inner string, arraySizes []string) string {
out := ""
//prepend all array sizes, from outer (end arraySizes) to inner (start arraySizes)
// prepend all array sizes, from outer (end arraySizes) to inner (start arraySizes)
for i := len(arraySizes) - 1; i >= 0; i-- {
out += "[" + arraySizes[i] + "]"
}
@ -209,7 +209,6 @@ func bindTypeGo(kind abi.Type) string {
// (Or just the type itself if it is not an array or slice)
// The length of the matched part is returned, with the translated type.
func bindUnnestedTypeGo(stringKind string) (int, string) {
switch {
case strings.HasPrefix(stringKind, "address"):
return len("address"), "common.Address"
@ -257,7 +256,6 @@ func bindTypeJava(kind abi.Type) string {
// (Or just the type itself if it is not an array or slice)
// The length of the matched part is returned, with the translated type.
func bindUnnestedTypeJava(stringKind string) (int, string) {
switch {
case strings.HasPrefix(stringKind, "address"):
parts := regexp.MustCompile(`address(\[[0-9]*\])?`).FindStringSubmatch(stringKind)
@ -277,7 +275,7 @@ func bindUnnestedTypeJava(stringKind string) (int, string) {
return len(parts[0]), "byte[]"
case strings.HasPrefix(stringKind, "int") || strings.HasPrefix(stringKind, "uint"):
//Note that uint and int (without digits) are also matched,
// Note that uint and int (without digits) are also matched,
// these are size 256, and will translate to BigInt (the default).
parts := regexp.MustCompile(`(u)?int([0-9]*)`).FindStringSubmatch(stringKind)
if len(parts) != 3 {
@ -291,7 +289,7 @@ func bindUnnestedTypeJava(stringKind string) (int, string) {
"64": "long",
}[parts[2]]
//default to BigInt
// default to BigInt
if namedSize == "" {
namedSize = "BigInt"
}

View file

@ -22,9 +22,7 @@ import (
"reflect"
)
var (
errBadBool = errors.New("abi: improperly encoded boolean value")
)
var errBadBool = errors.New("abi: improperly encoded boolean value")
// formatSliceString formats the reflection kind with the given slice size
// and returns a formatted string representation.
@ -75,7 +73,6 @@ func typeCheck(t Type, value reflect.Value) error {
} else {
return nil
}
}
// typeErr returns a formatted type casting error.

View file

@ -165,7 +165,6 @@ func TestEventMultiValueWithArrayUnpack(t *testing.T) {
}
func TestEventTupleUnpack(t *testing.T) {
type EventTransfer struct {
Value *big.Int
}
@ -269,7 +268,8 @@ func TestEventTupleUnpack(t *testing.T) {
&EventPledge{
addr,
bigintExpected2,
[3]byte{'u', 's', 'd'}},
[3]byte{'u', 's', 'd'},
},
jsonEventPledge,
"",
"Can unpack Pledge event into structure",
@ -279,7 +279,8 @@ func TestEventTupleUnpack(t *testing.T) {
&[]interface{}{
&addr,
&bigintExpected2,
&[3]byte{'u', 's', 'd'}},
&[3]byte{'u', 's', 'd'},
},
jsonEventPledge,
"",
"Can unpack Pledge event into slice",
@ -289,7 +290,8 @@ func TestEventTupleUnpack(t *testing.T) {
&[3]interface{}{
&addr,
&bigintExpected2,
&[3]byte{'u', 's', 'd'}},
&[3]byte{'u', 's', 'd'},
},
jsonEventPledge,
"",
"Can unpack Pledge event into an array",

View file

@ -77,5 +77,4 @@ func packNum(value reflect.Value) []byte {
default:
panic("abi: fatal error")
}
}

View file

@ -530,7 +530,8 @@ func TestPack(t *testing.T) {
FieldA *big.Int `abi:"a"` // Test whether abi tag works for nested tuple
B []*big.Int
}{big.NewInt(1), []*big.Int{big.NewInt(1), big.NewInt(0)}},
B: []*big.Int{big.NewInt(1), big.NewInt(0)}},
B: []*big.Int{big.NewInt(1), big.NewInt(0)},
},
common.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000040" + // a offset
"00000000000000000000000000000000000000000000000000000000000000e0" + // b offset
"0000000000000000000000000000000000000000000000000000000000000001" + // a.a value

View file

@ -112,7 +112,6 @@ func requireAssignable(dst, src reflect.Value) error {
// requireUnpackKind verifies preconditions for unpacking `args` into `kind`
func requireUnpackKind(v reflect.Value, t reflect.Type, k reflect.Kind,
args Arguments) error {
switch k {
case reflect.Struct:
case reflect.Slice, reflect.Array:

View file

@ -57,10 +57,8 @@ type Type struct {
TupleRawNames []string // Raw field name of all tuple fields
}
var (
// typeRegex parses the abi sub types
typeRegex = regexp.MustCompile("([a-zA-Z]+)(([0-9]+)(x([0-9]+))?)?")
)
// typeRegex parses the abi sub types
var typeRegex = regexp.MustCompile("([a-zA-Z]+)(([0-9]+)(x([0-9]+))?)?")
// NewType creates a new reflection type of abi type given in t.
func NewType(t string, components []ArgumentMarshaling) (typ Type, err error) {

View file

@ -95,14 +95,18 @@ func TestTypeRegexp(t *testing.T) {
// {"fixed[2]", nil, Type{}},
// {"fixed128x128[]", nil, Type{}},
// {"fixed128x128[2]", nil, Type{}},
{"tuple", []ArgumentMarshaling{{Name: "a", Type: "int64"}}, Type{Kind: reflect.Struct, T: TupleTy, Type: reflect.TypeOf(struct {
A int64 `json:"a"`
}{}), stringKind: "(int64)",
TupleElems: []*Type{{Kind: reflect.Int64, T: IntTy, Type: reflect.TypeOf(int64(0)), Size: 64, stringKind: "int64"}}, TupleRawNames: []string{"a"}}},
{"tuple with long name", []ArgumentMarshaling{{Name: "aTypicalParamName", Type: "int64"}}, Type{Kind: reflect.Struct, T: TupleTy, Type: reflect.TypeOf(struct {
ATypicalParamName int64 `json:"aTypicalParamName"`
}{}), stringKind: "(int64)",
TupleElems: []*Type{{Kind: reflect.Int64, T: IntTy, Type: reflect.TypeOf(int64(0)), Size: 64, stringKind: "int64"}}, TupleRawNames: []string{"aTypicalParamName"}}},
{"tuple", []ArgumentMarshaling{{Name: "a", Type: "int64"}}, Type{
Kind: reflect.Struct, T: TupleTy, Type: reflect.TypeOf(struct {
A int64 `json:"a"`
}{}), stringKind: "(int64)",
TupleElems: []*Type{{Kind: reflect.Int64, T: IntTy, Type: reflect.TypeOf(int64(0)), Size: 64, stringKind: "int64"}}, TupleRawNames: []string{"a"},
}},
{"tuple with long name", []ArgumentMarshaling{{Name: "aTypicalParamName", Type: "int64"}}, Type{
Kind: reflect.Struct, T: TupleTy, Type: reflect.TypeOf(struct {
ATypicalParamName int64 `json:"aTypicalParamName"`
}{}), stringKind: "(int64)",
TupleElems: []*Type{{Kind: reflect.Int64, T: IntTy, Type: reflect.TypeOf(int64(0)), Size: 64, stringKind: "int64"}}, TupleRawNames: []string{"aTypicalParamName"},
}},
}
for _, tt := range tests {

View file

@ -112,7 +112,6 @@ func readFixedBytes(t Type, word []byte) (interface{}, error) {
reflect.Copy(array, reflect.ValueOf(word[0:t.Size]))
return array.Interface(), nil
}
// iteratively unpack elements

View file

@ -679,7 +679,7 @@ func TestMultiReturnWithDeeplyNestedArray(t *testing.T) {
// construct the test array, each 3 char element is joined with 61 '0' chars,
// to from the ((3 + 61) * 0.5) = 32 byte elements in the array.
buff.Write(common.Hex2Bytes(strings.Join([]string{
"", //empty, to apply the 61-char separator to the first element as well.
"", // empty, to apply the 61-char separator to the first element as well.
"111", "112", "113", "121", "122", "123",
"211", "212", "213", "221", "222", "223",
"311", "312", "313", "321", "322", "323",

View file

@ -207,6 +207,7 @@ func (api *ExternalSigner) SignTextWithPassphrase(account accounts.Account, pass
func (api *ExternalSigner) SignTxWithPassphrase(account accounts.Account, passphrase string, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error) {
return nil, fmt.Errorf("passphrase-operations not supported on external signers")
}
func (api *ExternalSigner) SignDataWithPassphrase(account accounts.Account, passphrase, mimeType string, data []byte) ([]byte, error) {
return nil, fmt.Errorf("passphrase-operations not supported on external signers")
}

View file

@ -35,9 +35,7 @@ import (
"github.com/pborman/uuid"
)
const (
version = 3
)
const version = 3
type Key struct {
Id uuid.UUID // Version 4 "random" for unique id not derived from key data

View file

@ -137,7 +137,6 @@ func (ks keyStorePassphrase) JoinPath(filename string) string {
// Encryptdata encrypts the data given as 'data' with the password 'auth'.
func EncryptDataV3(data, auth []byte, scryptN, scryptP int) (CryptoJSON, error) {
salt := make([]byte, 32)
if _, err := io.ReadFull(rand.Reader, salt); err != nil {
panic("reading from crypto/rand failed: " + err.Error())

View file

@ -16,9 +16,7 @@
package accounts
import (
"testing"
)
import "testing"
func TestURLParsing(t *testing.T) {
url, err := parseURL("https://ethereum.org")

View file

@ -167,6 +167,7 @@ var MessageType_name = map[int32]string{
112: "MessageType_DebugLinkMemoryWrite",
113: "MessageType_DebugLinkFlashErase",
}
var MessageType_value = map[string]int32{
"MessageType_Initialize": 0,
"MessageType_Ping": 1,
@ -248,9 +249,11 @@ func (x MessageType) Enum() *MessageType {
*p = x
return p
}
func (x MessageType) String() string {
return proto.EnumName(MessageType_name, int32(x))
}
func (x *MessageType) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(MessageType_value, data, "MessageType")
if err != nil {

View file

@ -146,6 +146,7 @@ var FailureType_name = map[int32]string{
11: "Failure_NotInitialized",
99: "Failure_FirmwareError",
}
var FailureType_value = map[string]int32{
"Failure_UnexpectedMessage": 1,
"Failure_ButtonExpected": 2,
@ -166,9 +167,11 @@ func (x FailureType) Enum() *FailureType {
*p = x
return p
}
func (x FailureType) String() string {
return proto.EnumName(FailureType_name, int32(x))
}
func (x *FailureType) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(FailureType_value, data, "FailureType")
if err != nil {
@ -201,6 +204,7 @@ var OutputScriptType_name = map[int32]string{
4: "PAYTOWITNESS",
5: "PAYTOP2SHWITNESS",
}
var OutputScriptType_value = map[string]int32{
"PAYTOADDRESS": 0,
"PAYTOSCRIPTHASH": 1,
@ -215,9 +219,11 @@ func (x OutputScriptType) Enum() *OutputScriptType {
*p = x
return p
}
func (x OutputScriptType) String() string {
return proto.EnumName(OutputScriptType_name, int32(x))
}
func (x *OutputScriptType) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(OutputScriptType_value, data, "OutputScriptType")
if err != nil {
@ -248,6 +254,7 @@ var InputScriptType_name = map[int32]string{
3: "SPENDWITNESS",
4: "SPENDP2SHWITNESS",
}
var InputScriptType_value = map[string]int32{
"SPENDADDRESS": 0,
"SPENDMULTISIG": 1,
@ -261,9 +268,11 @@ func (x InputScriptType) Enum() *InputScriptType {
*p = x
return p
}
func (x InputScriptType) String() string {
return proto.EnumName(InputScriptType_name, int32(x))
}
func (x *InputScriptType) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(InputScriptType_value, data, "InputScriptType")
if err != nil {
@ -294,6 +303,7 @@ var RequestType_name = map[int32]string{
3: "TXFINISHED",
4: "TXEXTRADATA",
}
var RequestType_value = map[string]int32{
"TXINPUT": 0,
"TXOUTPUT": 1,
@ -307,9 +317,11 @@ func (x RequestType) Enum() *RequestType {
*p = x
return p
}
func (x RequestType) String() string {
return proto.EnumName(RequestType_name, int32(x))
}
func (x *RequestType) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(RequestType_value, data, "RequestType")
if err != nil {
@ -352,6 +364,7 @@ var ButtonRequestType_name = map[int32]string{
10: "ButtonRequest_Address",
11: "ButtonRequest_PublicKey",
}
var ButtonRequestType_value = map[string]int32{
"ButtonRequest_Other": 1,
"ButtonRequest_FeeOverThreshold": 2,
@ -371,9 +384,11 @@ func (x ButtonRequestType) Enum() *ButtonRequestType {
*p = x
return p
}
func (x ButtonRequestType) String() string {
return proto.EnumName(ButtonRequestType_name, int32(x))
}
func (x *ButtonRequestType) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(ButtonRequestType_value, data, "ButtonRequestType")
if err != nil {
@ -400,6 +415,7 @@ var PinMatrixRequestType_name = map[int32]string{
2: "PinMatrixRequestType_NewFirst",
3: "PinMatrixRequestType_NewSecond",
}
var PinMatrixRequestType_value = map[string]int32{
"PinMatrixRequestType_Current": 1,
"PinMatrixRequestType_NewFirst": 2,
@ -411,9 +427,11 @@ func (x PinMatrixRequestType) Enum() *PinMatrixRequestType {
*p = x
return p
}
func (x PinMatrixRequestType) String() string {
return proto.EnumName(PinMatrixRequestType_name, int32(x))
}
func (x *PinMatrixRequestType) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(PinMatrixRequestType_value, data, "PinMatrixRequestType")
if err != nil {
@ -445,6 +463,7 @@ var RecoveryDeviceType_name = map[int32]string{
0: "RecoveryDeviceType_ScrambledWords",
1: "RecoveryDeviceType_Matrix",
}
var RecoveryDeviceType_value = map[string]int32{
"RecoveryDeviceType_ScrambledWords": 0,
"RecoveryDeviceType_Matrix": 1,
@ -455,9 +474,11 @@ func (x RecoveryDeviceType) Enum() *RecoveryDeviceType {
*p = x
return p
}
func (x RecoveryDeviceType) String() string {
return proto.EnumName(RecoveryDeviceType_name, int32(x))
}
func (x *RecoveryDeviceType) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(RecoveryDeviceType_value, data, "RecoveryDeviceType")
if err != nil {
@ -484,6 +505,7 @@ var WordRequestType_name = map[int32]string{
1: "WordRequestType_Matrix9",
2: "WordRequestType_Matrix6",
}
var WordRequestType_value = map[string]int32{
"WordRequestType_Plain": 0,
"WordRequestType_Matrix9": 1,
@ -495,9 +517,11 @@ func (x WordRequestType) Enum() *WordRequestType {
*p = x
return p
}
func (x WordRequestType) String() string {
return proto.EnumName(WordRequestType_name, int32(x))
}
func (x *WordRequestType) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(WordRequestType_value, data, "WordRequestType")
if err != nil {

View file

@ -1007,9 +1007,9 @@ func newPodMetadata(env build.Environment, archive string) podMetadata {
// Cross compilation
func doXgo(cmdline []string) {
var (
alltools = flag.Bool("alltools", false, `Flag whether we're building all known tools, or only on in particular`)
)
var alltools = flag.Bool("alltools", false, `Flag whether we're building all known tools, or only on in particular`)
flag.CommandLine.Parse(cmdline)
env := build.Env()

View file

@ -176,14 +176,16 @@ Clef that the file is 'safe' to execute.`,
Description: `
The setpw command stores a password for a given address (keyfile). If you enter a blank passphrase, it will
remove any stored credential for that address (keyfile)
`}
`,
}
gendocCommand = cli.Command{
Action: GenDoc,
Name: "gendoc",
Usage: "Generate documentation about json-rpc format",
Description: `
The gendoc generates example structures of the json-rpc communication types.
`}
`,
}
)
func init() {
@ -213,8 +215,8 @@ func init() {
}
app.Action = signer
app.Commands = []cli.Command{initCommand, attestCommand, setCredentialCommand, gendocCommand}
}
func main() {
if err := app.Run(os.Args); err != nil {
fmt.Fprintln(os.Stderr, err)
@ -281,6 +283,7 @@ NOTE: This file does not contain your accounts. Those need to be backed up separ
`)
return nil
}
func attestFile(ctx *cli.Context) error {
if len(ctx.Args()) < 1 {
utils.Fatalf("This command requires an argument.")
@ -352,9 +355,9 @@ func signer(c *cli.Context) error {
if err := initialize(c); err != nil {
return err
}
var (
ui core.UIClientAPI
)
var ui core.UIClientAPI
if c.GlobalBool(stdiouiFlag.Name) {
log.Info("Using stdin/stdout as UI-channel")
ui = core.NewStdIOUI()
@ -391,7 +394,7 @@ func signer(c *cli.Context) error {
jsStorage := storage.NewAESEncryptedStorage(filepath.Join(vaultLocation, "jsstorage.json"), jskey)
configStorage := storage.NewAESEncryptedStorage(filepath.Join(vaultLocation, "config.json"), confkey)
//Do we have a rule-file?
// Do we have a rule-file?
if ruleFile := c.GlobalString(ruleFlag.Name); ruleFile != "" {
ruleJS, err := ioutil.ReadFile(c.GlobalString(ruleFile))
if err != nil {
@ -449,7 +452,8 @@ func signer(c *cli.Context) error {
Namespace: "account",
Public: true,
Service: api,
Version: "1.0"},
Version: "1.0",
},
}
if c.GlobalBool(utils.RPCEnabledFlag.Name) {
@ -554,6 +558,7 @@ func homeDir() string {
}
return ""
}
func readMasterKey(ctx *cli.Context, ui core.UIClientAPI) ([]byte, error) {
var (
file string
@ -577,7 +582,8 @@ func readMasterKey(ctx *cli.Context, ui core.UIClientAPI) ([]byte, error) {
resp, err := ui.OnInputRequired(core.UserInputRequest{
Title: "Master Password",
Prompt: "Please enter the password to decrypt the master seed",
IsPassword: true})
IsPassword: true,
})
if err != nil {
return nil, err
}
@ -634,7 +640,6 @@ func confirm(text string) bool {
}
func testExternalUI(api *core.SignerAPI) {
ctx := context.WithValue(context.Background(), "remote", "clef binary")
ctx = context.WithValue(ctx, "scheme", "in-proc")
ctx = context.WithValue(ctx, "local", "main")
@ -755,7 +760,6 @@ func testExternalUI(api *core.SignerAPI) {
}
result := fmt.Sprintf("Tests completed. %d errors:\n%s\n", len(errs), strings.Join(errs, "\n"))
api.UI.ShowInfo(result)
}
// getPassPhrase retrieves the password associated with clef, either fetched
@ -813,7 +817,6 @@ func decryptSeed(keyjson []byte, auth string) ([]byte, error) {
// GenDoc outputs examples of all structures used in json-rpc communication
func GenDoc(ctx *cli.Context) {
var (
a = common.HexToAddress("0xdeadbeef000000000000000000000000deadbeef")
b = common.HexToAddress("0x1111111122222222222233333333334444444444")
@ -848,7 +851,8 @@ func GenDoc(ctx *cli.Context) {
ContentType: accounts.MimetypeTextPlain,
Rawdata: []byte(msg),
Message: message,
Hash: sighash})
Hash: sighash,
})
}
{ // Sign plain text response
add("SignDataResponse - approve", "Response to SignDataRequest",
@ -883,13 +887,15 @@ func GenDoc(ctx *cli.Context) {
GasPrice: hexutil.Big(*big.NewInt(5)),
Gas: 1000,
Input: nil,
}})
},
})
}
{ // Sign tx response
data := hexutil.Bytes([]byte{0x04, 0x03, 0x02, 0x01})
add("SignTxResponse - approve", "Response to request to sign a transaction. This response needs to contain the `transaction`"+
", because the UI is free to make modifications to the transaction.",
&core.SignTxResponse{Approved: true,
&core.SignTxResponse{
Approved: true,
Transaction: core.SendTxArgs{
Data: &data,
Nonce: 0x4,
@ -899,7 +905,8 @@ func GenDoc(ctx *cli.Context) {
GasPrice: hexutil.Big(*big.NewInt(5)),
Gas: 1000,
Input: nil,
}})
},
})
add("SignTxResponse - deny", "Response to SignTxRequest. When denying a request, there's no need to "+
"provide the transaction in return",
&core.SignTxResponse{})
@ -939,7 +946,8 @@ func GenDoc(ctx *cli.Context) {
Meta: meta,
Accounts: []accounts.Account{
{a, accounts.URL{Scheme: "keystore", Path: "/path/to/keyfile/a"}},
{b, accounts.URL{Scheme: "keystore", Path: "/path/to/keyfile/b"}}},
{b, accounts.URL{Scheme: "keystore", Path: "/path/to/keyfile/b"}},
},
})
add("ListResponse", "Response to list request. The response contains a list of all addresses to show to the caller. "+
@ -948,7 +956,8 @@ func GenDoc(ctx *cli.Context) {
Accounts: []accounts.Account{
{common.HexToAddress("0xcowbeef000000cowbeef00000000000000000c0w"), accounts.URL{Path: ".. ignored .."}},
{common.HexToAddress("0xffffffffffffffffffffffffffffffffffffffff"), accounts.URL{}},
}})
},
})
}
fmt.Println(`## UI Client interface

View file

@ -24,9 +24,7 @@ import (
"gopkg.in/urfave/cli.v1"
)
const (
defaultKeyfileName = "keyfile.json"
)
const defaultKeyfileName = "keyfile.json"
// Git SHA1 commit hash of the release (set via linker flags)
var gitCommit = ""

View file

@ -52,7 +52,7 @@ var runCommand = cli.Command{
// the initialized Genesis structure
func readGenesis(genesisPath string) *core.Genesis {
// Make sure we have a valid genesis JSON
//genesisPath := ctx.Args().First()
// genesisPath := ctx.Args().First()
if len(genesisPath) == 0 {
utils.Fatalf("Must supply path to genesis JSON file")
}
@ -127,7 +127,7 @@ func runCmd(ctx *cli.Context) error {
var err error
// If - is specified, it means that code comes from stdin
if ctx.GlobalString(CodeFileFlag.Name) == "-" {
//Try reading from stdin
// Try reading from stdin
if hexcode, err = ioutil.ReadAll(os.Stdin); err != nil {
fmt.Printf("Could not load code from stdin: %v\n", err)
os.Exit(1)

View file

@ -84,9 +84,7 @@ var (
logFlag = flag.Int("loglevel", 3, "Log level to use for Ethereum and the faucet")
)
var (
ether = new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil)
)
var ether = new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil)
func main() {
// Parse the flags and set up the logger to print everything requested

View file

@ -51,18 +51,23 @@ type bindataFileInfo struct {
func (fi bindataFileInfo) Name() string {
return fi.name
}
func (fi bindataFileInfo) Size() int64 {
return fi.size
}
func (fi bindataFileInfo) Mode() os.FileMode {
return fi.mode
}
func (fi bindataFileInfo) ModTime() time.Time {
return fi.modTime
}
func (fi bindataFileInfo) IsDir() bool {
return false
}
func (fi bindataFileInfo) Sys() interface{} {
return nil
}

View file

@ -43,9 +43,7 @@ import (
cli "gopkg.in/urfave/cli.v1"
)
const (
clientIdentifier = "geth" // Client identifier to advertise over the network
)
const clientIdentifier = "geth" // Client identifier to advertise over the network
var (
// Git SHA1 commit hash of the release (set via linker flags)

View file

@ -147,25 +147,41 @@ func newAlethGenesisSpec(network string, genesis *core.Genesis) (*alethGenesisSp
spec.setAccount(address, account)
}
spec.setPrecompile(1, &alethGenesisSpecBuiltin{Name: "ecrecover",
Linear: &alethGenesisSpecLinearPricing{Base: 3000}})
spec.setPrecompile(2, &alethGenesisSpecBuiltin{Name: "sha256",
Linear: &alethGenesisSpecLinearPricing{Base: 60, Word: 12}})
spec.setPrecompile(3, &alethGenesisSpecBuiltin{Name: "ripemd160",
Linear: &alethGenesisSpecLinearPricing{Base: 600, Word: 120}})
spec.setPrecompile(4, &alethGenesisSpecBuiltin{Name: "identity",
Linear: &alethGenesisSpecLinearPricing{Base: 15, Word: 3}})
spec.setPrecompile(1, &alethGenesisSpecBuiltin{
Name: "ecrecover",
Linear: &alethGenesisSpecLinearPricing{Base: 3000},
})
spec.setPrecompile(2, &alethGenesisSpecBuiltin{
Name: "sha256",
Linear: &alethGenesisSpecLinearPricing{Base: 60, Word: 12},
})
spec.setPrecompile(3, &alethGenesisSpecBuiltin{
Name: "ripemd160",
Linear: &alethGenesisSpecLinearPricing{Base: 600, Word: 120},
})
spec.setPrecompile(4, &alethGenesisSpecBuiltin{
Name: "identity",
Linear: &alethGenesisSpecLinearPricing{Base: 15, Word: 3},
})
if genesis.Config.ByzantiumBlock != nil {
spec.setPrecompile(5, &alethGenesisSpecBuiltin{Name: "modexp",
StartingBlock: (hexutil.Uint64)(genesis.Config.ByzantiumBlock.Uint64())})
spec.setPrecompile(6, &alethGenesisSpecBuiltin{Name: "alt_bn128_G1_add",
spec.setPrecompile(5, &alethGenesisSpecBuiltin{
Name: "modexp",
StartingBlock: (hexutil.Uint64)(genesis.Config.ByzantiumBlock.Uint64()),
Linear: &alethGenesisSpecLinearPricing{Base: 500}})
spec.setPrecompile(7, &alethGenesisSpecBuiltin{Name: "alt_bn128_G1_mul",
})
spec.setPrecompile(6, &alethGenesisSpecBuiltin{
Name: "alt_bn128_G1_add",
StartingBlock: (hexutil.Uint64)(genesis.Config.ByzantiumBlock.Uint64()),
Linear: &alethGenesisSpecLinearPricing{Base: 40000}})
spec.setPrecompile(8, &alethGenesisSpecBuiltin{Name: "alt_bn128_pairing_product",
StartingBlock: (hexutil.Uint64)(genesis.Config.ByzantiumBlock.Uint64())})
Linear: &alethGenesisSpecLinearPricing{Base: 500},
})
spec.setPrecompile(7, &alethGenesisSpecBuiltin{
Name: "alt_bn128_G1_mul",
StartingBlock: (hexutil.Uint64)(genesis.Config.ByzantiumBlock.Uint64()),
Linear: &alethGenesisSpecLinearPricing{Base: 40000},
})
spec.setPrecompile(8, &alethGenesisSpecBuiltin{
Name: "alt_bn128_pairing_product",
StartingBlock: (hexutil.Uint64)(genesis.Config.ByzantiumBlock.Uint64()),
})
}
return spec, nil
}
@ -193,7 +209,6 @@ func (spec *alethGenesisSpec) setAccount(address common.Address, account core.Ge
}
a.Balance = (*math2.HexOrDecimal256)(account.Balance)
a.Nonce = account.Nonce
}
func (spec *alethGenesisSpec) setByzantium(num *big.Int) {
@ -385,8 +400,10 @@ func newParityChainSpec(network string, genesis *core.Genesis, bootnodes []strin
Nonce: math2.HexOrDecimal64(account.Nonce),
}
}
spec.setPrecompile(1, &parityChainSpecBuiltin{Name: "ecrecover",
Pricing: &parityChainSpecPricing{Linear: &parityChainSpecLinearPricing{Base: 3000}}})
spec.setPrecompile(1, &parityChainSpecBuiltin{
Name: "ecrecover",
Pricing: &parityChainSpecPricing{Linear: &parityChainSpecLinearPricing{Base: 3000}},
})
spec.setPrecompile(2, &parityChainSpecBuiltin{
Name: "sha256", Pricing: &parityChainSpecPricing{Linear: &parityChainSpecLinearPricing{Base: 60, Word: 12}},

View file

@ -204,7 +204,7 @@ func testPassword(t *testing.T) {
wrongPasswordFilename := testutil.TempFileWithContent(t, "just wr0ng")
defer os.RemoveAll(wrongPasswordFilename)
//download file with 'swarm down' with wrong password
// download file with 'swarm down' with wrong password
up = runSwarm(t,
"--bzzapi",
cluster.Nodes[0].URL,
@ -282,7 +282,7 @@ func testPK(t *testing.T) {
t.Fatalf("stdout not matched")
}
//get the public key from the publisher directory
// get the public key from the publisher directory
publicKeyFromDataDir := runSwarm(t,
"--bzzaccount",
publisherAccount.Address.String(),
@ -464,7 +464,7 @@ func testACT(t *testing.T, bogusEntries int) {
t.Fatalf("stdout not matched")
}
//get the public key from the publisher directory
// get the public key from the publisher directory
publicKeyFromDataDir := runSwarm(t,
"--bzzaccount",
publisherAccount.Address.String(),

View file

@ -39,7 +39,7 @@ import (
)
var (
//flag definition for the dumpconfig command
// flag definition for the dumpconfig command
DumpConfigCommand = cli.Command{
Action: utils.MigrateFlags(dumpConfig),
Name: "dumpconfig",
@ -50,14 +50,14 @@ var (
Description: `The dumpconfig command shows configuration values.`,
}
//flag definition for the config file command
// flag definition for the config file command
SwarmTomlConfigPathFlag = cli.StringFlag{
Name: "config",
Usage: "TOML configuration file",
}
)
//constants for environment variables
// constants for environment variables
const (
SwarmEnvChequebookAddr = "SWARM_CHEQUEBOOK_ADDR"
SwarmEnvAccount = "SWARM_ACCOUNT"
@ -103,49 +103,49 @@ var tomlSettings = toml.Config{
},
}
//before booting the swarm node, build the configuration
// before booting the swarm node, build the configuration
func buildConfig(ctx *cli.Context) (config *bzzapi.Config, err error) {
//start by creating a default config
// start by creating a default config
config = bzzapi.NewConfig()
//first load settings from config file (if provided)
// first load settings from config file (if provided)
config, err = configFileOverride(config, ctx)
if err != nil {
return nil, err
}
//override settings provided by environment variables
// override settings provided by environment variables
config = envVarsOverride(config)
//override settings provided by command line
// override settings provided by command line
config = cmdLineOverride(config, ctx)
//validate configuration parameters
// validate configuration parameters
err = validateConfig(config)
return
}
//finally, after the configuration build phase is finished, initialize
// finally, after the configuration build phase is finished, initialize
func initSwarmNode(config *bzzapi.Config, stack *node.Node, ctx *cli.Context, nodeconfig *node.Config) error {
//at this point, all vars should be set in the Config
//get the account for the provided swarm account
// at this point, all vars should be set in the Config
// get the account for the provided swarm account
prvkey := getAccount(config.BzzAccount, ctx, stack)
//set the resolved config path (geth --datadir)
// set the resolved config path (geth --datadir)
config.Path = expandPath(stack.InstanceDir())
//finally, initialize the configuration
// finally, initialize the configuration
err := config.Init(prvkey, nodeconfig.NodeKey())
if err != nil {
return err
}
//configuration phase completed here
// configuration phase completed here
log.Debug("Starting Swarm with the following parameters:")
//after having created the config, print it to screen
// after having created the config, print it to screen
log.Debug(printConfig(config))
return nil
}
//configFileOverride overrides the current config with the config file, if a config file has been provided
// configFileOverride overrides the current config with the config file, if a config file has been provided
func configFileOverride(config *bzzapi.Config, ctx *cli.Context) (*bzzapi.Config, error) {
var err error
//only do something if the -config flag has been set
// only do something if the -config flag has been set
if ctx.GlobalIsSet(SwarmTomlConfigPathFlag.Name) {
var filepath string
if filepath = ctx.GlobalString(SwarmTomlConfigPathFlag.Name); filepath == "" {
@ -158,9 +158,9 @@ func configFileOverride(config *bzzapi.Config, ctx *cli.Context) (*bzzapi.Config
}
defer f.Close()
//decode the TOML file into a Config struct
//note that we are decoding into the existing defaultConfig;
//if an entry is not present in the file, the default entry is kept
// decode the TOML file into a Config struct
// note that we are decoding into the existing defaultConfig;
// if an entry is not present in the file, the default entry is kept
err = tomlSettings.NewDecoder(f).Decode(&config)
// Add file name to errors that have a line number.
if _, ok := err.(*toml.LineError); ok {
@ -272,7 +272,6 @@ func cmdLineOverride(currentConfig *bzzapi.Config, ctx *cli.Context) *bzzapi.Con
}
return currentConfig
}
// envVarsOverride overrides the current config with whatver is provided in environment variables
@ -408,7 +407,7 @@ func dumpConfig(ctx *cli.Context) error {
return nil
}
//validate configuration parameters
// validate configuration parameters
func validateConfig(cfg *bzzapi.Config) (err error) {
for _, ensAPI := range cfg.EnsAPIs {
if ensAPI != "" {
@ -420,7 +419,7 @@ func validateConfig(cfg *bzzapi.Config) (err error) {
return nil
}
//validate EnsAPIs configuration parameter
// validate EnsAPIs configuration parameter
func validateEnsAPIs(s string) (err error) {
// missing contract address
if strings.HasPrefix(s, "@") {
@ -441,7 +440,7 @@ func validateEnsAPIs(s string) (err error) {
return nil
}
//print a Config as string
// print a Config as string
func printConfig(config *bzzapi.Config) string {
out, err := tomlSettings.Marshal(&config)
if err != nil {

View file

@ -142,17 +142,16 @@ func TestConfigCmdLineOverrides(t *testing.T) {
}
func TestConfigFileOverrides(t *testing.T) {
// assign ports
httpPort, err := assignTCPPort()
if err != nil {
t.Fatal(err)
}
//create a config file
//first, create a default conf
// create a config file
// first, create a default conf
defaultConf := api.NewConfig()
//change some values in order to test if they have been loaded
// change some values in order to test if they have been loaded
defaultConf.SyncEnabled = false
defaultConf.DeliverySkipCheck = true
defaultConf.NetworkID = 54
@ -160,18 +159,18 @@ func TestConfigFileOverrides(t *testing.T) {
defaultConf.DbCapacity = 9000000
defaultConf.HiveParams.KeepAliveInterval = 6000000000
defaultConf.Swap.Params.Strategy.AutoCashInterval = 600 * time.Second
//defaultConf.SyncParams.KeyBufferSize = 512
//create a TOML string
// defaultConf.SyncParams.KeyBufferSize = 512
// create a TOML string
out, err := tomlSettings.Marshal(&defaultConf)
if err != nil {
t.Fatalf("Error creating TOML file in TestFileOverride: %v", err)
}
//create file
// create file
f, err := ioutil.TempFile("", "testconfig.toml")
if err != nil {
t.Fatalf("Error writing TOML file in TestFileOverride: %v", err)
}
//write file
// write file
_, err = f.WriteString(string(out))
if err != nil {
t.Fatalf("Error writing TOML file in TestFileOverride: %v", err)
@ -280,9 +279,9 @@ func TestConfigEnvVars(t *testing.T) {
"--ipcpath", conf.IPCPath,
}
//node.Cmd = runSwarm(t,flags...)
//node.Cmd.cmd.Env = envVars
//the above assignment does not work, so we need a custom Cmd here in order to pass envVars:
// node.Cmd = runSwarm(t,flags...)
// node.Cmd.cmd.Env = envVars
// the above assignment does not work, so we need a custom Cmd here in order to pass envVars:
cmd := &exec.Cmd{
Path: reexec.Self(),
Args: append([]string{"swarm-test"}, flags...),
@ -290,11 +289,11 @@ func TestConfigEnvVars(t *testing.T) {
Stdout: os.Stdout,
}
cmd.Env = envVars
//stdout, err := cmd.StdoutPipe()
//if err != nil {
// stdout, err := cmd.StdoutPipe()
// if err != nil {
// t.Fatal(err)
//}
//stdout = bufio.NewReader(stdout)
// stdout = bufio.NewReader(stdout)
var stdin io.WriteCloser
if stdin, err = cmd.StdinPipe(); err != nil {
t.Fatal(err)
@ -303,7 +302,7 @@ func TestConfigEnvVars(t *testing.T) {
t.Fatal(err)
}
//cmd.InputLine(testPassphrase)
// cmd.InputLine(testPassphrase)
io.WriteString(stdin, testPassphrase+"\n")
defer func() {
if t.Failed() {
@ -354,37 +353,36 @@ func TestConfigEnvVars(t *testing.T) {
}
func TestConfigCmdLineOverridesFile(t *testing.T) {
// assign ports
httpPort, err := assignTCPPort()
if err != nil {
t.Fatal(err)
}
//create a config file
//first, create a default conf
// create a config file
// first, create a default conf
defaultConf := api.NewConfig()
//change some values in order to test if they have been loaded
// change some values in order to test if they have been loaded
defaultConf.SyncEnabled = true
defaultConf.NetworkID = 54
defaultConf.Port = "8588"
defaultConf.DbCapacity = 9000000
defaultConf.HiveParams.KeepAliveInterval = 6000000000
defaultConf.Swap.Params.Strategy.AutoCashInterval = 600 * time.Second
//defaultConf.SyncParams.KeyBufferSize = 512
//create a TOML file
// defaultConf.SyncParams.KeyBufferSize = 512
// create a TOML file
out, err := tomlSettings.Marshal(&defaultConf)
if err != nil {
t.Fatalf("Error creating TOML file in TestFileOverride: %v", err)
}
//write file
// write file
fname := "testconfig.toml"
f, err := ioutil.TempFile("", fname)
if err != nil {
t.Fatalf("Error writing TOML file in TestFileOverride: %v", err)
}
defer os.Remove(fname)
//write file
// write file
_, err = f.WriteString(string(out))
if err != nil {
t.Fatalf("Error writing TOML file in TestFileOverride: %v", err)

View file

@ -136,7 +136,6 @@ func feedCreateManifest(ctx *cli.Context) {
return
}
fmt.Println(manifestAddress) // output manifest address to the user in a single line (useful for other commands to pick up)
}
func feedUpdate(ctx *cli.Context) {
@ -234,5 +233,4 @@ func feedGetUser(ctx *cli.Context) common.Address {
utils.Fatalf("Cannot read private key. Must specify --user or --bzzaccount")
}
return crypto.PubkeyToAddress(pk.PublicKey)
}

View file

@ -65,7 +65,8 @@ func TestCLIFeedUpdate(t *testing.T) {
"feed", "update",
"--topic", topic.Hex(),
"--name", name,
hexData}
hexData,
}
// create an update and expect an exit without errors
log.Info("updating a feed with 'swarm feed update'")
@ -183,7 +184,8 @@ func TestCLIFeedUpdate(t *testing.T) {
"--bzzaccount", pkFileName,
"feed", "update",
"--manifest", manifestAddress,
hexData}
hexData,
}
// create an update and expect an error given there is a user mismatch
log.Info("updating a feed with 'swarm feed update'")

View file

@ -110,7 +110,7 @@ func unmount(cliContext *cli.Context) {
if err != nil {
utils.Fatalf("encountered an error calling the RPC endpoint while unmounting: %v", err)
}
fmt.Printf("%s\n", mf.LatestManifest) //print the latest manifest hash for user reference
fmt.Printf("%s\n", mf.LatestManifest) // print the latest manifest hash for user reference
}
func listMounts(cliContext *cli.Context) {

View file

@ -137,7 +137,7 @@ func TestCLISwarmFs(t *testing.T) {
}
log.Debug("swarmfs cli test: asserting no files in mount point")
//check that there's nothing in the mount folder
// check that there's nothing in the mount folder
filesInDir, err := ioutil.ReadDir(mountPoint)
if err != nil {
t.Fatalf("had an error reading the directory: %v", err)
@ -156,7 +156,7 @@ func TestCLISwarmFs(t *testing.T) {
log.Debug("swarmfs cli test: remounting at second mount point", "ipc path", filepath.Join(handlingNode.Dir, handlingNode.IpcPath))
//remount, check files
// remount, check files
newMount := runSwarm(t, []string{
fmt.Sprintf("--%s", utils.IPCPathFlag.Name), filepath.Join(handlingNode.Dir, handlingNode.IpcPath),
"fs",
@ -222,7 +222,8 @@ func doUploadEmptyDir(t *testing.T, node *testNode) string {
"--bzzapi", node.URL,
"--recursive",
"up",
tmpDir}
tmpDir,
}
log.Info("swarmfs cli test: uploading dir with 'swarm up'")
up := runSwarm(t, flags...)

View file

@ -63,7 +63,8 @@ var hashCommand = cli.Command{
},
},
},
}}
},
}
func hash(ctx *cli.Context) {
args := ctx.Args()
@ -85,6 +86,7 @@ func hash(ctx *cli.Context) {
fmt.Printf("%v\n", addr)
}
}
func ensNodeHash(ctx *cli.Context) {
args := ctx.Args()
if len(args) < 1 {
@ -97,6 +99,7 @@ func ensNodeHash(ctx *cli.Context) {
stringHex := hex.EncodeToString(hash[:])
fmt.Println(stringHex)
}
func encodeEipHash(ctx *cli.Context) {
args := ctx.Args()
if len(args) < 1 {

View file

@ -74,7 +74,7 @@ OPTIONS:
// e.g.: go install -ldflags "-X main.gitCommit=ed1312d01b19e04ef578946226e5d8069d5dfd5a" ./cmd/swarm
var gitCommit string
//declare a few constant error messages, useful for later error check comparisons in test
// declare a few constant error messages, useful for later error check comparisons in test
var (
SwarmErrNoBZZAccount = "bzzaccount option is required but not set; check your config file, command line or environment variables"
SwarmErrSwapSetNoAPI = "SWAP is enabled but --swap-api is not set"
@ -262,8 +262,8 @@ func version(ctx *cli.Context) error {
}
func bzzd(ctx *cli.Context) error {
//build a valid bzzapi.Config from all available sources:
//default config, file config, command line and env vars
// build a valid bzzapi.Config from all available sources:
// default config, file config, command line and env vars
bzzconfig, err := buildConfig(ctx)
if err != nil {
@ -272,22 +272,22 @@ func bzzd(ctx *cli.Context) error {
cfg := defaultNodeConfig
//pss operates on ws
// pss operates on ws
cfg.WSModules = append(cfg.WSModules, "pss")
//geth only supports --datadir via command line
//in order to be consistent within swarm, if we pass --datadir via environment variable
//or via config file, we get the same directory for geth and swarm
// geth only supports --datadir via command line
// in order to be consistent within swarm, if we pass --datadir via environment variable
// or via config file, we get the same directory for geth and swarm
if _, err := os.Stat(bzzconfig.Path); err == nil {
cfg.DataDir = bzzconfig.Path
}
//optionally set the bootnodes before configuring the node
// optionally set the bootnodes before configuring the node
setSwarmBootstrapNodes(ctx, &cfg)
//setup the ethereum node
// setup the ethereum node
utils.SetNodeConfig(ctx, &cfg)
//disable dynamic dialing from p2p/discovery
// disable dynamic dialing from p2p/discovery
cfg.P2P.NoDial = true
stack, err := node.New(&cfg)
@ -296,15 +296,15 @@ func bzzd(ctx *cli.Context) error {
}
defer stack.Close()
//a few steps need to be done after the config phase is completed,
//due to overriding behavior
// a few steps need to be done after the config phase is completed,
// due to overriding behavior
err = initSwarmNode(bzzconfig, stack, ctx, &cfg)
if err != nil {
return err
}
//register BZZ as node.Service in the ethereum node
// register BZZ as node.Service in the ethereum node
registerBzzService(bzzconfig, stack)
//start the node
// start the node
utils.StartNode(stack)
go func() {
@ -330,7 +330,7 @@ func bzzd(ctx *cli.Context) error {
}
func registerBzzService(bzzconfig *bzzapi.Config, stack *node.Node) {
//define the swarm service boot function
// define the swarm service boot function
boot := func(_ *node.ServiceContext) (node.Service, error) {
var nodeStore *mock.NodeStore
if bzzconfig.GlobalStoreAPI != "" {
@ -345,14 +345,14 @@ func registerBzzService(bzzconfig *bzzapi.Config, stack *node.Node) {
}
return swarm.NewSwarm(bzzconfig, nodeStore)
}
//register within the ethereum node
// register within the ethereum node
if err := stack.Register(boot); err != nil {
utils.Fatalf("Failed to register the Swarm service: %v", err)
}
}
func getAccount(bzzaccount string, ctx *cli.Context, stack *node.Node) *ecdsa.PrivateKey {
//an account is mandatory
// an account is mandatory
if bzzaccount == "" {
utils.Fatalf(SwarmErrNoBZZAccount)
}
@ -471,5 +471,4 @@ func setSwarmBootstrapNodes(ctx *cli.Context, cfg *node.Config) {
}
cfg.P2P.BootstrapNodes = append(cfg.P2P.BootstrapNodes, node)
}
}

View file

@ -71,6 +71,7 @@ func initCluster(t *testing.T) {
func serverFunc(api *api.API) swarmhttp.TestServer {
return swarmhttp.NewServer(api, "")
}
func TestMain(m *testing.M) {
// check if we have been reexec'd
if reexec.Init() {
@ -322,7 +323,6 @@ func existingTestNode(t *testing.T, dir string, bzzaccount string) *testNode {
}
func newTestNode(t *testing.T, dir string) *testNode {
conf, account := getTestAccount(t, dir)
ks := keystore.NewKeyStore(path.Join(dir, "keystore"), 1<<18, 1)

View file

@ -22,9 +22,7 @@ import (
cli "gopkg.in/urfave/cli.v1"
)
const (
feedRandomDataLength = 8
)
const feedRandomDataLength = 8
func feedUploadAndSyncCmd(ctx *cli.Context, tuid string) error {
errc := make(chan error)
@ -265,7 +263,6 @@ func feedUploadAndSync(c *cli.Context, tuid string) error {
time.Sleep(3 * time.Second)
for _, host := range hosts {
// manifest retrieve, topic only
for _, url := range []string{manifestWithTopic, manifestWithSubTopic, manifestWithMergedTopic} {
wg.Add(1)
@ -282,7 +279,6 @@ func feedUploadAndSync(c *cli.Context, tuid string) error {
}
}(url, httpEndpoint(host), ruid)
}
}
wg.Wait()
log.Info("all endpoints synced random file successfully")

View file

@ -32,9 +32,7 @@ import (
cli "gopkg.in/urfave/cli.v1"
)
var (
gitCommit string // Git SHA1 commit hash of the release (set via linker flags)
)
var gitCommit string // Git SHA1 commit hash of the release (set via linker flags)
var (
allhosts string
@ -51,7 +49,6 @@ var (
)
func main() {
app := cli.NewApp()
app.Name = "smoke-test"
app.Usage = ""

View file

@ -50,7 +50,7 @@ func slidingWindowCmd(ctx *cli.Context, tuid string) error {
}
func slidingWindow(ctx *cli.Context, tuid string) error {
var hashes []uploadResult //swarm hashes of the uploads
var hashes []uploadResult // swarm hashes of the uploads
nodes := len(hosts)
log.Info("sliding window test started", "tuid", tuid, "nodes", nodes, "filesize(kb)", filesize, "timeout", timeout)
uploadedBytes := 0

View file

@ -107,7 +107,7 @@ func fetchFeed(topic string, user string, endpoint string, original []byte, ruid
req = req.WithContext(httptrace.WithClientTrace(ctx, trace))
transport := http.DefaultTransport
//transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
// transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
tn = time.Now()
res, err := transport.RoundTrip(req)
@ -162,7 +162,7 @@ func fetch(hash string, endpoint string, original []byte, ruid string, tuid stri
req = req.WithContext(httptrace.WithClientTrace(ctx, trace))
transport := http.DefaultTransport
//transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
// transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
tn = time.Now()
res, err := transport.RoundTrip(req)

View file

@ -137,7 +137,6 @@ func TestSnapshotCreate(t *testing.T) {
t.Errorf("got services %v for node %v, want %v", gotServices, i, wantServices)
}
}
})
}
}

View file

@ -93,14 +93,16 @@ func testDefault(toEncrypt bool, t *testing.T) {
flags := []string{
"--bzzapi", cluster.Nodes[0].URL,
"up",
tmpFileName}
tmpFileName,
}
if toEncrypt {
hashRegexp = `[a-f\d]{128}`
flags = []string{
"--bzzapi", cluster.Nodes[0].URL,
"up",
"--encrypt",
tmpFileName}
tmpFileName,
}
}
// upload the file with 'swarm up' and expect a hash
log.Info(fmt.Sprintf("uploading file with 'swarm up'"))
@ -131,7 +133,7 @@ func testDefault(toEncrypt bool, t *testing.T) {
t.Fatalf("expected HTTP body %q, got %q", data, reply)
}
log.Debug("verifying uploaded file using `swarm down`")
//try to get the content with `swarm down`
// try to get the content with `swarm down`
tmpDownload, err := ioutil.TempDir("", "swarm-test")
tmpDownload = path.Join(tmpDownload, "tmpfile.tmp")
if err != nil {
@ -207,7 +209,8 @@ func testRecursive(toEncrypt bool, t *testing.T) {
"--bzzapi", cluster.Nodes[0].URL,
"--recursive",
"up",
tmpUploadDir}
tmpUploadDir,
}
if toEncrypt {
hashRegexp = `[a-f\d]{128}`
flags = []string{
@ -215,7 +218,8 @@ func testRecursive(toEncrypt bool, t *testing.T) {
"--recursive",
"up",
"--encrypt",
tmpUploadDir}
tmpUploadDir,
}
}
// upload the file with 'swarm up' and expect a hash
log.Info(fmt.Sprintf("uploading file with 'swarm up'"))
@ -228,7 +232,7 @@ func testRecursive(toEncrypt bool, t *testing.T) {
// get the file from the HTTP API of each node
for _, node := range cluster.Nodes {
log.Info("getting file from node", "node", node.Name)
//try to get the content with `swarm down`
// try to get the content with `swarm down`
tmpDownload, err := ioutil.TempDir("", "swarm-test")
if err != nil {
t.Fatal(err)

View file

@ -39,9 +39,7 @@ import (
"github.com/ethereum/go-ethereum/rlp"
)
const (
importBatchSize = 2500
)
const importBatchSize = 2500
// Fatalf formats a message to standard error and exits the program.
// The message is also printed to standard output if standard error

View file

@ -60,8 +60,7 @@ import (
cli "gopkg.in/urfave/cli.v1"
)
var (
CommandHelpTemplate = `{{.cmd.Name}}{{if .cmd.Subcommands}} command{{end}}{{if .cmd.Flags}} [command options]{{end}} [arguments...]
var CommandHelpTemplate = `{{.cmd.Name}}{{if .cmd.Subcommands}} command{{end}}{{if .cmd.Flags}} [command options]{{end}} [arguments...]
{{if .cmd.Description}}{{.cmd.Description}}
{{end}}{{if .cmd.Subcommands}}
SUBCOMMANDS:
@ -71,7 +70,6 @@ SUBCOMMANDS:
{{range $categorized.Flags}}{{"\t"}}{{.}}
{{end}}
{{end}}{{end}}`
)
func init() {
cli.AppHelpTemplate = `{{.Name}} {{if .Flags}}[global options] {{end}}command{{if .Flags}} [command options]{{end}} [arguments...]
@ -95,7 +93,7 @@ func NewApp(gitCommit, usage string) *cli.App {
app := cli.NewApp()
app.Name = filepath.Base(os.Args[0])
app.Author = ""
//app.Authors = nil
// app.Authors = nil
app.Email = ""
app.Version = params.VersionWithMeta
if len(gitCommit) >= 8 {

View file

@ -661,7 +661,7 @@ func writeMessageToFile(dir string, msg *whisper.ReceivedMessage, show bool) {
}
// this is a sample code; uncomment if you don't want to save your own messages.
//if whisper.IsPubKeyEqual(msg.Src, &asymKey.PublicKey) {
// if whisper.IsPubKeyEqual(msg.Src, &asymKey.PublicKey) {
// fmt.Printf("\n%s <%x>: message from myself received, not saved: '%s'\n", timestamp, address, name)
// return
//}

View file

@ -21,8 +21,7 @@ import (
"testing"
)
const (
testSource = `
const testSource = `
pragma solidity >0.0.0;
contract test {
/// @notice Will multiply ` + "`a`" + ` by 7.
@ -31,7 +30,6 @@ contract test {
}
}
`
)
func skipWithoutSolc(t *testing.T) {
if _, err := exec.LookPath("solc"); err != nil {

View file

@ -171,7 +171,6 @@ func BenchmarkByteAt(b *testing.B) {
}
func BenchmarkByteAtOld(b *testing.B) {
bigint := MustParseBig256("0x18F8F8F1000111000110011100222004330052300000000000000000FEFCF3CC")
for i := 0; i < b.N; i++ {
PaddedBigBytes(bigint, 32)
@ -237,6 +236,7 @@ func TestBigEndianByteAt(t *testing.T) {
}
}
func TestLittleEndianByteAt(t *testing.T) {
tests := []struct {
x string

View file

@ -16,9 +16,7 @@
package math
import (
"testing"
)
import "testing"
type operation byte

View file

@ -2,9 +2,7 @@
package prque
import (
"container/heap"
)
import "container/heap"
// Priority queue data structure.
type Prque struct {

View file

@ -16,9 +16,7 @@
package common
import (
"fmt"
)
import "fmt"
// StorageSize is a wrapper around a float value that supports user friendly
// formatting.

View file

@ -16,9 +16,7 @@
package common
import (
"testing"
)
import "testing"
func TestStorageSizeString(t *testing.T) {
tests := []struct {

View file

@ -153,7 +153,6 @@ func BenchmarkAddressHex(b *testing.B) {
}
func TestMixedcaseAccount_Address(t *testing.T) {
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-55.md
// Note: 0X{checksum_addr} is not valid according to spec above
@ -176,7 +175,7 @@ func TestMixedcaseAccount_Address(t *testing.T) {
}
}
//These should throw exceptions:
// These should throw exceptions:
var r2 []MixedcaseAddress
for _, r := range []string{
`["0x11111111111111111111122222222222233333"]`, // Too short
@ -185,14 +184,12 @@ func TestMixedcaseAccount_Address(t *testing.T) {
`["0x111111111111111111111222222222222333332344"]`, // Too long
`["1111111111111111111112222222222223333323"]`, // Missing 0x
`["x1111111111111111111112222222222223333323"]`, // Missing 0
`["0xG111111111111111111112222222222223333323"]`, //Non-hex
`["0xG111111111111111111112222222222223333323"]`, // Non-hex
} {
if err := json.Unmarshal([]byte(r), &r2); err == nil {
t.Errorf("Expected failure, input %v", r)
}
}
}
func TestHash_Scan(t *testing.T) {

View file

@ -814,7 +814,8 @@ var datasetSizes = [maxEpoch]uint64{
18102613376, 18111004544, 18119388544, 18127781248, 18136170368,
18144558976, 18152947328, 18161336192, 18169724288, 18178108544,
18186498944, 18194886784, 18203275648, 18211666048, 18220048768,
18228444544, 18236833408, 18245220736}
18228444544, 18236833408, 18245220736,
}
// cacheSizes is a lookup table for the ethash verification cache size for the
// first 2048 epochs (i.e. 61440000 blocks).
@ -1145,4 +1146,5 @@ var cacheSizes = [maxEpoch]uint64{
282590272, 282720832, 282853184, 282983744, 283115072, 283246144,
283377344, 283508416, 283639744, 283770304, 283901504, 284032576,
284163136, 284294848, 284426176, 284556992, 284687296, 284819264,
284950208, 285081536}
284950208, 285081536,
}

View file

@ -36,10 +36,8 @@ import (
"github.com/ethereum/go-ethereum/log"
)
const (
// staleThreshold is the maximum depth of the acceptable stale but valid ethash solution.
staleThreshold = 7
)
// staleThreshold is the maximum depth of the acceptable stale but valid ethash solution.
const staleThreshold = 7
var (
errNoMiningWork = errors.New("no mining work available yet")

View file

@ -157,7 +157,7 @@ func (c *Console) init(preload []string) error {
return fmt.Errorf("namespace flattening: %v", err)
}
// Initialize the global name register (disabled for now)
//c.jsre.Run(`var GlobalRegistrar = eth.contract(` + registrar.GlobalRegistrarAbi + `); registrar = GlobalRegistrar.at("` + registrar.GlobalRegistrarAddr + `");`)
// c.jsre.Run(`var GlobalRegistrar = eth.contract(` + registrar.GlobalRegistrarAbi + `); registrar = GlobalRegistrar.at("` + registrar.GlobalRegistrarAddr + `");`)
// If the console is in interactive mode, instrument password related methods to query the user
if c.prompter != nil {

View file

@ -63,6 +63,7 @@ func (p *hookedPrompter) PromptInput(prompt string) (string, error) {
func (p *hookedPrompter) PromptPassword(prompt string) (string, error) {
return "", errors.New("not implemented")
}
func (p *hookedPrompter) PromptConfirm(prompt string) (bool, error) {
return false, errors.New("not implemented")
}

View file

@ -55,10 +55,8 @@ import (
// * depositing ether to the chequebook
// * watching incoming ether
var (
gasToCash = uint64(2000000) // gas cost of a cash transaction using chequebook
// gasToDeploy = uint64(3000000)
)
var gasToCash = uint64(2000000) // gas cost of a cash transaction using chequebook
// gasToDeploy = uint64(3000000)
// Backend wraps all methods required for chequebook operation.
type Backend interface {
@ -100,7 +98,7 @@ type Chequebook struct {
// persisted fields
balance *big.Int // not synced with blockchain
contractAddr common.Address // contract address
sent map[common.Address]*big.Int //tallies for beneficiaries
sent map[common.Address]*big.Int // tallies for beneficiaries
txhash string // tx hash of last deposit tx
threshold *big.Int // threshold that triggers autodeposit if not nil

View file

@ -105,7 +105,6 @@ func TestIssueAndReceive(t *testing.T) {
if received.Cmp(big.NewInt(43)) != 0 {
t.Errorf("expected: %v, got %v", "43", received)
}
}
func TestCheckbookFile(t *testing.T) {
@ -216,7 +215,6 @@ func TestVerifyErrors(t *testing.T) {
if err == nil {
t.Fatalf("expected incorrect amount error, got none and value %v", received)
}
}
func TestDeposit(t *testing.T) {
@ -355,7 +353,6 @@ func TestDeposit(t *testing.T) {
if chbook.Balance().Cmp(exp) != 0 {
t.Fatalf("expected balance %v, got %v", exp, chbook.Balance())
}
}
func TestCash(t *testing.T) {
@ -483,5 +480,4 @@ func TestCash(t *testing.T) {
t.Fatalf("expected no error, got %v", err)
}
backend.Commit()
}

View file

@ -180,9 +180,9 @@ func (_Chequebook *ChequebookTransactorRaw) Transact(opts *bind.TransactOpts, me
//
// Solidity: function sent( address) constant returns(uint256)
func (_Chequebook *ChequebookCaller) Sent(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) {
var (
ret0 = new(*big.Int)
)
var ret0 = new(*big.Int)
out := ret0
err := _Chequebook.contract.Call(opts, out, "sent", arg0)
return *ret0, err
@ -321,7 +321,6 @@ type ChequebookOverdraft struct {
//
// Solidity: event Overdraft(deadbeat address)
func (_Chequebook *ChequebookFilterer) FilterOverdraft(opts *bind.FilterOpts) (*ChequebookOverdraftIterator, error) {
logs, sub, err := _Chequebook.contract.FilterLogs(opts, "Overdraft")
if err != nil {
return nil, err
@ -333,7 +332,6 @@ func (_Chequebook *ChequebookFilterer) FilterOverdraft(opts *bind.FilterOpts) (*
//
// Solidity: event Overdraft(deadbeat address)
func (_Chequebook *ChequebookFilterer) WatchOverdraft(opts *bind.WatchOpts, sink chan<- *ChequebookOverdraft) (event.Subscription, error) {
logs, sub, err := _Chequebook.contract.WatchLogs(opts, "Overdraft")
if err != nil {
return nil, err

View file

@ -80,7 +80,7 @@ func extractContentHash(buf []byte) (common.Hash, error) {
return common.Hash{}, errors.New("unknown storage system")
}
//todo: for the time being we implement loose enforcement for the EIP rules until ENS manager is updated
// todo: for the time being we implement loose enforcement for the EIP rules until ENS manager is updated
/*if contentType != swarmTypecode {
return common.Hash{}, errors.New("unknown content type")
}
@ -103,11 +103,11 @@ func extractContentHash(buf []byte) (common.Hash, error) {
func EncodeSwarmHash(hash common.Hash) ([]byte, error) {
var cidBytes []byte
var headerBytes = []byte{
nsSwarm, //swarm namespace
nsSwarm, // swarm namespace
cidv1, // CIDv1
swarmTypecode, // swarm hash
swarmHashtype, // keccak256 hash
hashLength, //hash length. 32 bytes
hashLength, // hash length. 32 bytes
}
varintbuf := make([]byte, binary.MaxVarintLen64)

View file

@ -64,8 +64,8 @@ func TestEIPSpecCidDecode(t *testing.T) {
if !bytes.Equal(hashBytes, decodedHashBytes) {
t.Fatal("should be equal")
}
}
func TestManualCidDecode(t *testing.T) {
// call cid encode method with hash. expect byte slice returned, compare according to spec

View file

@ -192,9 +192,9 @@ func (_ENS *ENSTransactorRaw) Transact(opts *bind.TransactOpts, method string, p
//
// Solidity: function owner(bytes32 node) constant returns(address)
func (_ENS *ENSCaller) Owner(opts *bind.CallOpts, node [32]byte) (common.Address, error) {
var (
ret0 = new(common.Address)
)
var ret0 = new(common.Address)
out := ret0
err := _ENS.contract.Call(opts, out, "owner", node)
return *ret0, err
@ -218,9 +218,9 @@ func (_ENS *ENSCallerSession) Owner(node [32]byte) (common.Address, error) {
//
// Solidity: function resolver(bytes32 node) constant returns(address)
func (_ENS *ENSCaller) Resolver(opts *bind.CallOpts, node [32]byte) (common.Address, error) {
var (
ret0 = new(common.Address)
)
var ret0 = new(common.Address)
out := ret0
err := _ENS.contract.Call(opts, out, "resolver", node)
return *ret0, err
@ -244,9 +244,9 @@ func (_ENS *ENSCallerSession) Resolver(node [32]byte) (common.Address, error) {
//
// Solidity: function ttl(bytes32 node) constant returns(uint64)
func (_ENS *ENSCaller) Ttl(opts *bind.CallOpts, node [32]byte) (uint64, error) {
var (
ret0 = new(uint64)
)
var ret0 = new(uint64)
out := ret0
err := _ENS.contract.Call(opts, out, "ttl", node)
return *ret0, err
@ -429,7 +429,6 @@ type ENSNewOwner struct {
//
// Solidity: event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner)
func (_ENS *ENSFilterer) FilterNewOwner(opts *bind.FilterOpts, node [][32]byte, label [][32]byte) (*ENSNewOwnerIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -450,7 +449,6 @@ func (_ENS *ENSFilterer) FilterNewOwner(opts *bind.FilterOpts, node [][32]byte,
//
// Solidity: event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner)
func (_ENS *ENSFilterer) WatchNewOwner(opts *bind.WatchOpts, sink chan<- *ENSNewOwner, node [][32]byte, label [][32]byte) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -570,7 +568,6 @@ type ENSNewResolver struct {
//
// Solidity: event NewResolver(bytes32 indexed node, address resolver)
func (_ENS *ENSFilterer) FilterNewResolver(opts *bind.FilterOpts, node [][32]byte) (*ENSNewResolverIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -587,7 +584,6 @@ func (_ENS *ENSFilterer) FilterNewResolver(opts *bind.FilterOpts, node [][32]byt
//
// Solidity: event NewResolver(bytes32 indexed node, address resolver)
func (_ENS *ENSFilterer) WatchNewResolver(opts *bind.WatchOpts, sink chan<- *ENSNewResolver, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -703,7 +699,6 @@ type ENSNewTTL struct {
//
// Solidity: event NewTTL(bytes32 indexed node, uint64 ttl)
func (_ENS *ENSFilterer) FilterNewTTL(opts *bind.FilterOpts, node [][32]byte) (*ENSNewTTLIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -720,7 +715,6 @@ func (_ENS *ENSFilterer) FilterNewTTL(opts *bind.FilterOpts, node [][32]byte) (*
//
// Solidity: event NewTTL(bytes32 indexed node, uint64 ttl)
func (_ENS *ENSFilterer) WatchNewTTL(opts *bind.WatchOpts, sink chan<- *ENSNewTTL, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -836,7 +830,6 @@ type ENSTransfer struct {
//
// Solidity: event Transfer(bytes32 indexed node, address owner)
func (_ENS *ENSFilterer) FilterTransfer(opts *bind.FilterOpts, node [][32]byte) (*ENSTransferIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -853,7 +846,6 @@ func (_ENS *ENSFilterer) FilterTransfer(opts *bind.FilterOpts, node [][32]byte)
//
// Solidity: event Transfer(bytes32 indexed node, address owner)
func (_ENS *ENSFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ENSTransfer, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)

View file

@ -192,9 +192,9 @@ func (_ENSRegistry *ENSRegistryTransactorRaw) Transact(opts *bind.TransactOpts,
//
// Solidity: function owner(bytes32 node) constant returns(address)
func (_ENSRegistry *ENSRegistryCaller) Owner(opts *bind.CallOpts, node [32]byte) (common.Address, error) {
var (
ret0 = new(common.Address)
)
var ret0 = new(common.Address)
out := ret0
err := _ENSRegistry.contract.Call(opts, out, "owner", node)
return *ret0, err
@ -218,9 +218,9 @@ func (_ENSRegistry *ENSRegistryCallerSession) Owner(node [32]byte) (common.Addre
//
// Solidity: function resolver(bytes32 node) constant returns(address)
func (_ENSRegistry *ENSRegistryCaller) Resolver(opts *bind.CallOpts, node [32]byte) (common.Address, error) {
var (
ret0 = new(common.Address)
)
var ret0 = new(common.Address)
out := ret0
err := _ENSRegistry.contract.Call(opts, out, "resolver", node)
return *ret0, err
@ -244,9 +244,9 @@ func (_ENSRegistry *ENSRegistryCallerSession) Resolver(node [32]byte) (common.Ad
//
// Solidity: function ttl(bytes32 node) constant returns(uint64)
func (_ENSRegistry *ENSRegistryCaller) Ttl(opts *bind.CallOpts, node [32]byte) (uint64, error) {
var (
ret0 = new(uint64)
)
var ret0 = new(uint64)
out := ret0
err := _ENSRegistry.contract.Call(opts, out, "ttl", node)
return *ret0, err
@ -429,7 +429,6 @@ type ENSRegistryNewOwner struct {
//
// Solidity: event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner)
func (_ENSRegistry *ENSRegistryFilterer) FilterNewOwner(opts *bind.FilterOpts, node [][32]byte, label [][32]byte) (*ENSRegistryNewOwnerIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -450,7 +449,6 @@ func (_ENSRegistry *ENSRegistryFilterer) FilterNewOwner(opts *bind.FilterOpts, n
//
// Solidity: event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner)
func (_ENSRegistry *ENSRegistryFilterer) WatchNewOwner(opts *bind.WatchOpts, sink chan<- *ENSRegistryNewOwner, node [][32]byte, label [][32]byte) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -570,7 +568,6 @@ type ENSRegistryNewResolver struct {
//
// Solidity: event NewResolver(bytes32 indexed node, address resolver)
func (_ENSRegistry *ENSRegistryFilterer) FilterNewResolver(opts *bind.FilterOpts, node [][32]byte) (*ENSRegistryNewResolverIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -587,7 +584,6 @@ func (_ENSRegistry *ENSRegistryFilterer) FilterNewResolver(opts *bind.FilterOpts
//
// Solidity: event NewResolver(bytes32 indexed node, address resolver)
func (_ENSRegistry *ENSRegistryFilterer) WatchNewResolver(opts *bind.WatchOpts, sink chan<- *ENSRegistryNewResolver, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -703,7 +699,6 @@ type ENSRegistryNewTTL struct {
//
// Solidity: event NewTTL(bytes32 indexed node, uint64 ttl)
func (_ENSRegistry *ENSRegistryFilterer) FilterNewTTL(opts *bind.FilterOpts, node [][32]byte) (*ENSRegistryNewTTLIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -720,7 +715,6 @@ func (_ENSRegistry *ENSRegistryFilterer) FilterNewTTL(opts *bind.FilterOpts, nod
//
// Solidity: event NewTTL(bytes32 indexed node, uint64 ttl)
func (_ENSRegistry *ENSRegistryFilterer) WatchNewTTL(opts *bind.WatchOpts, sink chan<- *ENSRegistryNewTTL, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -836,7 +830,6 @@ type ENSRegistryTransfer struct {
//
// Solidity: event Transfer(bytes32 indexed node, address owner)
func (_ENSRegistry *ENSRegistryFilterer) FilterTransfer(opts *bind.FilterOpts, node [][32]byte) (*ENSRegistryTransferIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -853,7 +846,6 @@ func (_ENSRegistry *ENSRegistryFilterer) FilterTransfer(opts *bind.FilterOpts, n
//
// Solidity: event Transfer(bytes32 indexed node, address owner)
func (_ENSRegistry *ENSRegistryFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ENSRegistryTransfer, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)

View file

@ -222,9 +222,9 @@ func (_PublicResolver *PublicResolverCallerSession) ABI(node [32]byte, contentTy
//
// Solidity: function addr(bytes32 node) constant returns(address)
func (_PublicResolver *PublicResolverCaller) Addr(opts *bind.CallOpts, node [32]byte) (common.Address, error) {
var (
ret0 = new(common.Address)
)
var ret0 = new(common.Address)
out := ret0
err := _PublicResolver.contract.Call(opts, out, "addr", node)
return *ret0, err
@ -248,9 +248,9 @@ func (_PublicResolver *PublicResolverCallerSession) Addr(node [32]byte) (common.
//
// Solidity: function contenthash(bytes32 node) constant returns(bytes)
func (_PublicResolver *PublicResolverCaller) Contenthash(opts *bind.CallOpts, node [32]byte) ([]byte, error) {
var (
ret0 = new([]byte)
)
var ret0 = new([]byte)
out := ret0
err := _PublicResolver.contract.Call(opts, out, "contenthash", node)
return *ret0, err
@ -274,9 +274,9 @@ func (_PublicResolver *PublicResolverCallerSession) Contenthash(node [32]byte) (
//
// Solidity: function name(bytes32 node) constant returns(string)
func (_PublicResolver *PublicResolverCaller) Name(opts *bind.CallOpts, node [32]byte) (string, error) {
var (
ret0 = new(string)
)
var ret0 = new(string)
out := ret0
err := _PublicResolver.contract.Call(opts, out, "name", node)
return *ret0, err
@ -336,9 +336,9 @@ func (_PublicResolver *PublicResolverCallerSession) Pubkey(node [32]byte) (struc
//
// Solidity: function supportsInterface(bytes4 interfaceID) constant returns(bool)
func (_PublicResolver *PublicResolverCaller) SupportsInterface(opts *bind.CallOpts, interfaceID [4]byte) (bool, error) {
var (
ret0 = new(bool)
)
var ret0 = new(bool)
out := ret0
err := _PublicResolver.contract.Call(opts, out, "supportsInterface", interfaceID)
return *ret0, err
@ -362,9 +362,9 @@ func (_PublicResolver *PublicResolverCallerSession) SupportsInterface(interfaceI
//
// Solidity: function text(bytes32 node, string key) constant returns(string)
func (_PublicResolver *PublicResolverCaller) Text(opts *bind.CallOpts, node [32]byte, key string) (string, error) {
var (
ret0 = new(string)
)
var ret0 = new(string)
out := ret0
err := _PublicResolver.contract.Call(opts, out, "text", node, key)
return *ret0, err
@ -588,7 +588,6 @@ type PublicResolverABIChanged struct {
//
// Solidity: event ABIChanged(bytes32 indexed node, uint256 indexed contentType)
func (_PublicResolver *PublicResolverFilterer) FilterABIChanged(opts *bind.FilterOpts, node [][32]byte, contentType []*big.Int) (*PublicResolverABIChangedIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -609,7 +608,6 @@ func (_PublicResolver *PublicResolverFilterer) FilterABIChanged(opts *bind.Filte
//
// Solidity: event ABIChanged(bytes32 indexed node, uint256 indexed contentType)
func (_PublicResolver *PublicResolverFilterer) WatchABIChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverABIChanged, node [][32]byte, contentType []*big.Int) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -729,7 +727,6 @@ type PublicResolverAddrChanged struct {
//
// Solidity: event AddrChanged(bytes32 indexed node, address a)
func (_PublicResolver *PublicResolverFilterer) FilterAddrChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverAddrChangedIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -746,7 +743,6 @@ func (_PublicResolver *PublicResolverFilterer) FilterAddrChanged(opts *bind.Filt
//
// Solidity: event AddrChanged(bytes32 indexed node, address a)
func (_PublicResolver *PublicResolverFilterer) WatchAddrChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverAddrChanged, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -862,7 +858,6 @@ type PublicResolverContenthashChanged struct {
//
// Solidity: event ContenthashChanged(bytes32 indexed node, bytes hash)
func (_PublicResolver *PublicResolverFilterer) FilterContenthashChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverContenthashChangedIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -879,7 +874,6 @@ func (_PublicResolver *PublicResolverFilterer) FilterContenthashChanged(opts *bi
//
// Solidity: event ContenthashChanged(bytes32 indexed node, bytes hash)
func (_PublicResolver *PublicResolverFilterer) WatchContenthashChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverContenthashChanged, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -995,7 +989,6 @@ type PublicResolverNameChanged struct {
//
// Solidity: event NameChanged(bytes32 indexed node, string name)
func (_PublicResolver *PublicResolverFilterer) FilterNameChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverNameChangedIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -1012,7 +1005,6 @@ func (_PublicResolver *PublicResolverFilterer) FilterNameChanged(opts *bind.Filt
//
// Solidity: event NameChanged(bytes32 indexed node, string name)
func (_PublicResolver *PublicResolverFilterer) WatchNameChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverNameChanged, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -1129,7 +1121,6 @@ type PublicResolverPubkeyChanged struct {
//
// Solidity: event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y)
func (_PublicResolver *PublicResolverFilterer) FilterPubkeyChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverPubkeyChangedIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -1146,7 +1137,6 @@ func (_PublicResolver *PublicResolverFilterer) FilterPubkeyChanged(opts *bind.Fi
//
// Solidity: event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y)
func (_PublicResolver *PublicResolverFilterer) WatchPubkeyChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverPubkeyChanged, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -1263,7 +1253,6 @@ type PublicResolverTextChanged struct {
//
// Solidity: event TextChanged(bytes32 indexed node, string indexedKey, string key)
func (_PublicResolver *PublicResolverFilterer) FilterTextChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverTextChangedIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -1280,7 +1269,6 @@ func (_PublicResolver *PublicResolverFilterer) FilterTextChanged(opts *bind.Filt
//
// Solidity: event TextChanged(bytes32 indexed node, string indexedKey, string key)
func (_PublicResolver *PublicResolverFilterer) WatchTextChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverTextChanged, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)

View file

@ -216,9 +216,9 @@ func (_PublicResolver *PublicResolverCallerSession) ABI(node [32]byte, contentTy
//
// Solidity: function addr(node bytes32) constant returns(ret address)
func (_PublicResolver *PublicResolverCaller) Addr(opts *bind.CallOpts, node [32]byte) (common.Address, error) {
var (
ret0 = new(common.Address)
)
var ret0 = new(common.Address)
out := ret0
err := _PublicResolver.contract.Call(opts, out, "addr", node)
return *ret0, err
@ -242,9 +242,9 @@ func (_PublicResolver *PublicResolverCallerSession) Addr(node [32]byte) (common.
//
// Solidity: function content(node bytes32) constant returns(ret bytes32)
func (_PublicResolver *PublicResolverCaller) Content(opts *bind.CallOpts, node [32]byte) ([32]byte, error) {
var (
ret0 = new([32]byte)
)
var ret0 = new([32]byte)
out := ret0
err := _PublicResolver.contract.Call(opts, out, "content", node)
return *ret0, err
@ -268,9 +268,9 @@ func (_PublicResolver *PublicResolverCallerSession) Content(node [32]byte) ([32]
//
// Solidity: function name(node bytes32) constant returns(ret string)
func (_PublicResolver *PublicResolverCaller) Name(opts *bind.CallOpts, node [32]byte) (string, error) {
var (
ret0 = new(string)
)
var ret0 = new(string)
out := ret0
err := _PublicResolver.contract.Call(opts, out, "name", node)
return *ret0, err
@ -330,9 +330,9 @@ func (_PublicResolver *PublicResolverCallerSession) Pubkey(node [32]byte) (struc
//
// Solidity: function supportsInterface(interfaceID bytes4) constant returns(bool)
func (_PublicResolver *PublicResolverCaller) SupportsInterface(opts *bind.CallOpts, interfaceID [4]byte) (bool, error) {
var (
ret0 = new(bool)
)
var ret0 = new(bool)
out := ret0
err := _PublicResolver.contract.Call(opts, out, "supportsInterface", interfaceID)
return *ret0, err
@ -356,9 +356,9 @@ func (_PublicResolver *PublicResolverCallerSession) SupportsInterface(interfaceI
//
// Solidity: function text(node bytes32, key string) constant returns(ret string)
func (_PublicResolver *PublicResolverCaller) Text(opts *bind.CallOpts, node [32]byte, key string) (string, error) {
var (
ret0 = new(string)
)
var ret0 = new(string)
out := ret0
err := _PublicResolver.contract.Call(opts, out, "text", node, key)
return *ret0, err
@ -582,7 +582,6 @@ type PublicResolverABIChanged struct {
//
// Solidity: event ABIChanged(node indexed bytes32, contentType indexed uint256)
func (_PublicResolver *PublicResolverFilterer) FilterABIChanged(opts *bind.FilterOpts, node [][32]byte, contentType []*big.Int) (*PublicResolverABIChangedIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -603,7 +602,6 @@ func (_PublicResolver *PublicResolverFilterer) FilterABIChanged(opts *bind.Filte
//
// Solidity: event ABIChanged(node indexed bytes32, contentType indexed uint256)
func (_PublicResolver *PublicResolverFilterer) WatchABIChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverABIChanged, node [][32]byte, contentType []*big.Int) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -723,7 +721,6 @@ type PublicResolverAddrChanged struct {
//
// Solidity: event AddrChanged(node indexed bytes32, a address)
func (_PublicResolver *PublicResolverFilterer) FilterAddrChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverAddrChangedIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -740,7 +737,6 @@ func (_PublicResolver *PublicResolverFilterer) FilterAddrChanged(opts *bind.Filt
//
// Solidity: event AddrChanged(node indexed bytes32, a address)
func (_PublicResolver *PublicResolverFilterer) WatchAddrChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverAddrChanged, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -856,7 +852,6 @@ type PublicResolverContentChanged struct {
//
// Solidity: event ContentChanged(node indexed bytes32, hash bytes32)
func (_PublicResolver *PublicResolverFilterer) FilterContentChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverContentChangedIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -873,7 +868,6 @@ func (_PublicResolver *PublicResolverFilterer) FilterContentChanged(opts *bind.F
//
// Solidity: event ContentChanged(node indexed bytes32, hash bytes32)
func (_PublicResolver *PublicResolverFilterer) WatchContentChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverContentChanged, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -989,7 +983,6 @@ type PublicResolverNameChanged struct {
//
// Solidity: event NameChanged(node indexed bytes32, name string)
func (_PublicResolver *PublicResolverFilterer) FilterNameChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverNameChangedIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -1006,7 +999,6 @@ func (_PublicResolver *PublicResolverFilterer) FilterNameChanged(opts *bind.Filt
//
// Solidity: event NameChanged(node indexed bytes32, name string)
func (_PublicResolver *PublicResolverFilterer) WatchNameChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverNameChanged, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -1123,7 +1115,6 @@ type PublicResolverPubkeyChanged struct {
//
// Solidity: event PubkeyChanged(node indexed bytes32, x bytes32, y bytes32)
func (_PublicResolver *PublicResolverFilterer) FilterPubkeyChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverPubkeyChangedIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -1140,7 +1131,6 @@ func (_PublicResolver *PublicResolverFilterer) FilterPubkeyChanged(opts *bind.Fi
//
// Solidity: event PubkeyChanged(node indexed bytes32, x bytes32, y bytes32)
func (_PublicResolver *PublicResolverFilterer) WatchPubkeyChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverPubkeyChanged, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -1257,7 +1247,6 @@ type PublicResolverTextChanged struct {
//
// Solidity: event TextChanged(node indexed bytes32, indexedKey indexed string, key string)
func (_PublicResolver *PublicResolverFilterer) FilterTextChanged(opts *bind.FilterOpts, node [][32]byte, indexedKey []string) (*PublicResolverTextChangedIterator, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)
@ -1278,7 +1267,6 @@ func (_PublicResolver *PublicResolverFilterer) FilterTextChanged(opts *bind.Filt
//
// Solidity: event TextChanged(node indexed bytes32, indexedKey indexed string, key string)
func (_PublicResolver *PublicResolverFilterer) WatchTextChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverTextChanged, node [][32]byte, indexedKey []string) (event.Subscription, error) {
var nodeRule []interface{}
for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem)

View file

@ -37,36 +37,47 @@ import (
func BenchmarkInsertChain_empty_memdb(b *testing.B) {
benchInsertChain(b, false, nil)
}
func BenchmarkInsertChain_empty_diskdb(b *testing.B) {
benchInsertChain(b, true, nil)
}
func BenchmarkInsertChain_valueTx_memdb(b *testing.B) {
benchInsertChain(b, false, genValueTx(0))
}
func BenchmarkInsertChain_valueTx_diskdb(b *testing.B) {
benchInsertChain(b, true, genValueTx(0))
}
func BenchmarkInsertChain_valueTx_100kB_memdb(b *testing.B) {
benchInsertChain(b, false, genValueTx(100*1024))
}
func BenchmarkInsertChain_valueTx_100kB_diskdb(b *testing.B) {
benchInsertChain(b, true, genValueTx(100*1024))
}
func BenchmarkInsertChain_uncles_memdb(b *testing.B) {
benchInsertChain(b, false, genUncles)
}
func BenchmarkInsertChain_uncles_diskdb(b *testing.B) {
benchInsertChain(b, true, genUncles)
}
func BenchmarkInsertChain_ring200_memdb(b *testing.B) {
benchInsertChain(b, false, genTxRing(200))
}
func BenchmarkInsertChain_ring200_diskdb(b *testing.B) {
benchInsertChain(b, true, genTxRing(200))
}
func BenchmarkInsertChain_ring1000_memdb(b *testing.B) {
benchInsertChain(b, false, genTxRing(1000))
}
func BenchmarkInsertChain_ring1000_diskdb(b *testing.B) {
benchInsertChain(b, true, genTxRing(1000))
}
@ -187,36 +198,47 @@ func benchInsertChain(b *testing.B, disk bool, gen func(int, *BlockGen)) {
func BenchmarkChainRead_header_10k(b *testing.B) {
benchReadChain(b, false, 10000)
}
func BenchmarkChainRead_full_10k(b *testing.B) {
benchReadChain(b, true, 10000)
}
func BenchmarkChainRead_header_100k(b *testing.B) {
benchReadChain(b, false, 100000)
}
func BenchmarkChainRead_full_100k(b *testing.B) {
benchReadChain(b, true, 100000)
}
func BenchmarkChainRead_header_500k(b *testing.B) {
benchReadChain(b, false, 500000)
}
func BenchmarkChainRead_full_500k(b *testing.B) {
benchReadChain(b, true, 500000)
}
func BenchmarkChainWrite_header_10k(b *testing.B) {
benchWriteChain(b, false, 10000)
}
func BenchmarkChainWrite_full_10k(b *testing.B) {
benchWriteChain(b, true, 10000)
}
func BenchmarkChainWrite_header_100k(b *testing.B) {
benchWriteChain(b, false, 100000)
}
func BenchmarkChainWrite_full_100k(b *testing.B) {
benchWriteChain(b, true, 100000)
}
func BenchmarkChainWrite_header_500k(b *testing.B) {
benchWriteChain(b, false, 500000)
}
func BenchmarkChainWrite_full_500k(b *testing.B) {
benchWriteChain(b, true, 500000)
}

View file

@ -1098,9 +1098,9 @@ func (bc *BlockChain) InsertChain(chain types.Blocks) (int, error) {
defer bc.blockProcFeed.Send(false)
// Remove already known canon-blocks
var (
block, prev *types.Block
)
var block, prev *types.Block
// Do a sanity check that the provided chain is actually ordered and linked
for i := 1; i < len(chain); i++ {
block = chain[i]

View file

@ -1200,7 +1200,6 @@ done:
t.Errorf("unexpected event fired: %v", e)
case <-time.After(250 * time.Millisecond):
}
}
// Tests if the canonical block can be fetched from the database during chain insertion.
@ -1592,7 +1591,7 @@ func benchmarkLargeNumberOfValueToNonexisting(b *testing.B, numTxs, numBlocks in
for txi := 0; txi < numTxs; txi++ {
uniq := uint64(i*numTxs + txi)
recipient := recipientFn(uniq)
//recipient := common.BigToAddress(big.NewInt(0).SetUint64(1337 + uniq))
// recipient := common.BigToAddress(big.NewInt(0).SetUint64(1337 + uniq))
tx, err := types.SignTx(types.NewTransaction(uniq, recipient, big.NewInt(1), params.TxGas, big.NewInt(1), nil), signer, testBankKey)
if err != nil {
b.Error(err)
@ -1620,10 +1619,10 @@ func benchmarkLargeNumberOfValueToNonexisting(b *testing.B, numTxs, numBlocks in
b.StopTimer()
if got := chain.CurrentBlock().Transactions().Len(); got != numTxs*numBlocks {
b.Fatalf("Transactions were not included, expected %d, got %d", numTxs*numBlocks, got)
}
}
}
func BenchmarkBlockChain_1x1000ValueTransferToNonexisting(b *testing.B) {
var (
numTxs = 1000
@ -1639,6 +1638,7 @@ func BenchmarkBlockChain_1x1000ValueTransferToNonexisting(b *testing.B) {
benchmarkLargeNumberOfValueToNonexisting(b, numTxs, numBlocks, recipientFn, dataFn)
}
func BenchmarkBlockChain_1x1000ValueTransferToExisting(b *testing.B) {
var (
numTxs = 1000
@ -1656,6 +1656,7 @@ func BenchmarkBlockChain_1x1000ValueTransferToExisting(b *testing.B) {
benchmarkLargeNumberOfValueToNonexisting(b, numTxs, numBlocks, recipientFn, dataFn)
}
func BenchmarkBlockChain_1x1000Executions(b *testing.B) {
var (
numTxs = 1000
@ -1735,7 +1736,6 @@ func TestLowDiffLongChain(t *testing.T) {
// - A common ancestor is placed at prune-point + blocksBetweenCommonAncestorAndPruneblock
// - The sidechain S is prepended with numCanonBlocksInSidechain blocks from the canon chain
func testSideImport(t *testing.T, numCanonBlocksInSidechain, blocksBetweenCommonAncestorAndPruneblock int) {
// Generate a canonical chain to act as the main dataset
engine := ethash.NewFaker()
db := rawdb.NewMemoryDatabase()
@ -1801,9 +1801,9 @@ func testSideImport(t *testing.T, numCanonBlocksInSidechain, blocksBetweenCommon
// [ Cn, Cn+1, Cc, Sn+3 ... Sm]
// ^ ^ ^ pruned
func TestPrunedImportSide(t *testing.T) {
//glogger := log.NewGlogHandler(log.StreamHandler(os.Stdout, log.TerminalFormat(false)))
//glogger.Verbosity(3)
//log.Root().SetHandler(log.Handler(glogger))
// glogger := log.NewGlogHandler(log.StreamHandler(os.Stdout, log.TerminalFormat(false)))
// glogger.Verbosity(3)
// log.Root().SetHandler(log.Handler(glogger))
testSideImport(t, 3, 3)
testSideImport(t, 3, -3)
testSideImport(t, 10, 0)

View file

@ -16,9 +16,7 @@
package bloombits
import (
"sync"
)
import "sync"
// request represents a bloom retrieval task to prioritize and pull from the local
// database or remotely from the network.

View file

@ -221,7 +221,7 @@ func (b *testChainIndexBackend) Process(ctx context.Context, header *types.Heade
if b.headerCnt > b.indexer.sectionSize {
b.t.Error("Processing too many headers")
}
//t.processCh <- header.Number.Uint64()
// t.processCh <- header.Number.Uint64()
select {
case <-time.After(10 * time.Second):
b.t.Fatal("Unexpected call to Process")

View file

@ -153,6 +153,7 @@ func (e *GenesisMismatchError) Error() string {
func SetupGenesisBlock(db ethdb.Database, genesis *Genesis) (*params.ChainConfig, common.Hash, error) {
return SetupGenesisBlockWithOverride(db, genesis, nil)
}
func SetupGenesisBlockWithOverride(db ethdb.Database, genesis *Genesis, constantinopleOverride *big.Int) (*params.ChainConfig, common.Hash, error) {
if genesis != nil && genesis.Config == nil {
return params.AllEthashProtocolChanges, common.Hash{}, errGenesisNoConfig

View file

@ -16,9 +16,7 @@
package rawdb
import (
"github.com/ethereum/go-ethereum/ethdb"
)
import "github.com/ethereum/go-ethereum/ethdb"
// table is a wrapper around a database that prefixes each key access with a pre-
// configured string.

View file

@ -25,10 +25,8 @@ import (
lru "github.com/hashicorp/golang-lru"
)
const (
// Number of codehash->size associations to keep.
codeSizeCacheSize = 100000
)
// Number of codehash->size associations to keep.
const codeSizeCacheSize = 100000
// Database wraps access to tries and contract code.
type Database interface {

View file

@ -34,7 +34,7 @@ var emptyCodeHash = crypto.Keccak256(nil)
type Code []byte
func (self Code) String() string {
return string(self) //strings.Join(Disassemble(self), " ")
return string(self) // strings.Join(Disassemble(self), " ")
}
type Storage map[common.Hash]common.Hash

View file

@ -95,7 +95,7 @@ func (s *StateSuite) SetUpTest(c *checker.C) {
func (s *StateSuite) TestNull(c *checker.C) {
address := common.HexToAddress("0x823140710bf13990e4500136726d8b55")
s.state.CreateAccount(address)
//value := common.FromHex("0x823140710bf13990e4500136726d8b55")
// value := common.FromHex("0x823140710bf13990e4500136726d8b55")
var value common.Hash
s.state.SetState(address, common.Hash{}, value)

View file

@ -27,9 +27,7 @@ import (
"github.com/ethereum/go-ethereum/params"
)
var (
errInsufficientBalanceForGas = errors.New("insufficient balance to pay for gas")
)
var errInsufficientBalanceForGas = errors.New("insufficient balance to pay for gas")
/*
The State Transitioning Model
@ -63,7 +61,7 @@ type StateTransition struct {
// Message represents a message sent to a contract.
type Message interface {
From() common.Address
//FromFrontier() (common.Address, error)
// FromFrontier() (common.Address, error)
To() *common.Address
GasPrice() *big.Int

View file

@ -35,10 +35,8 @@ import (
"github.com/ethereum/go-ethereum/params"
)
const (
// chainHeadChanSize is the size of channel listening to ChainHeadEvent.
chainHeadChanSize = 10
)
// chainHeadChanSize is the size of channel listening to ChainHeadEvent.
const chainHeadChanSize = 10
var (
// ErrInvalidSender is returned if the transaction contains an invalid signature.

View file

@ -573,7 +573,6 @@ func TestTransactionPostponing(t *testing.T) {
// Add a batch consecutive pending transactions for validation
txs := []*types.Transaction{}
for i, key := range keys {
for j := 0; j < 100; j++ {
var tx *types.Transaction
if (i+j)%2 == 0 {
@ -761,6 +760,7 @@ func TestTransactionQueueAccountLimiting(t *testing.T) {
func TestTransactionQueueGlobalLimiting(t *testing.T) {
testTransactionQueueGlobalLimiting(t, false)
}
func TestTransactionQueueGlobalLimitingNoLocals(t *testing.T) {
testTransactionQueueGlobalLimiting(t, true)
}

View file

@ -77,6 +77,7 @@ func TestUncleHash(t *testing.T) {
t.Fatalf("empty uncle hash is wrong, got %x != %x", h, exp)
}
}
func BenchmarkUncleHash(b *testing.B) {
uncles := make([]*Header, 0)
b.ResetTimer()

View file

@ -78,7 +78,6 @@ func (b Bloom) Test(test *big.Int) bool {
func (b Bloom) TestBytes(test []byte) bool {
return b.Test(new(big.Int).SetBytes(test))
}
// MarshalText encodes b as a hex string with 0x prefix.

View file

@ -31,9 +31,7 @@ import (
//go:generate gencodec -type txdata -field-override txdataMarshaling -out gen_tx_json.go
var (
ErrInvalidSig = errors.New("invalid transaction v, r, s values")
)
var ErrInvalidSig = errors.New("invalid transaction v, r, s values")
type Transaction struct {
data txdata

View file

@ -27,9 +27,7 @@ import (
"github.com/ethereum/go-ethereum/params"
)
var (
ErrInvalidChainId = errors.New("invalid chain id for signer")
)
var ErrInvalidChainId = errors.New("invalid chain id for signer")
// sigCache is used to cache the derived sender and contains
// the signer used to derive it.

View file

@ -24,6 +24,7 @@ type bitvec []byte
func (bits *bitvec) set(pos uint64) {
(*bits)[pos/8] |= 0x80 >> (pos % 8)
}
func (bits *bitvec) set8(pos uint64) {
(*bits)[pos/8] |= 0xFF >> (pos % 8)
(*bits)[pos/8+1] |= ^(0xFF >> (pos % 8))

View file

@ -64,6 +64,7 @@ func BenchmarkJumpdestAnalysis_1200k(bench *testing.B) {
}
bench.StopTimer()
}
func BenchmarkJumpdestHashing_1200k(bench *testing.B) {
// 4 ms
code := make([]byte, 1200000)

View file

@ -111,6 +111,7 @@ type sha256hash struct{}
func (c *sha256hash) RequiredGas(input []byte) uint64 {
return uint64(len(input)+31)/32*params.Sha256PerWordGas + params.Sha256BaseGas
}
func (c *sha256hash) Run(input []byte) ([]byte, error) {
h := sha256.Sum256(input)
return h[:], nil
@ -126,6 +127,7 @@ type ripemd160hash struct{}
func (c *ripemd160hash) RequiredGas(input []byte) uint64 {
return uint64(len(input)+31)/32*params.Ripemd160PerWordGas + params.Ripemd160BaseGas
}
func (c *ripemd160hash) Run(input []byte) ([]byte, error) {
ripemd := ripemd160.New()
ripemd.Write(input)
@ -142,6 +144,7 @@ type dataCopy struct{}
func (c *dataCopy) RequiredGas(input []byte) uint64 {
return uint64(len(input)+31)/32*params.IdentityPerWordGas + params.IdentityBaseGas
}
func (c *dataCopy) Run(in []byte) ([]byte, error) {
return in, nil
}

View file

@ -374,7 +374,7 @@ func benchmarkPrecompiled(addr string, test precompiledTest, bench *testing.B) {
res, err = RunPrecompiledContract(p, data, contract)
}
bench.StopTimer()
//Check if it is correct
// Check if it is correct
if err != nil {
bench.Error(err)
return

View file

@ -442,7 +442,6 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
evm.vmConfig.Tracer.CaptureEnd(ret, gas-contract.Gas, time.Since(start), err)
}
return ret, address, contract.Gas, err
}
// Create creates a new contract using code as deployment code.

View file

@ -44,7 +44,6 @@ var commonParams []*twoOperandParams
var twoOpMethods map[string]executionFunc
func init() {
// Params is a list of common edgecases that should be used for some common tests
params := []string{
"0000000000000000000000000000000000000000000000000000000000000000", // 0
@ -90,7 +89,6 @@ func init() {
}
func testTwoOperandOp(t *testing.T, tests []TwoOperandTestcase, opFn executionFunc, name string) {
var (
env = NewEVM(Context{}, nil, params.TestChainConfig, Config{})
stack = newstack()
@ -422,11 +420,13 @@ func BenchmarkOpEq(b *testing.B) {
opBenchmark(b, opEq, x, y)
}
func BenchmarkOpEq2(b *testing.B) {
x := "FBCDEF090807060504030201ffffffffFBCDEF090807060504030201ffffffff"
y := "FBCDEF090807060504030201ffffffffFBCDEF090807060504030201fffffffe"
opBenchmark(b, opEq, x, y)
}
func BenchmarkOpAnd(b *testing.B) {
x := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
y := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
@ -477,18 +477,21 @@ func BenchmarkOpSHL(b *testing.B) {
opBenchmark(b, opSHL, x, y)
}
func BenchmarkOpSHR(b *testing.B) {
x := "FBCDEF090807060504030201ffffffffFBCDEF090807060504030201ffffffff"
y := "ff"
opBenchmark(b, opSHR, x, y)
}
func BenchmarkOpSAR(b *testing.B) {
x := "FBCDEF090807060504030201ffffffffFBCDEF090807060504030201ffffffff"
y := "ff"
opBenchmark(b, opSAR, x, y)
}
func BenchmarkOpIsZero(b *testing.B) {
x := "FBCDEF090807060504030201ffffffffFBCDEF090807060504030201ffffffff"
opBenchmark(b, opIszero, x)

View file

@ -16,9 +16,7 @@
package vm
import (
"testing"
)
import "testing"
func TestIntPoolPoolGet(t *testing.T) {
poolOfIntPools.pools = make([]*intPool, 0, poolDefaultCap)

View file

@ -70,6 +70,7 @@ func memoryCall(stack *Stack) (uint64, bool) {
}
return y, false
}
func memoryDelegateCall(stack *Stack) (uint64, bool) {
x, overflow := calcMemSize64(stack.Back(4), stack.Back(5))
if overflow {

View file

@ -16,9 +16,7 @@
package vm
import (
"fmt"
)
import "fmt"
// OpCode is an EVM opcode
type OpCode byte
@ -280,8 +278,8 @@ var opCodeToString = map[OpCode]string{
// 0x50 range - 'storage' and execution.
POP: "POP",
//DUP: "DUP",
//SWAP: "SWAP",
// DUP: "DUP",
// SWAP: "SWAP",
MLOAD: "MLOAD",
MSTORE: "MSTORE",
MSTORE8: "MSTORE8",

View file

@ -149,6 +149,7 @@ func BenchmarkCall(b *testing.B) {
}
}
}
func benchmarkEVM_Create(bench *testing.B, code string) {
var (
statedb, _ = state.New(common.Hash{}, state.NewDatabase(rawdb.NewMemoryDatabase()))
@ -191,14 +192,17 @@ func BenchmarkEVM_CREATE_500(bench *testing.B) {
// initcode size 500K, repeatedly calls CREATE and then modifies the mem contents
benchmarkEVM_Create(bench, "5b6207a120600080f0600152600056")
}
func BenchmarkEVM_CREATE2_500(bench *testing.B) {
// initcode size 500K, repeatedly calls CREATE2 and then modifies the mem contents
benchmarkEVM_Create(bench, "5b586207a120600080f5600152600056")
}
func BenchmarkEVM_CREATE_1200(bench *testing.B) {
// initcode size 1200K, repeatedly calls CREATE and then modifies the mem contents
benchmarkEVM_Create(bench, "5b62124f80600080f0600152600056")
}
func BenchmarkEVM_CREATE2_1200(bench *testing.B) {
// initcode size 1200K, repeatedly calls CREATE2 and then modifies the mem contents
benchmarkEVM_Create(bench, "5b5862124f80600080f5600152600056")

View file

@ -39,10 +39,11 @@ func (st *Stack) Data() []*big.Int {
func (st *Stack) push(d *big.Int) {
// NOTE push limit (1024) is checked in baseCheck
//stackItem := new(big.Int).Set(d)
//st.data = append(st.data, stackItem)
// stackItem := new(big.Int).Set(d)
// st.data = append(st.data, stackItem)
st.data = append(st.data, d)
}
func (st *Stack) pushN(ds ...*big.Int) {
st.data = append(st.data, ds...)
}

View file

@ -16,13 +16,12 @@
package vm
import (
"github.com/ethereum/go-ethereum/params"
)
import "github.com/ethereum/go-ethereum/params"
func minSwapStack(n int) int {
return minStack(n, n)
}
func maxSwapStack(n int) int {
return maxStack(n, n)
}
@ -30,6 +29,7 @@ func maxSwapStack(n int) int {
func minDupStack(n int) int {
return minStack(n, n+1)
}
func maxDupStack(n int) int {
return maxStack(n, n+1)
}
@ -37,6 +37,7 @@ func maxDupStack(n int) int {
func maxStack(pop, push int) int {
return int(params.StackLimit) + pop - push
}
func minStack(pops, push int) int {
return pops
}

View file

@ -32,23 +32,28 @@ type bindataFileInfo struct {
func (fi bindataFileInfo) Name() string {
return fi.name
}
func (fi bindataFileInfo) Size() int64 {
return fi.size
}
func (fi bindataFileInfo) Mode() os.FileMode {
return fi.mode
}
func (fi bindataFileInfo) ModTime() time.Time {
return fi.modTime
}
func (fi bindataFileInfo) IsDir() bool {
return false
}
func (fi bindataFileInfo) Sys() interface{} {
return nil
}
//nolint:misspell
// nolint:misspell
var _indexHtml = []byte(`<!DOCTYPE html>
<html lang="en" style="height: 100%">
<head>
@ -92,7 +97,7 @@ func indexHtml() (*asset, error) {
return a, nil
}
//nolint:misspell
// nolint:misspell
var _bundleJs = []byte((((`!function(e) {
var t = {};
function n(r) {
@ -30224,8 +30229,8 @@ func bundleJs() (*asset, error) {
return a, nil
}
//nolint:misspell
//nolint:misspell
// nolint:misspell
// nolint:misspell
var _bundleJsMap = []byte(((((((((((((`{
"version": 3,
"sources": [

View file

@ -43,9 +43,7 @@ import (
"golang.org/x/net/websocket"
)
const (
sampleLimit = 200 // Maximum number of data samples
)
const sampleLimit = 200 // Maximum number of data samples
// Dashboard contains the dashboard internals.
type Dashboard struct {

View file

@ -16,9 +16,7 @@
package dashboard
import (
"encoding/json"
)
import "encoding/json"
type Message struct {
General *GeneralMessage `json:"general,omitempty"`

View file

@ -79,11 +79,9 @@ func (eth *Ethereum) startBloomHandlers(sectionSize uint64) {
}
}
const (
// bloomThrottling is the time to wait between processing two consecutive index
// sections. It's useful during chain upgrades to prevent disk overload.
bloomThrottling = 100 * time.Millisecond
)
// bloomThrottling is the time to wait between processing two consecutive index
// sections. It's useful during chain upgrades to prevent disk overload.
const bloomThrottling = 100 * time.Millisecond
// BloomIndexer implements a core.ChainIndexer, building up a rotated bloom bits index
// for the Ethereum header bloom filters, permitting blazing fast filtering.

Some files were not shown because too many files have changed in this diff Show more