Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
张蕾
Geth-Modification
Commits
be303ba1
Commit
be303ba1
authored
Jun 16, 2015
by
Gustav Simonsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update ethash Godep (again)
parent
a9d6846f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
12 deletions
+23
-12
Godeps.json
Godeps/Godeps.json
+2
-2
ethash.go
Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go
+1
-2
ethash_test.go
.../_workspace/src/github.com/ethereum/ethash/ethash_test.go
+20
-8
No files found.
Godeps/Godeps.json
View file @
be303ba1
...
@@ -21,8 +21,8 @@
...
@@ -21,8 +21,8 @@
},
},
{
{
"ImportPath"
:
"github.com/ethereum/ethash"
,
"ImportPath"
:
"github.com/ethereum/ethash"
,
"Comment"
:
"v23.1-222-g
5cfdcba
"
,
"Comment"
:
"v23.1-222-g
173b8ff
"
,
"Rev"
:
"
5cfdcba92e634db228d1ddb140e3b7a3c4b38177
"
"Rev"
:
"
173b8ff953610c13710061e83b95b50c73d7ea50
"
},
},
{
{
"ImportPath"
:
"github.com/howeyc/fsnotify"
,
"ImportPath"
:
"github.com/howeyc/fsnotify"
,
...
...
Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go
View file @
be303ba1
...
@@ -8,7 +8,6 @@ int ethashGoCallback_cgo(unsigned);
...
@@ -8,7 +8,6 @@ int ethashGoCallback_cgo(unsigned);
import
"C"
import
"C"
import
(
import
(
"bytes"
"errors"
"errors"
"fmt"
"fmt"
"io/ioutil"
"io/ioutil"
...
@@ -122,7 +121,7 @@ func (l *Light) Verify(block pow.Block) bool {
...
@@ -122,7 +121,7 @@ func (l *Light) Verify(block pow.Block) bool {
}
}
// avoid mixdigest malleability as it's not included in a block's "hashNononce"
// avoid mixdigest malleability as it's not included in a block's "hashNononce"
if
!
bytes
.
Equal
(
block
.
MixDigest
()
.
Bytes
(),
C
.
GoBytes
(
unsafe
.
Pointer
(
&
ret
.
mix_hash
),
C
.
int
(
32
))
)
{
if
block
.
MixDigest
()
!=
h256ToHash
(
ret
.
mix_hash
)
{
return
false
return
false
}
}
...
...
Godeps/_workspace/src/github.com/ethereum/ethash/ethash_test.go
View file @
be303ba1
...
@@ -39,6 +39,7 @@ var validBlocks = []*testBlock{
...
@@ -39,6 +39,7 @@ var validBlocks = []*testBlock{
hashNoNonce
:
common
.
HexToHash
(
"372eca2454ead349c3df0ab5d00b0b706b23e49d469387db91811cee0358fc6d"
),
hashNoNonce
:
common
.
HexToHash
(
"372eca2454ead349c3df0ab5d00b0b706b23e49d469387db91811cee0358fc6d"
),
difficulty
:
big
.
NewInt
(
132416
),
difficulty
:
big
.
NewInt
(
132416
),
nonce
:
0x495732e0ed7a801c
,
nonce
:
0x495732e0ed7a801c
,
mixDigest
:
common
.
HexToHash
(
"2f74cdeb198af0b9abe65d22d372e22fb2d474371774a9583c1cc427a07939f5"
),
},
},
// from proof of concept nine testnet, epoch 1
// from proof of concept nine testnet, epoch 1
{
{
...
@@ -46,6 +47,7 @@ var validBlocks = []*testBlock{
...
@@ -46,6 +47,7 @@ var validBlocks = []*testBlock{
hashNoNonce
:
common
.
HexToHash
(
"7e44356ee3441623bc72a683fd3708fdf75e971bbe294f33e539eedad4b92b34"
),
hashNoNonce
:
common
.
HexToHash
(
"7e44356ee3441623bc72a683fd3708fdf75e971bbe294f33e539eedad4b92b34"
),
difficulty
:
big
.
NewInt
(
1532671
),
difficulty
:
big
.
NewInt
(
1532671
),
nonce
:
0x318df1c8adef7e5e
,
nonce
:
0x318df1c8adef7e5e
,
mixDigest
:
common
.
HexToHash
(
"144b180aad09ae3c81fb07be92c8e6351b5646dda80e6844ae1b697e55ddde84"
),
},
},
// from proof of concept nine testnet, epoch 2
// from proof of concept nine testnet, epoch 2
{
{
...
@@ -53,6 +55,7 @@ var validBlocks = []*testBlock{
...
@@ -53,6 +55,7 @@ var validBlocks = []*testBlock{
hashNoNonce
:
common
.
HexToHash
(
"5fc898f16035bf5ac9c6d9077ae1e3d5fc1ecc3c9fd5bee8bb00e810fdacbaa0"
),
hashNoNonce
:
common
.
HexToHash
(
"5fc898f16035bf5ac9c6d9077ae1e3d5fc1ecc3c9fd5bee8bb00e810fdacbaa0"
),
difficulty
:
big
.
NewInt
(
2467358
),
difficulty
:
big
.
NewInt
(
2467358
),
nonce
:
0x50377003e5d830ca
,
nonce
:
0x50377003e5d830ca
,
mixDigest
:
common
.
HexToHash
(
"ab546a5b73c452ae86dadd36f0ed83a6745226717d3798832d1b20b489e82063"
),
},
},
}
}
...
@@ -73,8 +76,9 @@ func TestEthashConcurrentVerify(t *testing.T) {
...
@@ -73,8 +76,9 @@ func TestEthashConcurrentVerify(t *testing.T) {
defer
os
.
RemoveAll
(
eth
.
Full
.
Dir
)
defer
os
.
RemoveAll
(
eth
.
Full
.
Dir
)
block
:=
&
testBlock
{
difficulty
:
big
.
NewInt
(
10
)}
block
:=
&
testBlock
{
difficulty
:
big
.
NewInt
(
10
)}
nonce
,
_
:=
eth
.
Search
(
block
,
nil
)
nonce
,
md
:=
eth
.
Search
(
block
,
nil
)
block
.
nonce
=
nonce
block
.
nonce
=
nonce
block
.
mixDigest
=
common
.
BytesToHash
(
md
)
// Verify the block concurrently to check for data races.
// Verify the block concurrently to check for data races.
var
wg
sync
.
WaitGroup
var
wg
sync
.
WaitGroup
...
@@ -98,21 +102,26 @@ func TestEthashConcurrentSearch(t *testing.T) {
...
@@ -98,21 +102,26 @@ func TestEthashConcurrentSearch(t *testing.T) {
eth
.
Turbo
(
true
)
eth
.
Turbo
(
true
)
defer
os
.
RemoveAll
(
eth
.
Full
.
Dir
)
defer
os
.
RemoveAll
(
eth
.
Full
.
Dir
)
// launch n searches concurrently.
type
searchRes
struct
{
n
uint64
md
[]
byte
}
var
(
var
(
block
=
&
testBlock
{
difficulty
:
big
.
NewInt
(
35000
)}
block
=
&
testBlock
{
difficulty
:
big
.
NewInt
(
35000
)}
nsearch
=
10
nsearch
=
10
wg
=
new
(
sync
.
WaitGroup
)
wg
=
new
(
sync
.
WaitGroup
)
found
=
make
(
chan
uint64
)
found
=
make
(
chan
searchRes
)
stop
=
make
(
chan
struct
{})
stop
=
make
(
chan
struct
{})
)
)
rand
.
Read
(
block
.
hashNoNonce
[
:
])
rand
.
Read
(
block
.
hashNoNonce
[
:
])
wg
.
Add
(
nsearch
)
wg
.
Add
(
nsearch
)
// launch n searches concurrently.
for
i
:=
0
;
i
<
nsearch
;
i
++
{
for
i
:=
0
;
i
<
nsearch
;
i
++
{
go
func
()
{
go
func
()
{
nonce
,
_
:=
eth
.
Search
(
block
,
stop
)
nonce
,
md
:=
eth
.
Search
(
block
,
stop
)
select
{
select
{
case
found
<-
nonce
:
case
found
<-
searchRes
{
n
:
nonce
,
md
:
md
}
:
case
<-
stop
:
case
<-
stop
:
}
}
wg
.
Done
()
wg
.
Done
()
...
@@ -120,12 +129,14 @@ func TestEthashConcurrentSearch(t *testing.T) {
...
@@ -120,12 +129,14 @@ func TestEthashConcurrentSearch(t *testing.T) {
}
}
// wait for one of them to find the nonce
// wait for one of them to find the nonce
nonce
:=
<-
found
res
:=
<-
found
// stop the others
// stop the others
close
(
stop
)
close
(
stop
)
wg
.
Wait
()
wg
.
Wait
()
if
block
.
nonce
=
nonce
;
!
eth
.
Verify
(
block
)
{
block
.
nonce
=
res
.
n
block
.
mixDigest
=
common
.
BytesToHash
(
res
.
md
)
if
!
eth
.
Verify
(
block
)
{
t
.
Error
(
"Block could not be verified"
)
t
.
Error
(
"Block could not be verified"
)
}
}
}
}
...
@@ -140,8 +151,9 @@ func TestEthashSearchAcrossEpoch(t *testing.T) {
...
@@ -140,8 +151,9 @@ func TestEthashSearchAcrossEpoch(t *testing.T) {
for
i
:=
epochLength
-
40
;
i
<
epochLength
+
40
;
i
++
{
for
i
:=
epochLength
-
40
;
i
<
epochLength
+
40
;
i
++
{
block
:=
&
testBlock
{
number
:
i
,
difficulty
:
big
.
NewInt
(
90
)}
block
:=
&
testBlock
{
number
:
i
,
difficulty
:
big
.
NewInt
(
90
)}
rand
.
Read
(
block
.
hashNoNonce
[
:
])
rand
.
Read
(
block
.
hashNoNonce
[
:
])
nonce
,
_
:=
eth
.
Search
(
block
,
nil
)
nonce
,
md
:=
eth
.
Search
(
block
,
nil
)
block
.
nonce
=
nonce
block
.
nonce
=
nonce
block
.
mixDigest
=
common
.
BytesToHash
(
md
)
if
!
eth
.
Verify
(
block
)
{
if
!
eth
.
Verify
(
block
)
{
t
.
Fatalf
(
"Block could not be verified"
)
t
.
Fatalf
(
"Block could not be verified"
)
}
}
...
...
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