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-prc fix geth diff #6608

Merged
merged 30 commits into from
Dec 1, 2024
Merged

[pallet-revive] eth-prc fix geth diff #6608

merged 30 commits into from
Dec 1, 2024

Conversation

pgherveou
Copy link
Contributor

@pgherveou pgherveou commented Nov 22, 2024

  • Add a bunch of differential tests to ensure that responses from eth-rpc matches the one from geth
    • These tests are not run in CI for now but can be run locally with
cd revive/rpc/examples/js
bun test
  • EVM RPC server will not fail gas_estimation if no gas is specified, I updated pallet-revive to add an extra skip_transfer boolean check to replicate this behavior in our pallet

  • eth_transact and bare_eth_transact api have been updated to use GenericTransaction directly as this is what is used by eth_estimateGas and eth_call

@pgherveou pgherveou marked this pull request as ready for review November 26, 2024 15:57
@pgherveou
Copy link
Contributor Author

/cmd prdoc --audience runtime_dev --bump minor

@pgherveou pgherveou added T7-smart_contracts This PR/Issue is related to smart contracts. R0-silent Changes should not be mentioned in any release notes labels Nov 26, 2024
substrate/frame/revive/Cargo.toml Show resolved Hide resolved
substrate/frame/revive/rpc/src/client.rs Outdated Show resolved Hide resolved
substrate/frame/revive/src/exec.rs Show resolved Hide resolved
substrate/frame/revive/src/exec.rs Outdated Show resolved Hide resolved
Copy link
Member

@xermicus xermicus left a comment

Choose a reason for hiding this comment

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

Just some nits

prdoc/pr_6608.prdoc Outdated Show resolved Hide resolved
substrate/frame/revive/rpc/revive_chain.metadata Outdated Show resolved Hide resolved
}
match function_selector {
// assert(false)
[0x4E, 0x48, 0x7B, 0x71] => {
Copy link
Member

Choose a reason for hiding this comment

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

Does the alloy crate or something similar provide those types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure, this is inspired by the go-ethereum source code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't depend on alloy, so not really worth adding a new dependency just for that for now

substrate/frame/revive/rpc/src/client.rs Outdated Show resolved Hide resolved
substrate/frame/revive/src/lib.rs Outdated Show resolved Hide resolved
@pgherveou pgherveou requested a review from athei November 29, 2024 14:05
@paritytech-workflow-stopper
Copy link

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/12086529924
Failed job name: test-linux-stable

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.

I think you need to disable the tests written in Solidity for CI to pass. The 64bit PR broke them. Or you rebuilt them with a new revive.

@pgherveou
Copy link
Contributor Author

I think you need to disable the tests written in Solidity for CI to pass. The 64bit PR broke them. Or you rebuilt them with a new revive.

Didn't you do it in your PR already?

@athei
Copy link
Member

athei commented Nov 29, 2024

I think you need to disable the tests written in Solidity for CI to pass. The 64bit PR broke them. Or you rebuilt them with a new revive.

Didn't you do it in your PR already?

I did. I thought you added new tests here that need to be disabled. But the CI error is from something else.

@athei athei added this pull request to the merge queue Dec 1, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 1, 2024
@athei athei enabled auto-merge December 1, 2024 16:18
@athei athei added this pull request to the merge queue Dec 1, 2024
Merged via the queue into master with commit d1fafa8 Dec 1, 2024
193 of 198 checks passed
@athei athei deleted the pg/fix-geth-diff branch December 1, 2024 17:21
@pgherveou
Copy link
Contributor Author

Ah i was going to add a few tests will do that in a follow up

@cmichi
Copy link

cmichi commented Dec 6, 2024

@pgherveou I think you might have overlooked in fn bare_upload_code changing the

storage_deposit_limit: BalanceOf<T>,

to

storage_deposit_limit: DepositLimit<BalanceOf<T>>,

Here:
https://github.com/paritytech/polkadot-sdk/blob/master/substrate/frame/revive/src/lib.rs#L1468

@pgherveou
Copy link
Contributor Author

@pgherveou I think you might have overlooked in fn bare_upload_code changing the

storage_deposit_limit: BalanceOf<T>,

to

storage_deposit_limit: DepositLimit<BalanceOf<T>>,

Here: https://github.com/paritytech/polkadot-sdk/blob/master/substrate/frame/revive/src/lib.rs#L1468

Thanks @cmichi, this new type barely acts as a more meaningful replacement for Option< DepositLimit<BalanceOf<T>>>
so we don't really need it here

github-merge-queue bot pushed a commit that referenced this pull request Dec 11, 2024
Add tests for #6608 

fix paritytech/contract-issues#12

---------

Co-authored-by: command-bot <>
Krayt78 pushed a commit to Krayt78/polkadot-sdk that referenced this pull request Dec 18, 2024
* Add a bunch of differential tests to ensure that responses from
eth-rpc matches the one from `geth`
- These
[tests](https://github.com/paritytech/polkadot-sdk/blob/pg/fix-geth-diff/substrate/frame/revive/rpc/examples/js/src/geth-diff.test.ts)
are not run in CI for now but can be run locally with
```bash
cd revive/rpc/examples/js
bun test
```

* EVM RPC server will not fail gas_estimation if no gas is specified, I
updated pallet-revive to add an extra `skip_transfer` boolean check to
replicate this behavior in our pallet

* `eth_transact` and `bare_eth_transact` api have been updated to use
`GenericTransaction` directly as this is what is used by
`eth_estimateGas` and `eth_call`

## TODO

- [ ]  Add tests the new `skip_transfer` flag

---------

Co-authored-by: GitHub Action <[email protected]>
Co-authored-by: Alexander Theißen <[email protected]>
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.

5 participants