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] rpc integration #5808

Closed
wants to merge 7 commits into from
Closed
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
110 changes: 109 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,8 @@ members = [
"substrate/frame/referenda",
"substrate/frame/remark",
"substrate/frame/revive",
"substrate/frame/revive/evm",
"substrate/frame/revive/evm/codegen",
"substrate/frame/revive/fixtures",
"substrate/frame/revive/mock-network",
"substrate/frame/revive/proc-macro",
Expand Down Expand Up @@ -900,6 +902,7 @@ pallet-collator-selection = { path = "cumulus/pallets/collator-selection", defau
pallet-collective = { path = "substrate/frame/collective", default-features = false }
pallet-collective-content = { path = "cumulus/parachains/pallets/collective-content", default-features = false }
pallet-contracts = { path = "substrate/frame/contracts", default-features = false }
pallet-contracts-evm = { path = "substrate/frame/contracts/evm", default-features = false }
pallet-contracts-fixtures = { path = "substrate/frame/contracts/fixtures", default-features = false }
pallet-contracts-mock-network = { default-features = false, path = "substrate/frame/contracts/mock-network" }
pallet-contracts-proc-macro = { path = "substrate/frame/contracts/proc-macro", default-features = false }
Expand Down
18 changes: 18 additions & 0 deletions substrate/bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1399,6 +1399,7 @@ impl pallet_contracts::Config for Runtime {
}

impl pallet_revive::Config for Runtime {
type ChainId = ConstU32<42>;
type Time = Timestamp;
type Currency = Balances;
type RuntimeEvent = RuntimeEvent;
Expand Down Expand Up @@ -3025,6 +3026,23 @@ impl_runtime_apis! {
)
}

fn eth_call(
origin: H160,
dest: H160,
value: Balance,
input: Vec<u8>,
) -> pallet_revive::ContractExecResult<Balance, EventRecord>
{
Revive::bare_eth_call(
origin,
dest,
value,
input,
pallet_revive::DebugInfo::UnsafeDebug,
pallet_revive::CollectEvents::UnsafeCollect,
)
}

fn instantiate(
origin: AccountId,
value: Balance,
Expand Down
2 changes: 2 additions & 0 deletions substrate/frame/revive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ pallet-revive-fixtures = { workspace = true, default-features = false }
pallet-revive-uapi = { workspace = true, default-features = true }
pallet-revive-proc-macro = { workspace = true, default-features = true }
sp-api = { workspace = true }
sp-arithmetic = { workspace = true }
sp-core = { workspace = true }
sp-io = { workspace = true }
sp-runtime = { workspace = true }
Expand Down Expand Up @@ -95,6 +96,7 @@ std = [
"sp-std/std",
"xcm-builder/std",
"xcm/std",
"sp-arithmetic/std"
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
Expand Down
64 changes: 64 additions & 0 deletions substrate/frame/revive/evm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[package]
name = "pallet-revive-evm"
publish = true
version = "0.1.0"
authors.workspace = true
edition.workspace = true
license.workspace = true
description = "traits and types to enable integration with EVM"

[dependencies]
serde = { workspace = true, features = ["alloc", "derive"] }
sp-core = { workspace = true }
ethereum-types = { workspace = true, features = ["codec", "rlp", "serialize"] }
rlp = { workspace = true }
hex = { workspace = true }
log = { workspace = true }
secp256k1 = { workspace = true, features = ["recovery"], optional = true }
derive_more.workspace = true
codec = { workspace = true, features = ["derive"] }
sp-io = { workspace = true }
sp-runtime = { workspace = true }
pallet-revive = { workspace = true }
pallet-transaction-payment = { workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
sp-weights = { workspace = true }
scale-info = { workspace = true, features = ["derive"] }
jsonrpsee = { workspace = true, features = ["full"], optional = true }

[dev-dependencies]
serde_json.workspace = true
hex-literal.workspace = true
pretty_assertions.workspace = true

[features]
default = ["std"]
std = [
"jsonrpsee",
"codec/std",
"ethereum-types/std",
"frame-support/std",
"frame-system/std",
"hex/std",
"log/std",
"pallet-revive/std",
"pallet-transaction-payment/std",
"rlp/std",
"scale-info/std",
"secp256k1",
"secp256k1?/std",
"serde/std",
"serde_json/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-weights/std",
]
try-runtime = [
"pallet-revive/try-runtime",
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-transaction-payment/try-runtime",
"sp-runtime/try-runtime",
]
20 changes: 20 additions & 0 deletions substrate/frame/revive/evm/codegen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "pallet-revive-evm-codegen"
version = "0.1.0"
edition.workspace = true
publish = false

[dependencies]
Inflector.workspace = true
lazy_static.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
anyhow.workspace = true
indoc = "2.0.5"

[dev-dependencies]
pretty_assertions.workspace = true

[features]
default = ["std"]
std = ["serde/std", "serde_json/std", "anyhow/std"]
5 changes: 5 additions & 0 deletions substrate/frame/revive/evm/codegen/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Generates the Ethereum JSON-RPC API from the official specification.

- See <https://github.com/ethereum/execution-apis>
- See building instructions to re-generate the openrpc.json <https://github.com/ethereum/execution-apis?tab=readme-ov-file#building>
- Include fixes from <https://github.com/ethereum/execution-apis/pull/552>
Loading