Skip to content

Commit

Permalink
clean up make all
Browse files Browse the repository at this point in the history
  • Loading branch information
iquidus committed Jun 21, 2019
1 parent 6132342 commit c02ffc0
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 35 deletions.
14 changes: 9 additions & 5 deletions cmd/puppeth/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
20 changes: 2 additions & 18 deletions cmd/puppeth/wizard_genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions cmd/swarm/swarm-smoke/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions swarm/metrics/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
}
}
9 changes: 2 additions & 7 deletions tests/difficulty_test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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 {
Expand Down

0 comments on commit c02ffc0

Please sign in to comment.