diff --git a/src/error.rs b/src/error.rs
index 3e7d3eb6d..01618c66c 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -28,7 +28,7 @@ pub enum ExecutionError {
InvalidNonce { expected: U256, is: U256 },
/// Returned when cost of transaction (value + gas_price * gas) exceeds
/// current sender balance.
- NotEnoughCash { required: U256, is: U256 },
+ NotEnoughCash { required: U512, is: U512 },
/// Returned when internal evm error occurs.
Internal
}
diff --git a/src/executive.rs b/src/executive.rs
index 4e829cdd5..2527209c1 100644
--- a/src/executive.rs
+++ b/src/executive.rs
@@ -123,17 +123,17 @@ impl<'a> Executive<'a> {
// TODO: we might need bigints here, or at least check overflows.
let balance = self.state.balance(&sender);
- let gas_cost = t.gas * t.gas_price;
- let total_cost = t.value + gas_cost;
+ let gas_cost = U512::from(t.gas) * U512::from(t.gas_price);
+ let total_cost = U512::from(t.value) + gas_cost;
// avoid unaffordable transactions
- if balance < total_cost {
- return Err(From::from(ExecutionError::NotEnoughCash { required: total_cost, is: balance }));
+ if U512::from(balance) < total_cost {
+ return Err(From::from(ExecutionError::NotEnoughCash { required: total_cost, is: U512::from(balance) }));
}
// NOTE: there can be no invalid transactions from this point.
self.state.inc_nonce(&sender);
- self.state.sub_balance(&sender, &gas_cost);
+ self.state.sub_balance(&sender, &U256::from(gas_cost));
let mut substate = Substate::new();
let backup = self.state.clone();
diff --git a/src/transaction.rs b/src/transaction.rs
index 661c1355f..35bb0eed2 100644
--- a/src/transaction.rs
+++ b/src/transaction.rs
@@ -23,10 +23,58 @@ pub struct Transaction {
pub r: U256,
pub s: U256,
- hash: RefCell