Skip to content

Commit 242e1eb

Browse files
committed
Fixup
1 parent 3fed538 commit 242e1eb

File tree

16 files changed

+428
-691
lines changed

16 files changed

+428
-691
lines changed

sentinel/README.md

Lines changed: 253 additions & 93 deletions
Large diffs are not rendered by default.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// File: blockchain_client_wrapper/geth_wrapper.go
2+
package blockchain_client_wrapper
3+
4+
import (
5+
"context"
6+
"math/big"
7+
8+
"github.com/ethereum/go-ethereum"
9+
"github.com/ethereum/go-ethereum/ethclient"
10+
"github.com/smartcontractkit/chainlink-testing-framework/sentinel/api"
11+
)
12+
13+
// GethWrapper wraps a Geth client to implement the BlockchainClient interface.
14+
type GethWrapper struct {
15+
client *ethclient.Client
16+
}
17+
18+
// NewGethClientWrapper wraps an existing Geth client.
19+
func NewGethClientWrapper(client *ethclient.Client) api.BlockchainClient {
20+
return &GethWrapper{client: client}
21+
}
22+
23+
// BlockNumber retrieves the latest block number.
24+
func (g *GethWrapper) BlockNumber(ctx context.Context) (uint64, error) {
25+
return g.client.BlockNumber(ctx)
26+
}
27+
28+
// BlockByNumber retrieves a block by number.
29+
func (g *GethWrapper) FilterLogs(ctx context.Context, query api.FilterQuery) ([]api.Log, error) {
30+
fromBlock := new(big.Int).SetUint64(query.FromBlock)
31+
toBlock := new(big.Int).SetUint64(query.ToBlock)
32+
33+
// Convert FilterQuery to ethereum.FilterQuery
34+
ethQuery := ethereum.FilterQuery{
35+
FromBlock: fromBlock,
36+
ToBlock: toBlock,
37+
Addresses: query.Addresses,
38+
Topics: query.Topics,
39+
}
40+
41+
// Fetch logs using geth client
42+
ethLogs, err := g.client.FilterLogs(ctx, ethQuery)
43+
if err != nil {
44+
return nil, err
45+
}
46+
47+
// Convert []types.Log to []Log
48+
internalLogs := make([]api.Log, len(ethLogs))
49+
for i, ethLog := range ethLogs {
50+
internalLogs[i] = api.Log{
51+
Address: ethLog.Address,
52+
Topics: ethLog.Topics,
53+
Data: ethLog.Data,
54+
BlockNumber: ethLog.BlockNumber,
55+
TxHash: ethLog.TxHash,
56+
Index: ethLog.Index,
57+
}
58+
}
59+
60+
return internalLogs, nil
61+
}

sentinel/blockchain_wrapper/geth_wrapper.go

Lines changed: 0 additions & 1 deletion
This file was deleted.

sentinel/chain_poller/README.md

Lines changed: 0 additions & 73 deletions
This file was deleted.

sentinel/chain_poller/chain_poller_interface.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"github.com/smartcontractkit/chainlink-testing-framework/sentinel/api"
88
)
99

10-
// ChainPollerInterface defines the methods that ChainPoller must implement.
1110
type ChainPollerInterface interface {
1211
FilterLogs(ctx context.Context, filterQueries []api.FilterQuery) ([]api.Log, error)
1312
}

sentinel/chain_poller_service/README.md

Lines changed: 0 additions & 100 deletions
This file was deleted.

sentinel/chain_poller_service/chain_poller_service.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,13 @@ func (eps *ChainPollerService) pollCycle() {
177177

178178
// Construct filter queries with the same fromBlock and toBlock
179179
var filterQueries []api.FilterQuery
180-
for address, topics := range subscriptions { // 'topics' is []common.Hash
181-
for _, topic := range topics { // Iterate over each topic
182-
filterQueries = append(filterQueries, api.FilterQuery{
183-
FromBlock: fromBlock.Uint64(),
184-
ToBlock: toBlock,
185-
Addresses: []common.Address{address},
186-
Topics: [][]common.Hash{{topic}}, // Separate query per topic
187-
})
188-
}
180+
for _, eventKey := range subscriptions {
181+
filterQueries = append(filterQueries, api.FilterQuery{
182+
FromBlock: fromBlock.Uint64(),
183+
ToBlock: toBlock,
184+
Addresses: []common.Address{eventKey.Address},
185+
Topics: [][]common.Hash{{eventKey.Topic}},
186+
})
189187
}
190188

191189
// Fetch logs using the Chain Poller

sentinel/go.mod

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ require (
88
github.com/ethereum/go-ethereum v1.14.11
99
github.com/rs/zerolog v1.33.0
1010
github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.18
11-
github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.9
1211
github.com/stretchr/testify v1.9.0
1312
)
1413

@@ -17,9 +16,6 @@ require (
1716
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
1817
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
1918
github.com/Microsoft/go-winio v0.6.2 // indirect
20-
github.com/avast/retry-go v3.0.0+incompatible // indirect
21-
github.com/awalterschulze/gographviz v2.0.3+incompatible // indirect
22-
github.com/benbjohnson/clock v1.3.5 // indirect
2319
github.com/bits-and-blooms/bitset v1.13.0 // indirect
2420
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
2521
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
@@ -40,7 +36,6 @@ require (
4036
github.com/ethereum/c-kzg-4844 v1.0.0 // indirect
4137
github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 // indirect
4238
github.com/felixge/httpsnoop v1.0.4 // indirect
43-
github.com/fsnotify/fsnotify v1.7.0 // indirect
4439
github.com/go-logr/logr v1.4.2 // indirect
4540
github.com/go-logr/stdr v1.2.2 // indirect
4641
github.com/go-ole/go-ole v1.3.0 // indirect
@@ -60,11 +55,9 @@ require (
6055
github.com/moby/sys/user v0.1.0 // indirect
6156
github.com/moby/sys/userns v0.1.0 // indirect
6257
github.com/moby/term v0.5.0 // indirect
63-
github.com/montanaflynn/stats v0.7.1 // indirect
6458
github.com/morikuni/aec v1.0.0 // indirect
6559
github.com/opencontainers/go-digest v1.0.0 // indirect
6660
github.com/opencontainers/image-spec v1.1.0 // indirect
67-
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
6861
github.com/pkg/errors v0.9.1 // indirect
6962
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
7063
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
@@ -77,6 +70,7 @@ require (
7770
github.com/testcontainers/testcontainers-go v0.34.0 // indirect
7871
github.com/tklauser/go-sysconf v0.3.12 // indirect
7972
github.com/tklauser/numcpus v0.6.1 // indirect
73+
github.com/urfave/cli/v2 v2.27.5 // indirect
8074
github.com/yusufpapurcu/wmi v1.2.3 // indirect
8175
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect
8276
go.opentelemetry.io/otel v1.28.0 // indirect
@@ -85,7 +79,6 @@ require (
8579
go.opentelemetry.io/otel/sdk v1.19.0 // indirect
8680
go.opentelemetry.io/otel/trace v1.28.0 // indirect
8781
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
88-
go.uber.org/ratelimit v0.3.1 // indirect
8982
golang.org/x/crypto v0.28.0 // indirect
9083
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
9184
golang.org/x/sync v0.8.0 // indirect

sentinel/go.sum

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,6 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo
1010
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
1111
github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI=
1212
github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI=
13-
github.com/avast/retry-go v3.0.0+incompatible h1:4SOWQ7Qs+oroOTQOYnAHqelpCO0biHSxpiH9JdtuBj0=
14-
github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY=
15-
github.com/awalterschulze/gographviz v2.0.3+incompatible h1:9sVEXJBJLwGX7EQVhLm2elIKCm7P2YHFC8v6096G09E=
16-
github.com/awalterschulze/gographviz v2.0.3+incompatible/go.mod h1:GEV5wmg4YquNw7v1kkyoX9etIk8yVmXj+AkDHuuETHs=
17-
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df h1:GSoSVRLoBaFpOOds6QyY1L8AX7uoY+Ln3BHc22W40X0=
18-
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df/go.mod h1:hiVxq5OP2bUGBRNS3Z/bt/reCLFNbdcST6gISi1fiOM=
19-
github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o=
20-
github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
2113
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
2214
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
2315
github.com/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE=
@@ -28,8 +20,6 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOF
2820
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
2921
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
3022
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
31-
github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk=
32-
github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s=
3323
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
3424
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
3525
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
@@ -117,8 +107,6 @@ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
117107
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
118108
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
119109
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
120-
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
121-
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
122110
github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
123111
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
124112
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
@@ -181,8 +169,6 @@ github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g
181169
github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28=
182170
github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0=
183171
github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y=
184-
github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8eaE=
185-
github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
186172
github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
187173
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
188174
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
@@ -193,8 +179,6 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8
193179
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
194180
github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug=
195181
github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM=
196-
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
197-
github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc=
198182
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
199183
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
200184
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
@@ -234,8 +218,6 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ
234218
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
235219
github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.18 h1:a3xetGZh2nFO1iX5xd9OuqiCkgbWLvW6fTN6fgVubPo=
236220
github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.18/go.mod h1:NwmlNKqrb02v4Sci4b5KW644nfH2BW+FrKbWwTN5r6M=
237-
github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.9 h1:yB1x5UXvpZNka+5h57yo1/GrKfXKCqMzChCISpldZx4=
238-
github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.9/go.mod h1:lJk0atEJ5Zyo3Tqrmf1Pl9jUEe79EgDb9bD3K5OTUBI=
239221
github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA=
240222
github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg=
241223
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
@@ -285,10 +267,6 @@ go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+
285267
go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI=
286268
go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I=
287269
go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM=
288-
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
289-
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
290-
go.uber.org/ratelimit v0.3.1 h1:K4qVE+byfv/B3tC+4nYWP7v/6SimcO7HzHekoMNBma0=
291-
go.uber.org/ratelimit v0.3.1/go.mod h1:6euWsTB6U/Nb3X++xEUXA8ciPJvr19Q/0h1+oDcJhRk=
292270
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
293271
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
294272
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=

0 commit comments

Comments
 (0)