Skip to content

Commit

Permalink
[pallet-revive] fix file case (#6981)
Browse files Browse the repository at this point in the history
fix #6970

---------

Co-authored-by: command-bot <>
  • Loading branch information
pgherveou authored Jan 2, 2025
1 parent fcbc0ef commit 20513d6
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 136 deletions.
7 changes: 7 additions & 0 deletions prdoc/pr_6981.prdoc
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const ErrorTesterAbi = [
export const ErrorsAbi = [
{
inputs: [
{
Expand Down
106 changes: 0 additions & 106 deletions substrate/frame/revive/rpc/examples/js/abi/errorTester.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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
Expand Down
54 changes: 27 additions & 27 deletions substrate/frame/revive/rpc/examples/js/src/geth-diff.test.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -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
}

{
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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')],
Expand Down Expand Up @@ -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')],
Expand All @@ -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')],
Expand All @@ -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')],
Expand Down Expand Up @@ -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],
})
Expand All @@ -273,7 +273,7 @@ for (const env of envs) {
expect(balance).toBe(0n)

const data = encodeFunctionData({
abi: ErrorTesterAbi,
abi: ErrorsAbi,
functionName: 'setState',
args: [true],
})
Expand All @@ -284,7 +284,7 @@ for (const env of envs) {
{
data,
from: env.accountWallet.account.address,
to: errorTesterAddr,
to: errorsAddr,
},
],
})
Expand Down
2 changes: 1 addition & 1 deletion substrate/frame/revive/rpc/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 20513d6

Please sign in to comment.