Skip to content

Commit 58930a4

Browse files
Small fixes (#47)
* Fix typo in log message and update README path for solidity types mapping * Refactor metrics handling in sendOnlyNode tests for improved clarity and accuracy
1 parent 7155263 commit 58930a4

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

chains/heads/tracker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ func (t *tracker[HTH, S, ID, BHASH]) backfill(ctx context.Context, head, latestF
514514
}
515515

516516
if head.BlockHash() != latestFinalizedHead.BlockHash() {
517-
t.log.Criticalw("Finalized block missing from conical chain",
517+
t.log.Criticalw("Finalized block missing from canonical chain",
518518
"finalized_block_number", latestFinalizedHead.BlockNumber(), "finalized_hash", latestFinalizedHead.BlockHash(),
519519
"canonical_chain_block_number", head.BlockNumber(), "canonical_chain_hash", head.BlockHash())
520520
return FinalizedMissingError[BHASH]{latestFinalizedHead.BlockHash(), head.BlockHash()}

multinode/send_only_node.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ func (s *sendOnlyNode[CHAIN_ID, RPC]) start() {
119119
if err != nil || chainID.String() != s.chainID.String() {
120120
s.metrics.IncrementNodeTransitionsToUnreachable(ctx, s.name)
121121
if err != nil {
122-
s.metrics.IncrementNodeTransitionsToUnreachable(ctx, s.name)
123122
s.log.Errorw(fmt.Sprintf("Verify failed: %v", err), "err", err)
124123
s.setState(nodeStateUnreachable)
125124
} else {

multinode/send_only_node_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,13 @@ func TestStartSendOnlyNode(t *testing.T) {
7777
client := newMockSendOnlyClient[ID](t)
7878
client.On("Close").Once()
7979
client.On("Dial", mock.Anything).Return(nil)
80+
metrics := makeMockNodeMetrics(t)
8081
expectedError := errors.New("failed to get chain ID")
8182
chainID := RandomID()
8283
const failuresCount = 2
8384
client.On("ChainID", mock.Anything).Return(RandomID(), expectedError).Times(failuresCount)
8485

85-
s := NewSendOnlyNode(lggr, makeMockNodeMetrics(t), url.URL{}, t.Name(), chainID, client)
86+
s := NewSendOnlyNode(lggr, metrics, url.URL{}, t.Name(), chainID, client)
8687

8788
defer func() { assert.NoError(t, s.Close()) }()
8889
err := s.Start(tests.Context(t))
@@ -93,6 +94,8 @@ func TestStartSendOnlyNode(t *testing.T) {
9394
tests.AssertLogCountEventually(t, observedLogs, fmt.Sprintf("Verify failed: %v", expectedError), failuresCount)
9495
client.On("ChainID", mock.Anything).Return(chainID, nil)
9596
tests.AssertEventually(t, func() bool { return s.State() == nodeStateAlive })
97+
metrics.AssertNumberOfCalls(t, "IncrementNodeTransitionsToUnreachable", 1)
98+
metrics.AssertNumberOfCalls(t, "IncrementNodeTransitionsToAlive", 1)
9699
})
97100
t.Run("Can recover from chainID mismatch", func(t *testing.T) {
98101
t.Parallel()
@@ -105,7 +108,8 @@ func TestStartSendOnlyNode(t *testing.T) {
105108
const failuresCount = 2
106109
client.On("ChainID", mock.Anything).Return(rpcChainID, nil).Times(failuresCount)
107110
client.On("ChainID", mock.Anything).Return(configuredChainID, nil)
108-
s := NewSendOnlyNode(lggr, makeMockNodeMetrics(t), url.URL{}, t.Name(), configuredChainID, client)
111+
metrics := makeMockNodeMetrics(t)
112+
s := NewSendOnlyNode(lggr, metrics, url.URL{}, t.Name(), configuredChainID, client)
109113

110114
defer func() { assert.NoError(t, s.Close()) }()
111115
err := s.Start(tests.Context(t))
@@ -117,6 +121,9 @@ func TestStartSendOnlyNode(t *testing.T) {
117121
tests.AssertEventually(t, func() bool {
118122
return s.State() == nodeStateAlive
119123
})
124+
metrics.AssertNumberOfCalls(t, "IncrementNodeTransitionsToUnreachable", 1)
125+
metrics.AssertNumberOfCalls(t, "IncrementNodeTransitionsToInvalidChainID", 1)
126+
metrics.AssertNumberOfCalls(t, "IncrementNodeTransitionsToAlive", 1)
120127
})
121128
t.Run("Start with Random ChainID", func(t *testing.T) {
122129
t.Parallel()

tools/evm-chain-bindings/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ With probably plenty of bugs to be fixed, the POC supports:
1818
- Simple and complex types inputs and outputs.
1919
- Basic chain reader and chain writer configuration but works for simple use cases.
2020

21-
Solidity primitive types to Go primitive types are not fully mapped. If you encounter an issue regarding type mapping you can update the code in internal/gen/evm/solity_types_mapping.go
21+
Solidity primitive types to Go primitive types are not fully mapped. If you encounter an issue regarding type mapping you can update the code in pkg/gen/evm/solidity_types_mapping.go
2222

2323
## Troubleshooting and issue reporting
2424

0 commit comments

Comments
 (0)