Skip to content

Commit

Permalink
Add back tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pgherveou committed Dec 3, 2024
1 parent 2deb22e commit cc3fe4f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 22 deletions.
11 changes: 0 additions & 11 deletions substrate/frame/revive/rpc/examples/js/contracts/Revert.sol

This file was deleted.

Binary file not shown.
16 changes: 5 additions & 11 deletions substrate/frame/revive/rpc/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,38 +218,34 @@ async fn deploy_and_call() -> anyhow::Result<()> {
Ok(())
}

/// TODO: enable ( https://github.com/paritytech/contract-issues/issues/12 )
#[ignore]
#[tokio::test]
async fn revert_call() -> anyhow::Result<()> {
let _lock = SHARED_RESOURCES.write();
let client = SharedResources::client().await;
let (bytecode, contract) = get_contract("revert")?;
let (bytecode, contract) = get_contract("ErrorTester")?;
let receipt = TransactionBuilder::default()
.input(contract.constructor.clone().unwrap().encode_input(bytecode, &[]).unwrap())
.send_and_wait_for_receipt(&client)
.await?;

let err = TransactionBuilder::default()
.to(receipt.contract_address.unwrap())
.input(contract.function("doRevert")?.encode_input(&[])?.to_vec())
.input(contract.function("triggerRequireError")?.encode_input(&[])?.to_vec())
.send(&client)
.await
.unwrap_err();

let call_err = unwrap_call_err!(err.source().unwrap());
assert_eq!(call_err.message(), "execution reverted: revert message");
assert_eq!(call_err.message(), "execution reverted: This is a require error");
assert_eq!(call_err.code(), 3);
Ok(())
}

/// TODO: enable ( https://github.com/paritytech/contract-issues/issues/12 )
#[ignore]
#[tokio::test]
async fn event_logs() -> anyhow::Result<()> {
let _lock = SHARED_RESOURCES.write();
let client = SharedResources::client().await;
let (bytecode, contract) = get_contract("event")?;
let (bytecode, contract) = get_contract("Event")?;
let receipt = TransactionBuilder::default()
.input(bytecode)
.send_and_wait_for_receipt(&client)
Expand Down Expand Up @@ -284,13 +280,11 @@ async fn invalid_transaction() -> anyhow::Result<()> {
Ok(())
}

/// TODO: enable ( https://github.com/paritytech/contract-issues/issues/12 )
#[ignore]
#[tokio::test]
async fn native_evm_ratio_works() -> anyhow::Result<()> {
let _lock = SHARED_RESOURCES.write();
let client = SharedResources::client().await;
let (bytecode, contract) = get_contract("piggyBank")?;
let (bytecode, contract) = get_contract("PiggyBank")?;
let contract_address = TransactionBuilder::default()
.input(bytecode)
.send_and_wait_for_receipt(&client)
Expand Down

0 comments on commit cc3fe4f

Please sign in to comment.