commit
2c2e8ef154
@ -137,6 +137,7 @@ impl InstructionInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
/// Return details about specific instruction
|
/// Return details about specific instruction
|
||||||
pub fn get_info (instruction: Instruction) -> InstructionInfo {
|
pub fn get_info (instruction: Instruction) -> InstructionInfo {
|
||||||
match instruction {
|
match instruction {
|
||||||
@ -301,7 +302,7 @@ pub const EXP: Instruction = 0x0a;
|
|||||||
pub const SIGNEXTEND: Instruction = 0x0b;
|
pub const SIGNEXTEND: Instruction = 0x0b;
|
||||||
|
|
||||||
/// less-than comparision
|
/// less-than comparision
|
||||||
pub const LT: Instruction = 0x10;
|
pub const LT: Instruction = 0x10;
|
||||||
/// greater-than comparision
|
/// greater-than comparision
|
||||||
pub const GT: Instruction = 0x11;
|
pub const GT: Instruction = 0x11;
|
||||||
/// signed less-than comparision
|
/// signed less-than comparision
|
||||||
@ -324,10 +325,10 @@ pub const NOT: Instruction = 0x19;
|
|||||||
pub const BYTE: Instruction = 0x1a;
|
pub const BYTE: Instruction = 0x1a;
|
||||||
|
|
||||||
/// compute SHA3-256 hash
|
/// compute SHA3-256 hash
|
||||||
pub const SHA3: Instruction = 0x20;
|
pub const SHA3: Instruction = 0x20;
|
||||||
|
|
||||||
/// get address of currently executing account
|
/// get address of currently executing account
|
||||||
pub const ADDRESS: Instruction = 0x30;
|
pub const ADDRESS: Instruction = 0x30;
|
||||||
/// get balance of the given account
|
/// get balance of the given account
|
||||||
pub const BALANCE: Instruction = 0x31;
|
pub const BALANCE: Instruction = 0x31;
|
||||||
/// get execution origination address
|
/// get execution origination address
|
||||||
@ -367,7 +368,7 @@ pub const DIFFICULTY: Instruction = 0x44;
|
|||||||
pub const GASLIMIT: Instruction = 0x45;
|
pub const GASLIMIT: Instruction = 0x45;
|
||||||
|
|
||||||
/// remove item from stack
|
/// remove item from stack
|
||||||
pub const POP: Instruction = 0x50;
|
pub const POP: Instruction = 0x50;
|
||||||
/// load word from memory
|
/// load word from memory
|
||||||
pub const MLOAD: Instruction = 0x51;
|
pub const MLOAD: Instruction = 0x51;
|
||||||
/// save word to memory
|
/// save word to memory
|
||||||
@ -392,7 +393,7 @@ pub const GAS: Instruction = 0x5a;
|
|||||||
pub const JUMPDEST: Instruction = 0x5b;
|
pub const JUMPDEST: Instruction = 0x5b;
|
||||||
|
|
||||||
/// place 1 byte item on stack
|
/// place 1 byte item on stack
|
||||||
pub const PUSH1: Instruction = 0x60;
|
pub const PUSH1: Instruction = 0x60;
|
||||||
/// place 2 byte item on stack
|
/// place 2 byte item on stack
|
||||||
pub const PUSH2: Instruction = 0x61;
|
pub const PUSH2: Instruction = 0x61;
|
||||||
/// place 3 byte item on stack
|
/// place 3 byte item on stack
|
||||||
@ -457,7 +458,7 @@ pub const PUSH31: Instruction = 0x7e;
|
|||||||
pub const PUSH32: Instruction = 0x7f;
|
pub const PUSH32: Instruction = 0x7f;
|
||||||
|
|
||||||
/// copies the highest item in the stack to the top of the stack
|
/// copies the highest item in the stack to the top of the stack
|
||||||
pub const DUP1: Instruction = 0x80;
|
pub const DUP1: Instruction = 0x80;
|
||||||
/// copies the second highest item in the stack to the top of the stack
|
/// copies the second highest item in the stack to the top of the stack
|
||||||
pub const DUP2: Instruction = 0x81;
|
pub const DUP2: Instruction = 0x81;
|
||||||
/// copies the third highest item in the stack to the top of the stack
|
/// copies the third highest item in the stack to the top of the stack
|
||||||
@ -490,7 +491,7 @@ pub const DUP15: Instruction = 0x8e;
|
|||||||
pub const DUP16: Instruction = 0x8f;
|
pub const DUP16: Instruction = 0x8f;
|
||||||
|
|
||||||
/// swaps the highest and second highest value on the stack
|
/// swaps the highest and second highest value on the stack
|
||||||
pub const SWAP1: Instruction = 0x90;
|
pub const SWAP1: Instruction = 0x90;
|
||||||
/// swaps the highest and third highest value on the stack
|
/// swaps the highest and third highest value on the stack
|
||||||
pub const SWAP2: Instruction = 0x91;
|
pub const SWAP2: Instruction = 0x91;
|
||||||
/// swaps the highest and 4th highest value on the stack
|
/// swaps the highest and 4th highest value on the stack
|
||||||
@ -523,7 +524,7 @@ pub const SWAP15: Instruction = 0x9e;
|
|||||||
pub const SWAP16: Instruction = 0x9f;
|
pub const SWAP16: Instruction = 0x9f;
|
||||||
|
|
||||||
/// Makes a log entry; no topics.
|
/// Makes a log entry; no topics.
|
||||||
pub const LOG0: Instruction = 0xa0;
|
pub const LOG0: Instruction = 0xa0;
|
||||||
/// Makes a log entry; 1 topic.
|
/// Makes a log entry; 1 topic.
|
||||||
pub const LOG1: Instruction = 0xa1;
|
pub const LOG1: Instruction = 0xa1;
|
||||||
/// Makes a log entry; 2 topics.
|
/// Makes a log entry; 2 topics.
|
||||||
@ -536,7 +537,7 @@ pub const LOG4: Instruction = 0xa4;
|
|||||||
pub const MAX_NO_OF_TOPICS : usize = 4;
|
pub const MAX_NO_OF_TOPICS : usize = 4;
|
||||||
|
|
||||||
/// create a new account with associated code
|
/// create a new account with associated code
|
||||||
pub const CREATE: Instruction = 0xf0;
|
pub const CREATE: Instruction = 0xf0;
|
||||||
/// message-call into an account
|
/// message-call into an account
|
||||||
pub const CALL: Instruction = 0xf1;
|
pub const CALL: Instruction = 0xf1;
|
||||||
/// message-call with another account's code only
|
/// message-call with another account's code only
|
||||||
@ -546,5 +547,5 @@ pub const RETURN: Instruction = 0xf3;
|
|||||||
/// like CALLCODE but keeps caller's value and sender
|
/// like CALLCODE but keeps caller's value and sender
|
||||||
pub const DELEGATECALL: Instruction = 0xf4;
|
pub const DELEGATECALL: Instruction = 0xf4;
|
||||||
/// halt execution and register account for later deletion
|
/// halt execution and register account for later deletion
|
||||||
pub const SUICIDE: Instruction = 0xff;
|
pub const SUICIDE: Instruction = 0xff;
|
||||||
|
|
||||||
|
14
fmt.sh
Executable file
14
fmt.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
RUSTFMT="rustfmt --write-mode overwrite"
|
||||||
|
|
||||||
|
$RUSTFMT ./ethash/src/lib.rs
|
||||||
|
$RUSTFMT ./ethcore/src/lib.rs
|
||||||
|
$RUSTFMT ./evmjit/src/lib.rs
|
||||||
|
$RUSTFMT ./json/src/lib.rs
|
||||||
|
$RUSTFMT ./miner/src/lib.rs
|
||||||
|
$RUSTFMT ./parity/main.rs
|
||||||
|
$RUSTFMT ./rpc/src/lib.rs
|
||||||
|
$RUSTFMT ./sync/src/lib.rs
|
||||||
|
$RUSTFMT ./util/src/lib.rs
|
||||||
|
|
14
rustfmt.toml
Normal file
14
rustfmt.toml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
verbose=false
|
||||||
|
max_width=150
|
||||||
|
ideal_width=120
|
||||||
|
tabs_spaces=4
|
||||||
|
fn_call_width=100
|
||||||
|
single_line_if_else=true
|
||||||
|
where_indent="Visual"
|
||||||
|
where_trailing_comma=true
|
||||||
|
chain_base_indent="Inherit"
|
||||||
|
chain_indent="Tabbed"
|
||||||
|
reorder_imports=true
|
||||||
|
format_strings=false
|
||||||
|
hard_tabs=true
|
||||||
|
wrap_match_arms=false
|
@ -1 +0,0 @@
|
|||||||
hard_tabs = true
|
|
@ -208,7 +208,7 @@ pub mod ec {
|
|||||||
match context.verify(&try!(Message::from_slice(&message)), &sig, &publ) {
|
match context.verify(&try!(Message::from_slice(&message)), &sig, &publ) {
|
||||||
Ok(_) => Ok(true),
|
Ok(_) => Ok(true),
|
||||||
Err(Error::IncorrectSignature) => Ok(false),
|
Err(Error::IncorrectSignature) => Ok(false),
|
||||||
Err(x) => Err(<CryptoError as From<Error>>::from(x))
|
Err(x) => Err(CryptoError::from(x))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ impl<'a, 'view> Iterator for RlpIterator<'a, 'view> {
|
|||||||
|
|
||||||
fn next(&mut self) -> Option<Rlp<'a>> {
|
fn next(&mut self) -> Option<Rlp<'a>> {
|
||||||
let index = self.index;
|
let index = self.index;
|
||||||
let result = self.rlp.rlp.at(index).ok().map(| iter | { From::from(iter) });
|
let result = self.rlp.rlp.at(index).ok().map(From::from);
|
||||||
self.index += 1;
|
self.index += 1;
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user