Skip to content

Commit

Permalink
Release 0.1.1
Browse files Browse the repository at this point in the history
- Remove rust warnings
  • Loading branch information
jhelison authored Nov 29, 2022
2 parents a852669 + 8668f8a commit 2d42b56
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 7 deletions.
23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

# How Has This Been Tested?

Please describe the tests that you ran to verify your changes

- [ ] Test A
- [ ] Test B

# Relevant notes

Notes about your pull request that may be useful for the reviewer
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "randomx"
version = "0.1.1"
authors = ["Aron <a@a.com>"]
authors = ["Brick Abode <epiccash@brickabode.com>"]
build = "build.rs"

[dependencies]
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Randomx - Rust

RandomX is a proof-of-work (PoW) algorithm that is optimized for general-purpose CPUs. RandomX uses random code execution (hence the name) together with several memory-hard techniques to minimize the efficiency advantage of specialized hardware.

This is a rust build of the current Randomx algorithm

## Build steps

To build the project execute the following line in the terminal:

```sh
cargo build
```

## What was built

The rust library of the RandomX algorithm
6 changes: 3 additions & 3 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl RxState {
}

let flags = self.get_flags();
let mut cache_ptr = unsafe { randomx_alloc_cache(flags) };
let cache_ptr = unsafe { randomx_alloc_cache(flags) };

if cache_ptr.is_null() {
return Err("cache not allocated");
Expand All @@ -166,7 +166,7 @@ impl RxState {

//let mut dataset_ptr =
// unsafe { randomx_alloc_dataset(randomx_flags_RANDOMX_FLAG_LARGE_PAGES) };
let mut dataset_ptr = unsafe { randomx_alloc_dataset(self.get_flags()) };
let dataset_ptr = unsafe { randomx_alloc_dataset(self.get_flags()) };

/*if dataset_ptr.is_null() {
dataset_ptr = unsafe { randomx_alloc_dataset(self.get_flags()) };
Expand Down Expand Up @@ -255,7 +255,7 @@ impl RxState {

pub fn update_vms(&mut self) {
for vm in &self.vms {
let mut vm_lock = vm.write().unwrap();
let vm_lock = vm.write().unwrap();
unsafe {
self.cache
.as_ref()
Expand Down
6 changes: 3 additions & 3 deletions src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use bigint::uint::U256;
use std::mem::transmute;

pub fn from_u32_to_U256(v: &[u32; 8]) -> U256 {
pub fn from_u32_to_u256(v: &[u32; 8]) -> U256 {
let vu64: [u64; 4] = unsafe { transmute(*v) };

U256(vu64)
Expand All @@ -13,7 +13,7 @@ mod test {
#[test]
fn test_u32_to_u256() {
let v = [1; 8];
let result = crate::utils::from_u32_to_U256(&v);
let result = crate::utils::from_u32_to_u256(&v);
let expected: U256 = (0..8).fold(U256::from(0), |acc, i| {
acc + U256::from(2).pow(U256::from(i * 32))
});
Expand All @@ -25,7 +25,7 @@ mod test {
fn test_u32_to_u256_simple() {
let mut v = [0; 8];
v[0] = 1;
let result = crate::utils::from_u32_to_U256(&v);
let result = crate::utils::from_u32_to_u256(&v);
let expected = U256::from(1);
assert_eq!(expected, result);
}
Expand Down

0 comments on commit 2d42b56

Please sign in to comment.