Conversation
|
|
||
| /* Library Imports */ | ||
| import { Lib_Bytes32Utils } from "../../libraries/utils/Lib_Bytes32Utils.sol"; | ||
| import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; |
There was a problem hiding this comment.
Files were unused, I removed them.
| import { Lib_BytesUtils } from "../../libraries/utils/Lib_BytesUtils.sol"; | ||
| import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; | ||
| import { Lib_ECDSAUtils } from "../../libraries/utils/Lib_ECDSAUtils.sol"; | ||
| import { Lib_EIP155Tx } from "../../libraries/codec/Lib_EIP155Tx.sol"; |
There was a problem hiding this comment.
This file gets way simpler.
| @@ -0,0 +1,111 @@ | |||
| // SPDX-License-Identifier: MIT | |||
| pragma solidity >0.5.0 <0.9.0; | |||
There was a problem hiding this comment.
Pulled decoding logic into this file to make review easier. It's mostly the same as what was originally in OVM codec. We can confirm this with some careful review.
| @@ -1,98 +0,0 @@ | |||
| // SPDX-License-Identifier: MIT | |||
There was a problem hiding this comment.
File is no longer needed.
| @@ -1,95 +0,0 @@ | |||
| // SPDX-License-Identifier: MIT | |||
There was a problem hiding this comment.
We don't use this in geth and we shouldn't use this in ethereumjs-vm.
| @@ -1,22 +1,4 @@ | |||
| { | |||
| "tests": { | |||
| "decompressEIP155Transaction": { | |||
There was a problem hiding this comment.
Tests move to new eip155tx library.
| address to; | ||
| uint256 value; | ||
| bytes data; | ||
| uint8 recoveryParam; |
There was a problem hiding this comment.
This is basically just caching the recovery param so that it is only computed once instead of needing to compute it when calling sender which is only called once and is always called. Might save gas to use it depending on how well packed this struct can be made
There was a problem hiding this comment.
Right. Given a chain ID, the recovery param will never change. So it seems a bit easier to compute this once (we do actually end up computing this in two different places otherwise).
|
Overall good changes. The abi is changing, we need to make sure to not break everything when we publish these changes. Also we dont have hardhat deploy so there are no deployment artifacts in this repo so we need to be mindful about this change. |
| TransactionType transactionType = _getTransactionType(Lib_BytesUtils.toUint8(msg.data, 0)); | ||
|
|
||
| bytes32 r = Lib_BytesUtils.toBytes32(Lib_BytesUtils.slice(msg.data, 1, 32)); | ||
| bytes32 s = Lib_BytesUtils.toBytes32(Lib_BytesUtils.slice(msg.data, 33, 32)); |
There was a problem hiding this comment.
Removes the calls to slice which is good
|
The calldata size of using a RLP encoded tx is about ~250 gas more than using the custom serialization. Trading a bit of cost for simplicity, but its possible that the gas usage was decreased elsewhere in these changes. We really need automated gas metering in CI |
| import { Lib_SafeExecutionManagerWrapper } from "../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol"; | ||
| import { Lib_SafeMathWrapper } from "../../libraries/wrappers/Lib_SafeMathWrapper.sol"; | ||
|
|
||
| import { console } from "hardhat/console.sol"; |
There was a problem hiding this comment.
I know this is WIP, but just noting to remove this
| bytes memory _out | ||
| ) | ||
| { | ||
| return writeBytes(abi.encodePacked(_in)); |
There was a problem hiding this comment.
bytes32 isn't treated any differently from bytes when it comes to RLP.
| const message = serializeNativeTransaction(DEFAULT_EIP155_TX) | ||
| const sig = await signNativeTransaction(wallet, DEFAULT_EIP155_TX) | ||
| const transaction = DEFAULT_EIP155_TX | ||
| const encodedTransaction = await wallet.signTransaction(transaction) |
There was a problem hiding this comment.
These tests get way simpler.
| @@ -0,0 +1,248 @@ | |||
| { | |||
There was a problem hiding this comment.
Using this test file as the source of these tests: https://github.com/ethereumjs/ethereumjs-tx/blob/master/test/ttTransactionTestEip155VitaliksTests.json
There was a problem hiding this comment.
I didn't test hash here, but sender implicitly tests this under the hood so it should be fine.
There was a problem hiding this comment.
Covers tests for decode, encode, and sender.
| "0x044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", | ||
| "0x01", | ||
| "0x00", | ||
| false |
There was a problem hiding this comment.
Format is:
[
"0x00", // nonce
"0x04a817c800", // gasPrice
"0x5208", // gasLimit
"0x3535353535353535353535353535353535353535", // to
"0x00", // value
"0x", // data
"0x25", // v
"0x044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", // r
"0x044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", // s
"0x01", // chainId
"0x00", // recoveryParam
false // isCreate
]| import { Contract, BigNumber } from 'ethers' | ||
|
|
||
| const bigNumberify = (arr) => { | ||
| const bnRegex = /^\d+n$/gm |
There was a problem hiding this comment.
Made this generally more reliable. Treat more things as big numbers so that equality checking is easier.
| }) | ||
|
|
||
| // TEMPORARY: Skip gas checks for minnet. | ||
| it.skip(`should revert on insufficient gas`, async () => { |
There was a problem hiding this comment.
Skipped test has been modified. Should double check it still passes
|
Note that this change must be done in a way that is backwards compatible with the current ctc elements. From the point of view of geth, the old contract must be used when syncing the initial set of transactions. This makes me lean towards not changing the contract and adding a new one that is This means that geth needs the old serialization logic still and we need a way to selectively set |
|
CI Fails at: |
|
Converting to draft until checks pass. |
|
Is this dead? |
Description
Updates our sequencer entrypoint and ECDSA contracts to use the standard RLP encoding that we're using in geth now.
Metadata
Fixes
Contributing Agreement