Skip to content

Commit

Permalink
Merge pull request #154 from pegnet/feature/spr_v2
Browse files Browse the repository at this point in the history
SprSignatureActivation
  • Loading branch information
StarNeit authored Aug 26, 2020
2 parents 822036a + 921d6dc commit cdfc768
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/AdamSLevy/jsonrpc2/v13 v13.0.1
github.com/Factom-Asset-Tokens/factom v0.0.0-20191114224337-71de98ff5b3e
github.com/mattn/go-sqlite3 v1.11.0
github.com/pegnet/pegnet v0.5.1-0.20200821215317-2516c8c4196a
github.com/pegnet/pegnet v0.5.1-0.20200826220145-532bd212e1b6
github.com/rs/cors v1.7.0
github.com/sirupsen/logrus v1.4.2
github.com/spf13/cobra v0.0.5
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ github.com/FactomProject/factoid v0.3.4/go.mod h1:ExOuHMC672nR0h9b+jaTiW9ilQeWQO
github.com/FactomProject/factom v0.0.0-20160324204925-56e389d115c0/go.mod h1:V1V8mWqOI72JBpGj/aPQZEmhDepdykxyhVRH5GxbP4E=
github.com/FactomProject/factom v0.0.0-20190712163801-e7717c4ab072 h1:xp/3mIsJkBT0xcWnUvklVbFDf8V6gRjeHOBFhJic/UM=
github.com/FactomProject/factom v0.0.0-20190712163801-e7717c4ab072/go.mod h1:V1V8mWqOI72JBpGj/aPQZEmhDepdykxyhVRH5GxbP4E=
github.com/FactomProject/factom v0.3.6-0.20200826003247-4751d0f52dda h1:sc1jHcRNdWRCLY5IBl/Y0fKlbxAmqhZP3NFN0etsSbU=
github.com/FactomProject/factom v0.3.6-0.20200826003247-4751d0f52dda/go.mod h1:V1V8mWqOI72JBpGj/aPQZEmhDepdykxyhVRH5GxbP4E=
github.com/FactomProject/factomd v6.3.2+incompatible h1:Xw/neWF8IGiZhazvIVXnIUO6u7NYeJBoItx3mTHqA+I=
github.com/FactomProject/factomd v6.3.2+incompatible/go.mod h1:zeNvpIESaAp0bQSQ7U0c9tWzsklqMd5vGHLGCe3Bs3M=
github.com/FactomProject/fastsha256 v0.2.1 h1:ICfr2Lw5Ucy785GfJSjLLG9X1mZA6dsy/xgARlZ+brs=
Expand All @@ -68,12 +70,14 @@ github.com/FactomProject/gocoding v0.0.0-20150814232539-59666ce39524 h1:394GwlJF
github.com/FactomProject/gocoding v0.0.0-20150814232539-59666ce39524/go.mod h1:AtAVT8Uf+wlS9h/RK79oum1xym2r9UR5nb67zVEkq6Y=
github.com/FactomProject/goleveldb v0.2.1 h1:aKHpwSwVKEm/JQ97aLN+O7/xjSXjzof71gpPCukM+Ac=
github.com/FactomProject/goleveldb v0.2.1/go.mod h1:35UcJZvsGJAgxqegkfDb5S78gTlx/Pypzy4rZfM1pQA=
github.com/FactomProject/goleveldb v0.2.2-0.20170418171130-e7800c6976c5/go.mod h1:35UcJZvsGJAgxqegkfDb5S78gTlx/Pypzy4rZfM1pQA=
github.com/FactomProject/logrustash v0.0.0-20171005151533-9c7278ede46e h1:D/yNSYLSqUwukUw3115uW4RR+r0ftMUJFlcTC2e79pI=
github.com/FactomProject/logrustash v0.0.0-20171005151533-9c7278ede46e/go.mod h1:ah6QOMU70BGkGZRLG1Irc7f+j6eDU11tzHCI+rdLcoA=
github.com/FactomProject/netki-go-partner-client v0.0.0-20160324224126-426acb535e66 h1:H4nFZnW3EpbcefxbJAJxWCl7niO07QpKt8KeHtLwHoc=
github.com/FactomProject/netki-go-partner-client v0.0.0-20160324224126-426acb535e66/go.mod h1:L+Od0CCfb8IzUbPM4UxLaERB1I6Bw/lD2UtzRM90pIw=
github.com/FactomProject/serveridentity v0.0.0-20180611231115-cf42d2aa8deb h1:qU4hdSJnIMB9y+0GfHcE80v6edheTFR3VfrpuGgExc4=
github.com/FactomProject/serveridentity v0.0.0-20180611231115-cf42d2aa8deb/go.mod h1:qPNpznGlx4PdRmEL7I25U/zQHrbMK1h0Az8FYahuYdo=
github.com/FactomProject/snappy-go v0.0.0-20170202213131-f2f83b22c29e/go.mod h1:BQArcOnbPAS9l2B9Eo1R2i73/Es6PHRP0RrctmiH5jk=
github.com/FactomProject/web v0.1.0 h1:M136UkW3h/V8hH7h+s7qqm3GGSrKGKyXi6p94Z/AgPw=
github.com/FactomProject/web v0.1.0/go.mod h1:wiLhlN8amF4dalkSy+u75C3xsXaesSHy2cph6b/8PrI=
github.com/JohnCGriffin/overflow v0.0.0-20170615021017-4d914c927216/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk=
Expand Down Expand Up @@ -262,6 +266,8 @@ github.com/pegnet/pegnet v0.5.1-0.20200821172549-c71783d30916 h1:jhPobKbPCtwJmt5
github.com/pegnet/pegnet v0.5.1-0.20200821172549-c71783d30916/go.mod h1:Fy8Qohe9zIuqO9Q/ZOLUNpP2kuiFqxjevzaS3IL62+E=
github.com/pegnet/pegnet v0.5.1-0.20200821215317-2516c8c4196a h1:f+q9XPktXlURvO6tNa3SqUHnquKKK7RURW75sFLnma4=
github.com/pegnet/pegnet v0.5.1-0.20200821215317-2516c8c4196a/go.mod h1:Fy8Qohe9zIuqO9Q/ZOLUNpP2kuiFqxjevzaS3IL62+E=
github.com/pegnet/pegnet v0.5.1-0.20200826220145-532bd212e1b6 h1:ucPKH3+vQ/2ktMd3v50331rk5ZLvJN1P5AiYfpk8aP4=
github.com/pegnet/pegnet v0.5.1-0.20200826220145-532bd212e1b6/go.mod h1:NxKKJ9wnx/EvzfHk0p6XPlQqXIJg0iA4po0vzsdNx0o=
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0=
Expand Down
6 changes: 5 additions & 1 deletion node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ var (
V20HeightActivation uint32 = 258796

// Activation height for developer rewards
V20DevRewardsHeightActivation uint32 = 295000
V20DevRewardsHeightActivation uint32 = 260118

// SprSignatureActivation indicates the activation of SPR Signature.
// Estimated to be Aug 28th 2020
SprSignatureActivation uint32 = 260118
)

func SetAllActivations(act uint32) {
Expand Down
12 changes: 11 additions & 1 deletion node/spr.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"github.com/Factom-Asset-Tokens/factom"
"github.com/pegnet/pegnet/common"
"github.com/pegnet/pegnet/modules/graderStake"
)

Expand All @@ -23,6 +24,9 @@ func (d *Pegnetd) GradeS(ctx context.Context, block *factom.EBlock) (graderStake
if block.Height >= V20HeightActivation {
ver = 5
}
if block.Height >= SprSignatureActivation {
ver = 6
}

g, err := graderStake.NewGrader(ver, int32(block.Height))
if err != nil {
Expand All @@ -34,7 +38,13 @@ func (d *Pegnetd) GradeS(ctx context.Context, block *factom.EBlock) (graderStake
extids[i] = entry.ExtIDs[i]
}
// allow only top 100 stake holders submit prices
stakerRCD := extids[1]
var stakerRCD []byte
if block.Height >= V20HeightActivation {
stakerRCD = extids[1]
}
if block.Height >= SprSignatureActivation {
stakerRCD = common.ComputeRCDFromPubkey(extids[1])
}
if d.Pegnet.IsIncludedTopPEGAddress(stakerRCD) {
// ignore bad opr errors
err = g.AddSPR(entry.Hash[:], extids, entry.Content)
Expand Down
2 changes: 1 addition & 1 deletion node/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ OuterSyncLoop:

// One time operation, Inserts negative balance for the burn address that used during the attack
// We need to do this before main logic because sqlite db will be locked
if d.Sync.Synced+1 == V20HeightActivation+1000 {
if d.Sync.Synced+1 == V20DevRewardsHeightActivation {
d.NullifyBurnAddress(ctx, tx, d.Sync.Synced+1)
}

Expand Down

0 comments on commit cdfc768

Please sign in to comment.