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 return nil
} }
// UnpackValues can be used to unpack ABI-encoded hexdata according to the ABI-specification, // 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 return nil
}) })
} }
func (fb *filterBackend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription { func (fb *filterBackend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription {
return fb.bc.SubscribeChainEvent(ch) return fb.bc.SubscribeChainEvent(ch)
} }
func (fb *filterBackend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription { func (fb *filterBackend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription {
return fb.bc.SubscribeRemovedLogsEvent(ch) return fb.bc.SubscribeRemovedLogsEvent(ch)
} }
func (fb *filterBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription { func (fb *filterBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription {
return fb.bc.SubscribeLogsEvent(ch) return fb.bc.SubscribeLogsEvent(ch)
} }

View file

@ -78,5 +78,4 @@ func TestSimulatedBackend(t *testing.T) {
if isPending { if isPending {
t.Fatal("transaction should not have pending status") 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 mc.callContractBlockNumber = blockNumber
return nil, nil return nil, nil
} }
func TestPassingBlockNumber(t *testing.T) {
func TestPassingBlockNumber(t *testing.T) {
mc := &mockCaller{} mc := &mockCaller{}
bc := bind.NewBoundContract(common.HexToAddress("0x0"), abi.ABI{ 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. // Array sizes may also be "", indicating a dynamic array.
func wrapArray(stringKind string, innerLen int, innerMapping string) (string, []string) { func wrapArray(stringKind string, innerLen int, innerMapping string) (string, []string) {
remainder := stringKind[innerLen:] remainder := stringKind[innerLen:]
//find all the sizes // find all the sizes
matches := regexp.MustCompile(`\[(\d*)\]`).FindAllStringSubmatch(remainder, -1) matches := regexp.MustCompile(`\[(\d*)\]`).FindAllStringSubmatch(remainder, -1)
parts := make([]string, 0, len(matches)) parts := make([]string, 0, len(matches))
for _, match := range matches { for _, match := range matches {
//get group 1 from the regex match // get group 1 from the regex match
parts = append(parts, match[1]) parts = append(parts, match[1])
} }
return innerMapping, parts 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. // Simply returns the inner type if arraySizes is empty.
func arrayBindingGo(inner string, arraySizes []string) string { func arrayBindingGo(inner string, arraySizes []string) string {
out := "" 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-- { for i := len(arraySizes) - 1; i >= 0; i-- {
out += "[" + arraySizes[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) // (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. // The length of the matched part is returned, with the translated type.
func bindUnnestedTypeGo(stringKind string) (int, string) { func bindUnnestedTypeGo(stringKind string) (int, string) {
switch { switch {
case strings.HasPrefix(stringKind, "address"): case strings.HasPrefix(stringKind, "address"):
return len("address"), "common.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) // (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. // The length of the matched part is returned, with the translated type.
func bindUnnestedTypeJava(stringKind string) (int, string) { func bindUnnestedTypeJava(stringKind string) (int, string) {
switch { switch {
case strings.HasPrefix(stringKind, "address"): case strings.HasPrefix(stringKind, "address"):
parts := regexp.MustCompile(`address(\[[0-9]*\])?`).FindStringSubmatch(stringKind) parts := regexp.MustCompile(`address(\[[0-9]*\])?`).FindStringSubmatch(stringKind)
@ -277,7 +275,7 @@ func bindUnnestedTypeJava(stringKind string) (int, string) {
return len(parts[0]), "byte[]" return len(parts[0]), "byte[]"
case strings.HasPrefix(stringKind, "int") || strings.HasPrefix(stringKind, "uint"): 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). // these are size 256, and will translate to BigInt (the default).
parts := regexp.MustCompile(`(u)?int([0-9]*)`).FindStringSubmatch(stringKind) parts := regexp.MustCompile(`(u)?int([0-9]*)`).FindStringSubmatch(stringKind)
if len(parts) != 3 { if len(parts) != 3 {
@ -291,7 +289,7 @@ func bindUnnestedTypeJava(stringKind string) (int, string) {
"64": "long", "64": "long",
}[parts[2]] }[parts[2]]
//default to BigInt // default to BigInt
if namedSize == "" { if namedSize == "" {
namedSize = "BigInt" namedSize = "BigInt"
} }

View file

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

View file

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

View file

@ -77,5 +77,4 @@ func packNum(value reflect.Value) []byte {
default: default:
panic("abi: fatal error") 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 FieldA *big.Int `abi:"a"` // Test whether abi tag works for nested tuple
B []*big.Int B []*big.Int
}{big.NewInt(1), []*big.Int{big.NewInt(1), big.NewInt(0)}}, }{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 common.Hex2Bytes("0000000000000000000000000000000000000000000000000000000000000040" + // a offset
"00000000000000000000000000000000000000000000000000000000000000e0" + // b offset "00000000000000000000000000000000000000000000000000000000000000e0" + // b offset
"0000000000000000000000000000000000000000000000000000000000000001" + // a.a value "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` // requireUnpackKind verifies preconditions for unpacking `args` into `kind`
func requireUnpackKind(v reflect.Value, t reflect.Type, k reflect.Kind, func requireUnpackKind(v reflect.Value, t reflect.Type, k reflect.Kind,
args Arguments) error { args Arguments) error {
switch k { switch k {
case reflect.Struct: case reflect.Struct:
case reflect.Slice, reflect.Array: case reflect.Slice, reflect.Array:

View file

@ -57,10 +57,8 @@ type Type struct {
TupleRawNames []string // Raw field name of all tuple fields TupleRawNames []string // Raw field name of all tuple fields
} }
var ( // typeRegex parses the abi sub types
// typeRegex parses the abi sub types var typeRegex = regexp.MustCompile("([a-zA-Z]+)(([0-9]+)(x([0-9]+))?)?")
typeRegex = regexp.MustCompile("([a-zA-Z]+)(([0-9]+)(x([0-9]+))?)?")
)
// NewType creates a new reflection type of abi type given in t. // NewType creates a new reflection type of abi type given in t.
func NewType(t string, components []ArgumentMarshaling) (typ Type, err error) { 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{}}, // {"fixed[2]", nil, Type{}},
// {"fixed128x128[]", nil, Type{}}, // {"fixed128x128[]", nil, Type{}},
// {"fixed128x128[2]", nil, Type{}}, // {"fixed128x128[2]", nil, Type{}},
{"tuple", []ArgumentMarshaling{{Name: "a", Type: "int64"}}, Type{Kind: reflect.Struct, T: TupleTy, Type: reflect.TypeOf(struct { {"tuple", []ArgumentMarshaling{{Name: "a", Type: "int64"}}, Type{
A int64 `json:"a"` Kind: reflect.Struct, T: TupleTy, Type: reflect.TypeOf(struct {
}{}), stringKind: "(int64)", A int64 `json:"a"`
TupleElems: []*Type{{Kind: reflect.Int64, T: IntTy, Type: reflect.TypeOf(int64(0)), Size: 64, stringKind: "int64"}}, TupleRawNames: []string{"a"}}}, }{}), stringKind: "(int64)",
{"tuple with long name", []ArgumentMarshaling{{Name: "aTypicalParamName", Type: "int64"}}, Type{Kind: reflect.Struct, T: TupleTy, Type: reflect.TypeOf(struct { TupleElems: []*Type{{Kind: reflect.Int64, T: IntTy, Type: reflect.TypeOf(int64(0)), Size: 64, stringKind: "int64"}}, TupleRawNames: []string{"a"},
ATypicalParamName int64 `json:"aTypicalParamName"` }},
}{}), stringKind: "(int64)", {"tuple with long name", []ArgumentMarshaling{{Name: "aTypicalParamName", Type: "int64"}}, Type{
TupleElems: []*Type{{Kind: reflect.Int64, T: IntTy, Type: reflect.TypeOf(int64(0)), Size: 64, stringKind: "int64"}}, TupleRawNames: []string{"aTypicalParamName"}}}, 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 { 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])) reflect.Copy(array, reflect.ValueOf(word[0:t.Size]))
return array.Interface(), nil return array.Interface(), nil
} }
// iteratively unpack elements // 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, // 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. // to from the ((3 + 61) * 0.5) = 32 byte elements in the array.
buff.Write(common.Hex2Bytes(strings.Join([]string{ 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", "111", "112", "113", "121", "122", "123",
"211", "212", "213", "221", "222", "223", "211", "212", "213", "221", "222", "223",
"311", "312", "313", "321", "322", "323", "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) { 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") 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) { 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") return nil, fmt.Errorf("passphrase-operations not supported on external signers")
} }

View file

@ -35,9 +35,7 @@ import (
"github.com/pborman/uuid" "github.com/pborman/uuid"
) )
const ( const version = 3
version = 3
)
type Key struct { type Key struct {
Id uuid.UUID // Version 4 "random" for unique id not derived from key data 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'. // Encryptdata encrypts the data given as 'data' with the password 'auth'.
func EncryptDataV3(data, auth []byte, scryptN, scryptP int) (CryptoJSON, error) { func EncryptDataV3(data, auth []byte, scryptN, scryptP int) (CryptoJSON, error) {
salt := make([]byte, 32) salt := make([]byte, 32)
if _, err := io.ReadFull(rand.Reader, salt); err != nil { if _, err := io.ReadFull(rand.Reader, salt); err != nil {
panic("reading from crypto/rand failed: " + err.Error()) panic("reading from crypto/rand failed: " + err.Error())

View file

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

View file

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

View file

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

View file

@ -1007,9 +1007,9 @@ func newPodMetadata(env build.Environment, archive string) podMetadata {
// Cross compilation // Cross compilation
func doXgo(cmdline []string) { 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) flag.CommandLine.Parse(cmdline)
env := build.Env() env := build.Env()

View file

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

View file

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

View file

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

View file

@ -84,9 +84,7 @@ var (
logFlag = flag.Int("loglevel", 3, "Log level to use for Ethereum and the faucet") logFlag = flag.Int("loglevel", 3, "Log level to use for Ethereum and the faucet")
) )
var ( var ether = new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil)
ether = new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil)
)
func main() { func main() {
// Parse the flags and set up the logger to print everything requested // 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 { func (fi bindataFileInfo) Name() string {
return fi.name return fi.name
} }
func (fi bindataFileInfo) Size() int64 { func (fi bindataFileInfo) Size() int64 {
return fi.size return fi.size
} }
func (fi bindataFileInfo) Mode() os.FileMode { func (fi bindataFileInfo) Mode() os.FileMode {
return fi.mode return fi.mode
} }
func (fi bindataFileInfo) ModTime() time.Time { func (fi bindataFileInfo) ModTime() time.Time {
return fi.modTime return fi.modTime
} }
func (fi bindataFileInfo) IsDir() bool { func (fi bindataFileInfo) IsDir() bool {
return false return false
} }
func (fi bindataFileInfo) Sys() interface{} { func (fi bindataFileInfo) Sys() interface{} {
return nil return nil
} }

View file

@ -43,9 +43,7 @@ import (
cli "gopkg.in/urfave/cli.v1" cli "gopkg.in/urfave/cli.v1"
) )
const ( const clientIdentifier = "geth" // Client identifier to advertise over the network
clientIdentifier = "geth" // Client identifier to advertise over the network
)
var ( var (
// Git SHA1 commit hash of the release (set via linker flags) // 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.setAccount(address, account)
} }
spec.setPrecompile(1, &alethGenesisSpecBuiltin{Name: "ecrecover", spec.setPrecompile(1, &alethGenesisSpecBuiltin{
Linear: &alethGenesisSpecLinearPricing{Base: 3000}}) Name: "ecrecover",
spec.setPrecompile(2, &alethGenesisSpecBuiltin{Name: "sha256", Linear: &alethGenesisSpecLinearPricing{Base: 3000},
Linear: &alethGenesisSpecLinearPricing{Base: 60, Word: 12}}) })
spec.setPrecompile(3, &alethGenesisSpecBuiltin{Name: "ripemd160", spec.setPrecompile(2, &alethGenesisSpecBuiltin{
Linear: &alethGenesisSpecLinearPricing{Base: 600, Word: 120}}) Name: "sha256",
spec.setPrecompile(4, &alethGenesisSpecBuiltin{Name: "identity", Linear: &alethGenesisSpecLinearPricing{Base: 60, Word: 12},
Linear: &alethGenesisSpecLinearPricing{Base: 15, Word: 3}}) })
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 { if genesis.Config.ByzantiumBlock != nil {
spec.setPrecompile(5, &alethGenesisSpecBuiltin{Name: "modexp", spec.setPrecompile(5, &alethGenesisSpecBuiltin{
StartingBlock: (hexutil.Uint64)(genesis.Config.ByzantiumBlock.Uint64())}) Name: "modexp",
spec.setPrecompile(6, &alethGenesisSpecBuiltin{Name: "alt_bn128_G1_add",
StartingBlock: (hexutil.Uint64)(genesis.Config.ByzantiumBlock.Uint64()), 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()), StartingBlock: (hexutil.Uint64)(genesis.Config.ByzantiumBlock.Uint64()),
Linear: &alethGenesisSpecLinearPricing{Base: 40000}}) Linear: &alethGenesisSpecLinearPricing{Base: 500},
spec.setPrecompile(8, &alethGenesisSpecBuiltin{Name: "alt_bn128_pairing_product", })
StartingBlock: (hexutil.Uint64)(genesis.Config.ByzantiumBlock.Uint64())}) 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 return spec, nil
} }
@ -193,7 +209,6 @@ func (spec *alethGenesisSpec) setAccount(address common.Address, account core.Ge
} }
a.Balance = (*math2.HexOrDecimal256)(account.Balance) a.Balance = (*math2.HexOrDecimal256)(account.Balance)
a.Nonce = account.Nonce a.Nonce = account.Nonce
} }
func (spec *alethGenesisSpec) setByzantium(num *big.Int) { 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), Nonce: math2.HexOrDecimal64(account.Nonce),
} }
} }
spec.setPrecompile(1, &parityChainSpecBuiltin{Name: "ecrecover", spec.setPrecompile(1, &parityChainSpecBuiltin{
Pricing: &parityChainSpecPricing{Linear: &parityChainSpecLinearPricing{Base: 3000}}}) Name: "ecrecover",
Pricing: &parityChainSpecPricing{Linear: &parityChainSpecLinearPricing{Base: 3000}},
})
spec.setPrecompile(2, &parityChainSpecBuiltin{ spec.setPrecompile(2, &parityChainSpecBuiltin{
Name: "sha256", Pricing: &parityChainSpecPricing{Linear: &parityChainSpecLinearPricing{Base: 60, Word: 12}}, 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") wrongPasswordFilename := testutil.TempFileWithContent(t, "just wr0ng")
defer os.RemoveAll(wrongPasswordFilename) defer os.RemoveAll(wrongPasswordFilename)
//download file with 'swarm down' with wrong password // download file with 'swarm down' with wrong password
up = runSwarm(t, up = runSwarm(t,
"--bzzapi", "--bzzapi",
cluster.Nodes[0].URL, cluster.Nodes[0].URL,
@ -282,7 +282,7 @@ func testPK(t *testing.T) {
t.Fatalf("stdout not matched") t.Fatalf("stdout not matched")
} }
//get the public key from the publisher directory // get the public key from the publisher directory
publicKeyFromDataDir := runSwarm(t, publicKeyFromDataDir := runSwarm(t,
"--bzzaccount", "--bzzaccount",
publisherAccount.Address.String(), publisherAccount.Address.String(),
@ -464,7 +464,7 @@ func testACT(t *testing.T, bogusEntries int) {
t.Fatalf("stdout not matched") t.Fatalf("stdout not matched")
} }
//get the public key from the publisher directory // get the public key from the publisher directory
publicKeyFromDataDir := runSwarm(t, publicKeyFromDataDir := runSwarm(t,
"--bzzaccount", "--bzzaccount",
publisherAccount.Address.String(), publisherAccount.Address.String(),

View file

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

View file

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

View file

@ -136,7 +136,6 @@ func feedCreateManifest(ctx *cli.Context) {
return return
} }
fmt.Println(manifestAddress) // output manifest address to the user in a single line (useful for other commands to pick up) 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) { 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") utils.Fatalf("Cannot read private key. Must specify --user or --bzzaccount")
} }
return crypto.PubkeyToAddress(pk.PublicKey) return crypto.PubkeyToAddress(pk.PublicKey)
} }

View file

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

View file

@ -110,7 +110,7 @@ func unmount(cliContext *cli.Context) {
if err != nil { if err != nil {
utils.Fatalf("encountered an error calling the RPC endpoint while unmounting: %v", err) 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) { 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") 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) filesInDir, err := ioutil.ReadDir(mountPoint)
if err != nil { if err != nil {
t.Fatalf("had an error reading the directory: %v", err) 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)) 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{ newMount := runSwarm(t, []string{
fmt.Sprintf("--%s", utils.IPCPathFlag.Name), filepath.Join(handlingNode.Dir, handlingNode.IpcPath), fmt.Sprintf("--%s", utils.IPCPathFlag.Name), filepath.Join(handlingNode.Dir, handlingNode.IpcPath),
"fs", "fs",
@ -222,7 +222,8 @@ func doUploadEmptyDir(t *testing.T, node *testNode) string {
"--bzzapi", node.URL, "--bzzapi", node.URL,
"--recursive", "--recursive",
"up", "up",
tmpDir} tmpDir,
}
log.Info("swarmfs cli test: uploading dir with 'swarm up'") log.Info("swarmfs cli test: uploading dir with 'swarm up'")
up := runSwarm(t, flags...) up := runSwarm(t, flags...)

View file

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

View file

@ -74,7 +74,7 @@ OPTIONS:
// e.g.: go install -ldflags "-X main.gitCommit=ed1312d01b19e04ef578946226e5d8069d5dfd5a" ./cmd/swarm // e.g.: go install -ldflags "-X main.gitCommit=ed1312d01b19e04ef578946226e5d8069d5dfd5a" ./cmd/swarm
var gitCommit string 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 ( var (
SwarmErrNoBZZAccount = "bzzaccount option is required but not set; check your config file, command line or environment variables" 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" 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 { func bzzd(ctx *cli.Context) error {
//build a valid bzzapi.Config from all available sources: // build a valid bzzapi.Config from all available sources:
//default config, file config, command line and env vars // default config, file config, command line and env vars
bzzconfig, err := buildConfig(ctx) bzzconfig, err := buildConfig(ctx)
if err != nil { if err != nil {
@ -272,22 +272,22 @@ func bzzd(ctx *cli.Context) error {
cfg := defaultNodeConfig cfg := defaultNodeConfig
//pss operates on ws // pss operates on ws
cfg.WSModules = append(cfg.WSModules, "pss") cfg.WSModules = append(cfg.WSModules, "pss")
//geth only supports --datadir via command line // geth only supports --datadir via command line
//in order to be consistent within swarm, if we pass --datadir via environment variable // 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 // or via config file, we get the same directory for geth and swarm
if _, err := os.Stat(bzzconfig.Path); err == nil { if _, err := os.Stat(bzzconfig.Path); err == nil {
cfg.DataDir = bzzconfig.Path cfg.DataDir = bzzconfig.Path
} }
//optionally set the bootnodes before configuring the node // optionally set the bootnodes before configuring the node
setSwarmBootstrapNodes(ctx, &cfg) setSwarmBootstrapNodes(ctx, &cfg)
//setup the ethereum node // setup the ethereum node
utils.SetNodeConfig(ctx, &cfg) utils.SetNodeConfig(ctx, &cfg)
//disable dynamic dialing from p2p/discovery // disable dynamic dialing from p2p/discovery
cfg.P2P.NoDial = true cfg.P2P.NoDial = true
stack, err := node.New(&cfg) stack, err := node.New(&cfg)
@ -296,15 +296,15 @@ func bzzd(ctx *cli.Context) error {
} }
defer stack.Close() defer stack.Close()
//a few steps need to be done after the config phase is completed, // a few steps need to be done after the config phase is completed,
//due to overriding behavior // due to overriding behavior
err = initSwarmNode(bzzconfig, stack, ctx, &cfg) err = initSwarmNode(bzzconfig, stack, ctx, &cfg)
if err != nil { if err != nil {
return err return err
} }
//register BZZ as node.Service in the ethereum node // register BZZ as node.Service in the ethereum node
registerBzzService(bzzconfig, stack) registerBzzService(bzzconfig, stack)
//start the node // start the node
utils.StartNode(stack) utils.StartNode(stack)
go func() { go func() {
@ -330,7 +330,7 @@ func bzzd(ctx *cli.Context) error {
} }
func registerBzzService(bzzconfig *bzzapi.Config, stack *node.Node) { 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) { boot := func(_ *node.ServiceContext) (node.Service, error) {
var nodeStore *mock.NodeStore var nodeStore *mock.NodeStore
if bzzconfig.GlobalStoreAPI != "" { if bzzconfig.GlobalStoreAPI != "" {
@ -345,14 +345,14 @@ func registerBzzService(bzzconfig *bzzapi.Config, stack *node.Node) {
} }
return swarm.NewSwarm(bzzconfig, nodeStore) return swarm.NewSwarm(bzzconfig, nodeStore)
} }
//register within the ethereum node // register within the ethereum node
if err := stack.Register(boot); err != nil { if err := stack.Register(boot); err != nil {
utils.Fatalf("Failed to register the Swarm service: %v", err) utils.Fatalf("Failed to register the Swarm service: %v", err)
} }
} }
func getAccount(bzzaccount string, ctx *cli.Context, stack *node.Node) *ecdsa.PrivateKey { func getAccount(bzzaccount string, ctx *cli.Context, stack *node.Node) *ecdsa.PrivateKey {
//an account is mandatory // an account is mandatory
if bzzaccount == "" { if bzzaccount == "" {
utils.Fatalf(SwarmErrNoBZZAccount) utils.Fatalf(SwarmErrNoBZZAccount)
} }
@ -471,5 +471,4 @@ func setSwarmBootstrapNodes(ctx *cli.Context, cfg *node.Config) {
} }
cfg.P2P.BootstrapNodes = append(cfg.P2P.BootstrapNodes, node) 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 { func serverFunc(api *api.API) swarmhttp.TestServer {
return swarmhttp.NewServer(api, "") return swarmhttp.NewServer(api, "")
} }
func TestMain(m *testing.M) { func TestMain(m *testing.M) {
// check if we have been reexec'd // check if we have been reexec'd
if reexec.Init() { 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 { func newTestNode(t *testing.T, dir string) *testNode {
conf, account := getTestAccount(t, dir) conf, account := getTestAccount(t, dir)
ks := keystore.NewKeyStore(path.Join(dir, "keystore"), 1<<18, 1) ks := keystore.NewKeyStore(path.Join(dir, "keystore"), 1<<18, 1)

View file

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

View file

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

View file

@ -50,7 +50,7 @@ func slidingWindowCmd(ctx *cli.Context, tuid string) error {
} }
func slidingWindow(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) nodes := len(hosts)
log.Info("sliding window test started", "tuid", tuid, "nodes", nodes, "filesize(kb)", filesize, "timeout", timeout) log.Info("sliding window test started", "tuid", tuid, "nodes", nodes, "filesize(kb)", filesize, "timeout", timeout)
uploadedBytes := 0 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)) req = req.WithContext(httptrace.WithClientTrace(ctx, trace))
transport := http.DefaultTransport transport := http.DefaultTransport
//transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} // transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
tn = time.Now() tn = time.Now()
res, err := transport.RoundTrip(req) 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)) req = req.WithContext(httptrace.WithClientTrace(ctx, trace))
transport := http.DefaultTransport transport := http.DefaultTransport
//transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} // transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
tn = time.Now() tn = time.Now()
res, err := transport.RoundTrip(req) 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) 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{ flags := []string{
"--bzzapi", cluster.Nodes[0].URL, "--bzzapi", cluster.Nodes[0].URL,
"up", "up",
tmpFileName} tmpFileName,
}
if toEncrypt { if toEncrypt {
hashRegexp = `[a-f\d]{128}` hashRegexp = `[a-f\d]{128}`
flags = []string{ flags = []string{
"--bzzapi", cluster.Nodes[0].URL, "--bzzapi", cluster.Nodes[0].URL,
"up", "up",
"--encrypt", "--encrypt",
tmpFileName} tmpFileName,
}
} }
// upload the file with 'swarm up' and expect a hash // upload the file with 'swarm up' and expect a hash
log.Info(fmt.Sprintf("uploading file with 'swarm up'")) 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) t.Fatalf("expected HTTP body %q, got %q", data, reply)
} }
log.Debug("verifying uploaded file using `swarm down`") 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, err := ioutil.TempDir("", "swarm-test")
tmpDownload = path.Join(tmpDownload, "tmpfile.tmp") tmpDownload = path.Join(tmpDownload, "tmpfile.tmp")
if err != nil { if err != nil {
@ -207,7 +209,8 @@ func testRecursive(toEncrypt bool, t *testing.T) {
"--bzzapi", cluster.Nodes[0].URL, "--bzzapi", cluster.Nodes[0].URL,
"--recursive", "--recursive",
"up", "up",
tmpUploadDir} tmpUploadDir,
}
if toEncrypt { if toEncrypt {
hashRegexp = `[a-f\d]{128}` hashRegexp = `[a-f\d]{128}`
flags = []string{ flags = []string{
@ -215,7 +218,8 @@ func testRecursive(toEncrypt bool, t *testing.T) {
"--recursive", "--recursive",
"up", "up",
"--encrypt", "--encrypt",
tmpUploadDir} tmpUploadDir,
}
} }
// upload the file with 'swarm up' and expect a hash // upload the file with 'swarm up' and expect a hash
log.Info(fmt.Sprintf("uploading file with 'swarm up'")) 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 // get the file from the HTTP API of each node
for _, node := range cluster.Nodes { for _, node := range cluster.Nodes {
log.Info("getting file from node", "node", node.Name) 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") tmpDownload, err := ioutil.TempDir("", "swarm-test")
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)

View file

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

View file

@ -60,8 +60,7 @@ import (
cli "gopkg.in/urfave/cli.v1" cli "gopkg.in/urfave/cli.v1"
) )
var ( var CommandHelpTemplate = `{{.cmd.Name}}{{if .cmd.Subcommands}} command{{end}}{{if .cmd.Flags}} [command options]{{end}} [arguments...]
CommandHelpTemplate = `{{.cmd.Name}}{{if .cmd.Subcommands}} command{{end}}{{if .cmd.Flags}} [command options]{{end}} [arguments...]
{{if .cmd.Description}}{{.cmd.Description}} {{if .cmd.Description}}{{.cmd.Description}}
{{end}}{{if .cmd.Subcommands}} {{end}}{{if .cmd.Subcommands}}
SUBCOMMANDS: SUBCOMMANDS:
@ -71,7 +70,6 @@ SUBCOMMANDS:
{{range $categorized.Flags}}{{"\t"}}{{.}} {{range $categorized.Flags}}{{"\t"}}{{.}}
{{end}} {{end}}
{{end}}{{end}}` {{end}}{{end}}`
)
func init() { func init() {
cli.AppHelpTemplate = `{{.Name}} {{if .Flags}}[global options] {{end}}command{{if .Flags}} [command options]{{end}} [arguments...] 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 := cli.NewApp()
app.Name = filepath.Base(os.Args[0]) app.Name = filepath.Base(os.Args[0])
app.Author = "" app.Author = ""
//app.Authors = nil // app.Authors = nil
app.Email = "" app.Email = ""
app.Version = params.VersionWithMeta app.Version = params.VersionWithMeta
if len(gitCommit) >= 8 { 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. // 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) // fmt.Printf("\n%s <%x>: message from myself received, not saved: '%s'\n", timestamp, address, name)
// return // return
//} //}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -36,10 +36,8 @@ import (
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
) )
const ( // staleThreshold is the maximum depth of the acceptable stale but valid ethash solution.
// staleThreshold is the maximum depth of the acceptable stale but valid ethash solution. const staleThreshold = 7
staleThreshold = 7
)
var ( var (
errNoMiningWork = errors.New("no mining work available yet") 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) return fmt.Errorf("namespace flattening: %v", err)
} }
// Initialize the global name register (disabled for now) // 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 the console is in interactive mode, instrument password related methods to query the user
if c.prompter != nil { 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) { func (p *hookedPrompter) PromptPassword(prompt string) (string, error) {
return "", errors.New("not implemented") return "", errors.New("not implemented")
} }
func (p *hookedPrompter) PromptConfirm(prompt string) (bool, error) { func (p *hookedPrompter) PromptConfirm(prompt string) (bool, error) {
return false, errors.New("not implemented") return false, errors.New("not implemented")
} }

View file

@ -55,10 +55,8 @@ import (
// * depositing ether to the chequebook // * depositing ether to the chequebook
// * watching incoming ether // * watching incoming ether
var ( var gasToCash = uint64(2000000) // gas cost of a cash transaction using chequebook
gasToCash = uint64(2000000) // gas cost of a cash transaction using chequebook // gasToDeploy = uint64(3000000)
// gasToDeploy = uint64(3000000)
)
// Backend wraps all methods required for chequebook operation. // Backend wraps all methods required for chequebook operation.
type Backend interface { type Backend interface {
@ -100,7 +98,7 @@ type Chequebook struct {
// persisted fields // persisted fields
balance *big.Int // not synced with blockchain balance *big.Int // not synced with blockchain
contractAddr common.Address // contract address 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 txhash string // tx hash of last deposit tx
threshold *big.Int // threshold that triggers autodeposit if not nil 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 { if received.Cmp(big.NewInt(43)) != 0 {
t.Errorf("expected: %v, got %v", "43", received) t.Errorf("expected: %v, got %v", "43", received)
} }
} }
func TestCheckbookFile(t *testing.T) { func TestCheckbookFile(t *testing.T) {
@ -216,7 +215,6 @@ func TestVerifyErrors(t *testing.T) {
if err == nil { if err == nil {
t.Fatalf("expected incorrect amount error, got none and value %v", received) t.Fatalf("expected incorrect amount error, got none and value %v", received)
} }
} }
func TestDeposit(t *testing.T) { func TestDeposit(t *testing.T) {
@ -355,7 +353,6 @@ func TestDeposit(t *testing.T) {
if chbook.Balance().Cmp(exp) != 0 { if chbook.Balance().Cmp(exp) != 0 {
t.Fatalf("expected balance %v, got %v", exp, chbook.Balance()) t.Fatalf("expected balance %v, got %v", exp, chbook.Balance())
} }
} }
func TestCash(t *testing.T) { func TestCash(t *testing.T) {
@ -483,5 +480,4 @@ func TestCash(t *testing.T) {
t.Fatalf("expected no error, got %v", err) t.Fatalf("expected no error, got %v", err)
} }
backend.Commit() backend.Commit()
} }

View file

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

View file

@ -80,7 +80,7 @@ func extractContentHash(buf []byte) (common.Hash, error) {
return common.Hash{}, errors.New("unknown storage system") 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 { /*if contentType != swarmTypecode {
return common.Hash{}, errors.New("unknown content type") 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) { func EncodeSwarmHash(hash common.Hash) ([]byte, error) {
var cidBytes []byte var cidBytes []byte
var headerBytes = []byte{ var headerBytes = []byte{
nsSwarm, //swarm namespace nsSwarm, // swarm namespace
cidv1, // CIDv1 cidv1, // CIDv1
swarmTypecode, // swarm hash swarmTypecode, // swarm hash
swarmHashtype, // keccak256 hash swarmHashtype, // keccak256 hash
hashLength, //hash length. 32 bytes hashLength, // hash length. 32 bytes
} }
varintbuf := make([]byte, binary.MaxVarintLen64) varintbuf := make([]byte, binary.MaxVarintLen64)

View file

@ -64,8 +64,8 @@ func TestEIPSpecCidDecode(t *testing.T) {
if !bytes.Equal(hashBytes, decodedHashBytes) { if !bytes.Equal(hashBytes, decodedHashBytes) {
t.Fatal("should be equal") t.Fatal("should be equal")
} }
} }
func TestManualCidDecode(t *testing.T) { func TestManualCidDecode(t *testing.T) {
// call cid encode method with hash. expect byte slice returned, compare according to spec // 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) // Solidity: function owner(bytes32 node) constant returns(address)
func (_ENS *ENSCaller) Owner(opts *bind.CallOpts, node [32]byte) (common.Address, error) { 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 out := ret0
err := _ENS.contract.Call(opts, out, "owner", node) err := _ENS.contract.Call(opts, out, "owner", node)
return *ret0, err 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) // Solidity: function resolver(bytes32 node) constant returns(address)
func (_ENS *ENSCaller) Resolver(opts *bind.CallOpts, node [32]byte) (common.Address, error) { 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 out := ret0
err := _ENS.contract.Call(opts, out, "resolver", node) err := _ENS.contract.Call(opts, out, "resolver", node)
return *ret0, err 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) // Solidity: function ttl(bytes32 node) constant returns(uint64)
func (_ENS *ENSCaller) Ttl(opts *bind.CallOpts, node [32]byte) (uint64, error) { func (_ENS *ENSCaller) Ttl(opts *bind.CallOpts, node [32]byte) (uint64, error) {
var (
ret0 = new(uint64) var ret0 = new(uint64)
)
out := ret0 out := ret0
err := _ENS.contract.Call(opts, out, "ttl", node) err := _ENS.contract.Call(opts, out, "ttl", node)
return *ret0, err return *ret0, err
@ -429,7 +429,6 @@ type ENSNewOwner struct {
// //
// Solidity: event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner) // 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) { func (_ENS *ENSFilterer) FilterNewOwner(opts *bind.FilterOpts, node [][32]byte, label [][32]byte) (*ENSNewOwnerIterator, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) 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) // 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) { func (_ENS *ENSFilterer) WatchNewOwner(opts *bind.WatchOpts, sink chan<- *ENSNewOwner, node [][32]byte, label [][32]byte) (event.Subscription, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -570,7 +568,6 @@ type ENSNewResolver struct {
// //
// Solidity: event NewResolver(bytes32 indexed node, address resolver) // Solidity: event NewResolver(bytes32 indexed node, address resolver)
func (_ENS *ENSFilterer) FilterNewResolver(opts *bind.FilterOpts, node [][32]byte) (*ENSNewResolverIterator, error) { func (_ENS *ENSFilterer) FilterNewResolver(opts *bind.FilterOpts, node [][32]byte) (*ENSNewResolverIterator, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) 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) // Solidity: event NewResolver(bytes32 indexed node, address resolver)
func (_ENS *ENSFilterer) WatchNewResolver(opts *bind.WatchOpts, sink chan<- *ENSNewResolver, node [][32]byte) (event.Subscription, error) { func (_ENS *ENSFilterer) WatchNewResolver(opts *bind.WatchOpts, sink chan<- *ENSNewResolver, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -703,7 +699,6 @@ type ENSNewTTL struct {
// //
// Solidity: event NewTTL(bytes32 indexed node, uint64 ttl) // Solidity: event NewTTL(bytes32 indexed node, uint64 ttl)
func (_ENS *ENSFilterer) FilterNewTTL(opts *bind.FilterOpts, node [][32]byte) (*ENSNewTTLIterator, error) { func (_ENS *ENSFilterer) FilterNewTTL(opts *bind.FilterOpts, node [][32]byte) (*ENSNewTTLIterator, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) 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) // Solidity: event NewTTL(bytes32 indexed node, uint64 ttl)
func (_ENS *ENSFilterer) WatchNewTTL(opts *bind.WatchOpts, sink chan<- *ENSNewTTL, node [][32]byte) (event.Subscription, error) { func (_ENS *ENSFilterer) WatchNewTTL(opts *bind.WatchOpts, sink chan<- *ENSNewTTL, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -836,7 +830,6 @@ type ENSTransfer struct {
// //
// Solidity: event Transfer(bytes32 indexed node, address owner) // Solidity: event Transfer(bytes32 indexed node, address owner)
func (_ENS *ENSFilterer) FilterTransfer(opts *bind.FilterOpts, node [][32]byte) (*ENSTransferIterator, error) { func (_ENS *ENSFilterer) FilterTransfer(opts *bind.FilterOpts, node [][32]byte) (*ENSTransferIterator, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) 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) // Solidity: event Transfer(bytes32 indexed node, address owner)
func (_ENS *ENSFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ENSTransfer, node [][32]byte) (event.Subscription, error) { func (_ENS *ENSFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ENSTransfer, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) 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) // Solidity: function owner(bytes32 node) constant returns(address)
func (_ENSRegistry *ENSRegistryCaller) Owner(opts *bind.CallOpts, node [32]byte) (common.Address, error) { 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 out := ret0
err := _ENSRegistry.contract.Call(opts, out, "owner", node) err := _ENSRegistry.contract.Call(opts, out, "owner", node)
return *ret0, err return *ret0, err
@ -218,9 +218,9 @@ func (_ENSRegistry *ENSRegistryCallerSession) Owner(node [32]byte) (common.Addre
// //
// Solidity: function resolver(bytes32 node) constant returns(address) // Solidity: function resolver(bytes32 node) constant returns(address)
func (_ENSRegistry *ENSRegistryCaller) Resolver(opts *bind.CallOpts, node [32]byte) (common.Address, error) { 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 out := ret0
err := _ENSRegistry.contract.Call(opts, out, "resolver", node) err := _ENSRegistry.contract.Call(opts, out, "resolver", node)
return *ret0, err return *ret0, err
@ -244,9 +244,9 @@ func (_ENSRegistry *ENSRegistryCallerSession) Resolver(node [32]byte) (common.Ad
// //
// Solidity: function ttl(bytes32 node) constant returns(uint64) // Solidity: function ttl(bytes32 node) constant returns(uint64)
func (_ENSRegistry *ENSRegistryCaller) Ttl(opts *bind.CallOpts, node [32]byte) (uint64, error) { func (_ENSRegistry *ENSRegistryCaller) Ttl(opts *bind.CallOpts, node [32]byte) (uint64, error) {
var (
ret0 = new(uint64) var ret0 = new(uint64)
)
out := ret0 out := ret0
err := _ENSRegistry.contract.Call(opts, out, "ttl", node) err := _ENSRegistry.contract.Call(opts, out, "ttl", node)
return *ret0, err return *ret0, err
@ -429,7 +429,6 @@ type ENSRegistryNewOwner struct {
// //
// Solidity: event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner) // 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) { func (_ENSRegistry *ENSRegistryFilterer) FilterNewOwner(opts *bind.FilterOpts, node [][32]byte, label [][32]byte) (*ENSRegistryNewOwnerIterator, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) 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) // 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) { func (_ENSRegistry *ENSRegistryFilterer) WatchNewOwner(opts *bind.WatchOpts, sink chan<- *ENSRegistryNewOwner, node [][32]byte, label [][32]byte) (event.Subscription, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -570,7 +568,6 @@ type ENSRegistryNewResolver struct {
// //
// Solidity: event NewResolver(bytes32 indexed node, address resolver) // Solidity: event NewResolver(bytes32 indexed node, address resolver)
func (_ENSRegistry *ENSRegistryFilterer) FilterNewResolver(opts *bind.FilterOpts, node [][32]byte) (*ENSRegistryNewResolverIterator, error) { func (_ENSRegistry *ENSRegistryFilterer) FilterNewResolver(opts *bind.FilterOpts, node [][32]byte) (*ENSRegistryNewResolverIterator, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -587,7 +584,6 @@ func (_ENSRegistry *ENSRegistryFilterer) FilterNewResolver(opts *bind.FilterOpts
// //
// Solidity: event NewResolver(bytes32 indexed node, address resolver) // Solidity: event NewResolver(bytes32 indexed node, address resolver)
func (_ENSRegistry *ENSRegistryFilterer) WatchNewResolver(opts *bind.WatchOpts, sink chan<- *ENSRegistryNewResolver, node [][32]byte) (event.Subscription, error) { func (_ENSRegistry *ENSRegistryFilterer) WatchNewResolver(opts *bind.WatchOpts, sink chan<- *ENSRegistryNewResolver, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -703,7 +699,6 @@ type ENSRegistryNewTTL struct {
// //
// Solidity: event NewTTL(bytes32 indexed node, uint64 ttl) // Solidity: event NewTTL(bytes32 indexed node, uint64 ttl)
func (_ENSRegistry *ENSRegistryFilterer) FilterNewTTL(opts *bind.FilterOpts, node [][32]byte) (*ENSRegistryNewTTLIterator, error) { func (_ENSRegistry *ENSRegistryFilterer) FilterNewTTL(opts *bind.FilterOpts, node [][32]byte) (*ENSRegistryNewTTLIterator, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -720,7 +715,6 @@ func (_ENSRegistry *ENSRegistryFilterer) FilterNewTTL(opts *bind.FilterOpts, nod
// //
// Solidity: event NewTTL(bytes32 indexed node, uint64 ttl) // Solidity: event NewTTL(bytes32 indexed node, uint64 ttl)
func (_ENSRegistry *ENSRegistryFilterer) WatchNewTTL(opts *bind.WatchOpts, sink chan<- *ENSRegistryNewTTL, node [][32]byte) (event.Subscription, error) { func (_ENSRegistry *ENSRegistryFilterer) WatchNewTTL(opts *bind.WatchOpts, sink chan<- *ENSRegistryNewTTL, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -836,7 +830,6 @@ type ENSRegistryTransfer struct {
// //
// Solidity: event Transfer(bytes32 indexed node, address owner) // Solidity: event Transfer(bytes32 indexed node, address owner)
func (_ENSRegistry *ENSRegistryFilterer) FilterTransfer(opts *bind.FilterOpts, node [][32]byte) (*ENSRegistryTransferIterator, error) { func (_ENSRegistry *ENSRegistryFilterer) FilterTransfer(opts *bind.FilterOpts, node [][32]byte) (*ENSRegistryTransferIterator, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -853,7 +846,6 @@ func (_ENSRegistry *ENSRegistryFilterer) FilterTransfer(opts *bind.FilterOpts, n
// //
// Solidity: event Transfer(bytes32 indexed node, address owner) // Solidity: event Transfer(bytes32 indexed node, address owner)
func (_ENSRegistry *ENSRegistryFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ENSRegistryTransfer, node [][32]byte) (event.Subscription, error) { func (_ENSRegistry *ENSRegistryFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ENSRegistryTransfer, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) 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) // Solidity: function addr(bytes32 node) constant returns(address)
func (_PublicResolver *PublicResolverCaller) Addr(opts *bind.CallOpts, node [32]byte) (common.Address, error) { 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 out := ret0
err := _PublicResolver.contract.Call(opts, out, "addr", node) err := _PublicResolver.contract.Call(opts, out, "addr", node)
return *ret0, err return *ret0, err
@ -248,9 +248,9 @@ func (_PublicResolver *PublicResolverCallerSession) Addr(node [32]byte) (common.
// //
// Solidity: function contenthash(bytes32 node) constant returns(bytes) // Solidity: function contenthash(bytes32 node) constant returns(bytes)
func (_PublicResolver *PublicResolverCaller) Contenthash(opts *bind.CallOpts, node [32]byte) ([]byte, error) { func (_PublicResolver *PublicResolverCaller) Contenthash(opts *bind.CallOpts, node [32]byte) ([]byte, error) {
var (
ret0 = new([]byte) var ret0 = new([]byte)
)
out := ret0 out := ret0
err := _PublicResolver.contract.Call(opts, out, "contenthash", node) err := _PublicResolver.contract.Call(opts, out, "contenthash", node)
return *ret0, err return *ret0, err
@ -274,9 +274,9 @@ func (_PublicResolver *PublicResolverCallerSession) Contenthash(node [32]byte) (
// //
// Solidity: function name(bytes32 node) constant returns(string) // Solidity: function name(bytes32 node) constant returns(string)
func (_PublicResolver *PublicResolverCaller) Name(opts *bind.CallOpts, node [32]byte) (string, error) { func (_PublicResolver *PublicResolverCaller) Name(opts *bind.CallOpts, node [32]byte) (string, error) {
var (
ret0 = new(string) var ret0 = new(string)
)
out := ret0 out := ret0
err := _PublicResolver.contract.Call(opts, out, "name", node) err := _PublicResolver.contract.Call(opts, out, "name", node)
return *ret0, err return *ret0, err
@ -336,9 +336,9 @@ func (_PublicResolver *PublicResolverCallerSession) Pubkey(node [32]byte) (struc
// //
// Solidity: function supportsInterface(bytes4 interfaceID) constant returns(bool) // Solidity: function supportsInterface(bytes4 interfaceID) constant returns(bool)
func (_PublicResolver *PublicResolverCaller) SupportsInterface(opts *bind.CallOpts, interfaceID [4]byte) (bool, error) { func (_PublicResolver *PublicResolverCaller) SupportsInterface(opts *bind.CallOpts, interfaceID [4]byte) (bool, error) {
var (
ret0 = new(bool) var ret0 = new(bool)
)
out := ret0 out := ret0
err := _PublicResolver.contract.Call(opts, out, "supportsInterface", interfaceID) err := _PublicResolver.contract.Call(opts, out, "supportsInterface", interfaceID)
return *ret0, err return *ret0, err
@ -362,9 +362,9 @@ func (_PublicResolver *PublicResolverCallerSession) SupportsInterface(interfaceI
// //
// Solidity: function text(bytes32 node, string key) constant returns(string) // Solidity: function text(bytes32 node, string key) constant returns(string)
func (_PublicResolver *PublicResolverCaller) Text(opts *bind.CallOpts, node [32]byte, key string) (string, error) { func (_PublicResolver *PublicResolverCaller) Text(opts *bind.CallOpts, node [32]byte, key string) (string, error) {
var (
ret0 = new(string) var ret0 = new(string)
)
out := ret0 out := ret0
err := _PublicResolver.contract.Call(opts, out, "text", node, key) err := _PublicResolver.contract.Call(opts, out, "text", node, key)
return *ret0, err return *ret0, err
@ -588,7 +588,6 @@ type PublicResolverABIChanged struct {
// //
// Solidity: event ABIChanged(bytes32 indexed node, uint256 indexed contentType) // Solidity: event ABIChanged(bytes32 indexed node, uint256 indexed contentType)
func (_PublicResolver *PublicResolverFilterer) FilterABIChanged(opts *bind.FilterOpts, node [][32]byte, contentType []*big.Int) (*PublicResolverABIChangedIterator, error) { func (_PublicResolver *PublicResolverFilterer) FilterABIChanged(opts *bind.FilterOpts, node [][32]byte, contentType []*big.Int) (*PublicResolverABIChangedIterator, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -609,7 +608,6 @@ func (_PublicResolver *PublicResolverFilterer) FilterABIChanged(opts *bind.Filte
// //
// Solidity: event ABIChanged(bytes32 indexed node, uint256 indexed contentType) // 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) { func (_PublicResolver *PublicResolverFilterer) WatchABIChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverABIChanged, node [][32]byte, contentType []*big.Int) (event.Subscription, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -729,7 +727,6 @@ type PublicResolverAddrChanged struct {
// //
// Solidity: event AddrChanged(bytes32 indexed node, address a) // Solidity: event AddrChanged(bytes32 indexed node, address a)
func (_PublicResolver *PublicResolverFilterer) FilterAddrChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverAddrChangedIterator, error) { func (_PublicResolver *PublicResolverFilterer) FilterAddrChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverAddrChangedIterator, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -746,7 +743,6 @@ func (_PublicResolver *PublicResolverFilterer) FilterAddrChanged(opts *bind.Filt
// //
// Solidity: event AddrChanged(bytes32 indexed node, address a) // Solidity: event AddrChanged(bytes32 indexed node, address a)
func (_PublicResolver *PublicResolverFilterer) WatchAddrChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverAddrChanged, node [][32]byte) (event.Subscription, error) { func (_PublicResolver *PublicResolverFilterer) WatchAddrChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverAddrChanged, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -862,7 +858,6 @@ type PublicResolverContenthashChanged struct {
// //
// Solidity: event ContenthashChanged(bytes32 indexed node, bytes hash) // Solidity: event ContenthashChanged(bytes32 indexed node, bytes hash)
func (_PublicResolver *PublicResolverFilterer) FilterContenthashChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverContenthashChangedIterator, error) { func (_PublicResolver *PublicResolverFilterer) FilterContenthashChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverContenthashChangedIterator, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -879,7 +874,6 @@ func (_PublicResolver *PublicResolverFilterer) FilterContenthashChanged(opts *bi
// //
// Solidity: event ContenthashChanged(bytes32 indexed node, bytes hash) // Solidity: event ContenthashChanged(bytes32 indexed node, bytes hash)
func (_PublicResolver *PublicResolverFilterer) WatchContenthashChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverContenthashChanged, node [][32]byte) (event.Subscription, error) { func (_PublicResolver *PublicResolverFilterer) WatchContenthashChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverContenthashChanged, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -995,7 +989,6 @@ type PublicResolverNameChanged struct {
// //
// Solidity: event NameChanged(bytes32 indexed node, string name) // Solidity: event NameChanged(bytes32 indexed node, string name)
func (_PublicResolver *PublicResolverFilterer) FilterNameChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverNameChangedIterator, error) { func (_PublicResolver *PublicResolverFilterer) FilterNameChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverNameChangedIterator, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -1012,7 +1005,6 @@ func (_PublicResolver *PublicResolverFilterer) FilterNameChanged(opts *bind.Filt
// //
// Solidity: event NameChanged(bytes32 indexed node, string name) // Solidity: event NameChanged(bytes32 indexed node, string name)
func (_PublicResolver *PublicResolverFilterer) WatchNameChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverNameChanged, node [][32]byte) (event.Subscription, error) { func (_PublicResolver *PublicResolverFilterer) WatchNameChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverNameChanged, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -1129,7 +1121,6 @@ type PublicResolverPubkeyChanged struct {
// //
// Solidity: event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y) // Solidity: event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y)
func (_PublicResolver *PublicResolverFilterer) FilterPubkeyChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverPubkeyChangedIterator, error) { func (_PublicResolver *PublicResolverFilterer) FilterPubkeyChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverPubkeyChangedIterator, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) 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) // 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) { func (_PublicResolver *PublicResolverFilterer) WatchPubkeyChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverPubkeyChanged, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -1263,7 +1253,6 @@ type PublicResolverTextChanged struct {
// //
// Solidity: event TextChanged(bytes32 indexed node, string indexedKey, string key) // Solidity: event TextChanged(bytes32 indexed node, string indexedKey, string key)
func (_PublicResolver *PublicResolverFilterer) FilterTextChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverTextChangedIterator, error) { func (_PublicResolver *PublicResolverFilterer) FilterTextChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverTextChangedIterator, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) 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) // 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) { func (_PublicResolver *PublicResolverFilterer) WatchTextChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverTextChanged, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) 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) // Solidity: function addr(node bytes32) constant returns(ret address)
func (_PublicResolver *PublicResolverCaller) Addr(opts *bind.CallOpts, node [32]byte) (common.Address, error) { 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 out := ret0
err := _PublicResolver.contract.Call(opts, out, "addr", node) err := _PublicResolver.contract.Call(opts, out, "addr", node)
return *ret0, err return *ret0, err
@ -242,9 +242,9 @@ func (_PublicResolver *PublicResolverCallerSession) Addr(node [32]byte) (common.
// //
// Solidity: function content(node bytes32) constant returns(ret bytes32) // Solidity: function content(node bytes32) constant returns(ret bytes32)
func (_PublicResolver *PublicResolverCaller) Content(opts *bind.CallOpts, node [32]byte) ([32]byte, error) { 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 out := ret0
err := _PublicResolver.contract.Call(opts, out, "content", node) err := _PublicResolver.contract.Call(opts, out, "content", node)
return *ret0, err return *ret0, err
@ -268,9 +268,9 @@ func (_PublicResolver *PublicResolverCallerSession) Content(node [32]byte) ([32]
// //
// Solidity: function name(node bytes32) constant returns(ret string) // Solidity: function name(node bytes32) constant returns(ret string)
func (_PublicResolver *PublicResolverCaller) Name(opts *bind.CallOpts, node [32]byte) (string, error) { func (_PublicResolver *PublicResolverCaller) Name(opts *bind.CallOpts, node [32]byte) (string, error) {
var (
ret0 = new(string) var ret0 = new(string)
)
out := ret0 out := ret0
err := _PublicResolver.contract.Call(opts, out, "name", node) err := _PublicResolver.contract.Call(opts, out, "name", node)
return *ret0, err return *ret0, err
@ -330,9 +330,9 @@ func (_PublicResolver *PublicResolverCallerSession) Pubkey(node [32]byte) (struc
// //
// Solidity: function supportsInterface(interfaceID bytes4) constant returns(bool) // Solidity: function supportsInterface(interfaceID bytes4) constant returns(bool)
func (_PublicResolver *PublicResolverCaller) SupportsInterface(opts *bind.CallOpts, interfaceID [4]byte) (bool, error) { func (_PublicResolver *PublicResolverCaller) SupportsInterface(opts *bind.CallOpts, interfaceID [4]byte) (bool, error) {
var (
ret0 = new(bool) var ret0 = new(bool)
)
out := ret0 out := ret0
err := _PublicResolver.contract.Call(opts, out, "supportsInterface", interfaceID) err := _PublicResolver.contract.Call(opts, out, "supportsInterface", interfaceID)
return *ret0, err return *ret0, err
@ -356,9 +356,9 @@ func (_PublicResolver *PublicResolverCallerSession) SupportsInterface(interfaceI
// //
// Solidity: function text(node bytes32, key string) constant returns(ret string) // 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) { func (_PublicResolver *PublicResolverCaller) Text(opts *bind.CallOpts, node [32]byte, key string) (string, error) {
var (
ret0 = new(string) var ret0 = new(string)
)
out := ret0 out := ret0
err := _PublicResolver.contract.Call(opts, out, "text", node, key) err := _PublicResolver.contract.Call(opts, out, "text", node, key)
return *ret0, err return *ret0, err
@ -582,7 +582,6 @@ type PublicResolverABIChanged struct {
// //
// Solidity: event ABIChanged(node indexed bytes32, contentType indexed uint256) // Solidity: event ABIChanged(node indexed bytes32, contentType indexed uint256)
func (_PublicResolver *PublicResolverFilterer) FilterABIChanged(opts *bind.FilterOpts, node [][32]byte, contentType []*big.Int) (*PublicResolverABIChangedIterator, error) { func (_PublicResolver *PublicResolverFilterer) FilterABIChanged(opts *bind.FilterOpts, node [][32]byte, contentType []*big.Int) (*PublicResolverABIChangedIterator, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -603,7 +602,6 @@ func (_PublicResolver *PublicResolverFilterer) FilterABIChanged(opts *bind.Filte
// //
// Solidity: event ABIChanged(node indexed bytes32, contentType indexed uint256) // 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) { func (_PublicResolver *PublicResolverFilterer) WatchABIChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverABIChanged, node [][32]byte, contentType []*big.Int) (event.Subscription, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -723,7 +721,6 @@ type PublicResolverAddrChanged struct {
// //
// Solidity: event AddrChanged(node indexed bytes32, a address) // Solidity: event AddrChanged(node indexed bytes32, a address)
func (_PublicResolver *PublicResolverFilterer) FilterAddrChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverAddrChangedIterator, error) { func (_PublicResolver *PublicResolverFilterer) FilterAddrChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverAddrChangedIterator, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -740,7 +737,6 @@ func (_PublicResolver *PublicResolverFilterer) FilterAddrChanged(opts *bind.Filt
// //
// Solidity: event AddrChanged(node indexed bytes32, a address) // Solidity: event AddrChanged(node indexed bytes32, a address)
func (_PublicResolver *PublicResolverFilterer) WatchAddrChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverAddrChanged, node [][32]byte) (event.Subscription, error) { func (_PublicResolver *PublicResolverFilterer) WatchAddrChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverAddrChanged, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -856,7 +852,6 @@ type PublicResolverContentChanged struct {
// //
// Solidity: event ContentChanged(node indexed bytes32, hash bytes32) // Solidity: event ContentChanged(node indexed bytes32, hash bytes32)
func (_PublicResolver *PublicResolverFilterer) FilterContentChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverContentChangedIterator, error) { func (_PublicResolver *PublicResolverFilterer) FilterContentChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverContentChangedIterator, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -873,7 +868,6 @@ func (_PublicResolver *PublicResolverFilterer) FilterContentChanged(opts *bind.F
// //
// Solidity: event ContentChanged(node indexed bytes32, hash bytes32) // Solidity: event ContentChanged(node indexed bytes32, hash bytes32)
func (_PublicResolver *PublicResolverFilterer) WatchContentChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverContentChanged, node [][32]byte) (event.Subscription, error) { func (_PublicResolver *PublicResolverFilterer) WatchContentChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverContentChanged, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -989,7 +983,6 @@ type PublicResolverNameChanged struct {
// //
// Solidity: event NameChanged(node indexed bytes32, name string) // Solidity: event NameChanged(node indexed bytes32, name string)
func (_PublicResolver *PublicResolverFilterer) FilterNameChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverNameChangedIterator, error) { func (_PublicResolver *PublicResolverFilterer) FilterNameChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverNameChangedIterator, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -1006,7 +999,6 @@ func (_PublicResolver *PublicResolverFilterer) FilterNameChanged(opts *bind.Filt
// //
// Solidity: event NameChanged(node indexed bytes32, name string) // Solidity: event NameChanged(node indexed bytes32, name string)
func (_PublicResolver *PublicResolverFilterer) WatchNameChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverNameChanged, node [][32]byte) (event.Subscription, error) { func (_PublicResolver *PublicResolverFilterer) WatchNameChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverNameChanged, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -1123,7 +1115,6 @@ type PublicResolverPubkeyChanged struct {
// //
// Solidity: event PubkeyChanged(node indexed bytes32, x bytes32, y bytes32) // Solidity: event PubkeyChanged(node indexed bytes32, x bytes32, y bytes32)
func (_PublicResolver *PublicResolverFilterer) FilterPubkeyChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverPubkeyChangedIterator, error) { func (_PublicResolver *PublicResolverFilterer) FilterPubkeyChanged(opts *bind.FilterOpts, node [][32]byte) (*PublicResolverPubkeyChangedIterator, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) 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) // 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) { func (_PublicResolver *PublicResolverFilterer) WatchPubkeyChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverPubkeyChanged, node [][32]byte) (event.Subscription, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)
@ -1257,7 +1247,6 @@ type PublicResolverTextChanged struct {
// //
// Solidity: event TextChanged(node indexed bytes32, indexedKey indexed string, key string) // 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) { func (_PublicResolver *PublicResolverFilterer) FilterTextChanged(opts *bind.FilterOpts, node [][32]byte, indexedKey []string) (*PublicResolverTextChangedIterator, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) 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) // 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) { func (_PublicResolver *PublicResolverFilterer) WatchTextChanged(opts *bind.WatchOpts, sink chan<- *PublicResolverTextChanged, node [][32]byte, indexedKey []string) (event.Subscription, error) {
var nodeRule []interface{} var nodeRule []interface{}
for _, nodeItem := range node { for _, nodeItem := range node {
nodeRule = append(nodeRule, nodeItem) nodeRule = append(nodeRule, nodeItem)

View file

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

View file

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

View file

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

View file

@ -16,9 +16,7 @@
package bloombits package bloombits
import ( import "sync"
"sync"
)
// request represents a bloom retrieval task to prioritize and pull from the local // request represents a bloom retrieval task to prioritize and pull from the local
// database or remotely from the network. // 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 { if b.headerCnt > b.indexer.sectionSize {
b.t.Error("Processing too many headers") b.t.Error("Processing too many headers")
} }
//t.processCh <- header.Number.Uint64() // t.processCh <- header.Number.Uint64()
select { select {
case <-time.After(10 * time.Second): case <-time.After(10 * time.Second):
b.t.Fatal("Unexpected call to Process") 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) { func SetupGenesisBlock(db ethdb.Database, genesis *Genesis) (*params.ChainConfig, common.Hash, error) {
return SetupGenesisBlockWithOverride(db, genesis, nil) return SetupGenesisBlockWithOverride(db, genesis, nil)
} }
func SetupGenesisBlockWithOverride(db ethdb.Database, genesis *Genesis, constantinopleOverride *big.Int) (*params.ChainConfig, common.Hash, error) { func SetupGenesisBlockWithOverride(db ethdb.Database, genesis *Genesis, constantinopleOverride *big.Int) (*params.ChainConfig, common.Hash, error) {
if genesis != nil && genesis.Config == nil { if genesis != nil && genesis.Config == nil {
return params.AllEthashProtocolChanges, common.Hash{}, errGenesisNoConfig return params.AllEthashProtocolChanges, common.Hash{}, errGenesisNoConfig

View file

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

View file

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

View file

@ -34,7 +34,7 @@ var emptyCodeHash = crypto.Keccak256(nil)
type Code []byte type Code []byte
func (self Code) String() string { 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 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) { func (s *StateSuite) TestNull(c *checker.C) {
address := common.HexToAddress("0x823140710bf13990e4500136726d8b55") address := common.HexToAddress("0x823140710bf13990e4500136726d8b55")
s.state.CreateAccount(address) s.state.CreateAccount(address)
//value := common.FromHex("0x823140710bf13990e4500136726d8b55") // value := common.FromHex("0x823140710bf13990e4500136726d8b55")
var value common.Hash var value common.Hash
s.state.SetState(address, common.Hash{}, value) s.state.SetState(address, common.Hash{}, value)

View file

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

View file

@ -35,10 +35,8 @@ import (
"github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/params"
) )
const ( // chainHeadChanSize is the size of channel listening to ChainHeadEvent.
// chainHeadChanSize is the size of channel listening to ChainHeadEvent. const chainHeadChanSize = 10
chainHeadChanSize = 10
)
var ( var (
// ErrInvalidSender is returned if the transaction contains an invalid signature. // 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 // Add a batch consecutive pending transactions for validation
txs := []*types.Transaction{} txs := []*types.Transaction{}
for i, key := range keys { for i, key := range keys {
for j := 0; j < 100; j++ { for j := 0; j < 100; j++ {
var tx *types.Transaction var tx *types.Transaction
if (i+j)%2 == 0 { if (i+j)%2 == 0 {
@ -761,6 +760,7 @@ func TestTransactionQueueAccountLimiting(t *testing.T) {
func TestTransactionQueueGlobalLimiting(t *testing.T) { func TestTransactionQueueGlobalLimiting(t *testing.T) {
testTransactionQueueGlobalLimiting(t, false) testTransactionQueueGlobalLimiting(t, false)
} }
func TestTransactionQueueGlobalLimitingNoLocals(t *testing.T) { func TestTransactionQueueGlobalLimitingNoLocals(t *testing.T) {
testTransactionQueueGlobalLimiting(t, true) 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) t.Fatalf("empty uncle hash is wrong, got %x != %x", h, exp)
} }
} }
func BenchmarkUncleHash(b *testing.B) { func BenchmarkUncleHash(b *testing.B) {
uncles := make([]*Header, 0) uncles := make([]*Header, 0)
b.ResetTimer() b.ResetTimer()

View file

@ -78,7 +78,6 @@ func (b Bloom) Test(test *big.Int) bool {
func (b Bloom) TestBytes(test []byte) bool { func (b Bloom) TestBytes(test []byte) bool {
return b.Test(new(big.Int).SetBytes(test)) return b.Test(new(big.Int).SetBytes(test))
} }
// MarshalText encodes b as a hex string with 0x prefix. // 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 //go:generate gencodec -type txdata -field-override txdataMarshaling -out gen_tx_json.go
var ( var ErrInvalidSig = errors.New("invalid transaction v, r, s values")
ErrInvalidSig = errors.New("invalid transaction v, r, s values")
)
type Transaction struct { type Transaction struct {
data txdata data txdata

View file

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

View file

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

View file

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

View file

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

View file

@ -374,7 +374,7 @@ func benchmarkPrecompiled(addr string, test precompiledTest, bench *testing.B) {
res, err = RunPrecompiledContract(p, data, contract) res, err = RunPrecompiledContract(p, data, contract)
} }
bench.StopTimer() bench.StopTimer()
//Check if it is correct // Check if it is correct
if err != nil { if err != nil {
bench.Error(err) bench.Error(err)
return 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) evm.vmConfig.Tracer.CaptureEnd(ret, gas-contract.Gas, time.Since(start), err)
} }
return ret, address, contract.Gas, err return ret, address, contract.Gas, err
} }
// Create creates a new contract using code as deployment code. // Create creates a new contract using code as deployment code.

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -16,9 +16,7 @@
package dashboard package dashboard
import ( import "encoding/json"
"encoding/json"
)
type Message struct { type Message struct {
General *GeneralMessage `json:"general,omitempty"` 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
// bloomThrottling is the time to wait between processing two consecutive index // sections. It's useful during chain upgrades to prevent disk overload.
// sections. It's useful during chain upgrades to prevent disk overload. const bloomThrottling = 100 * time.Millisecond
bloomThrottling = 100 * time.Millisecond
)
// BloomIndexer implements a core.ChainIndexer, building up a rotated bloom bits index // BloomIndexer implements a core.ChainIndexer, building up a rotated bloom bits index
// for the Ethereum header bloom filters, permitting blazing fast filtering. // 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