Use legacy transaction format and defer support of dynamic gas price#78
Conversation
EIP1559d929532 to
bd20b0d
Compare
| gas: U64 | ||
| gas_tip_cap: U256 | ||
| gas_fee_cap: U256 | ||
| gas_price: U256 |
There was a problem hiding this comment.
does gas_price really need U256 size ?
There was a problem hiding this comment.
I am not sure actually, I basically tried to follow those types used in geth. Some of them like nonce and gas have less bits than the one specified in yellow paper, but others match.
So I was thinking there might be some reason for geth to have big.Int for gas_price, so I keep it as U256 here.
There was a problem hiding this comment.
if so, does N_BYTES_GAS = 8 of param.py need to change accordingly ?
There was a problem hiding this comment.
N_BYTES_GAS is for gas itself, tho it could have value up to 256 bits in yellow paper, but it's used as uint64 in geth, so N_BYTES_GAS = 8.
While gas_price is the unit that maps gas to real ether, which also could have value up to 256 bits, and used as big.Int in geth, so we try not to change it in case there is some edge cases that haven't came to our minds.
| caller_balance = rlc_store.to_rlc(int(1e20) - (tx.value + tx.gas * tx.gas_price), 32) | ||
| callee_balance = rlc_store.to_rlc(tx.value, 32) | ||
|
|
||
| bytecode = Bytecode("00") |
There was a problem hiding this comment.
I understand for begin_tx ,the byte code bytecode = Bytecode("00") here doesn't matter for any input , right ?
There was a problem hiding this comment.
Here is a decision I haven't figured it out yet, thanks for reminding me, I will convert this into a issue ASAP.
The decision is, if callee.code_hash = keccak256('') (e.g. callee is not yet a contract or precompiled), and when there is call to it, we have 2 options:
- Only do ether transfer, and not dive into another call.
- Do ether transfer, and prepare the call context just like we are diving into another call. The first executed opcode will always be
STOPbecauseprogram_counter == code_length(this check for opcode lookup is not yet implemented).
The first option is the exact behavior of geth (ref), but it introduces a branch if callee.code == keccak256(''), which requires some more constraints.
The second option is somehow weird, but it doesn't need extra constraint of BeginTx or CALL in the first option, by sacrificing an extra step, which I think is okay to do.
So the testing now have Bytecode("00"), which is actually having the exact behavior of the second option, to temporarily avoid this decision.
There was a problem hiding this comment.
yeah, we can think more later, I can approve this pr first for now.
This PR aims to change the transaction format to legacy one, and defer support of dynamic gas price transaction introduced by
EIP1559to the future work for simplicity.It also does:
add_wordtoadd_wordsto match current circuit implementationCallDataGasCostintx_tablefor lookup to calculate the correct intrinsic gas cost for legacy tx