Skip to content

Commit

Permalink
experiment with geth
Browse files Browse the repository at this point in the history
  • Loading branch information
pgherveou committed Dec 23, 2024
1 parent f900511 commit 9c4eb15
Show file tree
Hide file tree
Showing 20 changed files with 634 additions and 136 deletions.
33 changes: 33 additions & 0 deletions substrate/frame/revive/fixtures/contracts/dummy_2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// This file is part of Substrate.

// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#![no_std]
#![no_main]

extern crate common;
use uapi::{HostFn, HostFnImpl as api, StorageFlags};

#[no_mangle]
#[polkavm_derive::polkavm_export]
pub extern "C" fn deploy() {}

#[no_mangle]
#[polkavm_derive::polkavm_export]
pub extern "C" fn call() {
// Burn some PoV, clear_storage consumes some PoV as in order to clear the storage we need to we
// need to read its size first.
api::clear_storage(StorageFlags::empty(), b"");
}
15 changes: 15 additions & 0 deletions substrate/frame/revive/rpc/examples/js/abi/Callee.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[
{
"inputs": [
{
"internalType": "uint256",
"name": "iterations",
"type": "uint256"
}
],
"name": "consumeGas",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
15 changes: 15 additions & 0 deletions substrate/frame/revive/rpc/examples/js/abi/Callee.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export const CalleeAbi = [
{
inputs: [
{
internalType: "uint256",
name: "iterations",
type: "uint256",
},
],
name: "consumeGas",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
] as const;
57 changes: 57 additions & 0 deletions substrate/frame/revive/rpc/examples/js/abi/Caller.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[
{
"inputs": [
{
"internalType": "uint256",
"name": "_initialCounter",
"type": "uint256"
},
{
"internalType": "address",
"name": "_callee",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "callee",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "counter",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "gasToConsume",
"type": "uint256"
}
],
"name": "start",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
57 changes: 57 additions & 0 deletions substrate/frame/revive/rpc/examples/js/abi/Caller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
export const CallerAbi = [
{
inputs: [
{
internalType: "uint256",
name: "_initialCounter",
type: "uint256",
},
{
internalType: "address",
name: "_callee",
type: "address",
},
],
stateMutability: "nonpayable",
type: "constructor",
},
{
inputs: [],
name: "callee",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "counter",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "gasToConsume",
type: "uint256",
},
],
name: "start",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
] as const;
65 changes: 65 additions & 0 deletions substrate/frame/revive/rpc/examples/js/abi/PiggyBank.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
export const PiggyBankAbi = [
{
inputs: [],
stateMutability: "nonpayable",
type: "constructor",
},
{
inputs: [],
name: "deposit",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "payable",
type: "function",
},
{
inputs: [],
name: "getDeposit",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "owner",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "withdrawAmount",
type: "uint256",
},
],
name: "withdraw",
outputs: [
{
internalType: "uint256",
name: "remainingBal",
type: "uint256",
},
],
stateMutability: "nonpayable",
type: "function",
},
] as const;
29 changes: 29 additions & 0 deletions substrate/frame/revive/rpc/examples/js/abi/TracingCallee.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "caller",
"type": "address"
}
],
"name": "GasConsumed",
"type": "event"
},
{
"inputs": [],
"name": "consumeGas",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "failingFunction",
"outputs": [],
"stateMutability": "pure",
"type": "function"
}
]
29 changes: 29 additions & 0 deletions substrate/frame/revive/rpc/examples/js/abi/TracingCallee.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
export const TracingCalleeAbi = [
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "caller",
type: "address",
},
],
name: "GasConsumed",
type: "event",
},
{
inputs: [],
name: "consumeGas",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [],
name: "failingFunction",
outputs: [],
stateMutability: "pure",
type: "function",
},
] as const;
39 changes: 39 additions & 0 deletions substrate/frame/revive/rpc/examples/js/abi/TracingCaller.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[
{
"inputs": [
{
"internalType": "address",
"name": "_callee",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "callee",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "counter",
"type": "uint256"
}
],
"name": "start",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
39 changes: 39 additions & 0 deletions substrate/frame/revive/rpc/examples/js/abi/TracingCaller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
export const TracingCallerAbi = [
{
inputs: [
{
internalType: "address",
name: "_callee",
type: "address",
},
],
stateMutability: "nonpayable",
type: "constructor",
},
{
inputs: [],
name: "callee",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "counter",
type: "uint256",
},
],
name: "start",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
] as const;
Loading

0 comments on commit 9c4eb15

Please sign in to comment.