SChernykh / p2pool

Decentralized pool for Monero mining
GNU General Public License v3.0
1.08k stars 128 forks source link

Accepts works with entropy source. #105

Closed AnFunctionArray closed 2 years ago

AnFunctionArray commented 2 years ago

So I wanted to implement some randomness into the standard randomx algo and was surprised to find that I was able to skip the whole algo with some incredible hash speeds.

it's something like (in xmrig randomx.cpp):

    void randomx_calculate_hash_next(randomx_vm* machine, uint64_t (&tempHash)[8], const void* nextInput, size_t nextInputSize, void* output) {
        PROFILE_SCOPE(RandomX_hash);

        /*machine->resetRoundingMode();
        for (uint32_t chain = 0; chain < RandomX_CurrentConfig.ProgramCount - 1; ++chain) {
            machine->run(&tempHash);
            rx_blake2b_wrapper::run(tempHash, sizeof(tempHash), machine->getRegisterFile(), sizeof(randomx::RegisterFile));
        }
        machine->run(&tempHash);*/

        getentropy(tempHash, sizeof tempHash);

        // Finish current hash and fill the scratchpad for the next hash at the same time
        // rx_blake2b_wrapper::run(tempHash, sizeof(tempHash), nextInput, nextInputSize);
        machine->hashAndFill(output, tempHash);
    }

But if i connect to minexmr.com it says invalid share straight up.

Don't know if this exploit.

SChernykh commented 2 years ago

it says invalid share straight up Well, of course. It's not an exploit.

AnFunctionArray commented 2 years ago

That would be on minexmr - on p2pool it accepts it. But whatever not my issue - just reporting.

SChernykh commented 2 years ago

It accepts it because it uses the exact same code to check this "share". But other p2pool nodes will reject your shares and ban your node.