Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pallet-revive] fix file case #6981

Merged
merged 7 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is remove as duplicate of Errors.json I guess?

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
pgherveou marked this conversation as resolved.
Show resolved Hide resolved
File renamed without changes.
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
Loading