clean up make all

This commit is contained in:
Luke Williams 2019-06-21 22:45:01 +02:00
parent 613234211c
commit c02ffc0dec
5 changed files with 18 additions and 35 deletions

View file

@ -26,11 +26,15 @@ import (
"github.com/ubiq/go-ubiq/common"
"github.com/ubiq/go-ubiq/common/hexutil"
math2 "github.com/ubiq/go-ubiq/common/math"
"github.com/ubiq/go-ubiq/consensus/ubqhash"
// "github.com/ubiq/go-ubiq/consensus/ubqhash"
"github.com/ubiq/go-ubiq/core"
"github.com/ubiq/go-ubiq/params"
)
var (
blockReward *big.Int = big.NewInt(8e+18) // Block reward in wei for successfully mining a block
)
// alethGenesisSpec represents the genesis specification format used by the
// C++ Ethereum implementation.
type alethGenesisSpec struct {
@ -130,7 +134,7 @@ func newAlethGenesisSpec(network string, genesis *core.Genesis) (*alethGenesisSp
spec.Params.DifficultyBoundDivisor = (*math2.HexOrDecimal256)(params.DifficultyBoundDivisor)
spec.Params.GasLimitBoundDivisor = (math2.HexOrDecimal64)(params.GasLimitBoundDivisor)
spec.Params.DurationLimit = (*math2.HexOrDecimal256)(params.DurationLimit)
spec.Params.BlockReward = (*hexutil.Big)(ubqhash.FrontierBlockReward)
spec.Params.BlockReward = (*hexutil.Big)(blockReward)
spec.Genesis.Nonce = (hexutil.Bytes)(make([]byte, 8))
binary.LittleEndian.PutUint64(spec.Genesis.Nonce[:], genesis.Nonce)
@ -324,7 +328,7 @@ func newParityChainSpec(network string, genesis *core.Genesis, bootnodes []strin
spec.Engine.Ubqhash.Params.MinimumDifficulty = (*hexutil.Big)(params.MinimumDifficulty)
spec.Engine.Ubqhash.Params.DifficultyBoundDivisor = (*hexutil.Big)(params.DifficultyBoundDivisor)
spec.Engine.Ubqhash.Params.DurationLimit = (*hexutil.Big)(params.DurationLimit)
spec.Engine.Ubqhash.Params.BlockReward["0x0"] = hexutil.EncodeBig(ubqhash.FrontierBlockReward)
spec.Engine.Ubqhash.Params.BlockReward["0x0"] = hexutil.EncodeBig(blockReward)
// Homestead
spec.Engine.Ubqhash.Params.HomesteadTransition = hexutil.Uint64(genesis.Config.HomesteadBlock.Uint64())
@ -427,7 +431,7 @@ func (spec *parityChainSpec) setPrecompile(address byte, data *parityChainSpecBu
}
func (spec *parityChainSpec) setByzantium(num *big.Int) {
spec.Engine.Ubqhash.Params.BlockReward[hexutil.EncodeBig(num)] = hexutil.EncodeBig(ubqhash.ByzantiumBlockReward)
spec.Engine.Ubqhash.Params.BlockReward[hexutil.EncodeBig(num)] = hexutil.EncodeBig(blockReward)
spec.Engine.Ubqhash.Params.DifficultyBombDelays[hexutil.EncodeBig(num)] = hexutil.EncodeUint64(3000000)
n := hexutil.Uint64(num.Uint64())
spec.Engine.Ubqhash.Params.EIP100bTransition = n
@ -438,7 +442,7 @@ func (spec *parityChainSpec) setByzantium(num *big.Int) {
}
func (spec *parityChainSpec) setConstantinople(num *big.Int) {
spec.Engine.Ubqhash.Params.BlockReward[hexutil.EncodeBig(num)] = hexutil.EncodeBig(ubqhash.ConstantinopleBlockReward)
spec.Engine.Ubqhash.Params.BlockReward[hexutil.EncodeBig(num)] = hexutil.EncodeBig(blockReward)
spec.Engine.Ubqhash.Params.DifficultyBombDelays[hexutil.EncodeBig(num)] = hexutil.EncodeUint64(2000000)
n := hexutil.Uint64(num.Uint64())
spec.Params.EIP145Transition = n

View file

@ -248,28 +248,12 @@ func (w *wizard) manageGenesis() {
out, _ := json.MarshalIndent(w.conf.Genesis, "", " ")
// Export the native genesis spec used by puppeth and Gubiq
gethJson := filepath.Join(folder, fmt.Sprintf("%s.json", w.network))
if err := ioutil.WriteFile((gethJson), out, 0644); err != nil {
gubiqJson := filepath.Join(folder, fmt.Sprintf("%s.json", w.network))
if err := ioutil.WriteFile((gubiqJson), out, 0644); err != nil {
log.Error("Failed to save genesis file", "err", err)
return
}
log.Info("Saved native genesis chain spec", "path", gubiqJson)
// Export the genesis spec used by Aleth (formerly C++ Ethereum)
if spec, err := newAlethGenesisSpec(w.network, w.conf.Genesis); err != nil {
log.Error("Failed to create Aleth chain spec", "err", err)
} else {
saveGenesis(folder, w.network, "aleth", spec)
}
// Export the genesis spec used by Parity
if spec, err := newParityChainSpec(w.network, w.conf.Genesis, []string{}); err != nil {
log.Error("Failed to create Parity chain spec", "err", err)
} else {
saveGenesis(folder, w.network, "parity", spec)
}
// Export the genesis spec used by Harmony (formerly EthereumJ
saveGenesis(folder, w.network, "harmony", w.conf.Genesis)
case "3":
// Make sure we don't have any services running
if len(w.conf.servers()) > 0 {

View file

@ -22,7 +22,7 @@ import (
"sort"
"github.com/ubiq/go-ubiq/cmd/utils"
gethmetrics "github.com/ubiq/go-ubiq/metrics"
gubiqmetrics "github.com/ubiq/go-ubiq/metrics"
"github.com/ubiq/go-ubiq/metrics/influxdb"
swarmmetrics "github.com/ubiq/go-ubiq/swarm/metrics"
"github.com/ubiq/go-ubiq/swarm/tracing"
@ -183,7 +183,7 @@ func emitMetrics(ctx *cli.Context) error {
tagsMap["version"] = gitCommit
tagsMap["filesize"] = fmt.Sprintf("%v", filesize)
return influxdb.InfluxDBWithTagsOnce(gethmetrics.DefaultRegistry, endpoint, database, username, password, "swarm-smoke.", tagsMap)
return influxdb.InfluxDBWithTagsOnce(gubiqmetrics.DefaultRegistry, endpoint, database, username, password, "swarm-smoke.", tagsMap)
}
return nil

View file

@ -20,7 +20,7 @@ import (
"time"
"github.com/ubiq/go-ubiq/cmd/utils"
gethmetrics "github.com/ubiq/go-ubiq/metrics"
gubiqmetrics "github.com/ubiq/go-ubiq/metrics"
"github.com/ubiq/go-ubiq/metrics/influxdb"
"github.com/ubiq/go-ubiq/swarm/log"
cli "gopkg.in/urfave/cli.v1"
@ -97,12 +97,12 @@ func Setup(ctx *cli.Context) {
if enableExport {
log.Info("Enabling swarm metrics export to InfluxDB")
go influxdb.InfluxDBWithTags(gethmetrics.DefaultRegistry, 10*time.Second, endpoint, database, username, password, "swarm.", tagsMap)
go influxdb.InfluxDBWithTags(gubiqmetrics.DefaultRegistry, 10*time.Second, endpoint, database, username, password, "swarm.", tagsMap)
}
if enableAccountingExport {
log.Info("Exporting swarm accounting metrics to InfluxDB")
go influxdb.InfluxDBWithTags(gethmetrics.AccountingRegistry, 10*time.Second, endpoint, database, username, password, "accounting.", tagsMap)
go influxdb.InfluxDBWithTags(gubiqmetrics.AccountingRegistry, 10*time.Second, endpoint, database, username, password, "accounting.", tagsMap)
}
}
}

View file

@ -23,6 +23,7 @@ import (
"github.com/ubiq/go-ubiq/common"
"github.com/ubiq/go-ubiq/common/math"
"github.com/ubiq/go-ubiq/consensus/ubqhash"
//"github.com/ubiq/go-ubiq/core/types"
"github.com/ubiq/go-ubiq/params"
)
@ -49,14 +50,8 @@ type difficultyTestMarshaling struct {
func (test *DifficultyTest) Run(config *params.ChainConfig) error {
parentNumber := big.NewInt(int64(test.CurrentBlockNumber - 1))
/*parent := &types.Header{
Difficulty: test.ParentDifficulty,
Time: test.ParentTimestamp,
Number: parentNumber,
UncleHash: test.UncleHash,
}*/
actual := ubqhash.CalcDifficulty(config, test.CurrentTimestamp, parent)
actual := ubqhash.CalcDifficultyLegacy(test.CurrentTimestamp, test.ParentTimestamp, parentNumber, test.ParentDifficulty)
exp := test.CurrentDifficulty
if actual.Cmp(exp) != 0 {