Skip to content

feat(rpc): add eth_coinbase implementation#1597

Closed
MegaRedHand wants to merge 2 commits intoparadigmxyz:mainfrom
lambdaclass:add-coinbase
Closed

feat(rpc): add eth_coinbase implementation#1597
MegaRedHand wants to merge 2 commits intoparadigmxyz:mainfrom
lambdaclass:add-coinbase

Conversation

@MegaRedHand
Copy link
Copy Markdown
Contributor

@MegaRedHand MegaRedHand commented Mar 1, 2023

Ref: #1225

This PR adds the implementation for the eth_coinbase endpoint.

The coinbase is stored as part of the Pool configuration, and accessed via the TransactionPool::status method.

MegaRedHand and others added 2 commits February 28, 2023 18:54
Co-authored-by: lambdaclass-user <github@lambdaclass.com>
Co-authored-by: lambdaclass-user <github@lambdaclass.com>
@MegaRedHand
Copy link
Copy Markdown
Contributor Author

I was unsure of where to put the coinbase configuration. I assume the transaction pool would be in charge of bundling new transactions and minting new blocks (albeit delegating execution), so I think this could be a good place to store it. wdyt?

Comment on lines +17 to +18
/// The address of the pool owner.
pub coinbase: Address,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

hmm I don't think this makes sense here?
what's the argument for binding the coinbase to the pool?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd expect this to be part of the EthApi.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I understand that the coinbase would be the beneficiary or fee recipient of minted blocks, so it would be needed for execution payload building. Maybe we could make it part of EthApi, and pass the value to the block builder as a parameter when needed?

/// Handler for: `eth_coinbase`
async fn author(&self) -> Result<Address> {
Err(internal_rpc_err("unimplemented"))
Ok(self.pool().status().coinbase)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

hmm, I'm actually not sure if this is sound tbh, because tying coinbase to the pool does not feel right.

unsure when we'd actually need this, I guess for block building but isn't this now part of CL @rakita ?

the coinbase endpoint is also disabled on providers like infura etc.

Copy link
Copy Markdown
Collaborator

@rakita rakita Mar 2, 2023

Choose a reason for hiding this comment

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

Coinbase makes sense to be part of block builder but that is still not defined. Execution is building the block but CL is sending the needed parameters that are used to build the block.

Coinbase is send over EngineAPI from CL part. It is part of https://github.com/ethereum/execution-apis/blob/main/src/engine/shanghai.md#payloadattributesv2 :

suggestedFeeRecipient: DATA, 20 Bytes - suggested value for the feeRecipient field of the new payload

So it can be changed depending on given values from CL. Infur and providers probably disabled it because they are not mining, it was set before merge only if the node is configured as a miner (IIRC).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Then, should we close this until block building is defined? Or add it as an attribute of EthApi for now, updating it on every payload received from CL?

@mattsse mattsse added A-rpc Related to the RPC implementation C-discussion A discussion about the direction and design of the project labels Mar 1, 2023
@gakonst
Copy link
Copy Markdown
Member

gakonst commented Mar 9, 2023

Then, should we close this until block building is defined? Or add it as an attribute of EthApi for now, updating it on every payload received from CL?

I think yes, let's close this and defer to @mattsse @rakita @rkrasiuk on where this should sit. I assume it should be close to EthApi / EngineApi.

@gakonst gakonst closed this Mar 9, 2023
@mattsse mattsse mentioned this pull request Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rpc Related to the RPC implementation C-discussion A discussion about the direction and design of the project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants