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] eth-rpc add missing tests #6728

Merged
merged 11 commits into from
Dec 11, 2024
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
12 changes: 12 additions & 0 deletions prdoc/pr_6728.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
title: '[pallet-revive] eth-rpc add missing tests'
doc:
- audience: Runtime Dev
description: |-
Add tests for #6608

fix https://github.com/paritytech/contract-issues/issues/12
crates:
- name: pallet-revive-eth-rpc
bump: minor
- name: pallet-revive
bump: minor
2 changes: 1 addition & 1 deletion substrate/frame/revive/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ example = ["hex-literal", "rlp", "secp256k1", "subxt-signer"]
env_logger = { workspace = true }
static_init = { workspace = true }
hex-literal = { workspace = true }
pallet-revive-fixtures = { workspace = true }
pallet-revive-fixtures = { workspace = true, default-features = true }
substrate-cli-test-utils = { workspace = true }
subxt-signer = { workspace = true, features = ["unstable-eth"] }
106 changes: 106 additions & 0 deletions substrate/frame/revive/rpc/examples/js/abi/ErrorTester.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
[
{
"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"
}
]
106 changes: 106 additions & 0 deletions substrate/frame/revive/rpc/examples/js/abi/ErrorTester.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
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;
34 changes: 34 additions & 0 deletions substrate/frame/revive/rpc/examples/js/abi/EventExample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "message",
"type": "string"
}
],
"name": "ExampleEvent",
"type": "event"
},
{
"inputs": [],
"name": "triggerEvent",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
34 changes: 34 additions & 0 deletions substrate/frame/revive/rpc/examples/js/abi/EventExample.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
export const EventExampleAbi = [
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "sender",
type: "address",
},
{
indexed: false,
internalType: "uint256",
name: "value",
type: "uint256",
},
{
indexed: false,
internalType: "string",
name: "message",
type: "string",
},
],
name: "ExampleEvent",
type: "event",
},
{
inputs: [],
name: "triggerEvent",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
] as const;
35 changes: 35 additions & 0 deletions substrate/frame/revive/rpc/examples/js/abi/Flipper.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[
{
"inputs": [],
"name": "flip",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "getValue",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "value",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
}
]
35 changes: 35 additions & 0 deletions substrate/frame/revive/rpc/examples/js/abi/Flipper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
export const FlipperAbi = [
{
inputs: [],
name: "flip",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [],
name: "getValue",
outputs: [
{
internalType: "bool",
name: "",
type: "bool",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "value",
outputs: [
{
internalType: "bool",
name: "",
type: "bool",
},
],
stateMutability: "view",
type: "function",
},
] as const;
Loading
Loading