Skip to content

Commit

Permalink
Merge branch 'develop' into re-2201/network-policy-ingress
Browse files Browse the repository at this point in the history
  • Loading branch information
chainchad authored Jan 22, 2024
2 parents a716c63 + f0543e6 commit 921a8d2
Show file tree
Hide file tree
Showing 43 changed files with 4,200 additions and 80 deletions.
1 change: 1 addition & 0 deletions .github/workflows/automation-benchmark-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ on:
- SEPOLIA
- BASE_GOERLI
- ARBITRUM_SEPOLIA
- LINEA_GOERLI
TestInputs:
description: TestInputs
required: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/solidity-foundry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
strategy:
fail-fast: false
matrix:
product: [vrf, automation, llo-feeds, functions, shared]
product: [vrf, automation, llo-feeds, l2ep, functions, shared]
needs: [changes]
name: Foundry Tests ${{ matrix.product }}
# See https://github.com/foundry-rs/foundry/issues/3827
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,20 @@ spec:
selector:
matchLabels:
app: {{ $.Release.Name }}-db
# Used for testing.
# havoc-component-group and havoc-network-group are used by "havoc" chaos testing tool
havoc-component-group: db
havoc-network-group: db
instance: {{ $cfg.name }}-db
release: {{ $.Release.Name }}
template:
metadata:
labels:
app: {{ $.Release.Name }}-db
# Used for testing.
# havoc-component-group and havoc-network-group are used by "havoc" chaos testing tool
havoc-component-group: db
havoc-network-group: db
instance: {{ $cfg.name }}-db
release: {{ $.Release.Name }}
{{- range $key, $value := $.Values.labels }}
Expand Down
25 changes: 19 additions & 6 deletions charts/chainlink-cluster/templates/chainlink-node-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,39 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ $.Release.Name }}-{{ $cfg.name }}
name: {{ if eq $index 0 }}{{ $.Release.Name }}-{{ $cfg.name }}-bootstrap{{ else }}{{ $.Release.Name }}-{{ $cfg.name }}{{ end }}
spec:
strategy:
# Need to recreate the pod to deal with lease lock held by old pod.
type: Recreate
selector:
matchLabels:
app: {{ $.Release.Name }}
# Used for testing.
# havoc-component-group and havoc-network-group are used by "havoc" chaos testing tool
{{ if eq $index 0 }}{{ else }}
havoc-component-group: node
{{ end }}
{{ if eq $index 0 }}{{ else }}
havoc-network-group: {{ if gt $index 2 }}"1"{{ else }}"2"{{ end }}
{{ end }}
instance: {{ $cfg.name }}
release: {{ $.Release.Name }}
template:
metadata:
labels:
app: {{ $.Release.Name }}
# Used for testing.
# havoc-component-group and havoc-network-group are used by "havoc" chaos testing tool
{{ if eq $index 0 }}{{ else }}
havoc-component-group: node
{{ end }}
{{ if eq $index 0 }}{{ else }}
havoc-network-group: {{ if gt $index 2 }}"1"{{ else }}"2"{{ end }}
{{ end }}

instance: {{ $cfg.name }}
release: {{ $.Release.Name }}
# Used for testing. Role value should either be: bootstrap or node.
# There should only be one "bootstrap" node, the rest should be "node".
# Here we set the first node to be bootstrap, the rest to be node.
role: {{ if eq $index 0 }}bootstrap{{ else }}node{{ end }}
{{- range $key, $value := $.Values.labels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
Expand All @@ -43,7 +56,7 @@ spec:
{{- toYaml $.Values.chainlink.securityContext | nindent 12 }}
image: {{ default "public.ecr.aws/chainlink/chainlink" $cfg.image }}
imagePullPolicy: Always
command: ["bash", "-c", "while ! pg_isready -U postgres --host {{ $.Release.Name }}-db-{{ $cfg.name }} --port 5432; do echo \"waiting for database to start\"; sleep 1; done && chainlink -c /etc/node-secrets-volume/default.toml -c /etc/node-secrets-volume/overrides.toml -secrets /etc/node-secrets-volume/secrets.toml node start -d -p /etc/node-secrets-volume/node-password -a /etc/node-secrets-volume/apicredentials --vrfpassword=/etc/node-secrets-volume/apicredentials"]
command: [ "bash", "-c", "while ! pg_isready -U postgres --host {{ $.Release.Name }}-db-{{ $cfg.name }} --port 5432; do echo \"waiting for database to start\"; sleep 1; done && chainlink -c /etc/node-secrets-volume/default.toml -c /etc/node-secrets-volume/overrides.toml -secrets /etc/node-secrets-volume/secrets.toml node start -d -p /etc/node-secrets-volume/node-password -a /etc/node-secrets-volume/apicredentials --vrfpassword=/etc/node-secrets-volume/apicredentials" ]
ports:
- name: access
containerPort: {{ $.Values.chainlink.web_port }}
Expand Down
8 changes: 8 additions & 0 deletions charts/chainlink-cluster/templates/geth-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,19 @@ spec:
selector:
matchLabels:
app: geth
# Used for testing.
# havoc-component-group and havoc-network-group are used by "havoc" chaos testing tool
havoc-component-group: "blockchain"
havoc-network-group: "blockchain"
release: {{ .Release.Name }}
template:
metadata:
labels:
app: geth
# Used for testing.
# havoc-component-group and havoc-network-group are used by "havoc" chaos testing tool
havoc-component-group: "blockchain"
havoc-network-group: "blockchain"
release: {{ .Release.Name }}
annotations:
{{- range $key, $value := .Values.podAnnotations }}
Expand Down
18 changes: 13 additions & 5 deletions common/txmgr/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,29 +92,34 @@ func NewTracker[
}

func (tr *Tracker[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) Start(_ context.Context) (err error) {
tr.lock.Lock()
defer tr.lock.Unlock()
tr.lggr.Info("Abandoned transaction tracking enabled")
return tr.StartOnce("Tracker", func() error {
return tr.startInternal()
})
}

func (tr *Tracker[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) startInternal() (err error) {
tr.lock.Lock()
defer tr.lock.Unlock()

tr.ctx, tr.ctxCancel = context.WithCancel(context.Background())

if err := tr.setEnabledAddresses(); err != nil {
return fmt.Errorf("failed to set enabled addresses: %w", err)
}
tr.lggr.Info("Enabled addresses set")

if err := tr.trackAbandonedTxes(tr.ctx); err != nil {
return fmt.Errorf("failed to track abandoned txes: %w", err)
}

tr.isStarted = true
if len(tr.txCache) == 0 {
tr.lggr.Infow("no abandoned txes found, skipping runLoop")
tr.lggr.Info("no abandoned txes found, skipping runLoop")
return nil
}

tr.lggr.Infof("%d abandoned txes found, starting runLoop", len(tr.txCache))
tr.wg.Add(1)
go tr.runLoop()
return nil
Expand All @@ -129,7 +134,7 @@ func (tr *Tracker[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) Close() err
}

func (tr *Tracker[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) closeInternal() error {
tr.lggr.Infow("stopping tracker")
tr.lggr.Info("stopping tracker")
if !tr.isStarted {
return fmt.Errorf("tracker not started")
}
Expand Down Expand Up @@ -159,7 +164,7 @@ func (tr *Tracker[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) runLoop() {
}
}
case <-ttlExceeded.C:
tr.lggr.Infow("ttl exceeded")
tr.lggr.Info("ttl exceeded")
tr.MarkAllTxesFatal(tr.ctx)
return
case <-tr.ctx.Done():
Expand Down Expand Up @@ -211,6 +216,7 @@ func (tr *Tracker[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) trackAbando
return fmt.Errorf("tracker already started")
}

tr.lggr.Info("Retrieving non fatal transactions from txStore")
nonFatalTxes, err := tr.txStore.GetNonFatalTransactions(ctx, tr.chainID)
if err != nil {
return fmt.Errorf("failed to get non fatal txes from txStore: %w", err)
Expand Down Expand Up @@ -239,6 +245,8 @@ func (tr *Tracker[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) HandleTxesB
}

func (tr *Tracker[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) handleTxesByState(ctx context.Context, blockHeight int64) error {
tr.lggr.Info("Handling transactions by state")

for id, atx := range tr.txCache {
tx, err := tr.txStore.GetTxByID(ctx, atx.id)
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions common/txmgr/txmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,12 @@ func (b *Txm[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) Start(ctx
return fmt.Errorf("Txm: Estimator failed to start: %w", err)
}

b.logger.Info("Txm starting tracker")
if err := ms.Start(ctx, b.tracker); err != nil {
return fmt.Errorf("Txm: Tracker failed to start: %w", err)
}

b.logger.Info("Txm starting runLoop")
b.wg.Add(1)
go b.runLoop()
<-b.chSubbed
Expand Down
2 changes: 1 addition & 1 deletion contracts/GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ALL_FOUNDRY_PRODUCTS contains a list of all products that have a foundry
# profile defined and use the Foundry snapshots.
ALL_FOUNDRY_PRODUCTS = llo-feeds functions shared
ALL_FOUNDRY_PRODUCTS = l2ep llo-feeds functions shared

# To make a snapshot for a specific product, either set the `FOUNDRY_PROFILE` env var
# or call the target with `FOUNDRY_PROFILE=product`
Expand Down
Loading

0 comments on commit 921a8d2

Please sign in to comment.