Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions .changeset/fluffy-mangos-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@eth-optimism/core-utils': patch
'@eth-optimism/data-transport-layer': patch
---

Add an additional enum for EthSign transactions as they now are batch submitted with 2 different enum values
20 changes: 20 additions & 0 deletions packages/core-utils/src/coders/ecdsa-coder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import { Coder, Signature, Uint16, Uint8, Uint24, Address } from './types'
export enum TxType {
EIP155 = 0,
EthSign = 1,
EthSign2 = 2,
}

export const txTypePlainText = {
0: TxType.EIP155,
1: TxType.EthSign,
2: TxType.EthSign2,
EIP155: TxType.EIP155,
EthSign: TxType.EthSign,
}
Expand Down Expand Up @@ -169,6 +171,20 @@ class EthSignTxCoder extends DefaultEcdsaTxCoder {
}
}

class EthSign2TxCoder extends DefaultEcdsaTxCoder {
constructor() {
super(TxType.EthSign2)
}

public encode(txData: EthSignTxData): string {
return super.encode(txData)
}

public decode(txData: string): EthSignTxData {
return super.decode(txData)
}
}

class Eip155TxCoder extends DefaultEcdsaTxCoder {
constructor() {
super(TxType.EIP155)
Expand Down Expand Up @@ -209,6 +225,9 @@ function decode(data: string | Buffer): EIP155TxData {
if (type === TxType.EthSign) {
return new EthSignTxCoder().decode(data)
}
if (type === TxType.EthSign2) {
return new EthSign2TxCoder().decode(data)
}
return null
}

Expand All @@ -218,6 +237,7 @@ function decode(data: string | Buffer): EIP155TxData {
export const ctcCoder = {
eip155TxData: new Eip155TxCoder(),
ethSignTxData: new EthSignTxCoder(),
ethSign2TxData: new EthSign2TxCoder(),
encode,
decode,
}
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ const maybeDecodeSequencerBatchTransaction = (
} else if (txType === TxType.EthSign) {
type = 'ETH_SIGN'
decoded = ctcCoder.ethSignTxData.decode(transaction.toString('hex'))
} else if (txType === TxType.EthSign2) {
type = 'ETH_SIGN'
decoded = ctcCoder.ethSign2TxData.decode(transaction.toString('hex'))
} else {
throw new Error(`Unknown sequencer transaction type.`)
}
Expand Down