Skip to content

Commit 59ecf68

Browse files
authored
Merge branch 'main' into data-store/default-metadata-marshal-json
2 parents 3e64f0d + 6968d63 commit 59ecf68

26 files changed

+629
-112
lines changed

.changeset/cyan-bars-wink.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"chainlink-deployments-framework": minor
3+
---
4+
5+
adds solana program close and support for deploying without extended buffers

.github/workflows/pull-request-main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
with:
2121
only-new-issues: "false"
2222
golangci-lint-version: v2.0.2
23-
# Override the lint args because the detault ones are not compatible with golangci-lint v2
23+
# Override the lint args because the default ones are not compatible with golangci-lint v2
2424
golangci-lint-args: --output.checkstyle.path=golangci-lint-report.xml
2525

2626
ci-lint-misc:

.golangci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ linters:
132132
- third_party$
133133
- builtin$
134134
- examples$
135-
- deployment/*
136135
formatters:
137136
enable:
138137
- goimports

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# chainlink-deployments-framework
22

3+
## 0.0.14
4+
5+
### Patch Changes
6+
7+
- [#39](https://github.com/smartcontractkit/chainlink-deployments-framework/pull/39) [`08e4660`](https://github.com/smartcontractkit/chainlink-deployments-framework/commit/08e46605ecb71276b7a35aa94887473da5ee08fb) Thanks [@jkongie](https://github.com/jkongie)! - BREAKING: Operations retry logic is now opt in. Use the `WithRetry` method in your `ExecuteOperation` call to enable retries
8+
9+
## 0.0.13
10+
11+
### Patch Changes
12+
13+
- [#64](https://github.com/smartcontractkit/chainlink-deployments-framework/pull/64) [`f05efd9`](https://github.com/smartcontractkit/chainlink-deployments-framework/commit/f05efd9b0e417da9e6b0fd53372566584ad65520) Thanks [@graham-chainlink](https://github.com/graham-chainlink)! - migrate more helpers for writing changesets
14+
15+
## 0.0.12
16+
17+
### Patch Changes
18+
19+
- [#62](https://github.com/smartcontractkit/chainlink-deployments-framework/pull/62) [`e31e3ea`](https://github.com/smartcontractkit/chainlink-deployments-framework/commit/e31e3eab10cd8cbb10a3ee17ae4202fb7f9f495f) Thanks [@graham-chainlink](https://github.com/graham-chainlink)! - Add more helpers from chainlink/deployment which are useful for writing changesets
20+
21+
## 0.0.11
22+
23+
### Patch Changes
24+
25+
- [#59](https://github.com/smartcontractkit/chainlink-deployments-framework/pull/59) [`5d5a317`](https://github.com/smartcontractkit/chainlink-deployments-framework/commit/5d5a317363b549ac372b9f1c0430ff9566d4314d) Thanks [@graham-chainlink](https://github.com/graham-chainlink)! - better multiclient logging and expose dial attempts and delay as config
26+
327
## 0.0.10
428

529
### Patch Changes

README.md

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,56 @@
1-
# chainlink-deployments-framework
1+
<div align="center">
2+
<h1>Chainlink Deployments Framework</h1>
3+
<a><img src="https://github.com/smartcontractkit/chainlink-deployments-framework/actions/workflows/push-main.yml/badge.svg" /></a>
4+
<br/>
5+
<br/>
6+
</div>
7+
8+
9+
This repository contains the Chainlink Deployments Framework, a comprehensive set of libraries that enables developers to build, manage, and execute(in future) deployment changesets.
10+
The framework includes the Operations API and Datastore API.
11+
12+
## Usage
13+
14+
```bash
15+
# for writing changesets (migrated from chainlink/deployments
16+
$ go get github.com/smartcontractkit/chainlink-deployments-framework/deployment
17+
18+
# for operations api
19+
$ go get github.com/smartcontractkit/chainlink-deployments-framework/operations
20+
21+
# for datastore api
22+
$ go get github.com/smartcontractkit/chainlink-deployments-framework/datastore
23+
```
24+
25+
## Development
26+
27+
28+
### Installing Dependencies
29+
30+
Install the required tools using [asdf](https://asdf-vm.com/guide/getting-started.html):
31+
32+
```bash
33+
asdf install
34+
```
35+
36+
### Linting
37+
38+
```bash
39+
task lint
40+
```
41+
42+
### Testing
43+
44+
```bash
45+
task test
46+
```
47+
48+
## Contributing
49+
50+
For instructions on how to contribute to `chainlink-deployments-framework` and the release process,
51+
see [CONTRIBUTING.md](https://github.com/smartcontractkit/chainlink-deployments-framework/blob/main/CONTRIBUTING.md)
52+
53+
## Releasing
54+
55+
For instructions on how to release `chainlink-deployments-framework`,
56+
see [RELEASE.md](https://github.com/smartcontractkit/chainlink-deployments-framework/blob/main/RELEASE.md)

deployment/address_book.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package deployment
22

33
import (
4+
"errors"
45
"fmt"
56
"strings"
67
"sync"
@@ -9,7 +10,6 @@ import (
910

1011
"github.com/Masterminds/semver/v3"
1112
"github.com/ethereum/go-ethereum/common"
12-
"github.com/pkg/errors"
1313
chainsel "github.com/smartcontractkit/chain-selectors"
1414
)
1515

@@ -39,6 +39,7 @@ func (tv TypeAndVersion) String() string {
3939

4040
// Use the LabelSet's String method for sorted labels
4141
sortedLabels := tv.Labels.String()
42+
4243
return fmt.Sprintf("%s %s %s",
4344
tv.Type,
4445
tv.Version.String(),
@@ -64,6 +65,7 @@ func MustTypeAndVersionFromString(s string) TypeAndVersion {
6465
if err != nil {
6566
panic(err)
6667
}
68+
6769
return tv
6870
}
6971

@@ -82,6 +84,7 @@ func TypeAndVersionFromString(s string) (TypeAndVersion, error) {
8284
if len(parts) > 2 {
8385
labels = NewLabelSet(parts[2:]...)
8486
}
87+
8588
return TypeAndVersion{
8689
Type: ContractType(parts[0]),
8790
Version: *v,
@@ -121,17 +124,17 @@ type AddressBookMap struct {
121124
func (m *AddressBookMap) save(chainSelector uint64, address string, typeAndVersion TypeAndVersion) error {
122125
family, err := chainsel.GetSelectorFamily(chainSelector)
123126
if err != nil {
124-
return errors.Wrapf(ErrInvalidChainSelector, "chain selector %d", chainSelector)
127+
return fmt.Errorf("%w: chain selector %d", ErrInvalidChainSelector, chainSelector)
125128
}
126129
if family == chainsel.FamilyEVM {
127130
if address == "" || address == common.HexToAddress("0x0").Hex() {
128-
return errors.Wrap(ErrInvalidAddress, "address cannot be empty")
131+
return fmt.Errorf("%w: address cannot be empty", ErrInvalidAddress)
129132
}
130133
if common.IsHexAddress(address) {
131134
// IMPORTANT: WE ALWAYS STANDARDIZE ETHEREUM ADDRESS STRINGS TO EIP55
132135
address = common.HexToAddress(address).Hex()
133136
} else {
134-
return errors.Wrapf(ErrInvalidAddress, "address %s is not a valid Ethereum address, only Ethereum addresses supported for EVM chains", address)
137+
return fmt.Errorf("%w: address %s is not a valid Ethereum address, only Ethereum addresses supported for EVM chains", ErrInvalidAddress, address)
135138
}
136139
}
137140

@@ -149,6 +152,7 @@ func (m *AddressBookMap) save(chainSelector uint64, address string, typeAndVersi
149152
return fmt.Errorf("address %s already exists for chain %d", address, chainSelector)
150153
}
151154
m.addressesByChain[chainSelector][address] = typeAndVersion
155+
152156
return nil
153157
}
154158

@@ -157,6 +161,7 @@ func (m *AddressBookMap) save(chainSelector uint64, address string, typeAndVersi
157161
func (m *AddressBookMap) Save(chainSelector uint64, address string, typeAndVersion TypeAndVersion) error {
158162
m.mtx.Lock()
159163
defer m.mtx.Unlock()
164+
160165
return m.save(chainSelector, address, typeAndVersion)
161166
}
162167

@@ -173,14 +178,14 @@ func (m *AddressBookMap) Addresses() (map[uint64]map[string]TypeAndVersion, erro
173178
func (m *AddressBookMap) AddressesForChain(chainSelector uint64) (map[string]TypeAndVersion, error) {
174179
_, err := chainsel.GetChainIDFromSelector(chainSelector)
175180
if err != nil {
176-
return nil, errors.Wrapf(ErrInvalidChainSelector, "chain selector %d", chainSelector)
181+
return nil, fmt.Errorf("%w: chain selector %d", ErrInvalidChainSelector, chainSelector)
177182
}
178183

179184
m.mtx.RLock()
180185
defer m.mtx.RUnlock()
181186

182187
if _, exists := m.addressesByChain[chainSelector]; !exists {
183-
return nil, errors.Wrapf(ErrChainNotFound, "chain selector %d", chainSelector)
188+
return nil, fmt.Errorf("%w: chain selector %d", ErrChainNotFound, chainSelector)
184189
}
185190

186191
// maps are mutable and pass via a pointer
@@ -207,6 +212,7 @@ func (m *AddressBookMap) Merge(ab AddressBook) error {
207212
}
208213
}
209214
}
215+
210216
return nil
211217
}
212218

@@ -246,6 +252,7 @@ func (m *AddressBookMap) cloneAddresses(input map[uint64]map[string]TypeAndVersi
246252
for chainSelector, chainAddresses := range input {
247253
result[chainSelector] = maps.Clone(chainAddresses)
248254
}
255+
249256
return result
250257
}
251258

@@ -340,6 +347,7 @@ func toTypeAndVersionMap(addrs map[string]TypeAndVersion) map[typeVersionKey][]s
340347
for k, v := range addrs {
341348
tvkMap[tvKey(v)] = append(tvkMap[tvKey(v)], k)
342349
}
350+
343351
return tvkMap
344352
}
345353

deployment/address_book_labels.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ func NewLabelSet(labels ...string) LabelSet {
1414
for _, lb := range labels {
1515
set[lb] = struct{}{}
1616
}
17+
1718
return set
1819
}
1920

@@ -73,6 +74,7 @@ func (ls LabelSet) Equal(other LabelSet) bool {
7374
return false
7475
}
7576
}
77+
7678
return true
7779
}
7880

deployment/address_book_labels_test.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ import (
88

99
func TestNewLabelSet(t *testing.T) {
1010
t.Run("no labels", func(t *testing.T) {
11+
t.Parallel()
1112
ms := NewLabelSet()
1213
assert.Empty(t, ms, "expected empty set")
1314
})
14-
1515
t.Run("some labels", func(t *testing.T) {
16+
t.Parallel()
1617
ms := NewLabelSet("foo", "bar")
1718
assert.Len(t, ms, 2)
1819
assert.True(t, ms.Contains("foo"))
@@ -22,6 +23,7 @@ func TestNewLabelSet(t *testing.T) {
2223
}
2324

2425
func TestLabelSet_Add(t *testing.T) {
26+
t.Parallel()
2527
ms := NewLabelSet("initial")
2628
ms.Add("new")
2729

@@ -35,6 +37,7 @@ func TestLabelSet_Add(t *testing.T) {
3537
}
3638

3739
func TestLabelSet_Remove(t *testing.T) {
40+
t.Parallel()
3841
ms := NewLabelSet("remove_me", "keep")
3942
ms.Remove("remove_me")
4043

@@ -48,6 +51,7 @@ func TestLabelSet_Remove(t *testing.T) {
4851
}
4952

5053
func TestLabelSet_Contains(t *testing.T) {
54+
t.Parallel()
5155
ms := NewLabelSet("foo", "bar")
5256

5357
assert.True(t, ms.Contains("foo"))
@@ -56,7 +60,9 @@ func TestLabelSet_Contains(t *testing.T) {
5660
}
5761

5862
func TestLabelSet_List(t *testing.T) {
63+
t.Parallel()
5964
t.Run("list with items", func(t *testing.T) {
65+
t.Parallel()
6066
ms := NewLabelSet("foo", "bar", "baz")
6167

6268
labels := ms.List()
@@ -68,6 +74,7 @@ func TestLabelSet_List(t *testing.T) {
6874
})
6975

7076
t.Run("empty list", func(t *testing.T) {
77+
t.Parallel()
7178
ms := NewLabelSet()
7279

7380
labels := ms.List()
@@ -78,6 +85,7 @@ func TestLabelSet_List(t *testing.T) {
7885

7986
// TestLabelSet_String tests the String() method of the LabelSet type.
8087
func TestLabelSet_String(t *testing.T) {
88+
t.Parallel()
8189
tests := []struct {
8290
name string
8391
labels LabelSet
@@ -121,15 +129,16 @@ func TestLabelSet_String(t *testing.T) {
121129
}
122130

123131
for _, tt := range tests {
124-
tt := tt
125132
t.Run(tt.name, func(t *testing.T) {
133+
t.Parallel()
126134
result := tt.labels.String()
127135
assert.Equal(t, tt.expected, result, "LabelSet.String() should return the expected sorted string")
128136
})
129137
}
130138
}
131139

132140
func TestLabelSet_Equal(t *testing.T) {
141+
t.Parallel()
133142
tests := []struct {
134143
name string
135144
set1 LabelSet
@@ -193,7 +202,6 @@ func TestLabelSet_Equal(t *testing.T) {
193202
}
194203

195204
for _, tt := range tests {
196-
tt := tt
197205
t.Run(tt.name, func(t *testing.T) {
198206
t.Parallel()
199207

0 commit comments

Comments
 (0)