forked from mersinvald/bn
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request zcash-hackworks#14 from sorpaas/master
0x50 to 0x5f, 0x80 to 0x9f opcode and a simple Account implementation
- Loading branch information
Showing
11 changed files
with
265 additions
and
111 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,5 @@ path = "./src/bin/gaslighter/mod.rs" | |
clap = "2.22" | ||
log = "0.3" | ||
capnp = "0.8" | ||
ring = "^0.6.0" | ||
merkle = "1.1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use utils::u256::U256; | ||
use ring::digest::{Algorithm, Context, SHA256}; | ||
use merkle::{MerkleTree}; | ||
|
||
pub struct Account { | ||
nonce: usize, | ||
balance: U256, | ||
pub storageRoot: MerkleTree<U256>, | ||
codeHash: U256, | ||
} | ||
|
||
static digest: &'static Algorithm = &SHA256; | ||
|
||
impl Default for Account { | ||
fn default() -> Account { | ||
Account { | ||
nonce: 0, | ||
balance: 0.into(), | ||
storageRoot: MerkleTree::from_vec(digest, Vec::new()), | ||
codeHash: 0.into() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
#[macro_use] | ||
extern crate log; | ||
extern crate ring; | ||
extern crate merkle; | ||
|
||
pub mod vm; | ||
pub mod account; | ||
mod utils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.