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] Add Ethereum JSON-RPC server #5953

Open
wants to merge 44 commits into
base: pg/revive-rpc-fixes-v2
Choose a base branch
from

Conversation

pgherveou
Copy link
Contributor

@pgherveou pgherveou commented Oct 7, 2024

No description provided.

@pgherveou pgherveou changed the base branch from master to pg/revive-rpc-fixes-v2 October 7, 2024 13:16
@pgherveou pgherveou force-pushed the pg/revive-rpc-server branch 5 times, most recently from d80a5ce to d931a80 Compare October 9, 2024 10:47
@pgherveou pgherveou marked this pull request as ready for review October 10, 2024 15:25
@pgherveou pgherveou requested a review from a team as a code owner October 10, 2024 15:25
@pgherveou pgherveou added R0-silent Changes should not be mentioned in any release notes T7-smart_contracts This PR/Issue is related to smart contracts. labels Oct 10, 2024
Copy link
Member

@athei athei left a comment

Choose a reason for hiding this comment

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

Great that it works with vanilla ether.js now. This is how it should have been.

Copy link
Member

Choose a reason for hiding this comment

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

Should have a better name than just "demo". Maybe "rpc_demo".

Comment on lines 20 to 34
#[subxt::subxt(
runtime_metadata_path = "kitchensink.scale",
substitute_type(
path = "pallet_revive::primitives::EthContractResult<A>",
with = "::subxt::utils::Static<::pallet_revive::EthContractResult<A>>"
),
substitute_type(
path = "pallet_revive::primitives::EthTransactKind",
with = "::subxt::utils::Static<::pallet_revive::EthTransactKind>"
),
substitute_type(
path = "sp_weights::weight_v2::Weight",
with = "::subxt::utils::Static<::sp_weights::Weight>"
)
)]
Copy link
Member

Choose a reason for hiding this comment

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

I think we need to use the dynamic API of subxt here. Otherwise the pallet ids and so on will be hardcoded to whatever kitchensink is using, right?

Or how do we make sure that this will be compatible across different runtimes (westend ah, kusama ah, polkadot ah)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes correct, the only thing that can break I believe is the encoding of the dispatchable, since the index will differ for each runtime, I was planning to go with feature flag to start with, until I find a more suitable solution, will look into their dynamic API as well.

Comment on lines +33 to +35
pub extern "C" fn call() {
input!(128, data: [u8],);
api::deposit_event(&[], data);
Copy link
Member

Choose a reason for hiding this comment

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

Can we assert the selector here? ether.js should derive a selector from the provided ABI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah right yes it does, might be easier to add the assert in the js code directly, since that's where we define the "fake ABI"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R0-silent Changes should not be mentioned in any release notes T7-smart_contracts This PR/Issue is related to smart contracts.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants