mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 00:42:42 +00:00
Fix eth1_test_rig (#1014)
This commit is contained in:
@@ -27,4 +27,4 @@ dirs = "2.0"
|
|||||||
genesis = { path = "../beacon_node/genesis" }
|
genesis = { path = "../beacon_node/genesis" }
|
||||||
deposit_contract = { path = "../eth2/utils/deposit_contract" }
|
deposit_contract = { path = "../eth2/utils/deposit_contract" }
|
||||||
tree_hash = { path = "../eth2/utils/tree_hash" }
|
tree_hash = { path = "../eth2/utils/tree_hash" }
|
||||||
tokio = { version = "0.3", features = ["full"] }
|
tokio = { version = "0.2", features = ["full"] }
|
||||||
|
|||||||
@@ -190,31 +190,31 @@ impl DepositContract {
|
|||||||
.get(DEPOSIT_ACCOUNTS_INDEX)
|
.get(DEPOSIT_ACCOUNTS_INDEX)
|
||||||
.cloned()
|
.cloned()
|
||||||
.ok_or_else(|| "Insufficient accounts for deposit".to_string())
|
.ok_or_else(|| "Insufficient accounts for deposit".to_string())
|
||||||
})
|
})?;
|
||||||
.and_then(move |from| {
|
let tx_request = TransactionRequest {
|
||||||
let tx_request = TransactionRequest {
|
from,
|
||||||
from,
|
to: Some(self.contract.address()),
|
||||||
to: Some(contract.address()),
|
gas: Some(U256::from(DEPOSIT_GAS)),
|
||||||
gas: Some(U256::from(DEPOSIT_GAS)),
|
gas_price: None,
|
||||||
gas_price: None,
|
value: Some(from_gwei(deposit_data.amount)),
|
||||||
value: Some(from_gwei(deposit_data.amount)),
|
// Note: the reason we use this `TransactionRequest` instead of just using the
|
||||||
// Note: the reason we use this `TransactionRequest` instead of just using the
|
// function in `self.contract` is so that the `eth1_tx_data` function gets used
|
||||||
// function in `self.contract` is so that the `encode_eth1_tx_data` function gets used
|
// during testing.
|
||||||
// during testing.
|
//
|
||||||
//
|
// It's important that `eth1_tx_data` stays correct and does not suffer from
|
||||||
// It's important that `encode_eth1_tx_data` stays correct and does not suffer from
|
// code-rot.
|
||||||
// code-rot.
|
data: encode_eth1_tx_data(&deposit_data).map(Into::into).ok(),
|
||||||
data: encode_eth1_tx_data(&deposit_data).map(Into::into).ok(),
|
nonce: None,
|
||||||
nonce: None,
|
condition: None,
|
||||||
condition: None,
|
};
|
||||||
};
|
|
||||||
|
|
||||||
web3_1
|
self.web3
|
||||||
.eth()
|
.eth()
|
||||||
.send_transaction(tx_request)
|
.send_transaction(tx_request)
|
||||||
.compa().await()
|
.compat()
|
||||||
.map_err(|e| format!("Failed to call deposit fn: {:?}", e))?;
|
.await
|
||||||
Ok())
|
.map_err(|e| format!("Failed to call deposit fn: {:?}", e))?;
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Peforms many deposits, each preceded by a delay.
|
/// Peforms many deposits, each preceded by a delay.
|
||||||
|
|||||||
Reference in New Issue
Block a user