Skip to content
This repository has been archived by the owner on Feb 14, 2021. It is now read-only.

Use uint instead bigint #52

Merged
merged 3 commits into from
Aug 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified compiled/creator.wasm
Binary file not shown.
Binary file modified compiled/events.wasm
Binary file not shown.
Binary file modified compiled/keccak.wasm
Binary file not shown.
Binary file modified compiled/math.wasm
Binary file not shown.
Binary file modified compiled/setter.wasm
Binary file not shown.
8 changes: 4 additions & 4 deletions gen/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use std::path::PathBuf;
fn main() {
let args = env::args().collect::<Vec<_>>();
let (file_name, pwasm_ethereum_version) = match args.len() {
2 => (&args[1], r#""0.6.1""#.to_string()),
3 => (&args[1], format!(r#"{{ git = "https://github.com/paritytech/pwasm-ethereum", features = [{}] }}"#, args[2].split(",").map(|s| format!(r#""{}""#, s)).collect::<Vec<_>>().join(", "))),
2 => (&args[1], r#""0.6.3""#.to_string()),
3 => (&args[1], format!(r#"{{ version = "0.6.3", features = [{}] }}"#, args[2].split(",").map(|s| format!(r#""{}""#, s)).collect::<Vec<_>>().join(", "))),
_ => {
println!("Usage: {} gen <test.rs>", args[0]);
return;
Expand All @@ -21,8 +21,8 @@ authors = ["NikVolf <nikvolf@gmail.com>"]
[dependencies]
pwasm-std = "0.10.0"
pwasm-ethereum = {}
bigint = {{ version = "4", default-features = false }}
parity-hash = {{ version = "1", default-features = false }}
uint = {{ version = "0.3", default-features = false }}
parity-hash = {{ version = "1.2.2", default-features = false }}

[lib]
name = "$file_name"
Expand Down
6 changes: 4 additions & 2 deletions src/creator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

extern crate pwasm_std;
extern crate pwasm_ethereum;
extern crate bigint;
extern crate uint;

extern crate parity_hash as hash;

use pwasm_std::logger;
use pwasm_ethereum::{input, ret, create, create2, value};
use bigint::U256;

use uint::U256;
use hash::H256;

#[no_mangle]
Expand Down
4 changes: 2 additions & 2 deletions src/externs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

extern crate pwasm_std;
extern crate pwasm_ethereum;
extern crate bigint;
extern crate uint;

use pwasm_std::{Vec, write_u64};
use pwasm_ethereum::{self as ext};
use bigint::U256;
use uint::U256;

fn push_u64(buf: &mut Vec<u8>, val: u64) {
let mut slc = [0u8; 8];
Expand Down
4 changes: 2 additions & 2 deletions src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

extern crate pwasm_std;
extern crate pwasm_ethereum as ext;
extern crate bigint;
extern crate uint;

use pwasm_std::write_u32;
use pwasm_std::hash::H256;
use bigint::U256;
use uint::U256;

fn set_key_from_addr(key: u32, val: &[u8]) {
let mut full_key = [0u8; 32];
Expand Down
8 changes: 5 additions & 3 deletions src/math.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#![no_std]

extern crate bigint;
extern crate uint;

extern crate pwasm_ethereum;

use pwasm_ethereum::{ret, input};
use uint::U256;

#[no_mangle]
pub fn call() {
Expand All @@ -12,8 +14,8 @@ pub fn call() {
ret(&{
let code = input[0];

let a_param: bigint::U256 = (&input[1..33]).into();
let b_param: bigint::U256 = (&input[33..65]).into();
let a_param: U256 = (&input[1..33]).into();
let b_param: U256 = (&input[33..65]).into();

let result = match code {
0 => { a_param + b_param },
Expand Down