Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State dump split #2126

Merged
merged 15 commits into from
Feb 25, 2020
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
Cargo.lock linguist-generated=true -diff
**/package-lock.json linguist-generated=true -diff
near/res/testnet.json linguist-generated=true -diff
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@ pytest/.adversary

# a file indicating that the person understands the risks of running adversarial tests
pytest/.consent

# testnet genesis
/near/res/testnet.json
/near/res/testnet_genesis_records*.json
1 change: 1 addition & 0 deletions chain/client/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ pub fn setup(
&chain_genesis,
runtime.clone(),
network_adapter.clone(),
None,
)
.unwrap();
let config = ClientConfig::test(
Expand Down
12 changes: 11 additions & 1 deletion chain/client/src/view_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,19 @@ impl ViewClientActor {
chain_genesis: &ChainGenesis,
runtime_adapter: Arc<dyn RuntimeAdapter>,
network_adapter: Arc<dyn NetworkAdapter>,
expected_genesis_hash: Option<String>,
) -> Result<Self, Error> {
// TODO: should we create shared ChainStore that is passed to both Client and ViewClient?
let chain = Chain::new(store, runtime_adapter.clone(), chain_genesis)?;
let mut chain = Chain::new(store, runtime_adapter.clone(), chain_genesis)?;
if let Some(expected_genesis_hash) = expected_genesis_hash {
let genesis_hash = chain.get_block_by_height(0).unwrap().hash().to_string();
if genesis_hash != expected_genesis_hash {
panic!(
"Expected genesis hash to be {}, actual {}",
expected_genesis_hash, genesis_hash,
);
}
}
Ok(ViewClientActor {
chain,
runtime_adapter,
Expand Down
13 changes: 9 additions & 4 deletions chain/network/tests/announce_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,15 @@ pub fn setup_network_node(
.unwrap()
.start();

let view_client_actor =
ViewClientActor::new(store.clone(), &chain_genesis, runtime.clone(), network_adapter)
.unwrap()
.start();
let view_client_actor = ViewClientActor::new(
store.clone(),
&chain_genesis,
runtime.clone(),
network_adapter,
None,
)
.unwrap()
.start();

PeerManagerActor::new(
store.clone(),
Expand Down
1 change: 1 addition & 0 deletions chain/network/tests/routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ pub fn setup_network_node(
&chain_genesis,
runtime.clone(),
network_adapter.clone(),
None,
)
.unwrap()
.start();
Expand Down
Loading