Skip to content

Commit

Permalink
feat: new defs for op-services
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed Jan 23, 2025
1 parent 907945e commit 4dd1989
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 29 deletions.
72 changes: 72 additions & 0 deletions core/types/op_deposit_tx.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package types

import (
"bytes"
"math/big"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/rlp"
)

// CHANGES(taiko): make taiko-geth compatible with the op-service library.
const DepositTxType = 0x7E

type DepositTx struct {
// SourceHash uniquely identifies the source of the deposit
SourceHash common.Hash
// From is exposed through the types.Signer, not through TxData
From common.Address
// nil means contract creation
To *common.Address `rlp:"nil"`
// Mint is minted on L2, locked on L1, nil if no minting.
Mint *big.Int `rlp:"nil"`
// Value is transferred from L2 balance, executed after Mint (if any)
Value *big.Int
// gas limit
Gas uint64
// Field indicating if this transaction is exempt from the L2 gas limit.
IsSystemTransaction bool
// Normal Tx data
Data []byte
}

// copy creates a deep copy of the transaction data and initializes all fields.
func (tx *DepositTx) copy() TxData {

Check failure on line 34 in core/types/op_deposit_tx.go

View workflow job for this annotation

GitHub Actions / test

func `(*DepositTx).copy` is unused (unused)
return nil
}

// accessors for innerTx.
func (tx *DepositTx) txType() byte { return DepositTxType }

Check failure on line 39 in core/types/op_deposit_tx.go

View workflow job for this annotation

GitHub Actions / test

func `(*DepositTx).txType` is unused (unused)
func (tx *DepositTx) chainID() *big.Int { return common.Big0 }

Check failure on line 40 in core/types/op_deposit_tx.go

View workflow job for this annotation

GitHub Actions / test

func `(*DepositTx).chainID` is unused (unused)
func (tx *DepositTx) accessList() AccessList { return nil }

Check failure on line 41 in core/types/op_deposit_tx.go

View workflow job for this annotation

GitHub Actions / test

func `(*DepositTx).accessList` is unused (unused)
func (tx *DepositTx) data() []byte { return tx.Data }

Check failure on line 42 in core/types/op_deposit_tx.go

View workflow job for this annotation

GitHub Actions / test

func `(*DepositTx).data` is unused (unused)
func (tx *DepositTx) gas() uint64 { return tx.Gas }

Check failure on line 43 in core/types/op_deposit_tx.go

View workflow job for this annotation

GitHub Actions / test

func `(*DepositTx).gas` is unused (unused)
func (tx *DepositTx) gasFeeCap() *big.Int { return new(big.Int) }

Check failure on line 44 in core/types/op_deposit_tx.go

View workflow job for this annotation

GitHub Actions / test

func `(*DepositTx).gasFeeCap` is unused (unused)
func (tx *DepositTx) gasTipCap() *big.Int { return new(big.Int) }

Check failure on line 45 in core/types/op_deposit_tx.go

View workflow job for this annotation

GitHub Actions / test

func `(*DepositTx).gasTipCap` is unused (unused)
func (tx *DepositTx) gasPrice() *big.Int { return new(big.Int) }

Check failure on line 46 in core/types/op_deposit_tx.go

View workflow job for this annotation

GitHub Actions / test

func `(*DepositTx).gasPrice` is unused (unused)
func (tx *DepositTx) value() *big.Int { return tx.Value }

Check failure on line 47 in core/types/op_deposit_tx.go

View workflow job for this annotation

GitHub Actions / test

func `(*DepositTx).value` is unused (unused)
func (tx *DepositTx) nonce() uint64 { return 0 }
func (tx *DepositTx) to() *common.Address { return tx.To }
func (tx *DepositTx) isSystemTx() bool { return tx.IsSystemTransaction }

func (tx *DepositTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int {
return dst.Set(new(big.Int))
}

func (tx *DepositTx) effectiveNonce() *uint64 { return nil }

func (tx *DepositTx) rawSignatureValues() (v, r, s *big.Int) {
return common.Big0, common.Big0, common.Big0
}

func (tx *DepositTx) setSignatureValues(chainID, v, r, s *big.Int) {
// this is a noop for deposit transactions
}

func (tx *DepositTx) encode(b *bytes.Buffer) error {
return rlp.Encode(b, tx)
}

func (tx *DepositTx) decode(input []byte) error {
return rlp.DecodeBytes(input, tx)
}
29 changes: 0 additions & 29 deletions core/types/taiko_transaction.go
Original file line number Diff line number Diff line change
@@ -1,34 +1,5 @@
package types

import (
"math/big"

"github.com/ethereum/go-ethereum/common"
)

// To make taiko-geth compatible with op-service.
const DepositTxType = 0x7E

// To make taiko-geth compatible with op-service.
type DepositTx struct {
// SourceHash uniquely identifies the source of the deposit
SourceHash common.Hash
// From is exposed through the types.Signer, not through TxData
From common.Address
// nil means contract creation
To *common.Address `rlp:"nil"`
// Mint is minted on L2, locked on L1, nil if no minting.
Mint *big.Int `rlp:"nil"`
// Value is transferred from L2 balance, executed after Mint (if any)
Value *big.Int
// gas limit
Gas uint64
// Field indicating if this transaction is exempt from the L2 gas limit.
IsSystemTransaction bool
// Normal Tx data
Data []byte
}

func (tx *Transaction) MarkAsAnchor() error {
return tx.inner.markAsAnchor()
}
Expand Down

0 comments on commit 4dd1989

Please sign in to comment.