Skip to content

Commit

Permalink
Merging simulation test changes
Browse files Browse the repository at this point in the history
One big happy commit.

Co-authored-by: Shreekara <[email protected]>
Co-authored-by: Bryce <[email protected]>
  • Loading branch information
3 people authored Feb 18, 2022
1 parent 3c1fe8f commit ac15d46
Show file tree
Hide file tree
Showing 30 changed files with 692 additions and 325 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ run-full-mining:
ifeq (,$(wildcard nodelogs))
mkdir nodelogs
endif

@nohup $(MINING_BASE_COMMAND) --miner.etherbase $(PRIME_COINBASE) --http.addr $(HTTP_ADDR) --ws.addr $(WS_ADDR) --ws.api $(WS_API) --port $(PRIME_PORT_TCP) --http.port $(PRIME_PORT_HTTP) --ws.port $(PRIME_PORT_WS) --quaistats ${NAME}:prime${PASSWORD}@${STATS_HOST}:9000 >> nodelogs/prime.log 2>&1 &
@nohup $(MINING_BASE_COMMAND) --miner.etherbase $(REGION_1_COINBASE) --http.addr $(HTTP_ADDR) --ws.addr $(WS_ADDR) --ws.api $(WS_API) --port $(REGION_1_PORT_TCP) --http.port $(REGION_1_PORT_HTTP) --ws.port $(REGION_1_PORT_WS) --region 1 --quaistats ${NAME}:region1${PASSWORD}@${STATS_HOST}:9100 >> nodelogs/region-1.log 2>&1 &
@nohup $(MINING_BASE_COMMAND) --miner.etherbase $(REGION_2_COINBASE) --http.addr $(HTTP_ADDR) --ws.addr $(WS_ADDR) --ws.api $(WS_API) --port $(REGION_2_PORT_TCP) --http.port $(REGION_2_PORT_HTTP) --ws.port $(REGION_2_PORT_WS) --region 2 --quaistats ${NAME}:region2${PASSWORD}@${STATS_HOST}:9200 >> nodelogs/region-2.log 2>&1 &
Expand Down
19 changes: 13 additions & 6 deletions cmd/quai/dbcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ import (
"github.com/spruce-solutions/go-quai/common/hexutil"
"github.com/spruce-solutions/go-quai/console/prompt"
"github.com/spruce-solutions/go-quai/core/rawdb"
"github.com/spruce-solutions/go-quai/core/types"
"github.com/spruce-solutions/go-quai/eth/ethconfig"
"github.com/spruce-solutions/go-quai/ethdb"
"github.com/spruce-solutions/go-quai/log"
"github.com/spruce-solutions/go-quai/trie"
"github.com/spruce-solutions/go-quai/eth/ethconfig"
"github.com/spruce-solutions/go-quai/node"
"github.com/spruce-solutions/go-quai/core/types"
"github.com/spruce-solutions/go-quai/trie"
"gopkg.in/urfave/cli.v1"
)

Expand Down Expand Up @@ -179,8 +179,8 @@ WARNING: This is a low-level operation which may cause database corruption!`,
func removeDB(ctx *cli.Context) error {
// stack, config := makeConfigNode(ctx)
all_chain_dbs := []string{node.DefaultConfig.DataDir} // array to hold dirs of all chains
cache_path := ethconfig.Defaults.Ethash.CacheDir // dir for ethcache
dataset_path := ethconfig.Defaults.Ethash.DatasetDir // dir for ethash dataset
cache_path := ethconfig.Defaults.Ethash.CacheDir // dir for ethcache
dataset_path := ethconfig.Defaults.Ethash.DatasetDir // dir for ethash dataset

// construct all_chain_dbs to hold all paths properly formatted to machine OS
for n := 1; n < (types.ContextDepth + 1); n++ {
Expand All @@ -195,7 +195,7 @@ func removeDB(ctx *cli.Context) error {
// loop through each chain db in all_chain_dbs and prompt Y/n to delete
for _, d := range all_chain_dbs {
// Remove the full node state database
path := filepath.Join(d, "geth", "chaindata")
path := filepath.Join(d, "quai", "chaindata")
if common.FileExist(path) {
confirmAndRemoveDB(path, "full node state database")
} else {
Expand All @@ -208,6 +208,13 @@ func removeDB(ctx *cli.Context) error {
} else {
log.Info("Full node ancient database missing", "path", path)
}

extPath := filepath.Join(d, "quai", "externalblocks")
if common.FileExist(extPath) {
confirmAndRemoveDB(extPath, "full external blocks db")
} else {
log.Info("Full external blocks database missing", "path", extPath)
}
// Remove the light node database
/* path = d.ResolvePath("lightchaindata")
if common.FileExist(path) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/quai/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import (
)

const (
clientIdentifier = "geth" // Client identifier to advertise over the network
clientIdentifier = "quai" // Client identifier to advertise over the network
)

var (
Expand Down
15 changes: 12 additions & 3 deletions consensus/clique/clique.go
Original file line number Diff line number Diff line change
Expand Up @@ -596,18 +596,27 @@ func (c *Clique) GetExternalBlocks(chain consensus.ChainHeaderReader, header *ty
return make([]*types.ExternalBlock, 0), nil
}

// GetCoincidentHeader retrieves the furthest coincident header back
func (c *Clique) GetDifficultyContext(chain consensus.ChainHeaderReader, header *types.Header, context int) (int, error) {
return 0, nil
}

// GetCoincidentHeader retrieves the furthest coincident header back
func (c *Clique) GetCoincidentHeader(chain consensus.ChainHeaderReader, context int, header *types.Header) (*types.Header, int) {
return nil, 0
}

// GetStopHash retrieves the stop hash for tracing of blocks in a trace branch
func (c *Clique) GetStopHash(chain consensus.ChainHeaderReader, difficultyContext int, originalContext int, startingHeader *types.Header) (common.Hash, error) {
return common.Hash{}, nil
func (c *Clique) GetStopHash(chain consensus.ChainHeaderReader, difficultyContext int, originalContext int, startingHeader *types.Header) (common.Hash, int) {
return common.Hash{}, 0
}

// TraceBranch recursively traces branches to find
func (c *Clique) TraceBranch(chain consensus.ChainHeaderReader, header *types.Header, context int, stopHash common.Hash, originalContext int, originalLocation []byte, logging bool) ([]*types.ExternalBlock, error) {
func (c *Clique) PrimeTraceBranch(chain consensus.ChainHeaderReader, header *types.Header, context int, stopHash common.Hash, originalContext int, originalLocation []byte) ([]*types.ExternalBlock, error) {
return make([]*types.ExternalBlock, 0), nil
}

func (c *Clique) RegionTraceBranch(chain consensus.ChainHeaderReader, header *types.Header, context int, stopHash common.Hash, originalContext int, originalLocation []byte) ([]*types.ExternalBlock, error) {
return make([]*types.ExternalBlock, 0), nil
}

Expand Down
9 changes: 7 additions & 2 deletions consensus/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,16 @@ type Engine interface {
// GetCoincidentHeader retrieves the furthest coincident header back
GetCoincidentHeader(chain ChainHeaderReader, context int, header *types.Header) (*types.Header, int)

// GetDifficultyContext retrieves the difficulty at a given header
GetDifficultyContext(chain ChainHeaderReader, header *types.Header, context int) (int, error)

// GetStopHash retrieves the stop hash for tracing of blocks in a trace branch
GetStopHash(chain ChainHeaderReader, difficultyContext int, originalContext int, startingHeader *types.Header) (common.Hash, error)
GetStopHash(chain ChainHeaderReader, difficultyContext int, originalContext int, startingHeader *types.Header) (common.Hash, int)

// TraceBranch recursively traces branches to find
TraceBranch(chain ChainHeaderReader, header *types.Header, context int, stopHash common.Hash, originalContext int, originalLocation []byte, logging bool) ([]*types.ExternalBlock, error)
PrimeTraceBranch(chain ChainHeaderReader, header *types.Header, context int, stopHash common.Hash, originalContext int, originalLocation []byte) ([]*types.ExternalBlock, error)

RegionTraceBranch(chain ChainHeaderReader, header *types.Header, context int, stopHash common.Hash, originalContext int, originalLocation []byte) ([]*types.ExternalBlock, error)

// Seal generates a new sealing request for the given input block and pushes
// the result into the given channel.
Expand Down
Loading

0 comments on commit ac15d46

Please sign in to comment.