Skip to content

Commit 4866d7b

Browse files
tynesgakonst
andcommitted
l2geth: remove SignatureHashType (#752)
* l2geth: remove tx type * l2geth: no longer parse type in rollup client * chore: add changeset * chore: remove extra sighash params * fix: do not check txtype in integration tests Co-authored-by: Georgios Konstantopoulos <[email protected]>
1 parent 63eea83 commit 4866d7b

File tree

23 files changed

+74
-193
lines changed

23 files changed

+74
-193
lines changed

.changeset/six-seals-eat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@eth-optimism/l2geth': patch
3+
---
4+
5+
Removes the SignatureHashType from l2geth as it is deprecated and no longer required.

integration-tests/test/queue-ingestion.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ describe('Queue Ingestion', () => {
8686
// The `to` addresses are defined in the previous test and
8787
// increment sequentially.
8888
expect(tx.to).to.be.equal('0x' + `${i}`.repeat(40))
89-
// The transaction type is EIP155
90-
expect(tx.txType).to.be.equal('EIP155')
9189
// The queue origin is Layer 1
9290
expect(tx.queueOrigin).to.be.equal('l1')
9391
// the L1TxOrigin is equal to the Layer one from

integration-tests/test/rpc.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ describe('Basic RPC tests', () => {
225225
await result.wait()
226226

227227
const transaction = (await provider.getTransaction(result.hash)) as any
228-
expect(transaction.txType).to.equal('EIP155')
229228
expect(transaction.queueOrigin).to.equal('sequencer')
230229
expect(transaction.transactionIndex).to.be.eq(0)
231230
expect(transaction.gasLimit).to.be.deep.eq(BigNumber.from(tx.gasLimit))
@@ -246,7 +245,6 @@ describe('Basic RPC tests', () => {
246245
expect(block.number).to.not.equal(0)
247246
expect(typeof block.stateRoot).to.equal('string')
248247
expect(block.transactions.length).to.equal(1)
249-
expect(block.transactions[0].txType).to.equal('EIP155')
250248
expect(block.transactions[0].queueOrigin).to.equal('sequencer')
251249
expect(block.transactions[0].l1TxOrigin).to.equal(null)
252250
})

l2geth/accounts/abi/bind/backends/simulated.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -601,10 +601,9 @@ func (m callmsg) Gas() uint64 { return m.CallMsg.Gas }
601601
func (m callmsg) Value() *big.Int { return m.CallMsg.Value }
602602
func (m callmsg) Data() []byte { return m.CallMsg.Data }
603603

604-
func (m callmsg) L1MessageSender() *common.Address { return m.CallMsg.L1MessageSender }
605-
func (m callmsg) L1BlockNumber() *big.Int { return m.CallMsg.L1BlockNumber }
606-
func (m callmsg) QueueOrigin() *big.Int { return m.CallMsg.QueueOrigin }
607-
func (m callmsg) SignatureHashType() types.SignatureHashType { return m.CallMsg.SignatureHashType }
604+
func (m callmsg) L1MessageSender() *common.Address { return m.CallMsg.L1MessageSender }
605+
func (m callmsg) L1BlockNumber() *big.Int { return m.CallMsg.L1BlockNumber }
606+
func (m callmsg) QueueOrigin() *big.Int { return m.CallMsg.QueueOrigin }
608607

609608
// filterBackend implements filters.Backend to support filtering for logs without
610609
// taking bloom-bits acceleration structures into account.

l2geth/core/rawdb/accessors_chain_test.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ func TestBlockMetaStorage(t *testing.T) {
430430

431431
index1 := uint64(1)
432432
tx1 := types.NewTransaction(1, common.HexToAddress("0x1"), big.NewInt(1), 1, big.NewInt(1), nil)
433-
tx1Meta := types.NewTransactionMeta(nil, 0, nil, types.SighashEIP155, types.QueueOriginSequencer, &index1, nil, nil)
433+
tx1Meta := types.NewTransactionMeta(nil, 0, nil, types.QueueOriginSequencer, &index1, nil, nil)
434434
tx1.SetTransactionMeta(tx1Meta)
435435

436436
WriteTransactionMeta(db, index1, tx1.GetMeta())
@@ -442,9 +442,6 @@ func TestBlockMetaStorage(t *testing.T) {
442442
if meta.L1BlockNumber != nil {
443443
t.Fatalf("Could not recover L1BlockNumber")
444444
}
445-
if meta.SignatureHashType != types.SighashEIP155 {
446-
t.Fatalf("Could not recover sighash type")
447-
}
448445
if meta.Index == nil {
449446
t.Fatalf("Could not recover index")
450447
}
@@ -464,7 +461,7 @@ func TestBlockMetaStorage(t *testing.T) {
464461

465462
index2 := uint64(2)
466463
tx2 := types.NewTransaction(2, common.HexToAddress("0x02"), big.NewInt(2), 2, big.NewInt(2), nil)
467-
tx2Meta := types.NewTransactionMeta(l1BlockNumber, 0, &addr, types.SighashEthSign, types.QueueOriginSequencer, nil, nil, nil)
464+
tx2Meta := types.NewTransactionMeta(l1BlockNumber, 0, &addr, types.QueueOriginSequencer, nil, nil, nil)
468465
tx2.SetTransactionMeta(tx2Meta)
469466

470467
WriteTransactionMeta(db, index2, tx2.GetMeta())
@@ -477,7 +474,4 @@ func TestBlockMetaStorage(t *testing.T) {
477474
if meta2.L1BlockNumber.Cmp(l1BlockNumber) != 0 {
478475
t.Fatalf("Could not recover L1BlockNumber")
479476
}
480-
if meta2.SignatureHashType != types.SighashEthSign {
481-
t.Fatalf("Could not recover sighash type")
482-
}
483477
}

l2geth/core/rawdb/accessors_indexes_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ func TestLookupStorage(t *testing.T) {
7373
l1BlockNumber2 := big.NewInt(2)
7474

7575
tx1 := types.NewTransaction(1, common.BytesToAddress([]byte{0x11}), big.NewInt(111), 1111, big.NewInt(11111), []byte{0x11, 0x11, 0x11})
76-
tx1Meta := types.NewTransactionMeta(l1BlockNumber1, 0, &sender1, types.SighashEIP155, types.QueueOriginSequencer, nil, nil, nil)
76+
tx1Meta := types.NewTransactionMeta(l1BlockNumber1, 0, &sender1, types.QueueOriginSequencer, nil, nil, nil)
7777
tx1.SetTransactionMeta(tx1Meta)
7878

7979
tx2 := types.NewTransaction(2, common.BytesToAddress([]byte{0x22}), big.NewInt(222), 2222, big.NewInt(22222), []byte{0x22, 0x22, 0x22})
80-
tx2Meta := types.NewTransactionMeta(l1BlockNumber2, 0, &sender2, types.SighashEIP155, types.QueueOriginSequencer, nil, nil, nil)
80+
tx2Meta := types.NewTransactionMeta(l1BlockNumber2, 0, &sender2, types.QueueOriginSequencer, nil, nil, nil)
8181
tx2.SetTransactionMeta(tx2Meta)
8282

8383
tx3 := types.NewTransaction(3, common.BytesToAddress([]byte{0x33}), big.NewInt(333), 3333, big.NewInt(33333), []byte{0x33, 0x33, 0x33})
84-
tx3Meta := types.NewTransactionMeta(l1BlockNumber1, 0, nil, types.SighashEIP155, types.QueueOriginSequencer, nil, nil, nil)
84+
tx3Meta := types.NewTransactionMeta(l1BlockNumber1, 0, nil, types.QueueOriginSequencer, nil, nil, nil)
8585
tx3.SetTransactionMeta(tx3Meta)
8686

8787
txs := []*types.Transaction{tx1, tx2, tx3}

l2geth/core/state_transition.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ type Message interface {
7878
L1MessageSender() *common.Address
7979
L1BlockNumber() *big.Int
8080
QueueOrigin() *big.Int
81-
SignatureHashType() types.SignatureHashType
8281
}
8382

8483
// IntrinsicGas computes the 'intrinsic gas' for a message with the given data.

l2geth/core/state_transition_ovm.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ func modMessage(
156156
msg.L1MessageSender(),
157157
msg.L1BlockNumber(),
158158
queueOrigin,
159-
msg.SignatureHashType(),
160159
)
161160

162161
return outmsg, nil

l2geth/core/types/gen_tx_meta_json.go

Lines changed: 8 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

l2geth/core/types/transaction.go

Lines changed: 15 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,6 @@ var (
3535
ErrInvalidSig = errors.New("invalid transaction v, r, s values")
3636
)
3737

38-
// TODO(mark): migrate from sighash type to type
39-
type SignatureHashType uint8
40-
41-
const (
42-
SighashEIP155 SignatureHashType = 0
43-
SighashEthSign SignatureHashType = 1
44-
CreateEOA SignatureHashType = 2
45-
)
46-
4738
type Transaction struct {
4839
data txdata
4940
meta TransactionMeta
@@ -85,7 +76,6 @@ func NewTransaction(nonce uint64, to common.Address, amount *big.Int, gasLimit u
8576
return newTransaction(nonce, &to, amount, gasLimit, gasPrice, data)
8677
}
8778

88-
// TODO: cannot deploy contracts with SighashEthSign right until SighashEIP155 is no longer hardcoded
8979
func NewContractCreation(nonce uint64, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte) *Transaction {
9080
return newTransaction(nonce, nil, amount, gasLimit, gasPrice, data)
9181
}
@@ -95,7 +85,7 @@ func newTransaction(nonce uint64, to *common.Address, amount *big.Int, gasLimit
9585
data = common.CopyBytes(data)
9686
}
9787

98-
meta := NewTransactionMeta(nil, 0, nil, SighashEIP155, QueueOriginSequencer, nil, nil, nil)
88+
meta := NewTransactionMeta(nil, 0, nil, QueueOriginSequencer, nil, nil, nil)
9989

10090
d := txdata{
10191
AccountNonce: nonce,
@@ -230,14 +220,7 @@ func (tx *Transaction) Value() *big.Int { return new(big.Int).Set(tx.data.Amo
230220
func (tx *Transaction) Nonce() uint64 { return tx.data.AccountNonce }
231221
func (tx *Transaction) CheckNonce() bool { return true }
232222

233-
func (tx *Transaction) SetNonce(nonce uint64) { tx.data.AccountNonce = nonce }
234-
func (tx *Transaction) SignatureHashType() SignatureHashType { return tx.meta.SignatureHashType }
235-
func (tx *Transaction) SetSignatureHashType(sighashType SignatureHashType) {
236-
tx.meta.SignatureHashType = sighashType
237-
}
238-
func (tx *Transaction) IsEthSignSighash() bool {
239-
return tx.SignatureHashType() == SighashEthSign
240-
}
223+
func (tx *Transaction) SetNonce(nonce uint64) { tx.data.AccountNonce = nonce }
241224

242225
// To returns the recipient address of the transaction.
243226
// It returns nil if the transaction is a contract creation.
@@ -317,10 +300,9 @@ func (tx *Transaction) AsMessage(s Signer) (Message, error) {
317300
data: tx.data.Payload,
318301
checkNonce: true,
319302

320-
l1MessageSender: tx.meta.L1MessageSender,
321-
l1BlockNumber: tx.meta.L1BlockNumber,
322-
signatureHashType: tx.meta.SignatureHashType,
323-
queueOrigin: tx.meta.QueueOrigin,
303+
l1MessageSender: tx.meta.L1MessageSender,
304+
l1BlockNumber: tx.meta.L1BlockNumber,
305+
queueOrigin: tx.meta.QueueOrigin,
324306
}
325307

326308
var err error
@@ -533,13 +515,12 @@ type Message struct {
533515
data []byte
534516
checkNonce bool
535517

536-
l1MessageSender *common.Address
537-
l1BlockNumber *big.Int
538-
signatureHashType SignatureHashType
539-
queueOrigin *big.Int
518+
l1MessageSender *common.Address
519+
l1BlockNumber *big.Int
520+
queueOrigin *big.Int
540521
}
541522

542-
func NewMessage(from common.Address, to *common.Address, nonce uint64, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte, checkNonce bool, l1MessageSender *common.Address, l1BlockNumber *big.Int, queueOrigin QueueOrigin, signatureHashType SignatureHashType) Message {
523+
func NewMessage(from common.Address, to *common.Address, nonce uint64, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte, checkNonce bool, l1MessageSender *common.Address, l1BlockNumber *big.Int, queueOrigin QueueOrigin) Message {
543524
return Message{
544525
from: from,
545526
to: to,
@@ -550,10 +531,9 @@ func NewMessage(from common.Address, to *common.Address, nonce uint64, amount *b
550531
data: data,
551532
checkNonce: checkNonce,
552533

553-
l1BlockNumber: l1BlockNumber,
554-
l1MessageSender: l1MessageSender,
555-
signatureHashType: signatureHashType,
556-
queueOrigin: big.NewInt(int64(queueOrigin)),
534+
l1BlockNumber: l1BlockNumber,
535+
l1MessageSender: l1MessageSender,
536+
queueOrigin: big.NewInt(int64(queueOrigin)),
557537
}
558538
}
559539

@@ -566,7 +546,6 @@ func (m Message) Nonce() uint64 { return m.nonce }
566546
func (m Message) Data() []byte { return m.data }
567547
func (m Message) CheckNonce() bool { return m.checkNonce }
568548

569-
func (m Message) L1MessageSender() *common.Address { return m.l1MessageSender }
570-
func (m Message) L1BlockNumber() *big.Int { return m.l1BlockNumber }
571-
func (m Message) SignatureHashType() SignatureHashType { return m.signatureHashType }
572-
func (m Message) QueueOrigin() *big.Int { return m.queueOrigin }
549+
func (m Message) L1MessageSender() *common.Address { return m.l1MessageSender }
550+
func (m Message) L1BlockNumber() *big.Int { return m.l1BlockNumber }
551+
func (m Message) QueueOrigin() *big.Int { return m.queueOrigin }

0 commit comments

Comments
 (0)