all: mega format fixes

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

View file

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

View file

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

View file

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

View file

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

View file

@ -209,7 +209,6 @@ func bindTypeGo(kind abi.Type) string {
// (Or just the type itself if it is not an array or slice)
// The length of the matched part is returned, with the translated type.
func bindUnnestedTypeGo(stringKind string) (int, string) {
switch {
case strings.HasPrefix(stringKind, "address"):
return len("address"), "common.Address"
@ -257,7 +256,6 @@ func bindTypeJava(kind abi.Type) string {
// (Or just the type itself if it is not an array or slice)
// The length of the matched part is returned, with the translated type.
func bindUnnestedTypeJava(stringKind string) (int, string) {
switch {
case strings.HasPrefix(stringKind, "address"):
parts := regexp.MustCompile(`address(\[[0-9]*\])?`).FindStringSubmatch(stringKind)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -272,7 +272,6 @@ func cmdLineOverride(currentConfig *bzzapi.Config, ctx *cli.Context) *bzzapi.Con
}
return currentConfig
}
// envVarsOverride overrides the current config with whatver is provided in environment variables

View file

@ -142,7 +142,6 @@ func TestConfigCmdLineOverrides(t *testing.T) {
}
func TestConfigFileOverrides(t *testing.T) {
// assign ports
httpPort, err := assignTCPPort()
if err != nil {
@ -354,7 +353,6 @@ func TestConfigEnvVars(t *testing.T) {
}
func TestConfigCmdLineOverridesFile(t *testing.T) {
// assign ports
httpPort, err := assignTCPPort()
if err != nil {

View file

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

View file

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

View file

@ -222,7 +222,8 @@ func doUploadEmptyDir(t *testing.T, node *testNode) string {
"--bzzapi", node.URL,
"--recursive",
"up",
tmpDir}
tmpDir,
}
log.Info("swarmfs cli test: uploading dir with 'swarm up'")
up := runSwarm(t, flags...)

View file

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

View file

@ -471,5 +471,4 @@ func setSwarmBootstrapNodes(ctx *cli.Context, cfg *node.Config) {
}
cfg.P2P.BootstrapNodes = append(cfg.P2P.BootstrapNodes, node)
}
}

View file

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

View file

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

View file

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

View file

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

View file

@ -93,14 +93,16 @@ func testDefault(toEncrypt bool, t *testing.T) {
flags := []string{
"--bzzapi", cluster.Nodes[0].URL,
"up",
tmpFileName}
tmpFileName,
}
if toEncrypt {
hashRegexp = `[a-f\d]{128}`
flags = []string{
"--bzzapi", cluster.Nodes[0].URL,
"up",
"--encrypt",
tmpFileName}
tmpFileName,
}
}
// upload the file with 'swarm up' and expect a hash
log.Info(fmt.Sprintf("uploading file with 'swarm up'"))
@ -207,7 +209,8 @@ func testRecursive(toEncrypt bool, t *testing.T) {
"--bzzapi", cluster.Nodes[0].URL,
"--recursive",
"up",
tmpUploadDir}
tmpUploadDir,
}
if toEncrypt {
hashRegexp = `[a-f\d]{128}`
flags = []string{
@ -215,7 +218,8 @@ func testRecursive(toEncrypt bool, t *testing.T) {
"--recursive",
"up",
"--encrypt",
tmpUploadDir}
tmpUploadDir,
}
}
// upload the file with 'swarm up' and expect a hash
log.Info(fmt.Sprintf("uploading file with 'swarm up'"))

View file

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

View file

@ -60,8 +60,7 @@ import (
cli "gopkg.in/urfave/cli.v1"
)
var (
CommandHelpTemplate = `{{.cmd.Name}}{{if .cmd.Subcommands}} command{{end}}{{if .cmd.Flags}} [command options]{{end}} [arguments...]
var CommandHelpTemplate = `{{.cmd.Name}}{{if .cmd.Subcommands}} command{{end}}{{if .cmd.Flags}} [command options]{{end}} [arguments...]
{{if .cmd.Description}}{{.cmd.Description}}
{{end}}{{if .cmd.Subcommands}}
SUBCOMMANDS:
@ -71,7 +70,6 @@ SUBCOMMANDS:
{{range $categorized.Flags}}{{"\t"}}{{.}}
{{end}}
{{end}}{{end}}`
)
func init() {
cli.AppHelpTemplate = `{{.Name}} {{if .Flags}}[global options] {{end}}command{{if .Flags}} [command options]{{end}} [arguments...]

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -153,7 +153,6 @@ func BenchmarkAddressHex(b *testing.B) {
}
func TestMixedcaseAccount_Address(t *testing.T) {
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-55.md
// Note: 0X{checksum_addr} is not valid according to spec above
@ -190,9 +189,7 @@ func TestMixedcaseAccount_Address(t *testing.T) {
if err := json.Unmarshal([]byte(r), &r2); err == nil {
t.Errorf("Expected failure, input %v", r)
}
}
}
func TestHash_Scan(t *testing.T) {

View file

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

View file

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

View file

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

View file

@ -55,10 +55,8 @@ import (
// * depositing ether to the chequebook
// * watching incoming ether
var (
gasToCash = uint64(2000000) // gas cost of a cash transaction using chequebook
var gasToCash = uint64(2000000) // gas cost of a cash transaction using chequebook
// gasToDeploy = uint64(3000000)
)
// Backend wraps all methods required for chequebook operation.
type Backend interface {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1200,7 +1200,6 @@ done:
t.Errorf("unexpected event fired: %v", e)
case <-time.After(250 * time.Millisecond):
}
}
// Tests if the canonical block can be fetched from the database during chain insertion.
@ -1620,10 +1619,10 @@ func benchmarkLargeNumberOfValueToNonexisting(b *testing.B, numTxs, numBlocks in
b.StopTimer()
if got := chain.CurrentBlock().Transactions().Len(); got != numTxs*numBlocks {
b.Fatalf("Transactions were not included, expected %d, got %d", numTxs*numBlocks, got)
}
}
}
}
}
}
func BenchmarkBlockChain_1x1000ValueTransferToNonexisting(b *testing.B) {
var (
numTxs = 1000
@ -1639,6 +1638,7 @@ func BenchmarkBlockChain_1x1000ValueTransferToNonexisting(b *testing.B) {
benchmarkLargeNumberOfValueToNonexisting(b, numTxs, numBlocks, recipientFn, dataFn)
}
func BenchmarkBlockChain_1x1000ValueTransferToExisting(b *testing.B) {
var (
numTxs = 1000
@ -1656,6 +1656,7 @@ func BenchmarkBlockChain_1x1000ValueTransferToExisting(b *testing.B) {
benchmarkLargeNumberOfValueToNonexisting(b, numTxs, numBlocks, recipientFn, dataFn)
}
func BenchmarkBlockChain_1x1000Executions(b *testing.B) {
var (
numTxs = 1000
@ -1735,7 +1736,6 @@ func TestLowDiffLongChain(t *testing.T) {
// - A common ancestor is placed at prune-point + blocksBetweenCommonAncestorAndPruneblock
// - The sidechain S is prepended with numCanonBlocksInSidechain blocks from the canon chain
func testSideImport(t *testing.T, numCanonBlocksInSidechain, blocksBetweenCommonAncestorAndPruneblock int) {
// Generate a canonical chain to act as the main dataset
engine := ethash.NewFaker()
db := rawdb.NewMemoryDatabase()

View file

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

View file

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

View file

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

View file

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

View file

@ -27,9 +27,7 @@ import (
"github.com/ethereum/go-ethereum/params"
)
var (
errInsufficientBalanceForGas = errors.New("insufficient balance to pay for gas")
)
var errInsufficientBalanceForGas = errors.New("insufficient balance to pay for gas")
/*
The State Transitioning Model

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -16,9 +16,7 @@
package vm
import (
"fmt"
)
import "fmt"
// OpCode is an EVM opcode
type OpCode byte

View file

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

View file

@ -43,6 +43,7 @@ func (st *Stack) push(d *big.Int) {
// st.data = append(st.data, stackItem)
st.data = append(st.data, d)
}
func (st *Stack) pushN(ds ...*big.Int) {
st.data = append(st.data, ds...)
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1130,7 +1130,6 @@ func (d *Downloader) fetchParts(errCancel error, deliveryCh chan dataPack, deliv
expire func() map[string]int, pending func() int, inFlight func() bool, throttle func() bool, reserve func(*peerConnection, int) (*fetchRequest, bool, error),
fetchHook func([]*types.Header), fetch func(*peerConnection, *fetchRequest) error, cancel func(*fetchRequest), capacity func(*peerConnection) int,
idle func() ([]*peerConnection, int), setIdle func(*peerConnection, int), kind string) error {
// Create a ticker to detect expired retrieval tasks
ticker := time.NewTicker(100 * time.Millisecond)
defer ticker.Stop()

View file

@ -1453,12 +1453,15 @@ func (ftp *floodingTestPeer) Head() (common.Hash, *big.Int) { return ftp.peer.He
func (ftp *floodingTestPeer) RequestHeadersByHash(hash common.Hash, count int, skip int, reverse bool) error {
return ftp.peer.RequestHeadersByHash(hash, count, skip, reverse)
}
func (ftp *floodingTestPeer) RequestBodies(hashes []common.Hash) error {
return ftp.peer.RequestBodies(hashes)
}
func (ftp *floodingTestPeer) RequestReceipts(hashes []common.Hash) error {
return ftp.peer.RequestReceipts(hashes)
}
func (ftp *floodingTestPeer) RequestNodeData(hashes []common.Hash) error {
return ftp.peer.RequestNodeData(hashes)
}
@ -1502,33 +1505,41 @@ func TestRemoteHeaderRequestSpan(t *testing.T) {
expected []int
}{
// Remote is way higher. We should ask for the remote head and go backwards
{1500, 1000,
{
1500, 1000,
[]int{1323, 1339, 1355, 1371, 1387, 1403, 1419, 1435, 1451, 1467, 1483, 1499},
},
{15000, 13006,
{
15000, 13006,
[]int{14823, 14839, 14855, 14871, 14887, 14903, 14919, 14935, 14951, 14967, 14983, 14999},
},
// Remote is pretty close to us. We don't have to fetch as many
{1200, 1150,
{
1200, 1150,
[]int{1149, 1154, 1159, 1164, 1169, 1174, 1179, 1184, 1189, 1194, 1199},
},
// Remote is equal to us (so on a fork with higher td)
// We should get the closest couple of ancestors
{1500, 1500,
{
1500, 1500,
[]int{1497, 1499},
},
// We're higher than the remote! Odd
{1000, 1500,
{
1000, 1500,
[]int{997, 999},
},
// Check some weird edgecases that it behaves somewhat rationally
{0, 1500,
{
0, 1500,
[]int{0, 2},
},
{6000000, 0,
{
6000000, 0,
[]int{5999823, 5999839, 5999855, 5999871, 5999887, 5999903, 5999919, 5999935, 5999951, 5999967, 5999983, 5999999},
},
{0, 0,
{
0, 0,
[]int{0, 2},
},
}

View file

@ -18,9 +18,7 @@
package downloader
import (
"github.com/ethereum/go-ethereum/metrics"
)
import "github.com/ethereum/go-ethereum/metrics"
var (
headerInMeter = metrics.NewRegisteredMeter("eth/downloader/headers/in", nil)

View file

@ -99,15 +99,19 @@ func (w *lightPeerWrapper) Head() (common.Hash, *big.Int) { return w.peer.Head()
func (w *lightPeerWrapper) RequestHeadersByHash(h common.Hash, amount int, skip int, reverse bool) error {
return w.peer.RequestHeadersByHash(h, amount, skip, reverse)
}
func (w *lightPeerWrapper) RequestHeadersByNumber(i uint64, amount int, skip int, reverse bool) error {
return w.peer.RequestHeadersByNumber(i, amount, skip, reverse)
}
func (w *lightPeerWrapper) RequestBodies([]common.Hash) error {
panic("RequestBodies not supported in light client mode sync")
}
func (w *lightPeerWrapper) RequestReceipts([]common.Hash) error {
panic("RequestReceipts not supported in light client mode sync")
}
func (w *lightPeerWrapper) RequestNodeData([]common.Hash) error {
panic("RequestNodeData not supported in light client mode sync")
}

View file

@ -803,7 +803,6 @@ func (q *queue) DeliverReceipts(id string, receiptList [][]*types.Receipt) (int,
func (q *queue) deliver(id string, taskPool map[common.Hash]*types.Header, taskQueue *prque.Prque,
pendPool map[string]*fetchRequest, donePool map[common.Hash]struct{}, reqTimer metrics.Timer,
results int, reconstruct func(header *types.Header, index int, result *fetchResult) error) (int, error) {
// Short circuit if the data was never requested
request := pendPool[id]
if request == nil {

View file

@ -39,9 +39,7 @@ const (
blockLimit = 64 // Maximum number of unique blocks a peer may have delivered
)
var (
errTerminated = errors.New("terminated")
)
var errTerminated = errors.New("terminated")
// blockRetrievalFn is a callback type for retrieving a block from the local chain.
type blockRetrievalFn func(common.Hash) *types.Block

View file

@ -18,9 +18,7 @@
package fetcher
import (
"github.com/ethereum/go-ethereum/metrics"
)
import "github.com/ethereum/go-ethereum/metrics"
var (
propAnnounceInMeter = metrics.NewRegisteredMeter("eth/fetcher/prop/announces/in", nil)

View file

@ -34,9 +34,7 @@ import (
"github.com/ethereum/go-ethereum/rpc"
)
var (
deadline = 5 * time.Minute // consider a filter inactive if it has not been polled for within deadline
)
var deadline = 5 * time.Minute // consider a filter inactive if it has not been polled for within deadline
// filter is a helper struct that holds meta information over the filter type
// and associated subscription in the event system.
@ -251,7 +249,6 @@ func (api *PublicFilterAPI) Logs(ctx context.Context, crit FilterCriteria) (*rpc
}
go func() {
for {
select {
case logs := <-matchedLogs:

View file

@ -70,9 +70,7 @@ const (
chainEvChanSize = 10
)
var (
ErrInvalidSubscriptionID = errors.New("invalid id")
)
var ErrInvalidSubscriptionID = errors.New("invalid id")
type subscription struct {
id rpc.ID

View file

@ -54,9 +54,7 @@ const (
minBroadcastPeers = 4
)
var (
daoChallengeTimeout = 15 * time.Second // Time allowance for a node to reply to the DAO handshake challenge
)
var daoChallengeTimeout = 15 * time.Second // Time allowance for a node to reply to the DAO handshake challenge
// errIncompatibleConfig is returned if the requested protocols and configs are
// not compatible (low protocol version restrictions and high requirements).

View file

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

View file

@ -54,6 +54,7 @@ func (s *senderFromServer) Sender(tx *types.Transaction) (common.Address, error)
func (s *senderFromServer) Hash(tx *types.Transaction) common.Hash {
panic("can't sign with senderFromServer")
}
func (s *senderFromServer) SignatureValues(tx *types.Transaction, sig []byte) (R, S, V *big.Int, err error) {
panic("can't sign with senderFromServer")
}

View file

@ -16,9 +16,7 @@
package graphql
import (
"testing"
)
import "testing"
func TestBuildSchema(t *testing.T) {
// Make sure the schema can be parsed and matched up to the object model.

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