mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-30 16:43:46 +00:00
* chore(taiko_genesis): update devnet Pacaya genesis JSONs * feat: update ValidateAnchorTx * feat: update ValidateAnchorTx * feat: update l1Origin * Revert "feat: update l1Origin" This reverts commit 1337b37c051fe06ee87e4b7d6ec2b3857558e218. * feat: update L1Origin * feat: update genesis json * feat: add DepositTxType * feat: add DepositTxType * chore: update ci * feat: new defs * feat: new defs for op-services * feat: new defs for op-services * feat: new defs for op-services * feat: new defs for op-services * feat: new defs for op-services * feat: new defs for op-services * feat: update L1Origin * fix: fix lint errors * add preconf devent configs back in * Update core/rawdb/taiko_l1_origin.go Co-authored-by: maskpp <maskpp266@gmail.com> * feat: two more APIs * feat: update api backend * feat: update api backend * feat: rename an API * feat: rename an API * feat: rename an API * feat: update `BuildPayloadArgs` * feat: update `BuildPayloadArgs` * feat: update `BuildPayloadArgs` * chore: update ci * update preconf genesis * build * feat!: update ci * feat: update devnet json --------- Co-authored-by: maskpp <maskpp266@gmail.com> Co-authored-by: Jeffery Walsh <cyberhorsey@gmail.com>
64 lines
1.6 KiB
Go
64 lines
1.6 KiB
Go
package ethclient
|
|
|
|
import (
|
|
"context"
|
|
"math/big"
|
|
|
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
|
"github.com/ethereum/go-ethereum/core/rawdb"
|
|
)
|
|
|
|
// HeadL1Origin returns the latest L2 block's corresponding L1 origin.
|
|
func (ec *Client) HeadL1Origin(ctx context.Context) (*rawdb.L1Origin, error) {
|
|
var res *rawdb.L1Origin
|
|
|
|
if err := ec.c.CallContext(ctx, &res, "taiko_headL1Origin"); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return res, nil
|
|
}
|
|
|
|
// SetHeadL1Origin sets the latest L2 block's corresponding L1 origin.
|
|
func (ec *Client) SetHeadL1Origin(ctx context.Context, blockID *big.Int) (*big.Int, error) {
|
|
var res *big.Int
|
|
|
|
if err := ec.c.CallContext(ctx, &res, "taiko_setHeadL1Origin", blockID); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return res, nil
|
|
}
|
|
|
|
// L1OriginByID returns the L2 block's corresponding L1 origin.
|
|
func (ec *Client) L1OriginByID(ctx context.Context, blockID *big.Int) (*rawdb.L1Origin, error) {
|
|
var res *rawdb.L1Origin
|
|
|
|
if err := ec.c.CallContext(ctx, &res, "taiko_l1OriginByID", hexutil.EncodeBig(blockID)); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return res, nil
|
|
}
|
|
|
|
// UpdateL1Origin sets the L2 block's corresponding L1 origin.
|
|
func (ec *Client) UpdateL1Origin(ctx context.Context, l1Origin *rawdb.L1Origin) (*rawdb.L1Origin, error) {
|
|
var res *rawdb.L1Origin
|
|
|
|
if err := ec.c.CallContext(ctx, &res, "taiko_updateL1Origin", l1Origin); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return res, nil
|
|
}
|
|
|
|
// GetSyncMode returns the current sync mode of the L2 node.
|
|
func (ec *Client) GetSyncMode(ctx context.Context) (string, error) {
|
|
var res string
|
|
|
|
if err := ec.c.CallContext(ctx, &res, "taiko_getSyncMode"); err != nil {
|
|
return "", err
|
|
}
|
|
|
|
return res, nil
|
|
}
|