Skip to content

Commit

Permalink
Merge pull request #597 from FactomProject/FD-709_release_6.0.1
Browse files Browse the repository at this point in the history
Release v6.0.1
  • Loading branch information
factom-clay committed Oct 12, 2018
2 parents 1a4d70a + e916978 commit 035968e
Show file tree
Hide file tree
Showing 41 changed files with 373 additions and 102 deletions.
2 changes: 1 addition & 1 deletion Utilities/DatabaseGenerator/blockgen/blockgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (bg *BlockGen) NewBlock(prev *state.DBState, netid uint32, firstTimeStamp i
}
}

dblock.HeaderHash()
dblock.GetHeaderHash()
dblock.BuildBodyMR()
dblock.BuildKeyMerkleRoot()

Expand Down
2 changes: 1 addition & 1 deletion Utilities/DatabaseGenerator/blockgen/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (g *DBGenerator) loadGenesis() {
var err error
fmt.Println("\n***********************************")
fmt.Println("******* New Database **************")
fmt.Println("***********************************\n")
fmt.Println("***********************************")

var customIdentity interfaces.IHash
if g.FactomdState.Network == "CUSTOM" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestCheckDatabaseFromDBO(t *testing.T) {
}

func TestCheckDatabaseFromState(t *testing.T) {
state := testHelper.CreateAndPopulateTestState()
state := testHelper.CreateAndPopulateTestStateAndStartValidator()
CheckDatabase(state.DB.(interfaces.DBOverlay))
}

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.0.0
6.0.1
32 changes: 24 additions & 8 deletions activations/activationHeight.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package activations

import (
"fmt"
"math"
"os"

"github.com/FactomProject/factomd/common/globals"
Expand All @@ -12,9 +13,9 @@ import (
type ActivationType int

const (
_ ActivationType = iota // 0 Don't use ZERO
ELECTION_NO_SORT = iota // 1 -- this is a passing activation and this ID may be reused once that height is passes and the references are removed

_ ActivationType = iota // 0 Don't use ZERO
ELECTION_NO_SORT = iota // 1 -- this is a passing activation and this ID may be reused once that height is passes and the references are removed
TESTNET_COINBASE_PERIOD = iota // 2 -- this is a passing activation and this ID may be reused once that height is passes and the references are removed
//
ACTIVATION_TYPE_COUNT = iota - 1 // Always Last
)
Expand All @@ -23,6 +24,7 @@ type Activation struct {
Name string
Id ActivationType
Description string
DefaultHeight int // height of activation on nets not expressly listed (math.MaxInt32 means never)
ActivationHeight map[string]int // this maps a network Name to the height for that network for the feature to activate
}

Expand All @@ -33,14 +35,24 @@ func init() {

// unordered list of activations
var activations []Activation = []Activation{
Activation{"ElectionNoSort", ELECTION_NO_SORT, "Disable sorting of severs after elections",
Activation{"ElectionNoSort", ELECTION_NO_SORT,
"Disable sorting of severs after elections",
0, // active at the beginning of time unless overridden below
map[string]int{
"MAIN": 146060 + 8*24*10 + 1, // On 6/20/18 11:45 mainnet was 146060, we want activation at 6/28/18 at ~12pm
"TEST": 0, // On 6/20/18 11:45 testnet was 146060, we want activation at 6/22/18 at ~12pm
"LOCAL": 10, // Must be > 6 for TestActivationHeightElection to pass
"CUSTOM:fct_community_test": 33037 + 2*24*10 + 1, // On 6/22/18 11:45 testnet was 33037, we want activation at 6/24/18 at 12:00pm
},
},
Activation{"TestNetCoinBasePeriod", TESTNET_COINBASE_PERIOD,
"Change testnet coin base payout delay to 144 blocks",
math.MaxInt32, // inactive unless overridden below
map[string]int{
"MAIN": math.MaxInt32,
"LOCAL": math.MaxInt32,
"CUSTOM:fct_community_test": 45335, // Monday morning September 17
},
},
}

if ACTIVATION_TYPE_COUNT != len(activations) {
Expand All @@ -61,7 +73,7 @@ func (id ActivationType) String() string {

n, ok := ActivationNameMap[id]
if !ok {
n = fmt.Sprintf("ActivationId(%v)", id)
n = fmt.Sprintf("ActivationId(%v)", string(id))
}
return n
}
Expand Down Expand Up @@ -92,8 +104,12 @@ func IsActive(id ActivationType, height int) bool {

h, ok := a.ActivationHeight[netName]
if !ok {
fmt.Fprintf(os.Stderr, "Activation %s does not know network name \"%s\". Activating at 0.\n", id.String(), netName)
a.ActivationHeight[netName] = 0
a.ActivationHeight[netName] = a.DefaultHeight
if a.DefaultHeight != math.MaxInt32 {
fmt.Fprintf(os.Stderr, "Activation %s does not know network name \"%s\". Activating at %d.\n", id.String(), netName, a.DefaultHeight)
} else {
fmt.Fprintf(os.Stderr, "Activation %s does not know network name \"%s\". Never activating.\n", id.String(), netName)
}
return true
}

Expand Down
1 change: 0 additions & 1 deletion common/directoryBlock/directoryBlock.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ func NewDirectoryBlock(prev interfaces.IDirectoryBlock) interfaces.IDirectoryBlo

newdb.Header = new(DBlockHeader)
newdb.GetHeader().SetVersion(constants.VERSION_0)

if prev != nil {
newdb.GetHeader().SetPrevFullHash(prev.GetFullHash())
newdb.GetHeader().SetPrevKeyMR(prev.GetKeyMR())
Expand Down
2 changes: 1 addition & 1 deletion common/identityEntries/newServerEfficiency_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ func TestNewServerEfficiencyStruct(t *testing.T) {
}

if nses.Efficiency != 4952 {
t.Error("Should be 4952, found %d", nses.Efficiency)
t.Errorf("Should be 4952, found %d", nses.Efficiency)
}
}
4 changes: 2 additions & 2 deletions common/messages/dbstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -694,14 +694,14 @@ func (m *DBStateMsg) MarshalBinary() (rval []byte, err error) {

func (m *DBStateMsg) String() string {
data, _ := m.MarshalBinary()
return fmt.Sprintf("DBState: dbht:%3d [size: %11s] dblock %6x admin %6x fb %6x ec %6x hash %6x",
return fmt.Sprintf("DBState: dbht:%3d [size: %11s] dblock %6x admin %6x fb %6x ec %6x hash %6x ts:%s DB:%v",
m.DirectoryBlock.GetHeader().GetDBHeight(),
primitives.AddCommas(int64(len(data))),
m.DirectoryBlock.GetKeyMR().Bytes()[:3],
m.AdminBlock.GetHash().Bytes()[:3],
m.FactoidBlock.GetHash().Bytes()[:3],
m.EntryCreditBlock.GetHash().Bytes()[:3],
m.GetHash().Bytes()[:3])
m.GetHash().Bytes()[:3], m.DirectoryBlock.GetTimestamp().String(), m.IsInDB)
}

func (m *DBStateMsg) LogFields() log.Fields {
Expand Down
4 changes: 2 additions & 2 deletions common/messages/dbstate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func TestMarshalUnmarshalDBStateMsg(t *testing.T) {
}

func TestSimpleDBStateMsgValidate(t *testing.T) {
state := testHelper.CreateAndPopulateTestState()
state := testHelper.CreateAndPopulateTestStateAndStartValidator()

msg := new(DBStateMsg)
if msg.Validate(state) >= 0 {
Expand All @@ -190,7 +190,7 @@ func TestSimpleDBStateMsgValidate(t *testing.T) {
}

func TestDBStateDataValidate(t *testing.T) {
state := testHelper.CreateAndPopulateTestState()
state := testHelper.CreateAndPopulateTestStateAndStartValidator()
msg := newDBStateMsg()

if v := msg.ValidateData(state); v != 1 {
Expand Down
4 changes: 2 additions & 2 deletions common/messages/electionMsgs/electionAdapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestElectionAuditOrder(t *testing.T) {
}

func TestSimpleSigning(t *testing.T) {
s := CreateAndPopulateTestState()
s := CreateAndPopulateTestStateAndStartValidator()
e := NewTestElection()
v1 := NewTestVolunteerMessage(e, 2, 0)
err := v1.Sign(s)
Expand All @@ -60,7 +60,7 @@ func TestSimpleSigning(t *testing.T) {

func TestElectionAdapterSimple(t *testing.T) {
e := NewTestElection()
e.State = CreateAndPopulateTestState()
e.State = CreateAndPopulateTestStateAndStartValidator()
e.State.SetIdentityChainID(primitives.NewZeroHash())

a := NewElectionAdapter(e, primitives.NewZeroHash())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func NewController(feds, auds int) *Controller {
s.Online = true

c.feds[i] = &s
e.State = testHelper.CreateAndPopulateTestState()
e.State = testHelper.CreateAndPopulateTestStateAndStartValidator()
e.State.SetIdentityChainID(s.ChainID)
c.Elections[i] = e
}
Expand Down
2 changes: 1 addition & 1 deletion common/messages/electionMsgs/fedVoteLevelMsg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
func TestMarshalUnmarshalFedVoteLevel(t *testing.T) {
messages.General = new(msgsupport.GeneralFactory)
primitives.General = messages.General
s := testHelper.CreateAndPopulateTestState()
s := testHelper.CreateAndPopulateTestStateAndStartValidator()

test := func(va *FedVoteLevelMsg, num string) {
vas, err := va.JSONString()
Expand Down
2 changes: 1 addition & 1 deletion common/messages/electionMsgs/fedVotePropose_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestMarshalUnmarshalFedVoteProposal(t *testing.T) {
}
}

s := testHelper.CreateAndPopulateTestState()
s := testHelper.CreateAndPopulateTestStateAndStartValidator()
// Have volunteer
for i := 0; i < 20; i++ {
p := NewFedProposalMsg(primitives.RandomHash(), *randomVol(s))
Expand Down
2 changes: 1 addition & 1 deletion common/messages/electionMsgs/fedVoteVolunteerMsg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestUnmarshalFedVoteVolunteerDBSig(t *testing.T) {
vol := con.Volunteers[0]

var err error
s := testHelper.CreateAndPopulateTestState()
s := testHelper.CreateAndPopulateTestStateAndStartValidator()
for s.UpdateState() {
}
for s.Process() {
Expand Down
2 changes: 1 addition & 1 deletion common/messages/entryBlockResponse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestUnmarshalNilEntryBlockResponse(t *testing.T) {

func TestNewEntryBlockResponse(t *testing.T) {

state := testHelper.CreateAndPopulateTestState()
state := testHelper.CreateAndPopulateTestStateAndStartValidator()
msg := NewEntryBlockResponse(state)
response := msg.String()
timestamp := fmt.Sprintf("%d", msg.GetTimestamp().GetTimeMilli())
Expand Down
2 changes: 1 addition & 1 deletion common/messages/heartbeat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func newSignedHeartbeat() *Heartbeat {
}

func TestValidHeatbeat(t *testing.T) {
s := testHelper.CreateAndPopulateTestState()
s := testHelper.CreateAndPopulateTestStateAndStartValidator()
a := identity.RandomAuthority()

pkey := primitives.RandomPrivateKey()
Expand Down
4 changes: 2 additions & 2 deletions common/messages/revealEntry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func newRevealEntry() *RevealEntryMsg {
}

func TestValidRevealMsg(t *testing.T) {
s := testHelper.CreateAndPopulateTestState()
s := testHelper.CreateAndPopulateTestStateAndStartValidator()

if v := testValid(1, 0, s); v != 0 {
t.Error("Should be 0, found ", v)
Expand Down Expand Up @@ -163,7 +163,7 @@ func newMaliciousRevealEntry() *RevealEntryMsg {
}

func TestRevealMaliciousFirstEntryReveal(t *testing.T) {
testState := testHelper.CreateAndPopulateTestState()
testState := testHelper.CreateAndPopulateTestStateAndStartValidator()

m := newMaliciousRevealEntry()
goodEntry := newSignedCommitChain()
Expand Down
6 changes: 3 additions & 3 deletions controlPanel/controlPanel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestControlPanel(t *testing.T) {
if LongTest {
var i uint32
connections := make(chan interface{})
emptyState := CreateAndPopulateTestState()
emptyState := CreateAndPopulateTestStateAndStartValidator()

gitBuild := "Test Is Running"
go ServeControlPanel(emptyState.ControlPanelChannel, emptyState, connections, nil, gitBuild)
Expand All @@ -84,7 +84,7 @@ func TestControlPanel(t *testing.T) {

func TestDataDump(t *testing.T) {
AllConnections = NewConnectionsMap()
s := CreateAndPopulateTestState()
s := CreateAndPopulateTestStateAndStartValidator()
ds, err := state.DeepStateDisplayCopy(s)
if err != nil {
t.Error(err)
Expand All @@ -100,7 +100,7 @@ func TestDataDump(t *testing.T) {
func TestSearching(t *testing.T) {
var err error
InitTemplates()
s := CreateAndPopulateTestState()
s := CreateAndPopulateTestStateAndStartValidator()
StatePointer = s

c := new(SearchedStruct)
Expand Down
2 changes: 1 addition & 1 deletion database/securedb/encryptedMarshaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestEncryptedMarshaler(t *testing.T) {
var err error
var ems []*EncryptedMarshaler
var hashes []interfaces.BinaryMarshallable
s := testHelper.CreateAndPopulateTestState()
s := testHelper.CreateAndPopulateTestStateAndStartValidator()

key := primitives.RandomHash().Bytes()
// Test with IHash
Expand Down
Loading

0 comments on commit 035968e

Please sign in to comment.