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

feat(rpc): Add coinbase support to eth_callBundle; limit gas #12687

Conversation

ryanschneider
Copy link
Contributor

@ryanschneider ryanschneider commented Nov 19, 2024

Requires new alloy with : alloy-rs/alloy#1667

  • import new alloy or copy/paste EthCallBundle struct?

Tested on mekong:

--- a/crates/rpc/rpc-eth-api/src/helpers/transaction.rs
+++ b/crates/rpc/rpc-eth-api/src/helpers/transaction.rs
@@ -274,7 +274,7 @@ pub trait EthTransactions: LoadTransaction<Provider: BlockReaderIdExt> {
                     block
                         .transactions_with_sender()
                         .enumerate()
-                        .find(|(_, (signer, tx))| **signer == sender && tx.nonce() == nonce)
+                        .find(|(_, (signer, tx))| **signer == sender && (*tx).nonce() == nonce)
                         .map(|(index, (signer, tx))| {
                             let tx_info = TransactionInfo {
                                 hash: Some(tx.hash()),

Can now confirm that including a tx which sends eth to the target coinbase works. Below I send a tx which sends 1eth to 0x4bE0Cd2553356b4ABb8b6a1882325dAbC8d3013D and then set the coinbase to that address, and ethSentToCoinbase correctly shows 1eth in the result:

> cast rpc eth_callBundle '{"txs":["0x02f8778501a5ee289c80840e078998840e0789a6825208944be0cd2553356b4abb8b6a1882325dabc8d3013d880de0b6b3a764000080c080a0c3b6de99450a27e5bd1c4503d657e7725037e37f01ea95570545f1bb1d5ac77fa079100f752ac8ebeea043acce8f6fb37f4fa3714debeac4e3278aa2a3bf93ea4f"],"blockNumber":"'$(cast --to-hex $(cast block-number))'","stateBlockNumber":"'$(cast --to-hex $(cast block-number))'","coinbase":"0x4bE0Cd2553356b4ABb8b6a1882325dAbC8d3013D"}' | jq .

{
  "bundleHash": "0x9e1a23066a4feda73b2bf3ae946aadd3231a7a2c3e5fd2b13752ef7bb3d7e486",
  "bundleGasPrice": "47619282994047",
  "coinbaseDiff": "1000004942875000000",
  "ethSentToCoinbase": "1000000000000000000",
  "gasFees": "4942875000000",
  "results": [
    {
      "coinbaseDiff": "1000004942875000000",
      "ethSentToCoinbase": "1000000000000000000",
      "fromAddress": "0x1b57edab586cbdabd4d914869ae8bb78dbc05571",
      "gasFees": "4942875000000",
      "gasPrice": "235375000",
      "gasUsed": "0x5208",
      "toAddress": "0x4be0cd2553356b4abb8b6a1882325dabc8d3013d",
      "txHash": "0x3fe98324bab379e12a757059b677ccf5a942a612d4d2f936f6f872a4a00a2738",
      "value": "0x"
    }
  ],
  "stateBlockNumber": "0x17705",
  "totalGasUsed": "0x5208"
}

@mattsse mattsse mentioned this pull request Nov 28, 2024
@mattsse
Copy link
Collaborator

mattsse commented Nov 28, 2024

thanks @ryanschneider

superseded by #12930
applied your changes there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants