Skip to content

Commit

Permalink
test(application): test successfull transaction for validate_txn
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-wright committed Jun 29, 2023
1 parent f2ac0a2 commit ab7e267
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions core/application/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use anyhow::{anyhow, Result};
use draco_interfaces::{
application::ExecutionEngineSocket,
types::{
Block, Epoch, ExecutionData, ExecutionError, NodeInfo, ProofOfConsensus, Tokens,
TotalServed, TransactionResponse, UpdateMethod, UpdatePayload, UpdateRequest,
Block, Epoch, ExecutionError, NodeInfo, ProofOfConsensus, Tokens, TotalServed,
TransactionResponse, UpdateMethod, UpdatePayload, UpdateRequest,
},
ApplicationInterface, BlockExecutionResponse, DeliveryAcknowledgment, SyncQueryRunnerInterface,
};
Expand Down Expand Up @@ -822,11 +822,7 @@ async fn test_validate_txn() {
let res = run_transaction(vec![req.clone()], &update_socket)
.await
.unwrap();
assert_eq!(
res.txn_receipts[0],
//TransactionResponse::Revert(ExecutionError::EpochHasNotStarted)
query_runner.validate_txn(req)
);
assert_eq!(res.txn_receipts[0], query_runner.validate_txn(req));

// Submit a ChangeEpoch transaction that will succeed and ensure that the
// `validate_txn` method of the query runner returns the same response as the update runner.
Expand All @@ -835,8 +831,9 @@ async fn test_validate_txn() {
genesis_committee[0].public_key,
);
let res = run_transaction(vec![req], &update_socket).await.unwrap();
assert_eq!(
res.txn_receipts[0],
TransactionResponse::Success(ExecutionData::None)
let req = get_update_request_node(
UpdateMethod::ChangeEpoch { epoch: 0 },
genesis_committee[1].public_key,
);
assert_eq!(res.txn_receipts[0], query_runner.validate_txn(req));
}

0 comments on commit ab7e267

Please sign in to comment.