Browse Source

2.3.1, separate gostd and gostcoin algos

master
R4SAS 5 years ago
parent
commit
4efa648c4c
  1. 6
      Makefile.am
  2. 22
      README.txt
  3. 4
      algos.h
  4. 7
      api.cpp
  5. 24
      ccminer.cpp
  6. 2
      compat/ccminer-config.h
  7. 2
      configure.ac
  8. 2
      miner.h
  9. 16
      res/ccminer.rc
  10. 33
      util.cpp

6
Makefile.am

@ -38,9 +38,13 @@ ccminer_LDFLAGS = $(PTHREAD_FLAGS) @CUDA_LDFLAGS@ @@ -38,9 +38,13 @@ ccminer_LDFLAGS = $(PTHREAD_FLAGS) @CUDA_LDFLAGS@
ccminer_LDADD = @LIBCURL@ @JANSSON_LIBS@ @PTHREAD_LIBS@ @WS2_LIBS@ @CUDA_LIBS@ @OPENMP_CFLAGS@ @LIBS@ $(nvml_libs)
ccminer_CPPFLAGS = @LIBCURL_CPPFLAGS@ @OPENMP_CFLAGS@ $(CPPFLAGS) $(PTHREAD_FLAGS) -fno-strict-aliasing $(JANSSON_INCLUDES) $(DEF_INCLUDES) $(nvml_defs)
nvcc_ARCH = -gencode=arch=compute_50,code=\"sm_50,compute_50\"
nvcc_ARCH :=
#nvcc_ARCH += -gencode=arch=compute_75,code=\"sm_75,compute_75\" # CUDA 10 req.
#nvcc_ARCH += -gencode=arch=compute_70,code=\"sm_70,compute_70\" # CUDA 9.1
#nvcc_ARCH += -gencode=arch=compute_61,code=\"sm_61,compute_61\" # CUDA 8
#nvcc_ARCH += -gencode=arch=compute_52,code=\"sm_52,compute_52\"
nvcc_ARCH += -gencode=arch=compute_50,code=\"sm_50,compute_50\"
#nvcc_ARCH += -gencode=arch=compute_35,code=\"sm_35,compute_35\"
#nvcc_ARCH += -gencode=arch=compute_30,code=\"sm_30,compute_30\"
#nvcc_ARCH += -gencode=arch=compute_20,code=\"sm_21,compute_20\"

22
README.txt

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
ccminer 2.2.4 (Jan. 2018) "lyra2v2 and keccak improvements"
ccminer 2.3.1 (Jan. 2018) "lyra2v2 and keccak improvements"
---------------------------------------------------------------
***************************************************************
@ -277,6 +277,26 @@ so we can more efficiently implement new algorithms using the latest hardware @@ -277,6 +277,26 @@ so we can more efficiently implement new algorithms using the latest hardware
features.
>>> RELEASE HISTORY <<<
Jan. 30th 2019 v2.3.1
Handle Lyra2v3 algo
Handle sha256q algo
Handle exosis algo
Handle blake2b standard algo
June 23th 2018 v2.3
Handle phi2 header variation for smart contracts
Handle monero, stellite, graft and cryptolight variants
Handle SonoA algo
June 10th 2018 v2.2.6
New phi2 algo for LUX
New allium algo for Garlic
Apr. 02nd 2018 v2.2.5
New x16r algo for Raven
New x16s algo for Pigeon and Eden
New x12 algo for Galaxycash
Equihash (SIMT) sync issues for the Volta generation
Jan. 04th 2017 v2.2.4
Improve lyra2v2
Higher keccak default intensity

4
algos.h

@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
enum sha_algos {
ALGO_GOSTD = 0,
ALGO_GOSTCOIN,
ALGO_AUTO,
ALGO_COUNT
};
@ -14,6 +15,7 @@ extern volatile enum sha_algos opt_algo; @@ -14,6 +15,7 @@ extern volatile enum sha_algos opt_algo;
static const char *algo_names[] = {
"gostd",
"gostcoin",
"auto", /* reserved for multi algo */
""
};
@ -35,6 +37,8 @@ static inline int algo_to_int(char* arg) @@ -35,6 +37,8 @@ static inline int algo_to_int(char* arg)
i = ALGO_AUTO;
else if (!strcasecmp("gost", arg))
i = ALGO_GOSTD;
else if (!strcasecmp("gostcoin", arg))
i = ALGO_GOSTCOIN;
else
i = -1;
}

7
api.cpp

@ -250,7 +250,7 @@ static char *getpoolnfo(char *params) @@ -250,7 +250,7 @@ static char *getpoolnfo(char *params)
static void gpuhwinfos(int gpu_id)
{
char buf[256];
char buf[512];
char pstate[8];
char* card;
struct cgpu_info *cgpu = NULL;
@ -1245,7 +1245,7 @@ static void api() @@ -1245,7 +1245,7 @@ static void api()
char *wskey = NULL;
n = recv(c, &buf[0], SOCK_REC_BUFSZ, 0);
fail = SOCKETFAIL(n);
fail = SOCKETFAIL(n) || n < 0;
if (fail)
buf[0] = '\0';
else if (n > 0 && buf[n-1] == '\n') {
@ -1254,7 +1254,8 @@ static void api() @@ -1254,7 +1254,8 @@ static void api()
if (n > 0 && buf[n-1] == '\r')
buf[n-1] = '\0';
}
buf[n] = '\0';
else
buf[n] = '\0';
//if (opt_debug && opt_protocol && n > 0)
// applog(LOG_DEBUG, "API: recv command: (%d) '%s'+char(%x)", n, buf, buf[n-1]);

24
ccminer.cpp

@ -231,7 +231,8 @@ static char const usage[] = "\ @@ -231,7 +231,8 @@ static char const usage[] = "\
Usage: " PROGRAM_NAME " [OPTIONS]\n\
Options:\n\
-a, --algo=ALGO specify the hash algorithm to use\n\
gostd GOSTcoin\n\
gostd Double GOST R 34.11\n\
gostcoin GOSTcoin\n\
-d, --devices Comma separated list of CUDA devices to use.\n\
Device IDs start counting from 0! Alternatively takes\n\
string names of your cards like gtx780ti or gt640#2\n\
@ -1297,13 +1298,23 @@ static bool stratum_gen_work(struct stratum_ctx *sctx, struct work *work) @@ -1297,13 +1298,23 @@ static bool stratum_gen_work(struct stratum_ctx *sctx, struct work *work)
work->pooln = sctx->pooln;
/* Generate merkle root */
gostd(merkle_root, sctx->job.coinbase, (int)sctx->job.coinbase_size);
switch (opt_algo) {
case ALGO_GOSTCOIN:
gostd(merkle_root, sctx->job.coinbase, (int)sctx->job.coinbase_size);
break;
default:
sha256d(merkle_root, sctx->job.coinbase, (int)sctx->job.coinbase_size);
}
for (i = 0; i < sctx->job.merkle_count; i++) {
memcpy(merkle_root + 32, sctx->job.merkle[i], 32);
//GOSTCoin
memcpy(merkle_root + 32, merkle_root, 32);
gostd(merkle_root, merkle_root, 64);
if (opt_algo == ALGO_GOSTCOIN)
{
memcpy(merkle_root + 32, merkle_root, 32);
gostd(merkle_root, merkle_root, 64);
} else
sha256d(merkle_root, merkle_root, 64);
}
/* Increment extranonce2 */
@ -1736,7 +1747,7 @@ static void *miner_thread(void *userdata) @@ -1736,7 +1747,7 @@ static void *miner_thread(void *userdata)
max64 *= (uint32_t)thr_hashrates[thr_id];
/* on start, max64 should not be 0,
* before hashrate is computed */
* before hashrate is computed */
if (max64 < minmax) {
minmax = 0x400000;
max64 = max(minmax-1, max64);
@ -2344,6 +2355,7 @@ void parse_arg(int key, char *arg) @@ -2344,6 +2355,7 @@ void parse_arg(int key, char *arg)
if (v < 1 || v > 65535) // sanity check
show_usage_and_exit(1);
opt_api_mcast_port = v;
break;
case 'B':
opt_background = true;
break;

2
compat/ccminer-config.h

@ -164,7 +164,7 @@ @@ -164,7 +164,7 @@
#define PACKAGE_URL "https://github.com/GOSTSec/ccminer-gostd-lite"
/* Define to the version of this package. */
#define PACKAGE_VERSION "2.2.4-gostd-lite"
#define PACKAGE_VERSION "2.3.1-gostd-lite"
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be

2
configure.ac

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
AC_INIT([ccminer], [2.2.4-gostd-lite], [], [ccminer], [https://github.com/GOSTSec/ccminer-gostd-lite])
AC_INIT([ccminer], [2.3.1-gostd-lite], [], [ccminer], [https://github.com/GOSTSec/ccminer-gostd-lite])
AC_PREREQ([2.59c])
AC_CANONICAL_SYSTEM

2
miner.h

@ -542,7 +542,7 @@ struct stratum_job { @@ -542,7 +542,7 @@ struct stratum_job {
unsigned char version[4];
unsigned char nbits[4];
unsigned char ntime[4];
unsigned char claim[32]; // lbry
unsigned char extra[64];
bool clean;
unsigned char nreward[2];
uint32_t height;

16
res/ccminer.rc

@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Anglais (États-Unis) resources
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
@ -60,8 +60,8 @@ IDI_ICON1 ICON "ccminer.ico" @@ -60,8 +60,8 @@ IDI_ICON1 ICON "ccminer.ico"
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,2,4,0
PRODUCTVERSION 2,2,4,0
FILEVERSION 2,3,1,0
PRODUCTVERSION 2,3,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x21L
@ -76,10 +76,10 @@ BEGIN @@ -76,10 +76,10 @@ BEGIN
BEGIN
BLOCK "040904e4"
BEGIN
VALUE "FileVersion", "2.2.4"
VALUE "LegalCopyright", "Copyright (C) 2018"
VALUE "ProductName", "ccminer"
VALUE "ProductVersion", "2.2.4"
VALUE "FileVersion", "2.3.1"
VALUE "LegalCopyright", "Copyright (C) 2019"
VALUE "ProductName", "ccminer-gostd-lite"
VALUE "ProductVersion", "2.3.1"
END
END
BLOCK "VarFileInfo"
@ -88,7 +88,7 @@ BEGIN @@ -88,7 +88,7 @@ BEGIN
END
END
#endif // Anglais (États-Unis) resources
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////

33
util.cpp

@ -614,7 +614,7 @@ err_out: @@ -614,7 +614,7 @@ err_out:
json_t *json_rpc_call_pool(CURL *curl, struct pool_infos *pool, const char *req,
bool longpoll_scan, bool longpoll, int *curl_err)
{
char userpass[512];
char userpass[768];
// todo, malloc and store that in pool array
snprintf(userpass, sizeof(userpass), "%s%c%s", pool->user,
strlen(pool->pass)?':':'\0', pool->pass);
@ -625,7 +625,7 @@ json_t *json_rpc_call_pool(CURL *curl, struct pool_infos *pool, const char *req, @@ -625,7 +625,7 @@ json_t *json_rpc_call_pool(CURL *curl, struct pool_infos *pool, const char *req,
/* called only from longpoll thread, we have the lp_url */
json_t *json_rpc_longpoll(CURL *curl, char *lp_url, struct pool_infos *pool, const char *req, int *curl_err)
{
char userpass[512];
char userpass[768];
snprintf(userpass, sizeof(userpass), "%s%c%s", pool->user,
strlen(pool->pass)?':':'\0', pool->pass);
@ -1346,8 +1346,12 @@ bool stratum_authorize(struct stratum_ctx *sctx, const char *user, const char *p @@ -1346,8 +1346,12 @@ bool stratum_authorize(struct stratum_ctx *sctx, const char *user, const char *p
err_val = json_object_get(val, "error");
if (!res_val || json_is_false(res_val) ||
(err_val && !json_is_null(err_val))) {
applog(LOG_ERR, "Stratum authentication failed");
(err_val && !json_is_null(err_val))) {
if (err_val && json_is_array(err_val)) {
const char* reason = json_string_value(json_array_get(err_val, 1));
applog(LOG_ERR, "Stratum authentication failed (%s)", reason);
}
else applog(LOG_ERR, "Stratum authentication failed");
goto out;
}
@ -1431,7 +1435,7 @@ static uint32_t getblocheight(struct stratum_ctx *sctx) @@ -1431,7 +1435,7 @@ static uint32_t getblocheight(struct stratum_ctx *sctx)
static bool stratum_notify(struct stratum_ctx *sctx, json_t *params)
{
const char *job_id, *prevhash, *coinb1, *coinb2, *version, *nbits, *stime;
const char *claim = NULL, *nreward = NULL;
const char *extradata = NULL, *nreward = NULL;
size_t coinb1_size, coinb2_size;
bool clean, ret = false;
int merkle_count, i, p=0;
@ -1439,19 +1443,9 @@ static bool stratum_notify(struct stratum_ctx *sctx, json_t *params) @@ -1439,19 +1443,9 @@ static bool stratum_notify(struct stratum_ctx *sctx, json_t *params)
uchar **merkle = NULL;
// uchar(*merkle_tree)[32] = { 0 };
int ntime;
char algo[64] = { 0 };
get_currentalgo(algo, sizeof(algo));
bool has_claim = !strcasecmp(algo, "lbry");
job_id = json_string_value(json_array_get(params, p++));
prevhash = json_string_value(json_array_get(params, p++));
if (has_claim) {
claim = json_string_value(json_array_get(params, p++));
if (!claim || strlen(claim) != 64) {
applog(LOG_ERR, "Stratum notify: invalid claim parameter");
goto out;
}
}
coinb1 = json_string_value(json_array_get(params, p++));
coinb2 = json_string_value(json_array_get(params, p++));
merkle_arr = json_array_get(params, p++);
@ -1465,8 +1459,8 @@ static bool stratum_notify(struct stratum_ctx *sctx, json_t *params) @@ -1465,8 +1459,8 @@ static bool stratum_notify(struct stratum_ctx *sctx, json_t *params)
nreward = json_string_value(json_array_get(params, p++));
if (!job_id || !prevhash || !coinb1 || !coinb2 || !version || !nbits || !stime ||
strlen(prevhash) != 64 || strlen(version) != 8 ||
strlen(nbits) != 8 || strlen(stime) != 8) {
strlen(prevhash) != 64 || strlen(version) != 8 ||
strlen(nbits) != 8 || strlen(stime) != 8) {
applog(LOG_ERR, "Stratum notify: invalid parameters");
goto out;
}
@ -1500,7 +1494,7 @@ static bool stratum_notify(struct stratum_ctx *sctx, json_t *params) @@ -1500,7 +1494,7 @@ static bool stratum_notify(struct stratum_ctx *sctx, json_t *params)
coinb1_size = strlen(coinb1) / 2;
coinb2_size = strlen(coinb2) / 2;
sctx->job.coinbase_size = coinb1_size + sctx->xnonce1_size +
sctx->xnonce2_size + coinb2_size;
sctx->xnonce2_size + coinb2_size;
sctx->job.coinbase = (uchar*) realloc(sctx->job.coinbase, sctx->job.coinbase_size);
sctx->job.xnonce2 = sctx->job.coinbase + coinb1_size + sctx->xnonce1_size;
@ -1514,7 +1508,6 @@ static bool stratum_notify(struct stratum_ctx *sctx, json_t *params) @@ -1514,7 +1508,6 @@ static bool stratum_notify(struct stratum_ctx *sctx, json_t *params)
free(sctx->job.job_id);
sctx->job.job_id = strdup(job_id);
hex2bin(sctx->job.prevhash, prevhash, 32);
if (has_claim) hex2bin(sctx->job.claim, claim, 32);
sctx->job.height = getblocheight(sctx);
@ -2138,7 +2131,7 @@ void print_hash_tests(void) @@ -2138,7 +2131,7 @@ void print_hash_tests(void)
printf(CL_WHT "CPU HASH ON EMPTY BUFFER RESULTS:" CL_N "\n");
gostd_hash(&hash[0], &buf[0]);
printpfx("gost", hash);
printpfx("gostd", hash);
printf("\n");

Loading…
Cancel
Save