id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c27000
return em.pubsubServer.UnsubscribeAll(ctx, subscriber) }
c27001
defer cl.Unlock() cl.passthrough = passthrough }
c27002
defer cl.RUnlock() return cl.passthrough }
c27003
"captured_logging_source", "tendermint_log15")). AddSinks( Sink().SetOutput(StdoutOutput()), ), ), } fmt.Println(loggingConfig.RootTOMLString()) }
c27004
Info: log.With(swapLogger, structure.ChannelKey, structure.InfoChannelName, ), Trace: log.With(swapLogger, structure.ChannelKey, structure.TraceChannelName, ), } }
c27005
log.Logger) { l.Output.Swap(infoLogger) }
c27006
return Msg(l.Info, message, keyvals...) }
c27007
return Msg(l.Trace, message, keyvals...) }
c27008
order which they appear return l.With(structure.ScopeKey, scopeName) }
c27009
structure.MessageKey, message) return logger.Log(prepended...) }
c27010
8 * uint(offset%laneSize) d.a[offset/laneSize] ^= t d.absorbed += len(p) }
c27011
dup := *d dup.finalize() return dup.squeeze(in, dup.outputSize) }
c27012
if err != nil { return nil, err } logger := logging.NewLogger(outputLogger) if !loggingConfig.Trace { logger.Trace = log.NewNopLogger() } go func() { err := <-errCh.Out() if err != nil { fmt.Printf("Logging error: %v", err) } }() return logger, nil } }
c27013
outputLogger, errCh, err := loggerFromLoggingConfig(loggingConfig) if err != nil { return err, channels.NewDeadChannel() } logger.SwapOutput(outputLogger) return nil, errCh }
c27014
// Loop over the signatures, as these are less likely to have collisions for _, e := range s.EventsById { newSpec.Events[e.Name] = e newSpec.EventsById[e.EventID] = e } } return &newSpec }
c27015
err = RevertAbi.UnpackWithID(data, &msg) message = &msg } return }
c27016
left { copy(padded[size-len(input):], input) } else { copy(padded, input) } return padded }
c27017
return false, ErrValueNotSet(ty) } return bp.Perms&ty == ty, nil }
c27018
value { bp.Perms |= ty } else { bp.Perms &= ^ty } return nil }
c27019
if ty == 0 { return ErrInvalidPermission(ty) } bp.SetBit &= ^ty return nil }
c27020
return false } return bp.SetBit&ty == ty }
c27021
bp.SetBit) | (bpFallthrough.Perms & (^bp.SetBit & bpFallthrough.SetBit)), SetBit: bp.SetBit | bpFallthrough.SetBit, } }
c27022
make(map[string]process.Process), listeners: make(map[string]net.Listener), shutdownNotify: make(chan struct{}), txCodec: txs.NewAminoCodec(), database: dbm.NewDB(BurrowDBName, dbm.GoLevelDBBackend, dbDir), }, err }
c27023
kern.Logger = logger.WithInfo(structure.CallerKey, log.Caller(LoggingCallerDepth)).With("height", heightValuer) kern.Emitter.SetLogger(logger) }
c27024
if !bytes.Equal(kern.State.Hash(), kern.Blockchain.AppHashAfterLastBlock()) { return fmt.Errorf("state and blockchain disagree on app hash at height %d: "+ "state gives %X, blockchain gives %X", kern.Blockchain.LastBlockHeight(), kern.State.Hash(), kern.Blockchain.AppHashAfterLastBlock()) } } else { ...
c27025
if err = kern.State.InitialCommit(); err != nil { return err } if !bytes.Equal(kern.State.Hash(), kern.Blockchain.GenesisDoc().AppHash) { return fmt.Errorf("Restore produced a different apphash expect 0x%x got 0x%x", kern.Blockchain.GenesisDoc().AppHash, kern.State.Hash()) } err = kern.Blockchain.CommitWit...
c27026
} return tendermint.NewNodeView(kern.Node, kern.txCodec, kern.RunID) }
c27027
kern.exeOptions = append(kern.exeOptions, opts...) }
c27028
{ kern.Launchers = append(kern.Launchers, pl...) }
c27029
launcher.Name, err) } kern.processes[launcher.Name] = srvr } } go kern.supervise() return nil }
c27030
reload logger: %v", kern, err) } case <-syncCh: err := kern.Logger.Sync() if err != nil { fmt.Fprintf(os.Stderr, "%v: could not sync logger: %v", kern, err) } case sig := <-shutdownCh: kern.Logger.InfoMsg(fmt.Sprintf("Caught %v signal so shutting down", sig), "signal", sig.String()) kern....
c27031
} } } logger.InfoMsg("Shutdown complete") // Best effort structure.Sync(kern.Logger.Info) structure.Sync(kern.Logger.Trace) // We don't want to wait for them, but yielding for a cooldown Let other goroutines flush // potentially interesting final output (e.g. log messages) time.Sleep(CooldownTime) ...
c27032
"data", name.Data, "amount", name.Amount) return client.Name(&def.NameArg{ Input: name.Source, Sequence: name.Sequence, Name: name.Name, Amount: name.Amount, Data: name.Data, Fee: name.Fee, }, logger) }
c27033
if err := abi.UnpackEvent(&evAbi, log.Topics, log.Data, unpackedData...); err != nil { return nil, errors.Wrap(err, "Could not unpack event data") } // for each decoded item value, stores it in given item name for i, input := range evAbi.Inputs { switch v := unpackedData[i].(type) { case *crypto.Address: ...
c27034
params, backend, blockchain, nil, logger.WithScope("NewBatchExecutor"), options...) }
c27035
if err != nil { return err } err = exe.proposalRegCache.Flush(ws, exe.state) if err != nil { return err } err = exe.validatorCache.Flush(ws, exe.state) if err != nil { return err } err = ws.AddBlock(blockExecution) if err != nil { return err } return nil }) if err != nil { return...
c27036
acc.PublicKey = *sig.PublicKey exe.logger.TraceMsg("Incrementing sequence number Tx signatory/input", "height", exe.block.Height, "tag", "sequence", "account", acc.Address, "old_sequence", acc.Sequence, "new_sequence", acc.Sequence+1) acc.Sequence++ err = exe.stateCache.UpdateAccount(acc) if ...
c27037
p.CurveType.ABCIType(), Data: p.PublicKey, } }
c27038
projection, err = NewProjectionFromFolder(specFileOrDirs...) if err != nil { return nil, fmt.Errorf("error parsing spec: %v", err) } if createBlkTxTables { // add block & tx to tables definition blkTxTables := getBlockTxTablesDefinition() for k, v := range blkTxTables { projection.Tables[k] = v } }...
c27039
}, { Name: types.SQLColumnLabelEnvelope, Type: types.SQLColumnTypeJSON, Primary: false, }, { Name: types.SQLColumnLabelEvents, Type: types.SQLColumnTypeJSON, Primary: false, }, { Name: types.SQLColumnLabelResult, Type: types.SQLColumnTypeJ...
c27040
Specification (Decode)", "spec", abiSpecBytes) // Unpack the result return DecodeFunctionReturn(abiSpecBytes, funcName, resultRaw) }
c27041
return fmt.Errorf("error returned while walking abiDir '%s': %v", dir, err) } ext := filepath.Ext(path) if fi.IsDir() || !(ext == ".bin" || ext == ".abi") { return nil } if err == nil { abiSpc, err := ReadAbiSpecFile(path) if err != nil { return errors.Wrap(err, "Error parsing abi file...
c27042
if err != nil { return nil, err } transactions = append(transactions, txEnv) } return transactions, nil }
c27043
name, Amounts: balance.New().Native(amount).Power(Power), Permissions: []string{permission.AllString}, }, }, } }
c27044
if override.Name != "" { if i, ok := indexOfBase[override.Name]; ok { bases[i] = mergeAccount(bases[i], override) continue } } bases = append(bases, override) } return bases }
c27045
error if name != "" { addr, err = coreNameGet(keysDir, name) if err != nil { return "", err } } return strings.ToUpper(addr), nil }
c27046
failures := 0 successes := 0 for range playbooks { jobResult := <-resultQ results[jobResult.jobNo] = &jobResult for results[printed] != nil { res := results[printed] os.Stderr.Write(res.log.Bytes()) if res.err != nil { fmt.Fprintf(os.Stderr, "ERROR: %v", res.err) } res.log.Truncate(0) if...
c27047
has hash: 0x%X, which does not "+ "match the one found in database: 0x%X, database genesis:\n%v\npassed genesis:\n%v\n", argHash, dbHash, bc.genesisDoc.JSONString(), genesisDoc.JSONString()) } return true, bc, nil } logger.InfoMsg("No existing blockchain state found in database, making new blockchain") ...
c27048
genesisDoc.ChainID(), lastBlockTime: genesisDoc.GenesisTime, appHashAfterLastBlock: genesisDoc.Hash(), } return bc }
c27049
|| ct == SQLColumnTypeSerial || ct == SQLColumnTypeNumeric || ct == SQLColumnTypeBigInt }
c27050
err = convertPermissionsMapStringIntToBasePermissions(permissions) if err != nil { return nil, err } accountPermissions.Roles = roles return accountPermissions, nil }
c27051
{ return basePermissions, err } // sets the permissions bitflag and the setbit flag for the permission. basePermissions.Set(permissionsFlag, value) } return basePermissions, nil }
c27052
ZeroBasePermissions, err } return BasePermissions{ Perms: permFlag, SetBit: permFlag, }, nil }
c27053
} flag, err := PermStringToFlag(s) if err != nil { return permFlag, err } permFlag |= flag } return permFlag, nil }
c27054
permFlag > 0 { permStrings = append(permStrings, permFlag.String()) } } return permStrings }
c27055
nameReg: nameReg, blockchain: blockchain, validators: validators, nodeView: nodeView, logger: logger.With(structure.ComponentKey, "Service"), } }
c27056
for height := minHeight; height <= maxHeight; height++ { blockMeta := s.nodeView.BlockStore().LoadBlockMeta(height) blockMetas = append(blockMetas, blockMeta) } return &ResultBlocks{ LastHeight: uint64(latestHeight), BlockMetas: blockMetas, }, nil }
c27057
random: rand.New(rand.NewSource(seed)), } }
c27058
address if update.PublicKey != nil { address := update.PublicKey.GetAddress() if update.Address != nil && address != *update.Address { return fmt.Errorf("supplied public key %v whose address %v does not match %v provided by"+ "GovTx", update.PublicKey, address, update.Address) } update.Address =...
c27059
"err", err) return false, err } if found == 0 { db.Log.Warn("msg", "Table not found", "value", safeTable) return false, nil } return true, nil }
c27060
nil, err } if _, err = db.DBAdapter.TypeMapping(columnSQLType); err != nil { return nil, err } columns = append(columns, &types.SQLTableColumn{ Name: columnName, Type: columnSQLType, Length: columnLength, Primary: columnIsPK == 1, }) } if err = rows.Err(); err != nil { db.Log.Inf...
c27061
jsonData []byte jsonData, err = db.getJSON(newColumn) if err != nil { db.Log.Info("msg", "error marshaling column", "err", err, "value", fmt.Sprintf("%v", newColumn)) return err } //insert log _, err = db.DB.Exec(logQuery, table.Name, "", "", nil, nil, types.ActionAlterTable, jsonData, qu...
c27062
initialization) if !isInitialise { // Marshal the table into a JSON string. var jsonData []byte jsonData, err = db.getJSON(table) if err != nil { db.Log.Info("msg", "error marshaling table", "err", err, "value", fmt.Sprintf("%v", table)) return err } sqlValues, _ := db.getJSON(nil) //insert log ...
c27063
{ return "", errors.New("error table does not contain any fields") } query := db.DBAdapter.SelectRowQuery(table.Name, fields, strconv.FormatUint(height, 10)) return query, nil }
c27064
db.Log.Info("msg", "Error scanning table structure", "err", err) return tables, err } err = rows.Err() if err != nil { db.Log.Info("msg", "Error scanning table structure", "err", err) return tables, err } table, err = db.getTableDef(tableName) if err != nil { return tables, err } tables[...
c27065
"", ",", "") return replacer.Replace(parameter) }
c27066
return json.Marshal(JSON) } return json.Marshal("") }
c27067
return json.Marshal(values) } return json.Marshal("") }
c27068
:= json.Unmarshal(bytes, &pointers) return pointers, err }
c27069
return NewException(e.ErrorCode(), e.String()) default: return NewException(ErrorCodeGeneric, err.Error()) } }
c27070
> 0 { return PublicKey{}, fmt.Errorf("attempting to create an 'unset' PublicKey but passed non-empty key bytes: %X", bs) } return PublicKey{}, nil default: return PublicKey{}, ErrInvalidCurve(curveType) } return PublicKey{PublicKey: bs, CurveType: curveType}, nil }
c27071
!= nil { return err } *p = initP return nil }
c27072
} if !bytes.Equal(derivedPrivateKey, candidatePrivateKey) { return fmt.Errorf("ed25519 key generated from prefix of %X should equal %X, but is %X", candidatePrivateKey, candidatePrivateKey, derivedPrivateKey) } return nil }
c27073
nil, fmt.Errorf("ContentAddressedStore could not hash data: %v", err) } hash := hasher.Sum(nil) cas.db.SetSync(hash, data) return hash, nil }
c27074
peek(stack).AddSinks(sinkConfig) stack = append(stack, sinkConfig) } return stack }
c27075
Log: log, Closing: false, EventsChannel: eventChannel, } }
c27076
if c.GRPCConnection == nil { return errors.New("grpc disconnected") } if grpcState := c.GRPCConnection.GetState(); grpcState != connectivity.Ready { return errors.New("grpc connection not ready") } return nil }
c27077
c.Closing = true c.GRPCConnection.Close() }
c27078
make(map[string]types.EventDataTable), BlockHeight: height, } return &BlockData{ Data: data, } }
c27079
b.Data.Tables[tableName] = types.EventDataTable{} } b.Data.Tables[tableName] = append(b.Data.Tables[tableName], row) }
c27080
return nil, fmt.Errorf("GetRows: tableName does not exists as a table in data structure: %s ", tableName) }
c27081
prevent? if b.Data.BlockHeight == height && len(b.Data.Tables) > 0 { hasRows = true } return hasRows }
c27082
slice: make([]byte, initialCapacity), maximumCapacity: maximumCapacity, errSink: errSink, } }
c27083
cache, Blockchain: tip, Logger: logger, } txe := exec.NewTxExecution(txs.Enclose(tip.ChainID(), &payload.CallTx{ Input: &payload.TxInput{ Address: fromAddress, }, Address: &address, Data: data, GasLimit: contexts.GasLimit, })) err := exe.Execute(txe, txe.Envelope.Tx.Payload) if err !=...
c27084
to target account (overwriting target) cache := acmstate.NewCache(reader) err := cache.UpdateAccount(&acm.Account{ Address: address, Code: code, }) if err != nil { return nil, err } return CallSim(cache, tip, fromAddress, address, data, logger) }
c27085
!= "" { kern.keyClient, err = keys.NewRemoteKeyClient(conf.RemoteAddress, kern.Logger) if err != nil { return err } } else { kern.keyClient = keys.NewLocalKeyClient(kern.keyStore, kern.Logger) } return nil }
c27086
err := lifecycle.NewLoggerFromLoggingConfig(conf) kern.SetLogger(logger) return err }
c27087
kern.exeOptions = exeOptions kern.timeoutFactor = conf.TimeoutFactor } return nil }
c27088
break } if v.Address == thisAddress && v.NodeAddress != nil { k, err := kern.keyStore.GetKey("", v.NodeAddress.Bytes()) if err == nil { nodeKey = &k.PrivateKey } break } } tmGenesisDoc := tendermint.DeriveGenesisDoc(&genesisDoc, kern.Blockchain.AppHashAfterLastBlock()) heightValuer := log.Va...
c27089
nil { return nil, fmt.Errorf("could not add execution options: %v", err) } err = kern.LoadState(conf.GenesisDoc) if err != nil { return nil, fmt.Errorf("could not load state: %v", err) } if conf.ValidatorAddress == nil { return nil, fmt.Errorf("ValidatorAddress must be set") } privVal, err := kern.Priv...
c27090
big.Int to hold a positive representation of a negative number return new(big.Int).And(x, tt256m1) }
c27091
all bits above sign bit (including sign bit) return x.Or(x, mask.Not(mask)) } else { // Number represented is positive - clear all bits above sign bit (including sign bit) return x.And(x, mask) } }
c27092
10*time.Second) defer cancel() _, err := l.kc.List(ctx, &ListRequest{}) return err }
c27093
return nil, err } kc := NewKeysClient(conn) return &remoteKeyClient{kc: kc, rpcAddress: rpcAddress, logger: logger}, nil }
c27094
logger.WithScope("LocalKeyClient") return &localKeyClient{ks: ks, logger: logger} }
c27095
return a typed signature when we reform the keys service return &Signer{ keyClient: keyClient, address: address, publicKey: publicKey, }, nil }
c27096
adapter.Log.Info("msg", "Error creating database connection", "err", err) return nil, err } return db, nil }
c27097
VALUES ('%s','%s',%d,%d,%d,%d);`, types.SQLDictionaryTableName, types.SQLColumnLabelTableName, types.SQLColumnLabelColumnName, types.SQLColumnLabelColumnType, types.SQLColumnLabelColumnLength, types.SQLColumnLabelPrimaryKey, types.SQLColumnLabelColumnOrder, tableName, columnName, sqlColumnType, length, 0...
c27098
case SetBase: return SetBaseString case UnsetBase: return UnsetBaseString case SetGlobal: return SetGlobalString case HasRole: return HasRoleString case AddRole: return AddRoleString case RemoveRole: return RemoveRoleString default: return UnknownString } }
c27099
return HasBase, nil case SetBaseString, "setbase", "set_base": return SetBase, nil case UnsetBaseString, "unsetbase", "unset_base": return UnsetBase, nil case SetGlobalString, "setglobal", "set_global": return SetGlobal, nil case HasRoleString, "hasrole", "has_role": return HasRole, nil case AddRoleString...