protolambda / rollup-node-experiments

rollup node experiments
MIT License
15 stars 5 forks source link

Malformatted L1 Deposit Log #3

Closed trianglesphere closed 2 years ago

trianglesphere commented 2 years ago

Setup

Sending a deposit Tx in the following way (want to mint L2 eth, no contracts or data).

deposit="0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001"
abi="depositTransaction(address,uint256,uint256,bool,bytes)"
account="0x30ec912c5b1d14aa6d1cb9aa7a6682415c4f7eb0"

seth send --password signer_password.txt --keystore data_l1/keystore -F $account $deposit "$abi" $account $(seth --to-wei 1 eth) 1000000 false 0x

Result:

ERROR[01-13|10:40:42.016] Failed to extend L2 chain with new L1 block engine=0 l1=ef188f..1b3981:20 l2=8654b2..a97c39:19 err="failed to derive execution payload inputs: failed to derive user deposits: malformatted L1 deposit log: deposit event data too small (192 bytes): 
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000f4240000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000"
protolambda commented 2 years ago

Are you running the latest staging branch or another thing? Nvm, I see input-deriv-test-cleanup, that should be good, hmm

We added the mint param to the deposit log later on, so maybe it's failing to parse it because that code change is missing

protolambda commented 2 years ago

Found the off by one: 6*32 = 192, 7*32=224

https://github.com/ethereum-optimism/optimistic-specs/blob/212f234ee7bcfd5e813f9c6c2cd12058cfb0f989/opnode/l2/input_derivation.go#L47

Here it increments the offset 6 times with 32 bytes to get to the dynamic remainder of the log data. It starts at 0, not at 32 though, so it should be 6*32.

Will fix, thanks for the bug report!

trianglesphere commented 2 years ago

Ok. I'm going to double check the contract version. Skimming the L1 contract, it seems like it hasn't been updated in over a week (other than some solc changes)

trianglesphere commented 2 years ago

FYI there are 7 fields, but I'm less familiar with how dynamic length fields / bools are packed in

trianglesphere commented 2 years ago

Example log split at 32 byte intervals

address to
address from
u256 mint
u256 value
u256 gasLimit
bool creation
bytes data

0000000000000000000000000000000000000000000000000000000000000000   - to? 
0000000000000000000000000000000000000000000000000de0b6b3a7640000   - from?
00000000000000000000000000000000000000000000000000000000000f4240   - 1000000 (mint/value)
0000000000000000000000000000000000000000000000000000000000000000   - value?
00000000000000000000000000000000000000000000000000000000000000a0   - ??
0000000000000000000000000000000000000000000000000000000000000000   - empty data
protolambda commented 2 years ago

Updated input-deriv-test-cleanup and cherry-picked to staging

protolambda commented 2 years ago
0000000000000000000000000000000000000000000000000000000000000000  # value: 0 (transfer 0 on L2)
0000000000000000000000000000000000000000000000000de0b6b3a7640000  # mint: 0xde0b6b3a7640000 = 1000000000000000000 = 1 ETH (move 1 ETH from L1 to L2)
00000000000000000000000000000000000000000000000000000000000f4240  # gas: 0xf4240 = 1000000
0000000000000000000000000000000000000000000000000000000000000000  # isCreation (boolean set to false)
00000000000000000000000000000000000000000000000000000000000000a0  # data offset: 0xa0 = 160 = 32*5 bytes
0000000000000000000000000000000000000000000000000000000000000000  # data length: 0
# no data contents since length was 0

The to and from are separate from that data, since those are indexed log fields

trianglesphere commented 2 years ago

Ok. I got it. I used the new version and was able to see the balance of the account increase on L2

trianglesphere commented 2 years ago

Fixed in https://github.com/ethereum-optimism/optimistic-specs/pull/128/commits/225955bc37ece44e9a6c4aee5d76e3808a129a75