Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(taiko-client): revert pr 18442 #18450

Merged
merged 2 commits into from
Nov 6, 2024
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
25 changes: 0 additions & 25 deletions packages/taiko-client/bindings/gen_taiko_l1.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/taiko-client/pkg/rpc/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -594,14 +594,14 @@ func (c *Client) CheckL1Reorg(ctx context.Context, blockID *big.Int) (*ReorgChec
// If we rollback to the genesis block, then there is no L1Origin information recorded in the L2 execution
// engine for that block, so we will query the protocol to use `GenesisHeight` value to reset the L1 cursor.
if blockID.Cmp(common.Big0) == 0 {
state, err := GetProtocolStateVariables(c.TaikoL1, &bind.CallOpts{Context: ctxWithTimeout})
slotA, _, err := c.TaikoL1.GetStateVariables(&bind.CallOpts{Context: ctxWithTimeout})
if err != nil {
return result, err
}

if result.L1CurrentToReset, err = c.L1.HeaderByNumber(
ctxWithTimeout,
new(big.Int).SetUint64(state.A.GenesisHeight),
new(big.Int).SetUint64(slotA.GenesisHeight),
); err != nil {
return nil, err
}
Expand Down
21 changes: 3 additions & 18 deletions packages/taiko-client/pkg/rpc/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package rpc

import (
"context"
"errors"
"math/big"
"os"
"os/signal"
Expand Down Expand Up @@ -32,7 +31,6 @@ var (
syscall.SIGTERM,
syscall.SIGQUIT,
}
ErrSlotBMarshal = errors.New("abi: cannot marshal in to go type: length insufficient 160 require 192")
)

// GetProtocolConfigs gets the protocol configs from TaikoL1 contract.
Expand Down Expand Up @@ -65,24 +63,11 @@ func GetProtocolStateVariables(
opts.Context, cancel = CtxWithTimeoutOrDefault(opts.Context, defaultTimeout)
defer cancel()

var slotBV1 bindings.TaikoDataSlotBV1
// Notice: sloB.LastProposedIn and slotB.LastUnpausedAt are always 0
// before upgrading contract, but we can ignore it since we won't use it.
slotA, slotB, err := taikoL1Client.GetStateVariables(opts)
if err != nil {
if errors.Is(err, ErrSlotBMarshal) {
slotA, slotBV1, err = taikoL1Client.GetStateVariablesV1(opts)
if err != nil {
return nil, err
}
slotB = bindings.TaikoDataSlotB{
NumBlocks: slotBV1.NumBlocks,
LastVerifiedBlockId: slotBV1.LastVerifiedBlockId,
ProvingPaused: slotBV1.ProvingPaused,
LastProposedIn: nil,
LastUnpausedAt: slotBV1.LastUnpausedAt,
}
} else {
return nil, err
}
return nil, err
}
return &struct {
A bindings.TaikoDataSlotA
Expand Down
Loading