Skip to content

Commit 087dce7

Browse files
feat(eth): expose AnchorV4ProposalID method (#478)
1 parent d677404 commit 087dce7

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

eth/taiko_api_backend.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func (s *TaikoAPIBackend) getLastBlockByBatchId(batchID *big.Int) (*big.Int, err
110110
break
111111
}
112112
// Decode the AnchorV4 calldata to fetch the proposal ID for comparison.
113-
proposalID, err := anchorV4ProposalID(currentBlock.Transactions()[0].Data())
113+
proposalID, err := AnchorV4ProposalID(currentBlock.Transactions()[0].Data())
114114
if err != nil {
115115
return nil, err
116116
}
@@ -123,8 +123,8 @@ func (s *TaikoAPIBackend) getLastBlockByBatchId(batchID *big.Int) (*big.Int, err
123123
return nil, ethereum.NotFound
124124
}
125125

126-
// anchorV4ProposalID extracts the proposal ID encoded inside an AnchorV4 transaction's calldata.
127-
func anchorV4ProposalID(txData []byte) (*big.Int, error) {
126+
// AnchorV4ProposalID extracts the proposal ID encoded inside an AnchorV4 transaction's calldata.
127+
func AnchorV4ProposalID(txData []byte) (*big.Int, error) {
128128
if len(txData) < len(taiko.AnchorV4Selector) {
129129
return nil, fmt.Errorf("anchorV4 tx data too short: %d", len(txData))
130130
}

eth/taiko_api_backend_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func TestAnchorV4ProposalID(t *testing.T) {
1515
t.Fatalf("failed to decode calldata: %v", err)
1616
}
1717

18-
proposalID, err := anchorV4ProposalID(data)
18+
proposalID, err := AnchorV4ProposalID(data)
1919
if err != nil {
2020
t.Fatalf("unexpected error: %v", err)
2121
}
@@ -27,7 +27,7 @@ func TestAnchorV4ProposalID(t *testing.T) {
2727
}
2828

2929
func TestAnchorV4ProposalIDInvalidData(t *testing.T) {
30-
if _, err := anchorV4ProposalID([]byte{0x10, 0x0f}); err == nil {
30+
if _, err := AnchorV4ProposalID([]byte{0x10, 0x0f}); err == nil {
3131
t.Fatal("expected error for malformed calldata")
3232
}
3333
}

0 commit comments

Comments
 (0)