Skip to content

Commit 602b8f9

Browse files
authored
precompiles: Fix unused input hash in bn254 (#917)
The first 32 bytes of inputs to bn254's ecadd and ecmul precompiles are stored in a hash256 object but never used. This fixes a copy&paste typo.
1 parent cc19e6e commit 602b8f9

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

test/state/precompiles.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,6 @@ ExecutionResult ecadd_execute(const uint8_t* input, size_t input_size, uint8_t*
202202
if (input_size != 0)
203203
std::memcpy(input_buffer, input, std::min(input_size, std::size(input_buffer)));
204204

205-
ethash::hash256 h{};
206-
std::memcpy(h.bytes, input_buffer, sizeof(h));
207-
208205
const evmmax::bn254::Point p = {intx::be::unsafe::load<intx::uint256>(input_buffer),
209206
intx::be::unsafe::load<intx::uint256>(input_buffer + 32)};
210207
const evmmax::bn254::Point q = {intx::be::unsafe::load<intx::uint256>(input_buffer + 64),
@@ -230,9 +227,6 @@ ExecutionResult ecmul_execute(const uint8_t* input, size_t input_size, uint8_t*
230227
if (input_size != 0)
231228
std::memcpy(input_buffer, input, std::min(input_size, std::size(input_buffer)));
232229

233-
ethash::hash256 h{};
234-
std::memcpy(h.bytes, input_buffer, sizeof(h));
235-
236230
const evmmax::bn254::Point p = {intx::be::unsafe::load<intx::uint256>(input_buffer),
237231
intx::be::unsafe::load<intx::uint256>(input_buffer + 32)};
238232
const auto c = intx::be::unsafe::load<intx::uint256>(input_buffer + 64);

0 commit comments

Comments
 (0)