Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesPiechota committed Sep 8, 2024
1 parent a578c24 commit 7781562
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
5 changes: 4 additions & 1 deletion apps/arweave/src/ar_block.erl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-export([block_field_size_limit/1, verify_timestamp/2,
get_max_timestamp_deviation/0, verify_last_retarget/2, verify_weave_size/3,
verify_cumulative_diff/2, verify_block_hash_list_merkle/2, compute_hash_list_merkle/1,
compute_h0/2, compute_h0/6,
compute_h0/2, compute_h0/5, compute_h0/6,
compute_h1/3, compute_h2/3, compute_solution_h/2,
indep_hash/1, indep_hash/2, indep_hash2/2,
generate_signed_hash/1, verify_signature/3,
Expand Down Expand Up @@ -168,6 +168,9 @@ compute_h0(B, PrevB) ->
PrevNonceLimiterInfo = PrevB#block.nonce_limiter_info,
Seed = PrevNonceLimiterInfo#nonce_limiter_info.seed,
NonceLimiterOutput = NonceLimiterInfo#nonce_limiter_info.output,
compute_h0(NonceLimiterOutput, PartitionNumber, Seed, MiningAddr, PackingDifficulty).

compute_h0(NonceLimiterOutput, PartitionNumber, Seed, MiningAddr, PackingDifficulty) ->
compute_h0(NonceLimiterOutput, PartitionNumber, Seed, MiningAddr, PackingDifficulty,
ar_packing_server:get_packing_state()).

Expand Down
20 changes: 11 additions & 9 deletions apps/arweave/src/ar_mine_randomx.erl
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,8 @@ randomx_decrypt_sub_chunk(Packing, RandomxState, Key, Chunk, SubChunkStartOffset

randomx_reencrypt_chunk(SourcePacking, TargetPacking,
RandomxState, UnpackKey, PackKey, Chunk, ChunkSize) ->
case randomx_reencrypt_chunk2(SourcePacking, TargetPacking,
RandomxState, UnpackKey, PackKey, Chunk, ChunkSize) of
{error, Error} ->
{exception, Error};
Reply ->
Reply
end.
randomx_reencrypt_chunk2(SourcePacking, TargetPacking,
RandomxState, UnpackKey, PackKey, Chunk, ChunkSize).

%%%===================================================================
%%% Private functions.
Expand Down Expand Up @@ -319,6 +314,8 @@ randomx_reencrypt_chunk2({composite, Addr1, PackingDifficulty1},
?DATA_CHUNK_SIZE),
{ok, Repacked, Unpadded}
end;
{error, Error} ->
{exception, Error};
Reply ->
Reply
end;
Expand All @@ -329,8 +326,13 @@ randomx_reencrypt_chunk2(SourcePacking, TargetPacking,
{rx512, RandomxState}, UnpackKey, PackKey, Chunk, ChunkSize) ->
UnpackRounds = packing_rounds(SourcePacking),
PackRounds = packing_rounds(TargetPacking),
ar_rx512_nif:rx512_reencrypt_chunk_nif(RandomxState, UnpackKey, PackKey, Chunk, ChunkSize,
UnpackRounds, PackRounds, jit(), large_pages(), hardware_aes());
case ar_rx512_nif:rx512_reencrypt_chunk_nif(RandomxState, UnpackKey, PackKey, Chunk,
ChunkSize, UnpackRounds, PackRounds, jit(), large_pages(), hardware_aes()) of
{error, Error} ->
{exception, Error};
Reply ->
Reply
end;
randomx_reencrypt_chunk2(
_SourcePacking, _TargetPacking, _BadState, _UnpackKey, _PackKey, _Chunk, _ChunkSize) ->
{error, invalid_randomx_mode}.
Expand Down

0 comments on commit 7781562

Please sign in to comment.