Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,31 @@ const maybeDecodeSequencerBatchTransaction = (
let decoded = null
let type = null

try {
// Try to decode as RLP first. This function will throw if the transaction can't be properly
// decoded as RLP and we'll get bumped down to the next set of possible decodings.
const decodedTx = ethers.utils.parseTransaction(transaction)

return {
type: 'EIP155',
decoded: {
nonce: BigNumber.from(decodedTx.nonce).toNumber(),
gasPrice: BigNumber.from(decodedTx.gasPrice).toNumber(),
gasLimit: BigNumber.from(decodedTx.gasLimit).toNumber(),
target: toHexString(decodedTx.to), // Maybe null this out for creations?
data: toHexString(decodedTx.data),
sig: {
v: BigNumber.from(decodedTx.v).toNumber(),
r: toHexString(decodedTx.r),
s: toHexString(decodedTx.s),
},
type: 0, // EIP155 legacy holdover.
},
}
} catch (err) {
// Do nothing, fall back to legacy decode.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should increment a Counter here; cc @annieke

}

try {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We don't need this decoding anymore because we don't have to be backwards compatible

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Assuming this is added to semver version 0.3.x

const txType = transaction.slice(0, 1).readUInt8()
if (txType === TxType.EIP155) {
Expand Down