Skip to content

Commit e7804b8

Browse files
refactor: use chain sel from loop instead of chain.ChainSelector() (#146)
No behaviour change, i had to do this because in Chainlink, there are many tests where they do ``` cldf_chain.NewBlockChains(map[uint64]cldf_chain.BlockChain{ chainselectors.SOLANA_DEVNET.Selector: cldf_solana.Chain{}, }) ``` Discover [in this PR with the CI failures](smartcontractkit/chainlink-deployments#3548) So when we do .EVMChains(), the chainselector is 0 because cldf_solana.Chain{} is set to default value. I could update the code on Chainlink but this involves more code change.
1 parent 925f216 commit e7804b8

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.changeset/four-phones-take.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"chainlink-deployments-framework": patch
3+
---
4+
5+
refactor: use chain sel from loop instead of chain.ChainSelector()

chain/blockchain.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,17 +190,17 @@ func (b BlockChains) ListChainSelectors(options ...ChainSelectorsOption) []uint6
190190
// It handles both value and pointer types, allowing for flexibility in how chains are stored.
191191
func getChainsByType[VT any, PT any](b BlockChains) map[uint64]VT {
192192
chains := make(map[uint64]VT, len(b.chains))
193-
for _, chain := range b.chains {
193+
for sel, chain := range b.chains {
194194
switch c := any(chain).(type) {
195195
case VT:
196-
chains[chain.ChainSelector()] = c
196+
chains[sel] = c
197197
case PT:
198198
val := reflect.ValueOf(c)
199199
if val.Kind() == reflect.Ptr && !val.IsNil() {
200200
elem := val.Elem()
201201
if elem.CanInterface() {
202202
if v, ok := elem.Interface().(VT); ok {
203-
chains[chain.ChainSelector()] = v
203+
chains[sel] = v
204204
}
205205
}
206206
}

0 commit comments

Comments
 (0)