Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
validator
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Odysseus
validator
Commits
e72f7675
Commit
e72f7675
authored
Feb 21, 2024
by
贾浩@五瓣科技
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
skip empty proof
parent
fe2b03cf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
3 deletions
+10
-3
grpc.go
api/grpc.go
+3
-0
witness.go
core/witness.go
+1
-0
merkle_proof_test.go
tree/merkle_proof_test.go
+6
-3
No files found.
api/grpc.go
View file @
e72f7675
...
@@ -38,6 +38,9 @@ func (s *Server) PushProof(ctx context.Context, req *witnessv1.PushProofRequest)
...
@@ -38,6 +38,9 @@ func (s *Server) PushProof(ctx context.Context, req *witnessv1.PushProofRequest)
log
.
WithFields
(
log
.
Fields
{
"miner"
:
miner
,
"reward"
:
reward
,
"proofs"
:
len
(
proofs
)})
.
Debug
(
"push proof"
)
log
.
WithFields
(
log
.
Fields
{
"miner"
:
miner
,
"reward"
:
reward
,
"proofs"
:
len
(
proofs
)})
.
Debug
(
"push proof"
)
for
_
,
proof
:=
range
proofs
{
for
_
,
proof
:=
range
proofs
{
if
proof
.
Workload
==
0
{
continue
}
hashPayload
:=
append
(
append
([]
byte
(
proof
.
TaskId
),
proof
.
ReqHash
...
),
proof
.
RespHash
...
)
hashPayload
:=
append
(
append
([]
byte
(
proof
.
TaskId
),
proof
.
ReqHash
...
),
proof
.
RespHash
...
)
containerPubKey
,
err
:=
crypto
.
SigToPub
(
crypto
.
Keccak256
(
hashPayload
),
proof
.
ContainerSignature
)
containerPubKey
,
err
:=
crypto
.
SigToPub
(
crypto
.
Keccak256
(
hashPayload
),
proof
.
ContainerSignature
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
core/witness.go
View file @
e72f7675
...
@@ -369,6 +369,7 @@ func (w *Witness) GetMerkleProof(address common.Address) (workload uint64, proof
...
@@ -369,6 +369,7 @@ func (w *Witness) GetMerkleProof(address common.Address) (workload uint64, proof
w
.
Unlock
()
w
.
Unlock
()
if
!
ok
{
if
!
ok
{
// todo
// todo
return
0
,
nil
}
}
object
:=
w
.
state
.
GetMinerObject
(
address
)
object
:=
w
.
state
.
GetMinerObject
(
address
)
...
...
tree/merkle_proof_test.go
View file @
e72f7675
...
@@ -11,9 +11,12 @@ import (
...
@@ -11,9 +11,12 @@ import (
func
TestMT
(
t
*
testing
.
T
)
{
func
TestMT
(
t
*
testing
.
T
)
{
proofs
:=
make
([]
common
.
Hash
,
0
)
proofs
:=
make
([]
common
.
Hash
,
0
)
proofs
=
append
(
proofs
,
common
.
HexToHash
(
"0x1"
))
proofs
=
append
(
proofs
,
crypto
.
Keccak256Hash
(
common
.
HexToHash
(
"0x1"
)
.
Bytes
()))
proofs
=
append
(
proofs
,
common
.
HexToHash
(
"0x2"
))
proofs
=
append
(
proofs
,
crypto
.
Keccak256Hash
(
common
.
HexToHash
(
"0x2"
)
.
Bytes
()))
proofs
=
append
(
proofs
,
common
.
HexToHash
(
"0x3"
))
proofs
=
append
(
proofs
,
crypto
.
Keccak256Hash
(
common
.
HexToHash
(
"0x3"
)
.
Bytes
()))
proofs
=
append
(
proofs
,
crypto
.
Keccak256Hash
(
common
.
HexToHash
(
"0x4"
)
.
Bytes
()))
proofs
=
append
(
proofs
,
crypto
.
Keccak256Hash
(
common
.
HexToHash
(
"0x5"
)
.
Bytes
()))
proofs
=
append
(
proofs
,
crypto
.
Keccak256Hash
(
common
.
HexToHash
(
"0x6"
)
.
Bytes
()))
address
:=
common
.
HexToAddress
(
"0x1f9090aaE28b8a3dCeaDf281B0F12828e676c326"
)
address
:=
common
.
HexToAddress
(
"0x1f9090aaE28b8a3dCeaDf281B0F12828e676c326"
)
amount
:=
big
.
NewInt
(
0
)
.
SetUint64
(
10
)
amount
:=
big
.
NewInt
(
0
)
.
SetUint64
(
10
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment