diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..85f8a7a --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -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 \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index d925cfd..886c0f3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "randomx" version = "0.1.1" -authors = ["Aron "] +authors = ["Brick Abode "] build = "build.rs" [dependencies] diff --git a/README.md b/README.md new file mode 100644 index 0000000..2e5c2c4 --- /dev/null +++ b/README.md @@ -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 \ No newline at end of file diff --git a/src/types.rs b/src/types.rs index ae6483d..a5aed8c 100644 --- a/src/types.rs +++ b/src/types.rs @@ -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"); @@ -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()) }; @@ -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() diff --git a/src/utils.rs b/src/utils.rs index e899bd1..8487e82 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -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) @@ -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)) }); @@ -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); }