Skip to content

Commit

Permalink
chore: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
0xJepsen committed Feb 8, 2024
1 parent 3cab79b commit 66cff87
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions arbiter-core/src/middleware/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,10 @@ impl Middleware for ArbiterMiddleware {
let outcome = provider.outcome_receiver.recv()??;

if let Outcome::TransactionCompleted(execution_result, receipt_data) = outcome {
let mut block_hasher = Sha256::new();
block_hasher.update(receipt_data.block_number.to_string().as_bytes());
let block_hash = block_hasher.finalize();
let block_hash = Some(H256::from_slice(&block_hash));
match execution_result {
ExecutionResult::Revert { gas_used, output } => {
return Err(ArbiterCoreError::ExecutionRevert {
Expand Down Expand Up @@ -494,7 +498,7 @@ impl Middleware for ArbiterMiddleware {
match output {
Output::Create(_, address) => {
let tx_receipt = TransactionReceipt {
block_hash: None,
block_hash,
block_number: Some(receipt_data.block_number),
contract_address: Some(recast_address(address.unwrap())),
logs: logs.clone(),
Expand Down Expand Up @@ -546,7 +550,7 @@ impl Middleware for ArbiterMiddleware {
}
Output::Call(_) => {
let tx_receipt = TransactionReceipt {
block_hash: None,
block_hash,
block_number: Some(receipt_data.block_number),
contract_address: None,
logs: logs.clone(),
Expand Down
2 changes: 1 addition & 1 deletion arbiter-core/tests/environment_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async fn receipt_data() {
block_hasher.update(receipt.block_number.unwrap().to_string().as_bytes());
let block_hash = block_hasher.finalize();
let block_hash = Some(H256::from_slice(&block_hash));
assert_eq!(receipt.block_hash, block_hash);
assert_eq!(receipt.block_hash, block_hash); // panic here left side is none
assert_eq!(receipt.status, Some(1.into()));

assert!(receipt.contract_address.is_none());
Expand Down
2 changes: 1 addition & 1 deletion arbiter-core/tests/middleware_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ async fn access() {

#[tokio::test]
async fn stream_with_meta() {
let (_, client) = startup();
let (_environment, client) = startup();

let arbx = deploy_arbx(client.clone()).await;

Expand Down

0 comments on commit 66cff87

Please sign in to comment.