Skip to content

#80 implementation for proof of ownership #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Aug 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
34e90cf
#80 add core node admin services
komodo2662 Jul 22, 2019
2521aee
improve generate proof of ownership function
komodo2662 Jul 24, 2019
ca54cbe
on progress proof of ownership validation
komodo2662 Jul 25, 2019
81b28cd
node message conversion from byte
komodo2662 Jul 26, 2019
b5fa82e
fix bug failed test ci
komodo2662 Jul 26, 2019
cecd529
fix bug failed test ci
komodo2662 Jul 26, 2019
2fb38ea
fix bug failed test ci
komodo2662 Jul 26, 2019
27c5fd6
fix bug failed test ci
komodo2662 Jul 26, 2019
49f3232
fix bug failed test ci
komodo2662 Jul 26, 2019
9e9f157
add nodeAdminCoreService test
komodo2662 Jul 26, 2019
9f20018
resolve conflict
komodo2662 Jul 31, 2019
e94b8b8
resolve conflict
komodo2662 Jul 31, 2019
c180081
resolve conflict
komodo2662 Aug 1, 2019
5967f28
add config owner acc address
komodo2662 Aug 1, 2019
853b613
resolve conflict
komodo2662 Aug 1, 2019
feddcb8
Merge branch 'develop' into 80-tech-proofofownership
komodo2662 Aug 1, 2019
f59c7e3
resolve conflict
komodo2662 Aug 2, 2019
f7cf4f1
resolve conflict
komodo2662 Aug 2, 2019
ceef0fd
resolve conflict
komodo2662 Aug 2, 2019
99859ae
Merge remote-tracking branch 'origin/develop' into 80-tech-proofofown…
Aug 2, 2019
e0de91c
recompiled schema after refactoring ProofOfOwnership protobuf
Aug 3, 2019
a44549f
added GetBlockByHeight to blockService and creted unit test
Aug 3, 2019
ac2b13e
finished refactoring ValidateProofOfOwnership
Aug 3, 2019
6d4ae36
fixed go-lint errors
Aug 3, 2019
de4088e
Merge remote-tracking branch 'origin/develop' into 80-tech-proofofown…
Aug 5, 2019
e6f7d12
fixed loading config params: using configuration already loaded in ma…
Aug 5, 2019
ae4024d
injected BlockService into NodeAdminService to make it mockable and r…
Aug 5, 2019
0809658
simplified unit tests by removing unecessary mocked queries (since no…
Aug 5, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions common/constant/node.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package constant

var (
// ProofOfOwnershipExpiration number of blocks after a proof of ownership message 'expires' (is considered invalid)
ProofOfOwnershipExpiration uint32 = 100
)
6 changes: 3 additions & 3 deletions common/crypto/signature.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
type (
SignatureInterface interface {
Sign(payload []byte, accountType uint32, accountAddress, seed string) []byte
SignBlock(payload []byte, nodeSeed string) []byte
SignByNode(payload []byte, nodeSeed string) []byte
VerifySignature(payload, signature []byte, accountType uint32, accountAddress string) bool
}

Expand Down Expand Up @@ -37,8 +37,8 @@ func (sig *Signature) Sign(payload []byte, accountType uint32, accountAddress, s
}
}

// SignBlock special method for signing block only, there will be no multiple signature options
func (*Signature) SignBlock(payload []byte, nodeSeed string) []byte {
// SignByNode special method for signing block only, there will be no multiple signature options
func (*Signature) SignByNode(payload []byte, nodeSeed string) []byte {
nodePrivateKey := ed25519GetPrivateKeyFromSeed(nodeSeed)
return ed25519.Sign(nodePrivateKey, payload)
}
Expand Down
6 changes: 3 additions & 3 deletions common/crypto/signature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func TestSignature_SignBlock(t *testing.T) {
want []byte
}{
{
name: "SignBlock:success",
name: "SignByNode:success",
args: args{
payload: []byte{12, 43, 65, 65, 12, 123, 43, 12, 1, 24, 5, 5, 12, 54},
nodeSeed: "concur vocalist rotten busload gap quote stinging undiluted surfer goofiness deviation starved",
Expand All @@ -96,8 +96,8 @@ func TestSignature_SignBlock(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
s := &Signature{}
if got := s.SignBlock(tt.args.payload, tt.args.nodeSeed); !reflect.DeepEqual(got, tt.want) {
t.Errorf("Signature.SignBlock() = %v, want %v", got, tt.want)
if got := s.SignByNode(tt.args.payload, tt.args.nodeSeed); !reflect.DeepEqual(got, tt.want) {
t.Errorf("Signature.SignByNode() = %v, want %v", got, tt.want)
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion common/model/host.pb.go

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

46 changes: 25 additions & 21 deletions common/model/nodeRegistration.pb.go

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

Loading