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
3593662b
Commit
3593662b
authored
May 07, 2015
by
Gustav Simonsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update ethash deps (more build fixes, tests)
parent
97c37356
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
65 additions
and
21 deletions
+65
-21
Godeps.json
Godeps/Godeps.json
+2
-2
ethashc.go
Godeps/_workspace/src/github.com/ethereum/ethash/ethashc.go
+11
-1
internal.c
...e/src/github.com/ethereum/ethash/src/libethash/internal.c
+1
-1
internal.h
...e/src/github.com/ethereum/ethash/src/libethash/internal.h
+3
-3
io.h
...rkspace/src/github.com/ethereum/ethash/src/libethash/io.h
+4
-3
io_win32.c
...e/src/github.com/ethereum/ethash/src/libethash/io_win32.c
+1
-1
util.h
...space/src/github.com/ethereum/ethash/src/libethash/util.h
+4
-4
test.cpp
..._workspace/src/github.com/ethereum/ethash/test/c/test.cpp
+39
-6
No files found.
Godeps/Godeps.json
View file @
3593662b
...
@@ -17,8 +17,8 @@
...
@@ -17,8 +17,8 @@
},
},
{
{
"ImportPath"
:
"github.com/ethereum/ethash"
,
"ImportPath"
:
"github.com/ethereum/ethash"
,
"Comment"
:
"v23.1-
195-g4d50db9
"
,
"Comment"
:
"v23.1-
204-g0401fdf
"
,
"Rev"
:
"
4d50db90d8bb5f2fae357570366cb8c657a4ddfc
"
"Rev"
:
"
0401fdf56a3bc8679f9560e542c3d1cf83020efe
"
},
},
{
{
"ImportPath"
:
"github.com/howeyc/fsnotify"
,
"ImportPath"
:
"github.com/howeyc/fsnotify"
,
...
...
Godeps/_workspace/src/github.com/ethereum/ethash/ethashc.go
View file @
3593662b
package
ethash
package
ethash
/*
-mno-stack-arg-probe disables stack probing which avoids the function
__chkstk_ms being linked. this avoids a clash of this symbol as we also
separately link the secp256k1 lib which ends up defining this symbol
1. https://gcc.gnu.org/onlinedocs/gccint/Stack-Checking.html
2. https://groups.google.com/forum/#!msg/golang-dev/v1bziURSQ4k/88fXuJ24e-gJ
3. https://groups.google.com/forum/#!topic/golang-nuts/VNP6Mwz_B6o
*/
/*
/*
#cgo CFLAGS: -std=gnu99 -Wall
#cgo CFLAGS: -std=gnu99 -Wall
#cgo windows CFLAGS: -mno-stack-arg-probe
#cgo windows CFLAGS: -mno-stack-arg-probe
...
@@ -10,7 +21,6 @@ package ethash
...
@@ -10,7 +21,6 @@ package ethash
#include "src/libethash/io.c"
#include "src/libethash/io.c"
#ifdef _WIN32
#ifdef _WIN32
# include "src/libethash/util_win32.c"
# include "src/libethash/io_win32.c"
# include "src/libethash/io_win32.c"
# include "src/libethash/mmap_win32.c"
# include "src/libethash/mmap_win32.c"
#else
#else
...
...
Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/internal.c
View file @
3593662b
...
@@ -280,7 +280,7 @@ ethash_h256_t ethash_get_seedhash(uint64_t block_number)
...
@@ -280,7 +280,7 @@ ethash_h256_t ethash_get_seedhash(uint64_t block_number)
return
ret
;
return
ret
;
}
}
int
ethash_quick_check_difficulty
(
bool
ethash_quick_check_difficulty
(
ethash_h256_t
const
*
header_hash
,
ethash_h256_t
const
*
header_hash
,
uint64_t
const
nonce
,
uint64_t
const
nonce
,
ethash_h256_t
const
*
mix_hash
,
ethash_h256_t
const
*
mix_hash
,
...
...
Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/internal.h
View file @
3593662b
...
@@ -47,7 +47,7 @@ static inline void ethash_h256_reset(ethash_h256_t* hash)
...
@@ -47,7 +47,7 @@ static inline void ethash_h256_reset(ethash_h256_t* hash)
}
}
// Returns if hash is less than or equal to difficulty
// Returns if hash is less than or equal to difficulty
static
inline
int
ethash_check_difficulty
(
static
inline
bool
ethash_check_difficulty
(
ethash_h256_t
const
*
hash
,
ethash_h256_t
const
*
hash
,
ethash_h256_t
const
*
difficulty
ethash_h256_t
const
*
difficulty
)
)
...
@@ -59,10 +59,10 @@ static inline int ethash_check_difficulty(
...
@@ -59,10 +59,10 @@ static inline int ethash_check_difficulty(
}
}
return
ethash_h256_get
(
hash
,
i
)
<
ethash_h256_get
(
difficulty
,
i
);
return
ethash_h256_get
(
hash
,
i
)
<
ethash_h256_get
(
difficulty
,
i
);
}
}
return
1
;
return
true
;
}
}
int
ethash_quick_check_difficulty
(
bool
ethash_quick_check_difficulty
(
ethash_h256_t
const
*
header_hash
,
ethash_h256_t
const
*
header_hash
,
uint64_t
const
nonce
,
uint64_t
const
nonce
,
ethash_h256_t
const
*
mix_hash
,
ethash_h256_t
const
*
mix_hash
,
...
...
Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/io.h
View file @
3593662b
...
@@ -34,11 +34,12 @@
...
@@ -34,11 +34,12 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
// Maximum size for mutable part of DAG file name
// Maximum size for mutable part of DAG file name
// 6 is for "full-R", the suffix of the filename
// 10 is for maximum number of digits of a uint32_t (for REVISION)
// 10 is for maximum number of digits of a uint32_t (for REVISION)
// 1 is for
_
and 16 is for the first 16 hex digits for first 8 bytes of
// 1 is for
-
and 16 is for the first 16 hex digits for first 8 bytes of
// the seedhash and last 1 is for the null terminating character
// the seedhash and last 1 is for the null terminating character
// Reference: https://github.com/ethereum/wiki/wiki/Ethash-DAG
// Reference: https://github.com/ethereum/wiki/wiki/Ethash-DAG
#define DAG_MUTABLE_NAME_MAX_SIZE (10 + 1 + 16 + 1)
#define DAG_MUTABLE_NAME_MAX_SIZE (
6 +
10 + 1 + 16 + 1)
/// Possible return values of @see ethash_io_prepare
/// Possible return values of @see ethash_io_prepare
enum
ethash_io_rc
{
enum
ethash_io_rc
{
ETHASH_IO_FAIL
=
0
,
///< There has been an IO failure
ETHASH_IO_FAIL
=
0
,
///< There has been an IO failure
...
@@ -176,7 +177,7 @@ static inline bool ethash_io_mutable_name(
...
@@ -176,7 +177,7 @@ static inline bool ethash_io_mutable_name(
#if LITTLE_ENDIAN == BYTE_ORDER
#if LITTLE_ENDIAN == BYTE_ORDER
hash
=
ethash_swap_u64
(
hash
);
hash
=
ethash_swap_u64
(
hash
);
#endif
#endif
return
snprintf
(
output
,
DAG_MUTABLE_NAME_MAX_SIZE
,
"
%u_
%016"
PRIx64
,
revision
,
hash
)
>=
0
;
return
snprintf
(
output
,
DAG_MUTABLE_NAME_MAX_SIZE
,
"
full-R%u-
%016"
PRIx64
,
revision
,
hash
)
>=
0
;
}
}
#ifdef __cplusplus
#ifdef __cplusplus
...
...
Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/io_win32.c
View file @
3593662b
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
#include <stdio.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/types.h>
#include <
S
hlobj.h>
#include <
s
hlobj.h>
FILE
*
ethash_fopen
(
char
const
*
file_name
,
char
const
*
mode
)
FILE
*
ethash_fopen
(
char
const
*
file_name
,
char
const
*
mode
)
{
{
...
...
Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/util.h
View file @
3593662b
...
@@ -26,11 +26,11 @@
...
@@ -26,11 +26,11 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
//
#ifdef _MSC_VER
#ifdef _MSC_VER
void
debugf
(
char
const
*
str
,
...);
void
debugf
(
char
const
*
str
,
...);
//
#else
#else
//
#define debugf printf
#define debugf printf
//
#endif
#endif
static
inline
uint32_t
min_u32
(
uint32_t
a
,
uint32_t
b
)
static
inline
uint32_t
min_u32
(
uint32_t
a
,
uint32_t
b
)
{
{
...
...
Godeps/_workspace/src/github.com/ethereum/ethash/test/c/test.cpp
View file @
3593662b
...
@@ -205,10 +205,10 @@ BOOST_AUTO_TEST_CASE(test_ethash_io_mutable_name) {
...
@@ -205,10 +205,10 @@ BOOST_AUTO_TEST_CASE(test_ethash_io_mutable_name) {
// should have at least 8 bytes provided since this is what we test :)
// should have at least 8 bytes provided since this is what we test :)
ethash_h256_t
seed1
=
ethash_h256_static_init
(
0
,
10
,
65
,
255
,
34
,
55
,
22
,
8
);
ethash_h256_t
seed1
=
ethash_h256_static_init
(
0
,
10
,
65
,
255
,
34
,
55
,
22
,
8
);
ethash_io_mutable_name
(
1
,
&
seed1
,
mutable_name
);
ethash_io_mutable_name
(
1
,
&
seed1
,
mutable_name
);
BOOST_REQUIRE_EQUAL
(
0
,
strcmp
(
mutable_name
,
"
1_
000a41ff22371608"
));
BOOST_REQUIRE_EQUAL
(
0
,
strcmp
(
mutable_name
,
"
full-R1-
000a41ff22371608"
));
ethash_h256_t
seed2
=
ethash_h256_static_init
(
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
);
ethash_h256_t
seed2
=
ethash_h256_static_init
(
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
);
ethash_io_mutable_name
(
44
,
&
seed2
,
mutable_name
);
ethash_io_mutable_name
(
44
,
&
seed2
,
mutable_name
);
BOOST_REQUIRE_EQUAL
(
0
,
strcmp
(
mutable_name
,
"
44_
0000000000000000"
));
BOOST_REQUIRE_EQUAL
(
0
,
strcmp
(
mutable_name
,
"
full-R44-
0000000000000000"
));
}
}
BOOST_AUTO_TEST_CASE
(
test_ethash_dir_creation
)
{
BOOST_AUTO_TEST_CASE
(
test_ethash_dir_creation
)
{
...
@@ -599,16 +599,49 @@ BOOST_AUTO_TEST_CASE(test_incomplete_dag_file) {
...
@@ -599,16 +599,49 @@ BOOST_AUTO_TEST_CASE(test_incomplete_dag_file) {
fs
::
remove_all
(
"./test_ethash_directory/"
);
fs
::
remove_all
(
"./test_ethash_directory/"
);
}
}
BOOST_AUTO_TEST_CASE
(
test_block_verification
)
{
BOOST_AUTO_TEST_CASE
(
test_block22_verification
)
{
// from POC-9 testnet, epoch 0
ethash_light_t
light
=
ethash_light_new
(
22
);
ethash_light_t
light
=
ethash_light_new
(
22
);
ethash_h256_t
seedhash
=
stringToBlockhash
(
"372eca2454ead349c3df0ab5d00b0b706b23e49d469387db91811cee0358fc6d"
);
ethash_h256_t
seedhash
=
stringToBlockhash
(
"372eca2454ead349c3df0ab5d00b0b706b23e49d469387db91811cee0358fc6d"
);
BOOST_ASSERT
(
light
);
BOOST_ASSERT
(
light
);
ethash_return_value_t
ret
=
ethash_light_compute
(
ethash_return_value_t
ret
=
ethash_light_compute
(
light
,
light
,
seedhash
,
seedhash
,
0x495732e0ed7a801c
0x495732e0ed7a801c
U
);
);
BOOST_REQUIRE_EQUAL
(
blockhashToHexString
(
&
ret
.
result
),
"00000b184f1fdd88bfd94c86c39e65db0c36144d5e43f745f722196e730cb614"
);
BOOST_REQUIRE_EQUAL
(
blockhashToHexString
(
&
ret
.
result
),
"00000b184f1fdd88bfd94c86c39e65db0c36144d5e43f745f722196e730cb614"
);
ethash_h256_t
difficulty
=
ethash_h256_static_init
(
0x2
,
0x5
,
0x40
);
BOOST_REQUIRE
(
ethash_check_difficulty
(
&
ret
.
result
,
&
difficulty
));
ethash_light_delete
(
light
);
}
BOOST_AUTO_TEST_CASE
(
test_block30001_verification
)
{
// from POC-9 testnet, epoch 1
ethash_light_t
light
=
ethash_light_new
(
30001
);
ethash_h256_t
seedhash
=
stringToBlockhash
(
"7e44356ee3441623bc72a683fd3708fdf75e971bbe294f33e539eedad4b92b34"
);
BOOST_ASSERT
(
light
);
ethash_return_value_t
ret
=
ethash_light_compute
(
light
,
seedhash
,
0x318df1c8adef7e5eU
);
ethash_h256_t
difficulty
=
ethash_h256_static_init
(
0x17
,
0x62
,
0xff
);
BOOST_REQUIRE
(
ethash_check_difficulty
(
&
ret
.
result
,
&
difficulty
));
ethash_light_delete
(
light
);
}
BOOST_AUTO_TEST_CASE
(
test_block60000_verification
)
{
// from POC-9 testnet, epoch 2
ethash_light_t
light
=
ethash_light_new
(
60000
);
ethash_h256_t
seedhash
=
stringToBlockhash
(
"5fc898f16035bf5ac9c6d9077ae1e3d5fc1ecc3c9fd5bee8bb00e810fdacbaa0"
);
BOOST_ASSERT
(
light
);
ethash_return_value_t
ret
=
ethash_light_compute
(
light
,
seedhash
,
0x50377003e5d830caU
);
ethash_h256_t
difficulty
=
ethash_h256_static_init
(
0x25
,
0xa6
,
0x1e
);
BOOST_REQUIRE
(
ethash_check_difficulty
(
&
ret
.
result
,
&
difficulty
));
ethash_light_delete
(
light
);
ethash_light_delete
(
light
);
}
}
...
@@ -617,7 +650,7 @@ BOOST_AUTO_TEST_CASE(test_block_verification) {
...
@@ -617,7 +650,7 @@ BOOST_AUTO_TEST_CASE(test_block_verification) {
// Uncomment and run on your own machine if you want to confirm
// Uncomment and run on your own machine if you want to confirm
// it works fine.
// it works fine.
#if 0
#if 0
static int
lef
_cb(unsigned _progress)
static int
progress
_cb(unsigned _progress)
{
{
printf("CREATING DAG. PROGRESS: %u\n", _progress);
printf("CREATING DAG. PROGRESS: %u\n", _progress);
fflush(stdout);
fflush(stdout);
...
@@ -627,7 +660,7 @@ static int lef_cb(unsigned _progress)
...
@@ -627,7 +660,7 @@ static int lef_cb(unsigned _progress)
BOOST_AUTO_TEST_CASE(full_dag_test) {
BOOST_AUTO_TEST_CASE(full_dag_test) {
ethash_light_t light = ethash_light_new(55);
ethash_light_t light = ethash_light_new(55);
BOOST_ASSERT(light);
BOOST_ASSERT(light);
ethash_full_t full = ethash_full_new(light,
lef
_cb);
ethash_full_t full = ethash_full_new(light,
progress
_cb);
BOOST_ASSERT(full);
BOOST_ASSERT(full);
ethash_light_delete(light);
ethash_light_delete(light);
ethash_full_delete(full);
ethash_full_delete(full);
...
...
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