Skip to content

Commit

Permalink
[pallet-revive] fix file case
Browse files Browse the repository at this point in the history
  • Loading branch information
pgherveou committed Dec 23, 2024
1 parent e964644 commit a6be119
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 135 deletions.
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
Binary file not shown.
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

0 comments on commit a6be119

Please sign in to comment.