From cc3fe4f0189e6922af357b61c632cec8bd4cbbdf Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 3 Dec 2024 16:32:12 +0100 Subject: [PATCH] Add back tests --- .../revive/rpc/examples/js/contracts/Revert.sol | 11 ----------- .../rpc/examples/js/pvm/RevertExample.polkavm | Bin 1863 -> 0 bytes substrate/frame/revive/rpc/src/tests.rs | 16 +++++----------- 3 files changed, 5 insertions(+), 22 deletions(-) delete mode 100644 substrate/frame/revive/rpc/examples/js/contracts/Revert.sol delete mode 100644 substrate/frame/revive/rpc/examples/js/pvm/RevertExample.polkavm diff --git a/substrate/frame/revive/rpc/examples/js/contracts/Revert.sol b/substrate/frame/revive/rpc/examples/js/contracts/Revert.sol deleted file mode 100644 index 53f1f8994256..000000000000 --- a/substrate/frame/revive/rpc/examples/js/contracts/Revert.sol +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -contract RevertExample { - constructor() { - } - - function doRevert() public { - revert("revert message"); - } -} diff --git a/substrate/frame/revive/rpc/examples/js/pvm/RevertExample.polkavm b/substrate/frame/revive/rpc/examples/js/pvm/RevertExample.polkavm deleted file mode 100644 index 9f3acddcf4afa05cfee97e7294e3f3d2ee11e88b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1863 zcmcJPUq~EB9LHz(_I75^)tfu-Zgzeey$fr!(m$3y)KVxH6R4L`5pyZB%WKs^jCS@C+rG4v zLYJGl;WvMN-}!uJruU845qcG)>L+3Jc~ZHFlFDAi3;0E$qU;o9_{i8q@mM}LnjOy< zC&rH)%NMi5hYwE_bAzM#>`<?M#7hH!(hLk5GH1+rHRuSCaN>Z+WIXUtTI#ya`t|{ggJc9M`Xr;f1(}1j%di zq{yaH{X;SLl>nhg#-!F;QEa|P4%r3615-CAx|{6+wH<>@5kX7qkwTB5QD-xV6(l*r z9!b#@6c$}hXx5@rR&>mYIZkvI2_)MxBc0Xpiu_MN6jdP35&=7_d98q8pRExtv@SL* zE6vMNdQoe=)_N&@P1mmn(wDR1w7w$-Xhk#SyLEv@3Yk}*)Yk&uU zi$w@<3|s~72d)73y^ny))4-)Kkg(2X@zyE3(P+K1|5ioy-exWl zn|Ihi)9;E#+y*0EA%KHqSZE>gr1?Z&{PaVN5B#Z5B>VsL-S`*!Zf{ie?R}ze=TGYx ze*%97 zQ)@RPecdf7_cZQZW-<=!}^O#K*1T2rf diff --git a/substrate/frame/revive/rpc/src/tests.rs b/substrate/frame/revive/rpc/src/tests.rs index 7f2d4e683c31..bdf6765a8e00 100644 --- a/substrate/frame/revive/rpc/src/tests.rs +++ b/substrate/frame/revive/rpc/src/tests.rs @@ -218,13 +218,11 @@ 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) @@ -232,24 +230,22 @@ async fn revert_call() -> anyhow::Result<()> { 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) @@ -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)