celo-org / op-geth

GNU Lesser General Public License v3.0
0 stars 0 forks source link

CIP-64 / CIP-66 compatible `TransactionArgs` #123

Closed ezdac closed 3 months ago

ezdac commented 4 months ago

Fixes #109

Add CIP-66 transaction type

This introduces the CeloDenominatedTx type, which will when implemented allow for the fee-currency to be denominated in cel2 native token.

Make the TransactionArgs CIP-64/CIP-66 compatible

The TransactionArgs are used in some API endpoints to fill incomplete fields of passed in transactions and then convert this internally to an EVM-message or Transaction. This PR adds code that distinguishes some combination of passed in fields for the TransactionArgs between CIP-64 and CIP-66 transactions in order to create the concrete internal transaction type. The filling of missing required fields now considers wether the transaction is Celo-denominated or not. Additionally, the new MaxFeeInFeeCurrency field is passed along to the internal transaction representations.

ezdac commented 3 months ago

Will this allow creating CIP-64 txs from the JS console, or does that require additional changes?

I'm not sure what JS console you mean, but in general, if you add an additional argument feeCurrency to calls like eth_fillTransaction and eth_signTransaction (local node with keystore) you should now get back a CIP-64 transaction with filled in defaults (see the added test).

However it seems that most client libraries construct their transactions by potentially making individual calls to eth_gasPrice etc, then rlp-encoding and signing locally and using eth_sendRawTransaction: https://github.com/celo-org/op-geth/issues/109#issuecomment-2084931456

karlb commented 3 months ago

I'm not sure what JS console you mean

I meant to one you get with geth --dev console

aaronmgdr commented 3 months ago

@karlb can we talk about the eth_fillTransaction is it true that if i send params like {feeCurrency: "0x....", value: 0, data: '0x...'} it will give back
{feeCurrency: "0x....", value: 0, data: '0x...', maxFeePerGas: '0x', maxPriorityFeePerGas: '0x', maxFeeInFeeCurrency: '0x', gas: '0x' }