Skip to content

Commit

Permalink
Merge pull request #430 from FactomProject/rollup
Browse files Browse the repository at this point in the history
Rollup of FD-412 413 414 354
  • Loading branch information
carryforward committed Mar 2, 2018
2 parents cb5f49b + 8f167e7 commit 0d505cf
Show file tree
Hide file tree
Showing 16 changed files with 268 additions and 82 deletions.
38 changes: 19 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ jobs:
build:
working_directory: /go/src/github.com/FactomProject/factomd
docker:
- image: circleci/golang:1.9
- image: circleci/golang:1.10

steps:
- checkout

- restore_cache:
keys:
- v1-factomd-go-build-cache-{{ checksum "glide.lock" }}
- v2-factomd-go-build-cache-{{ checksum "glide.lock" }}

- run:
name: Get glide
command: |
go get -v github.com/Masterminds/glide
cd $GOPATH/src/github.com/Masterminds/glide
git checkout tags/v0.12.3
git checkout tags/v0.13.1
go install
- run:
name: Get goveralls
command: |
go get github.com/mattn/goveralls
cd $GOPATH/src/github.com/Masterminds/glide
git checkout tags/v0.12.3
git checkout tags/v0.13.1
go install
- run:
name: Get the dependencies
Expand All @@ -37,35 +37,35 @@ jobs:
command: go install -v

- save_cache:
key: v1-factomd-go-build-cache-{{ checksum "glide.lock" }}
key: v2-factomd-go-build-cache-{{ checksum "glide.lock" }}
paths:
- vendor

test:
working_directory: /go/src/github.com/FactomProject/factomd
docker:
- image: circleci/golang:1.9
- image: circleci/golang:1.10

steps:
- checkout

- restore_cache:
keys:
- v1-factomd-go-build-cache-{{ checksum "glide.lock" }}
- v2-factomd-go-build-cache-{{ checksum "glide.lock" }}

- run:
name: Get glide
command: |
go get -v github.com/Masterminds/glide
cd $GOPATH/src/github.com/Masterminds/glide
git checkout tags/v0.12.3
git checkout tags/v0.13.1
go install
- run:
name: Get goveralls
command: |
go get github.com/mattn/goveralls
cd $GOPATH/src/github.com/Masterminds/glide
git checkout tags/v0.12.3
git checkout tags/v0.13.1
go install
- run:
name: Get the dependencies
Expand All @@ -78,39 +78,39 @@ jobs:
- run:
name: Run tests!
no_output_timeout: 2400
command: go test -v $(glide nv)
command: go test -v -vet=off $(glide nv)


- save_cache:
key: v1-factomd-go-build-cache-{{ checksum "glide.lock" }}
key: v2-factomd-go-build-cache-{{ checksum "glide.lock" }}
paths:
- vendor

coveralls:
working_directory: /go/src/github.com/FactomProject/factomd
docker:
- image: circleci/golang:1.9
- image: circleci/golang:1.10

steps:
- checkout

- restore_cache:
keys:
- v1-factomd-go-build-cache-{{ checksum "glide.lock" }}
- v2-factomd-go-build-cache-{{ checksum "glide.lock" }}

- run:
name: Get glide
command: |
go get -v github.com/Masterminds/glide
cd $GOPATH/src/github.com/Masterminds/glide
git checkout tags/v0.12.3
git checkout tags/v0.13.1
go install
- run:
name: Get goveralls
command: |
go get github.com/mattn/goveralls
cd $GOPATH/src/github.com/Masterminds/glide
git checkout tags/v0.12.3
git checkout tags/v0.13.1
go install
- run:
name: Get the dependencies
Expand All @@ -123,11 +123,11 @@ jobs:
- run:
name: Coveralls!
no_output_timeout: 2400
command: goveralls -v -ignore=$(paste -sd, .coverignore) -service=circle-ci -repotoken=$COVERALLS_TOKEN
command: goveralls -v -flags "-vet=off" -ignore=$(paste -sd, .coverignore) -service=circle-ci -repotoken=$COVERALLS_TOKEN


- save_cache:
key: v1-factomd-go-build-cache-{{ checksum "glide.lock" }}
key: v2-factomd-go-build-cache-{{ checksum "glide.lock" }}
paths:
- vendor

Expand All @@ -149,7 +149,7 @@ jobs:
# Hence, checksumming glide.lock
- restore_cache:
keys:
- v5-factomd-cache-{{ checksum "glide.lock" }}
- v6-factomd-cache-{{ checksum "glide.lock" }}

# Load the images if the cache hit
- run:
Expand Down Expand Up @@ -244,7 +244,7 @@ jobs:
docker save -o /images/factomd.tar factomd $(docker history -q factomd |grep -v missing | grep -v none)
- save_cache:
key: v5-factomd-cache-{{ checksum "glide.lock" }}
key: v6-factomd-cache-{{ checksum "glide.lock" }}
paths:
- /images

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.9
FROM golang:1.10

# Get git
RUN apt-get update \
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.9-alpine as builder
FROM golang:1.10-alpine as builder

# Get git
RUN apk add --no-cache curl git
Expand Down Expand Up @@ -28,7 +28,7 @@ RUN mkdir -p /root/.factom/m2
COPY factomd.conf /root/.factom/m2/factomd.conf

# Now squash everything
FROM alpine:3.6
FROM alpine:3.7

# Get git
RUN apk add --no-cache ca-certificates curl git
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.2.19
0.4.2.20
3 changes: 1 addition & 2 deletions common/messages/commitEntry.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,7 @@ func (m *CommitEntryMsg) LeaderExecute(state interfaces.IState) {
// this commit is invalid.
if state.NoEntryYet(m.CommitEntry.EntryHash, m.CommitEntry.GetTimestamp()) {
state.LeaderExecuteCommitEntry(m)
} else {
state.FollowerExecuteCommitEntry(m)
// If this test fails then an existing entry has the same hash and this commit will never get processed.
}
}

Expand Down
16 changes: 10 additions & 6 deletions common/messages/dbstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type DBStateMsg struct {
MessageBase
Timestamp interfaces.Timestamp

//TODO: handle misformed DBStates!
//TODO: handle malformed DBStates!
DirectoryBlock interfaces.IDirectoryBlock
AdminBlock interfaces.IAdminBlock
FactoidBlock interfaces.IFBlock
Expand All @@ -43,6 +43,7 @@ type DBStateMsg struct {
IgnoreSigs bool
Sent interfaces.Timestamp
IsInDB bool
IsLast bool // Flag from state.LoadDatabase() that this is the last saved block loaded at boot.
}

var _ interfaces.IMsg = (*DBStateMsg)(nil)
Expand Down Expand Up @@ -340,10 +341,17 @@ func (m *DBStateMsg) SigTally(state interfaces.IState) int {
// If there is a repeat signature, we do not count it twice
sigmap := make(map[string]bool)
for _, sig := range m.SignatureList.List {
// check expected signature
if sigmap[fmt.Sprintf("%x", sig.GetSignature()[:])] {
continue // Toss duplicate signatures
}
sigmap[fmt.Sprintf("%x", sig.GetSignature()[:])] = true
check, err := state.VerifyAuthoritySignature(data, sig.GetSignature(), dbheight)
if err == nil && check >= 0 {
validSigCount++
continue
}
// it was not the expected signature check the boot strap
//Check signature against the Skeleton key
authoritativeKey := state.GetNetworkBootStrapKey()
if authoritativeKey != nil {
Expand All @@ -355,11 +363,7 @@ func (m *DBStateMsg) SigTally(state interfaces.IState) int {
}
}

check, err := state.VerifyAuthoritySignature(data, sig.GetSignature(), dbheight)
if err == nil && check >= 0 {
validSigCount++
continue
}
// save the unverified sig so we can check for leadership changes later on

if sig.Verify(data) {
remainingSig = append(remainingSig, sig)
Expand Down
14 changes: 8 additions & 6 deletions factomd.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import (
"os"

"fmt"
. "github.com/FactomProject/factomd/engine"
log "github.com/sirupsen/logrus"
"runtime"
"time"

. "github.com/FactomProject/factomd/engine"
log "github.com/sirupsen/logrus"

"bufio"
"io"
"net"
Expand Down Expand Up @@ -63,10 +64,6 @@ func main() {
func isCompilerVersionOK() bool {
goodenough := false

if strings.Contains(runtime.Version(), "1.5") {
goodenough = true
}

if strings.Contains(runtime.Version(), "1.6") {
goodenough = true
}
Expand All @@ -82,6 +79,11 @@ func isCompilerVersionOK() bool {
if strings.Contains(runtime.Version(), "1.9") {
goodenough = true
}

if strings.Contains(runtime.Version(), "1.10") {
goodenough = true
}

return goodenough
}

Expand Down
2 changes: 2 additions & 0 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

105 changes: 105 additions & 0 deletions scripts/racecondition_loadtesting.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#import addresses
factom-cli importaddress Fs2DNirmGDtnAZGXqca3XHkukTNMxoMGFFQxJA3bAjJnKzzsZBMH
factom-cli importaddress Es3LB2YW9bpdWmMnNQYb31kyPzqnecsNqmg5W4K7FKp4UP6omRTa
factom-cli importaddress Es2Zp56srDCV1QBFreSqYNSEkLSys2sj54L5qE3M88dWnoVL9sEf
factom-cli importaddress Es38CboJYYSovciHHtigHiv9kkKf5uzAAQjBst5QYcgt9a4m6ywv
factom-cli importaddress Es2aZZDjHdnnLzLWnDmNMRQFxTuRGsBsR7Gx96wBLNAWYQWoTFeH
factom-cli importaddress Es3p1AND3WwwTNNNPHLNy6LC8RQTE9YUE2zPYvXHPFLz5siAwT1H
factom-cli importaddress Es37igANtD8Z44pdXnNX4M5GJEsNLAk84MVVvrvnWRtBoacYmtdN
factom-cli importaddress Es2Rf7iM6PdsqfYCo3D1tnAR65SkLENyWJG1deUzpRMQmbh9F3eG
factom-cli importaddress Es4Mzp5ULbHw8eF4ZsxCRGFdhk8x2NbBEh1qor8aYoTxBmUP2TM4
factom-cli importaddress Es2tsKCLkXNMFVMT5GxiEVQz6KXdConW65cU3YTJokAHxPyYdWpA
factom-cli importaddress Es3e762q6TyqsyCtDai2RzzyUefWkoW3fdawyeK8CYfeYdhK1zz1
factom-cli importaddress Es2eDGnHNi8sTGtMyQSZV7HQX6yJXH8pnDnruS99vSzCD3vJwJoo
factom-cli importaddress Es3t4CtTPUuhBd41FB4BaVfH4Q2y7Qbs8xqk5MQ2x2KwR1r6eK2B
factom-cli importaddress Es3FV5JhfSxBbgfVPBKoziU3VcxYq4hgiXNiC3d9RgMvEvNCm3Jj
factom-cli importaddress Es3EfnjhS65agfy1cDoqUTxjicU3sL9cYxujwLzP1vnhHn9BjVvM
factom-cli importaddress Es3PQb6fVpLV2FbjrtxQXGGK6x9NmRiiDzjxhZEMXsVzh9efX5Cs
factom-cli importaddress Es2bSy4z5GFr4854fw6ZmQJM58xoYzuU7TfUt216ic7h4BQnGNqF
factom-cli importaddress Es3Bevp66wUp5NotP5a9SB2sBLj18uMvb3sqeJRUaDveJsgjanmm
factom-cli importaddress Es2azYxtCLskkvApoEMPAngqLXytpFyeVjikfLgundkQZPHTm31G
factom-cli importaddress Es34frQyDvxQDPeo7ZRFUxQjhkfSECFYh8GzNuczAL5JDtuuBbzG
factom-cli importaddress Es2hhDhFbWB1F2qGmhHZpgGX6WqYASELApeLpFAecrgaRUAAZwRd

#assign public keys to variables
ec[0]=EC1nje9iEd4k3hzHad4Qty7fAxKdji9Ep4ZjnRiTAcSrEDL1drU4
ec[1]=EC1qYbSLcGdLsbEkEMD1X9XqTff89Dc3mB94o6S55eAsahtGBQfK
ec[2]=EC1zpfdA5BjH6ixoYsu9KmYDrjDkqp1dX17nrgnWQ9Vsckh21Bbo
ec[3]=EC26nwbLvZk7h2U7C9V6hDKyuAHVz9LB9mwFCKYdaAdCd6zBf6kH
ec[4]=EC28pzmdcSg82ZyHRRrRukDxbCXAD4E6ftt1EsufmqVXaKTuWpU2
ec[5]=EC2DKSYyRcNWf7RS963VFYgMExoHRYLHVeCfQ9PGPmNzwrcmgm2r
ec[6]=EC2MAKZyVMuPdFEXEVd3bZMzJvb9xc6e3y5x11wbUczZzxnLNxuz
ec[7]=EC2N8ACTibRrHWDfp69sgNgtg6QG3GNUnB2HLtYG4iWNEZWrna5a
ec[8]=EC2aP6FUr1Ka9qfnZQSA5jbNGNaZeQjqnMmdyvJiBKXDx4eyip4P
ec[9]=EC2bGXjgzFdxj1PpoHekFadN4mjqPDaJeTcGS2tW1KVAeh7BYVb6
ec[10]=EC2dmFatZhymujjfRTvoesTNgKES1AqTADBMD1JE1cu2CmqFRVbF
ec[11]=EC2enVcf1ZV3vE1rTA7muepnM44LBhJS97j9eaeyDVuAN2SW5VJk
ec[12]=EC2kcjomA1sRmtuNdEEBwmR5PpZQfj2dEXJFx9gyTXeAsr2v3smh
ec[13]=EC2yuMHdCn1V1j2vHEc4gCMcQ8nR7TiSpMmL1zZNqejpZaaJ1WSB
ec[14]=EC31ASJ7P32tBrV54FjJHY6fZgQJT1t4gZRzz3fMszSNNzLuyhme
ec[15]=EC33dwXXiMGxCeTBVBcZzHF8QM4ge7UHnXAygmbVXAn1cWUsHn4X
ec[16]=EC37iMMmjtjqdofpeQDkP9XPQkinLC66JW22j7RVSsQv7oBMuC8W
ec[17]=EC3C1hhyojkBTQEtfti7vAueRJWtrLUCatQLPdzFSp5xsc8yPk4q
ec[18]=EC3fTo4Vj4nU3WCJcTFEes9Qdy21G8CRGVSMwSeBKtHVpaWEk1W8
ec[19]=EC3hNsEBBzFvf58pw1omVgrBobA6S4kEE4656uqdfk4ex7811vwr


#transfer funds to each of the entry credit address
for ((i=0; i < 20; i++)); do
echo $i
factom-cli rmtx t1
factom-cli newtx t1
factom-cli addtxinput t1 FA3EPZYqodgyEGXNMbiZKE5TS2x2J9wF8J9MvPZb52iGR78xMgCb 1
factom-cli addtxecoutput t1 ${ec[i]} 1
factom-cli addtxfee t1 FA3EPZYqodgyEGXNMbiZKE5TS2x2J9wF8J9MvPZb52iGR78xMgCb
factom-cli signtx t1
factom-cli sendtx t1
factom-cli listaddresses
#sleep 1s
done


#create chain with each of the entry credit address
for i in $(seq 20); do
echo ${ec[i]}
echo "hello world" | factom-cli addchain -n testing$i -n factom ${ec[i]}
done

sleep 1s

#assign chainid to variables
ChainID[1]=5132d9a8895a3b07d9ee61b856d860029f95947f8b504a1065c90bfdf5de133d
ChainID[2]=85d578a3a13999e261f06131235b3549b0d136755d52820e6c8ce14019334900
ChainID[3]=292024e2ae4c36acfb9650e6b145f6b60486c118322ceb1dad58d851276715d7
ChainID[4]=8f0657e56d8c860aed79f1d965df1ee8a42010fd918390c11394cb6ea39510a0
ChainID[5]=d70bc802a0d88df358048c731075a2ee3186d3f9c16c0ef66a61c37b56855712
ChainID[6]=991c54538c1a26ca564589327a9087c62a74596d013fbd24a1cb07911b9652bc
ChainID[7]=64eefedf8911c56db0bec825deea62d9dd4252b9aeb59adceeeee07132f35be4
ChainID[8]=84b6b414704fb3cff43304f11a4609dc919b9142c33b9ab1124e7fbe7462298c
ChainID[9]=1b869d24cf0709ea93a04c23c6aea239f3c35ce8a3e51fd6767a6181d37e3e1a
ChainID[10]=085cecb8874d10e74987f7262465601421e15abf85410c46b175dc7c053731c7
ChainID[11]=5a16f703ffd83ce4816214eb9cff79dd7ce650a6fa393273cbd824ed036dfbbe
ChainID[12]=868aa9e374e014cda9c293f1cb4a9f16dc3b28abed1d2141cbc5545bbc3e3e31
ChainID[13]=2de808ccfb8db7bb44a8e5722b6655b589079dd9a8ae0fbee2da3370d5d9e13a
ChainID[14]=b69469af5a875cfd50786827e92171a84232bd7a198fa29234ac931e40a342c3
ChainID[15]=58bf7850ef6afe6ef313718afb20429b3f6eb094fe297de5cdf8d08d4ebd3c86
ChainID[16]=33d3f40829af1dccf7798a55f3074855dba20a27a1b780cb32f1df849ef94757
ChainID[17]=a7576d1b7cae66a083fcd3e2117f35f9b6b217a0c8df6aaa53278215fe70a07f
ChainID[18]=b4e0ec762c2372e028e0838542a8134f804e09721fd4460315b03a36e8303489
ChainID[19]=f37f3789fdf3c9c73dabf7687cfdb730532c0cce2cebbb962739231c06cdf93f
ChainID[20]=bbaa38fbfb0ba18456e631df41b488662d69c84f4f55463f5ad28121a939f678


#factom-cli addentry to each of the chains
for j in $(seq 10000); do
for ((i=1; i < 20; i++)); do
echo "Making entries into chain $i"
echo "---------------------------------"
d=`date +%y%m%d%H%M%S`
echo $d $i-$j | factom-cli addentry -f -c ${ChainID[i]} ${ec[i]}
echo "---------------------------------"
done
sleep 1s
done


0 comments on commit 0d505cf

Please sign in to comment.