diff --git a/prdoc/pr_6981.prdoc b/prdoc/pr_6981.prdoc new file mode 100644 index 000000000000..8ed70e51ef45 --- /dev/null +++ b/prdoc/pr_6981.prdoc @@ -0,0 +1,7 @@ +title: '[pallet-revive] fix file case' +doc: +- audience: Runtime Dev + description: "fix https://github.com/paritytech/polkadot-sdk/issues/6970\r\n" +crates: +- name: pallet-revive-eth-rpc + bump: minor diff --git a/substrate/frame/revive/rpc/examples/js/abi/ErrorTester.json b/substrate/frame/revive/rpc/examples/js/abi/Errors.json similarity index 100% rename from substrate/frame/revive/rpc/examples/js/abi/ErrorTester.json rename to substrate/frame/revive/rpc/examples/js/abi/Errors.json diff --git a/substrate/frame/revive/rpc/examples/js/abi/ErrorTester.ts b/substrate/frame/revive/rpc/examples/js/abi/Errors.ts similarity index 98% rename from substrate/frame/revive/rpc/examples/js/abi/ErrorTester.ts rename to substrate/frame/revive/rpc/examples/js/abi/Errors.ts index f3776e498fd5..b39567531c6d 100644 --- a/substrate/frame/revive/rpc/examples/js/abi/ErrorTester.ts +++ b/substrate/frame/revive/rpc/examples/js/abi/Errors.ts @@ -1,4 +1,4 @@ -export const ErrorTesterAbi = [ +export const ErrorsAbi = [ { inputs: [ { diff --git a/substrate/frame/revive/rpc/examples/js/abi/errorTester.ts b/substrate/frame/revive/rpc/examples/js/abi/errorTester.ts deleted file mode 100644 index f3776e498fd5..000000000000 --- a/substrate/frame/revive/rpc/examples/js/abi/errorTester.ts +++ /dev/null @@ -1,106 +0,0 @@ -export const ErrorTesterAbi = [ - { - inputs: [ - { - internalType: "string", - name: "message", - type: "string", - }, - ], - name: "CustomError", - type: "error", - }, - { - inputs: [ - { - internalType: "bool", - name: "newState", - type: "bool", - }, - ], - name: "setState", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "state", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "triggerAssertError", - outputs: [], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "triggerCustomError", - outputs: [], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "triggerDivisionByZero", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "triggerOutOfBoundsError", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "triggerRequireError", - outputs: [], - stateMutability: "pure", - type: "function", - }, - { - inputs: [], - name: "triggerRevertError", - outputs: [], - stateMutability: "pure", - type: "function", - }, - { - inputs: [ - { - internalType: "uint256", - name: "value", - type: "uint256", - }, - ], - name: "valueMatch", - outputs: [], - stateMutability: "payable", - type: "function", - }, -] as const; diff --git a/substrate/frame/revive/rpc/examples/js/contracts/ErrorTester.sol b/substrate/frame/revive/rpc/examples/js/contracts/Errors.sol similarity index 98% rename from substrate/frame/revive/rpc/examples/js/contracts/ErrorTester.sol rename to substrate/frame/revive/rpc/examples/js/contracts/Errors.sol index f1fdd219624a..abbdba8d32eb 100644 --- a/substrate/frame/revive/rpc/examples/js/contracts/ErrorTester.sol +++ b/substrate/frame/revive/rpc/examples/js/contracts/Errors.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -contract ErrorTester { +contract Errors { bool public state; // Payable function that can be used to test insufficient funds errors diff --git a/substrate/frame/revive/rpc/examples/js/pvm/ErrorTester.polkavm b/substrate/frame/revive/rpc/examples/js/pvm/Errors.polkavm similarity index 100% rename from substrate/frame/revive/rpc/examples/js/pvm/ErrorTester.polkavm rename to substrate/frame/revive/rpc/examples/js/pvm/Errors.polkavm diff --git a/substrate/frame/revive/rpc/examples/js/src/geth-diff.test.ts b/substrate/frame/revive/rpc/examples/js/src/geth-diff.test.ts index 37ebbc9ea3b3..b9ee877927bb 100644 --- a/substrate/frame/revive/rpc/examples/js/src/geth-diff.test.ts +++ b/substrate/frame/revive/rpc/examples/js/src/geth-diff.test.ts @@ -1,7 +1,7 @@ import { jsonRpcErrors, procs, createEnv, getByteCode } from './geth-diff-setup.ts' import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test' import { encodeFunctionData, Hex, parseEther } from 'viem' -import { ErrorTesterAbi } from '../abi/ErrorTester' +import { ErrorsAbi } from '../abi/Errors' import { FlipperCallerAbi } from '../abi/FlipperCaller' import { FlipperAbi } from '../abi/Flipper' @@ -17,19 +17,19 @@ const envs = await Promise.all([createEnv('geth'), createEnv('kitchensink')]) for (const env of envs) { describe(env.serverWallet.chain.name, () => { - let errorTesterAddr: Hex = '0x' + let errorsAddr: Hex = '0x' let flipperAddr: Hex = '0x' let flipperCallerAddr: Hex = '0x' beforeAll(async () => { { const hash = await env.serverWallet.deployContract({ - abi: ErrorTesterAbi, - bytecode: getByteCode('errorTester', env.evm), + abi: ErrorsAbi, + bytecode: getByteCode('errors', env.evm), }) const deployReceipt = await env.serverWallet.waitForTransactionReceipt({ hash }) if (!deployReceipt.contractAddress) throw new Error('Contract address should be set') - errorTesterAddr = deployReceipt.contractAddress + errorsAddr = deployReceipt.contractAddress } { @@ -60,8 +60,8 @@ for (const env of envs) { expect.assertions(3) try { await env.accountWallet.readContract({ - address: errorTesterAddr, - abi: ErrorTesterAbi, + address: errorsAddr, + abi: ErrorsAbi, functionName: 'triggerAssertError', }) } catch (err) { @@ -78,8 +78,8 @@ for (const env of envs) { expect.assertions(3) try { await env.accountWallet.readContract({ - address: errorTesterAddr, - abi: ErrorTesterAbi, + address: errorsAddr, + abi: ErrorsAbi, functionName: 'triggerRevertError', }) } catch (err) { @@ -96,8 +96,8 @@ for (const env of envs) { expect.assertions(3) try { await env.accountWallet.readContract({ - address: errorTesterAddr, - abi: ErrorTesterAbi, + address: errorsAddr, + abi: ErrorsAbi, functionName: 'triggerDivisionByZero', }) } catch (err) { @@ -116,8 +116,8 @@ for (const env of envs) { expect.assertions(3) try { await env.accountWallet.readContract({ - address: errorTesterAddr, - abi: ErrorTesterAbi, + address: errorsAddr, + abi: ErrorsAbi, functionName: 'triggerOutOfBoundsError', }) } catch (err) { @@ -136,8 +136,8 @@ for (const env of envs) { expect.assertions(3) try { await env.accountWallet.readContract({ - address: errorTesterAddr, - abi: ErrorTesterAbi, + address: errorsAddr, + abi: ErrorsAbi, functionName: 'triggerCustomError', }) } catch (err) { @@ -154,8 +154,8 @@ for (const env of envs) { expect.assertions(3) try { await env.accountWallet.simulateContract({ - address: errorTesterAddr, - abi: ErrorTesterAbi, + address: errorsAddr, + abi: ErrorsAbi, functionName: 'valueMatch', value: parseEther('10'), args: [parseEther('10')], @@ -187,8 +187,8 @@ for (const env of envs) { expect.assertions(3) try { await env.accountWallet.estimateContractGas({ - address: errorTesterAddr, - abi: ErrorTesterAbi, + address: errorsAddr, + abi: ErrorsAbi, functionName: 'valueMatch', value: parseEther('10'), args: [parseEther('10')], @@ -205,8 +205,8 @@ for (const env of envs) { expect.assertions(3) try { await env.accountWallet.estimateContractGas({ - address: errorTesterAddr, - abi: ErrorTesterAbi, + address: errorsAddr, + abi: ErrorsAbi, functionName: 'valueMatch', value: parseEther('10'), args: [parseEther('10')], @@ -223,8 +223,8 @@ for (const env of envs) { expect.assertions(3) try { await env.serverWallet.estimateContractGas({ - address: errorTesterAddr, - abi: ErrorTesterAbi, + address: errorsAddr, + abi: ErrorsAbi, functionName: 'valueMatch', value: parseEther('11'), args: [parseEther('10')], @@ -255,8 +255,8 @@ for (const env of envs) { expect(balance).toBe(0n) await env.accountWallet.estimateContractGas({ - address: errorTesterAddr, - abi: ErrorTesterAbi, + address: errorsAddr, + abi: ErrorsAbi, functionName: 'setState', args: [true], }) @@ -273,7 +273,7 @@ for (const env of envs) { expect(balance).toBe(0n) const data = encodeFunctionData({ - abi: ErrorTesterAbi, + abi: ErrorsAbi, functionName: 'setState', args: [true], }) @@ -284,7 +284,7 @@ for (const env of envs) { { data, from: env.accountWallet.account.address, - to: errorTesterAddr, + to: errorsAddr, }, ], }) diff --git a/substrate/frame/revive/rpc/src/tests.rs b/substrate/frame/revive/rpc/src/tests.rs index 43b600c33d78..e64e16d45b2a 100644 --- a/substrate/frame/revive/rpc/src/tests.rs +++ b/substrate/frame/revive/rpc/src/tests.rs @@ -222,7 +222,7 @@ async fn deploy_and_call() -> anyhow::Result<()> { async fn revert_call() -> anyhow::Result<()> { let _lock = SHARED_RESOURCES.write(); let client = SharedResources::client().await; - let (bytecode, contract) = get_contract("ErrorTester")?; + let (bytecode, contract) = get_contract("Errors")?; let receipt = TransactionBuilder::default() .input(bytecode) .send_and_wait_for_receipt(&client)