Skip to content
This repository was archived by the owner on Apr 24, 2022. It is now read-only.

Commit 451fa11

Browse files
committedApr 21, 2018
Update ethash library
1 parent 7a8be35 commit 451fa11

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed
 

‎cmake/ProjectEthash.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ExternalProject_Add(
99
ethash-project
1010
PREFIX ${prefix}
1111
GIT_REPOSITORY https://github.com/chfast/ethash
12-
GIT_TAG 701c4c94fbaf525c4e5e871fe466a90b1aa6228e
12+
GIT_TAG 09b50e66b868b114e89f4b649099edc3b899e91e
1313
CMAKE_ARGS
1414
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
1515
-DETHASH_BUILD_TESTS=OFF

‎libethash-cl/CLMiner.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -588,10 +588,10 @@ bool CLMiner::init(int epoch)
588588
m_globalWorkSize = ((m_globalWorkSize / m_workgroupSize) + 1) * m_workgroupSize;
589589

590590
const auto& context = ethash::managed::get_epoch_context(epoch);
591-
const auto lightNumItems = ethash::get_light_cache_num_items(context);
592-
const auto dagNumItems = ethash::get_full_dataset_num_items(context);
591+
const auto lightNumItems = context.light_cache_num_items;
592+
const auto lightSize = ethash::get_light_cache_size(lightNumItems);
593+
const auto dagNumItems = context.full_dataset_num_items;
593594
const auto dagSize = ethash::get_full_dataset_size(dagNumItems);
594-
const auto lightRef = ethash::managed::get_light_cache_data(epoch);
595595

596596
// patch source code
597597
// note: The kernels here are simply compiled version of the respective .cl kernels
@@ -652,15 +652,15 @@ bool CLMiner::init(int epoch)
652652
// create buffer for dag
653653
try
654654
{
655-
cllog << "Creating light cache buffer, size" << lightRef.size;
656-
m_light = cl::Buffer(m_context, CL_MEM_READ_ONLY, lightRef.size);
655+
cllog << "Creating light cache buffer, size" << lightSize;
656+
m_light = cl::Buffer(m_context, CL_MEM_READ_ONLY, lightSize);
657657
cllog << "Creating DAG buffer, size" << dagSize;
658658
m_dag = cl::Buffer(m_context, CL_MEM_READ_ONLY, dagSize);
659659
cllog << "Loading kernels";
660660
m_searchKernel = cl::Kernel(program, "ethash_search");
661661
m_dagKernel = cl::Kernel(program, "ethash_calculate_dag_item");
662662
cllog << "Writing light cache buffer";
663-
m_queue.enqueueWriteBuffer(m_light, CL_TRUE, 0, lightRef.size, lightRef.data);
663+
m_queue.enqueueWriteBuffer(m_light, CL_TRUE, 0, lightSize, context.light_cache);
664664
}
665665
catch (cl::Error const& err)
666666
{

‎libethcore/EthashAux.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Result EthashAux::LightAllocation::compute(h256 const& _headerHash, uint64_t _no
7171

7272
Result EthashAux::eval(int epoch, h256 const& _headerHash, uint64_t _nonce) noexcept
7373
{
74-
auto headerHash = ethash::hash256::from_bytes(_headerHash.data());
74+
auto headerHash = ethash::hash256_from_bytes(_headerHash.data());
7575
auto result = ethash::managed::hash(epoch, headerHash, _nonce);
7676
h256 mix{reinterpret_cast<byte*>(result.mix_hash.bytes), h256::ConstructFromPointer};
7777
h256 final{reinterpret_cast<byte*>(result.final_hash.bytes), h256::ConstructFromPointer};

‎libpoolprotocols/getwork/EthGetworkClient.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void EthGetworkClient::workLoop()
101101
WorkPackage newWorkPackage;
102102
newWorkPackage.header = h256(v[0].asString());
103103
newWorkPackage.epoch = ethash::find_epoch_number(
104-
ethash::hash256::from_bytes(h256{v[1].asString()}.data()));
104+
ethash::hash256_from_bytes(h256{v[1].asString()}.data()));
105105

106106
// Since we do not have a real connected state with getwork, we just fake it.
107107
// If getting work succeeds we know that the connection works

‎libpoolprotocols/stratum/EthStratumClient.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ void EthStratumClient::processReponse(Json::Value& responseObject)
509509
reset_work_timeout();
510510

511511
m_current.epoch = ethash::find_epoch_number(
512-
ethash::hash256::from_bytes(h256{sSeedHash}.data()));
512+
ethash::hash256_from_bytes(h256{sSeedHash}.data()));
513513
m_current.header = h256(sHeaderHash);
514514
m_current.boundary = h256();
515515
diffToTarget((uint32_t*)m_current.boundary.data(), m_nextWorkDifficulty);
@@ -547,7 +547,7 @@ void EthStratumClient::processReponse(Json::Value& responseObject)
547547

548548
m_current.header = h256(sHeaderHash);
549549
m_current.epoch = ethash::find_epoch_number(
550-
ethash::hash256::from_bytes(h256{sSeedHash}.data()));
550+
ethash::hash256_from_bytes(h256{sSeedHash}.data()));
551551
m_current.boundary = h256(sShareTarget);
552552
m_current.job = h256(job);
553553

0 commit comments

Comments
 (0)
This repository has been archived.