Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
feat(bindings): update Go contract bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed Apr 5, 2024
1 parent cd26204 commit b3d4653
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "Push docker image to GCR"

on:
push:
branches: [main]
branches: [main,b-9]
tags:
- "v*"

Expand Down
2 changes: 1 addition & 1 deletion bindings/.githead
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b853c08eb82cf93bba81b51169c1add8b42f4b09
a05e7b209611404d64579982d6769ebbf70506c1
105 changes: 77 additions & 28 deletions bindings/gen_taiko_l1.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pkg/rpc/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,14 +420,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 {
stateVars, err := c.TaikoL1.GetStateVariables(&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(stateVars.A.GenesisHeight),
new(big.Int).SetUint64(slotA.GenesisHeight),
); err != nil {
return nil, err
}
Expand Down
7 changes: 5 additions & 2 deletions pkg/rpc/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ func GetProtocolStateVariables(
A bindings.TaikoDataSlotA
B bindings.TaikoDataSlotB
}, error) {
stateVars, err := taikoL1Client.GetStateVariables(opts)
slotA, slotB, err := taikoL1Client.GetStateVariables(opts)
if err != nil {
return nil, err
}
return &stateVars, nil
return &struct {
A bindings.TaikoDataSlotA
B bindings.TaikoDataSlotB
}{slotA, slotB}, nil
}

// CheckProverBalance checks if the prover has the necessary allowance and
Expand Down
6 changes: 3 additions & 3 deletions prover/event_handler/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ func (s *ProverEventHandlerTestSuite) TestGetProvingWindowNotFound() {
}

func (s *ProverEventHandlerTestSuite) TestIsBlockVerified() {
vars, err := s.RPCClient.TaikoL1.GetStateVariables(nil)
_, slotB, err := s.RPCClient.TaikoL1.GetStateVariables(nil)
s.Nil(err)

verified, err := isBlockVerified(
context.Background(),
s.RPCClient,
new(big.Int).SetUint64(vars.B.LastVerifiedBlockId),
new(big.Int).SetUint64(slotB.LastVerifiedBlockId),
)
s.Nil(err)
s.True(verified)

verified, err = isBlockVerified(
context.Background(),
s.RPCClient,
new(big.Int).SetUint64(vars.B.LastVerifiedBlockId+1),
new(big.Int).SetUint64(slotB.LastVerifiedBlockId+1),
)
s.Nil(err)
s.False(verified)
Expand Down

0 comments on commit b3d4653

Please sign in to comment.