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

fix: vote reject when wasm panics #171

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
use std::{convert::TryInto, net::SocketAddr};

use async_trait::async_trait;
use log::info;
use log::trace;
use tari_app_grpc::tari_rpc::{self as grpc, GetCommitteeRequest, GetShardKeyRequest};
use tari_base_node_grpc_client::BaseNodeGrpcClient;
use tari_common_types::types::{FixedHash, PublicKey};
Expand Down Expand Up @@ -101,7 +101,6 @@ impl BaseNodeClient for GrpcBaseNodeClient {
async fn get_validator_nodes(&mut self, height: u64) -> Result<Vec<ValidatorNode>, BaseNodeError> {
let inner = self.connection().await?;
let request = grpc::GetActiveValidatorNodesRequest { height };
dbg!(&request);
let mut vns = vec![];
let mut stream = inner.get_active_validator_nodes(request).await?.into_inner();
loop {
Expand All @@ -117,7 +116,7 @@ impl BaseNodeClient for GrpcBaseNodeClient {
});
},
Ok(None) => {
info!(target: LOG_TARGET, "No new validator nodes for this epoch");
trace!(target: LOG_TARGET, "No new validator nodes for this epoch");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removes an extra log in the console

break;
},
Err(e) => {
Expand Down Expand Up @@ -169,7 +168,6 @@ impl BaseNodeClient for GrpcBaseNodeClient {
start_hash: start_hash.map(|v| v.to_vec()).unwrap_or_default(),
count,
};
dbg!(&request);
let mut templates = vec![];
let mut stream = inner.get_template_registrations(request).await?.into_inner();
loop {
Expand Down
6 changes: 5 additions & 1 deletion applications/tari_validator_node/src/payload_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ where TTemplateProvider: TemplateProvider
let package = builder.build();

let processor = TransactionProcessor::new(runtime, package);
let result = processor.execute(transaction)?;
let tx_hash = *transaction.hash();
let result = match processor.execute(transaction) {
Ok(result) => result,
Err(err) => FinalizeResult::errored(tx_hash, err.to_string()),
};
Ok(result)
}
}
Expand Down
2 changes: 1 addition & 1 deletion applications/tari_validator_node_web_ui/build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><script defer="defer" src="/static/js/main.bc0c3b4b.js"></script><link href="/static/css/main.1d3be740.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="data:;base64,="><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><script defer="defer" src="/static/js/main.bc0c3b4b.js"></script><link href="/static/css/main.1d3be740.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
3 changes: 2 additions & 1 deletion applications/tari_validator_node_web_ui/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="icon" href="data:;base64,=">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removes the log in the console

<!-- no fav icon <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />-->
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
Expand Down
6 changes: 0 additions & 6 deletions dan_layer/core/src/workers/hotstuff_waiter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,12 +483,6 @@ where
shard_pledges: HashMap<ShardId, Vec<ObjectPledge>>,
payload: TPayload,
) -> Result<FinalizeResult, HotStuffError> {
// let shard_pledges = node
// .justify()
// .all_shard_nodes()
// .iter()
// .map(|s| (s.shard_id, s.pledges.clone()))
// .collect();
let finalize = self.payload_processor.process_payload(payload, shard_pledges)?;
Ok(finalize)
}
Expand Down
10 changes: 10 additions & 0 deletions dan_layer/engine_types/src/commit_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ impl FinalizeResult {
result,
}
}

pub fn errored(transaction_hash: Hash, reason: String) -> Self {
Self::new(
transaction_hash,
Vec::new(),
TransactionResult::Reject(RejectResult {
reason: format!("Transaction errored: {}", reason),
}),
)
}
}

#[derive(Debug, Clone, Serialize, Deserialize)]
Expand Down