Removed DAO soft fork traces (#1639)
This commit is contained in:
parent
d8472a8031
commit
5dba43178b
@ -59,8 +59,6 @@ pub enum TransactionError {
|
|||||||
},
|
},
|
||||||
/// Transaction's gas limit (aka gas) is invalid.
|
/// Transaction's gas limit (aka gas) is invalid.
|
||||||
InvalidGasLimit(OutOfBounds<U256>),
|
InvalidGasLimit(OutOfBounds<U256>),
|
||||||
/// Transaction is invalid for some other reason.
|
|
||||||
DAORescue,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for TransactionError {
|
impl fmt::Display for TransactionError {
|
||||||
@ -79,7 +77,6 @@ impl fmt::Display for TransactionError {
|
|||||||
GasLimitExceeded { limit, got } =>
|
GasLimitExceeded { limit, got } =>
|
||||||
format!("Gas limit exceeded. Limit={}, Given={}", limit, got),
|
format!("Gas limit exceeded. Limit={}, Given={}", limit, got),
|
||||||
InvalidGasLimit(ref err) => format!("Invalid gas limit. {}", err),
|
InvalidGasLimit(ref err) => format!("Invalid gas limit. {}", err),
|
||||||
DAORescue => "Transaction is invalid due to the DAO rescue.".into(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
f.write_fmt(format_args!("Transaction error ({})", msg))
|
f.write_fmt(format_args!("Transaction error ({})", msg))
|
||||||
|
@ -80,8 +80,6 @@ pub struct Schedule {
|
|||||||
pub tx_data_non_zero_gas: usize,
|
pub tx_data_non_zero_gas: usize,
|
||||||
/// Gas price for copying memory
|
/// Gas price for copying memory
|
||||||
pub copy_gas: usize,
|
pub copy_gas: usize,
|
||||||
/// DAO Rescue softfork block
|
|
||||||
pub reject_dao_transactions: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Schedule {
|
impl Schedule {
|
||||||
@ -128,7 +126,6 @@ impl Schedule {
|
|||||||
tx_data_zero_gas: 4,
|
tx_data_zero_gas: 4,
|
||||||
tx_data_non_zero_gas: 68,
|
tx_data_non_zero_gas: 68,
|
||||||
copy_gas: 3,
|
copy_gas: 3,
|
||||||
reject_dao_transactions: false,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,33 +232,6 @@ impl State {
|
|||||||
let options = TransactOptions { tracing: tracing, vm_tracing: false, check_nonce: true };
|
let options = TransactOptions { tracing: tracing, vm_tracing: false, check_nonce: true };
|
||||||
let e = try!(Executive::new(self, env_info, engine, vm_factory).transact(t, options));
|
let e = try!(Executive::new(self, env_info, engine, vm_factory).transact(t, options));
|
||||||
|
|
||||||
let broken_dao = H256::from("6a5d24750f78441e56fec050dc52fe8e911976485b7472faac7464a176a67caa");
|
|
||||||
|
|
||||||
// dao attack soft fork
|
|
||||||
if engine.schedule(&env_info).reject_dao_transactions {
|
|
||||||
let whitelisted = if let Action::Call(to) = t.action {
|
|
||||||
to == Address::from("Da4a4626d3E16e094De3225A751aAb7128e96526") ||
|
|
||||||
to == Address::from("2ba9D006C1D72E67A70b5526Fc6b4b0C0fd6D334")
|
|
||||||
} else { false };
|
|
||||||
if !whitelisted {
|
|
||||||
// collect all the addresses which have changed.
|
|
||||||
let addresses = self.cache.borrow().iter().map(|(addr, _)| addr.clone()).collect::<Vec<_>>();
|
|
||||||
|
|
||||||
for a in &addresses {
|
|
||||||
if self.code(a).map_or(false, |c| c.sha3() == broken_dao) {
|
|
||||||
// Figure out if the balance has been reduced.
|
|
||||||
let maybe_original = self.trie_factory
|
|
||||||
.readonly(self.db.as_hashdb(), &self.root)
|
|
||||||
.expect(SEC_TRIE_DB_UNWRAP_STR)
|
|
||||||
.get(&a).map(Account::from_rlp);
|
|
||||||
if maybe_original.map_or(false, |original| *original.balance() > self.balance(a)) {
|
|
||||||
return Err(Error::Transaction(TransactionError::DAORescue));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO uncomment once to_pod() works correctly.
|
// TODO uncomment once to_pod() works correctly.
|
||||||
// trace!("Applied transaction. Diff:\n{}\n", state_diff::diff_pod(&old, &self.to_pod()));
|
// trace!("Applied transaction. Diff:\n{}\n", state_diff::diff_pod(&old, &self.to_pod()));
|
||||||
self.commit();
|
self.commit();
|
||||||
|
@ -170,7 +170,6 @@ fn transaction_error(error: EthcoreError) -> Error {
|
|||||||
format!("Transaction cost exceeds current gas limit. Limit: {}, got: {}. Try decreasing supplied gas.", limit, got)
|
format!("Transaction cost exceeds current gas limit. Limit: {}, got: {}. Try decreasing supplied gas.", limit, got)
|
||||||
},
|
},
|
||||||
InvalidGasLimit(_) => "Supplied gas is beyond limit.".into(),
|
InvalidGasLimit(_) => "Supplied gas is beyond limit.".into(),
|
||||||
DAORescue => "Transaction removes funds from a DAO.".into(),
|
|
||||||
};
|
};
|
||||||
Error {
|
Error {
|
||||||
code: ErrorCode::ServerError(error_codes::TRANSACTION_ERROR),
|
code: ErrorCode::ServerError(error_codes::TRANSACTION_ERROR),
|
||||||
|
Loading…
Reference in New Issue
Block a user