Skip to content

Commit f6d6a51

Browse files
committed
Merge branch 'master' into rodrigo/expand-reexecution-metrics
2 parents cbc6298 + aa60844 commit f6d6a51

File tree

21 files changed

+546
-45
lines changed

21 files changed

+546
-45
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
/flake.nix @joshua-kim @maru-ava
2323
/network/p2p/ @joshua-kim
2424
/network/p2p/*.md @joshua-kim @meaghanfitzgerald
25+
/nix/* @joshua-kim @maru-ava
2526
/scripts/ @joshua-kim @maru-ava
2627
/scripts/*.md @joshua-kim @maru-ava @meaghanfitzgerald
2728
/scripts/benchmark_cchain_range.sh @aaronbuchwald

.github/actions/c-chain-reexecution-benchmark/action.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ inputs:
3030
description: 'The duration of the AWS role to assume for S3 access.'
3131
required: true
3232
default: '43200' # 12 hours
33+
prometheus-url:
34+
description: 'The URL of the prometheus instance.'
35+
required: true
36+
default: ''
3337
prometheus-push-url:
3438
description: 'The push URL of the prometheus instance.'
3539
required: true
@@ -60,7 +64,6 @@ inputs:
6064
runs:
6165
using: composite
6266
steps:
63-
- uses: ./.github/actions/setup-go-for-project
6467
- name: Set task env
6568
shell: bash
6669
run: |
@@ -93,6 +96,7 @@ runs:
9396
BENCHMARK_OUTPUT_FILE=${{ env.BENCHMARK_OUTPUT_FILE }} \
9497
RUNNER_NAME=${{ inputs.runner_name }} \
9598
METRICS_ENABLED=true
99+
prometheus_url: ${{ inputs.prometheus-url }}
96100
prometheus_push_url: ${{ inputs.prometheus-push-url }}
97101
prometheus_username: ${{ inputs.prometheus-username }}
98102
prometheus_password: ${{ inputs.prometheus-password }}
@@ -108,8 +112,6 @@ runs:
108112
github-token: ${{ inputs.github-token }}
109113
auto-push: ${{ inputs.push-github-action-benchmark }}
110114

111-
- uses: ./.github/actions/install-nix
112-
if: ${{ inputs.push-post-state != '' }}
113115
- name: Push Post-State to S3 (if not exists)
114116
if: ${{ inputs.push-post-state != '' }}
115117
shell: nix develop --command bash -x {0}

.github/actions/install-nix/action.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,23 @@ runs:
1515
github_access_token: ${{ inputs.github_token }}
1616
- run: nix develop --command echo "dependencies installed"
1717
shell: bash
18+
# Cache Go modules (architecture-independent)
19+
- uses: actions/cache@v4
20+
id: go-mod-cache
21+
with:
22+
path: ~/go/pkg/mod
23+
key: ${{ runner.os }}-go-mod-${{ hashFiles('go.sum', 'tools/go.sum') }}
24+
restore-keys: ${{ runner.os }}-go-mod-
25+
# Cache Go build cache (architecture-specific)
26+
- uses: actions/cache@v4
27+
with:
28+
path: ~/.cache/go-build
29+
key: ${{ runner.os }}-${{ runner.arch }}-go-build-${{ hashFiles('go.sum', 'tools/go.sum') }}
30+
restore-keys: ${{ runner.os }}-${{ runner.arch }}-go-build-
31+
# Download modules only on cache miss
32+
- run: nix develop --command go mod download
33+
if: steps.go-mod-cache.outputs.cache-hit != 'true'
34+
shell: bash
35+
- run: nix develop --command go mod download -modfile=tools/go.mod
36+
if: steps.go-mod-cache.outputs.cache-hit != 'true'
37+
shell: bash

.github/actions/run-monitored-tmpnet-cmd/action.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,33 @@ runs:
5959
# - Avoid using the install-nix custom action since a relative
6060
# path wouldn't be resolveable from other repos and an absolute
6161
# path would require setting a version.
62+
# - TODO(marun) Switch to a relative reference to the install-nix
63+
# custom action if/when no external repos use this action.
6264
- uses: cachix/install-nix-action@02a151ada4993995686f9ed4f1be7cfbb229e56f #v31
6365
with:
6466
github_access_token: ${{ inputs.github_token }}
6567
- run: $GITHUB_ACTION_PATH/nix-develop.sh --command echo "dependencies installed"
6668
shell: bash
69+
# Cache Go modules (architecture-independent)
70+
- uses: actions/cache@v4
71+
id: go-mod-cache
72+
with:
73+
path: ~/go/pkg/mod
74+
key: ${{ runner.os }}-go-mod-${{ hashFiles('go.sum', 'tools/go.sum') }}
75+
restore-keys: ${{ runner.os }}-go-mod-
76+
# Cache Go build cache (architecture-specific)
77+
- uses: actions/cache@v4
78+
with:
79+
path: ~/.cache/go-build
80+
key: ${{ runner.os }}-${{ runner.arch }}-go-build-${{ hashFiles('go.sum', 'tools/go.sum') }}
81+
restore-keys: ${{ runner.os }}-${{ runner.arch }}-go-build-
82+
# Download modules only on cache miss
83+
- run: $GITHUB_ACTION_PATH/nix-develop.sh --command go mod download
84+
if: steps.go-mod-cache.outputs.cache-hit != 'true'
85+
shell: bash
86+
- run: $GITHUB_ACTION_PATH/nix-develop.sh --command go mod download -modfile=tools/go.mod
87+
if: steps.go-mod-cache.outputs.cache-hit != 'true'
88+
shell: bash
6789
- name: Notify of metrics availability
6890
if: (inputs.prometheus_username != '')
6991
shell: bash

.github/workflows/c-chain-reexecution-benchmark-container.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ jobs:
105105
end-block: ${{ matrix.end-block }}
106106
block-dir-src: ${{ matrix.block-dir-src }}
107107
current-state-dir-src: ${{ matrix.current-state-dir-src }}
108+
prometheus-url: ${{ secrets.PROMETHEUS_URL || '' }}
108109
prometheus-push-url: ${{ secrets.PROMETHEUS_PUSH_URL || '' }}
109110
prometheus-username: ${{ secrets.PROMETHEUS_USERNAME || '' }}
110111
prometheus-password: ${{ secrets.PROMETHEUS_PASSWORD || '' }}

.github/workflows/c-chain-reexecution-benchmark-gh-native.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ jobs:
9595
end-block: ${{ matrix.end-block }}
9696
block-dir-src: ${{ matrix.block-dir-src }}
9797
current-state-dir-src: ${{ matrix.current-state-dir-src }}
98+
prometheus-url: ${{ secrets.PROMETHEUS_URL || '' }}
9899
prometheus-push-url: ${{ secrets.PROMETHEUS_PUSH_URL || '' }}
99100
prometheus-username: ${{ secrets.PROMETHEUS_USERNAME || '' }}
100101
prometheus-password: ${{ secrets.PROMETHEUS_PASSWORD || '' }}

.github/workflows/ci.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ jobs:
4646
runs-on: ubuntu-latest
4747
steps:
4848
- uses: actions/checkout@v4
49-
- uses: ./.github/actions/setup-go-for-project
5049
- name: Run e2e tests
5150
uses: ./.github/actions/run-monitored-tmpnet-cmd
5251
with:
@@ -65,7 +64,6 @@ jobs:
6564
runs-on: ubuntu-latest
6665
steps:
6766
- uses: actions/checkout@v4
68-
- uses: ./.github/actions/setup-go-for-project
6967
- name: Run e2e tests
7068
uses: ./.github/actions/run-monitored-tmpnet-cmd
7169
with:
@@ -84,7 +82,6 @@ jobs:
8482
runs-on: ubuntu-latest
8583
steps:
8684
- uses: actions/checkout@v4
87-
- uses: ./.github/actions/setup-go-for-project
8885
- uses: ./.github/actions/run-monitored-tmpnet-cmd
8986
with:
9087
run: ./scripts/run_task.sh test-e2e-kube-ci
@@ -103,7 +100,6 @@ jobs:
103100
runs-on: ubuntu-latest
104101
steps:
105102
- uses: actions/checkout@v4
106-
- uses: ./.github/actions/setup-go-for-project
107103
- name: Run e2e tests with existing network
108104
uses: ./.github/actions/run-monitored-tmpnet-cmd
109105
with:
@@ -121,7 +117,6 @@ jobs:
121117
runs-on: ubuntu-latest
122118
steps:
123119
- uses: actions/checkout@v4
124-
- uses: ./.github/actions/setup-go-for-project
125120
- name: Run e2e tests
126121
uses: ./.github/actions/run-monitored-tmpnet-cmd
127122
with:
@@ -139,7 +134,6 @@ jobs:
139134
runs-on: ubuntu-latest
140135
steps:
141136
- uses: actions/checkout@v4
142-
- uses: ./.github/actions/setup-go-for-project
143137
- uses: ./.github/actions/install-nix
144138
- name: Runs all lint checks
145139
shell: nix develop --command bash -x {0}
@@ -157,7 +151,6 @@ jobs:
157151
runs-on: ubuntu-latest
158152
steps:
159153
- uses: actions/checkout@v4
160-
- uses: ./.github/actions/setup-go-for-project
161154
# Use the dev shell instead of bufbuild/buf-action to ensure the dev shell provides the expected versions
162155
- uses: ./.github/actions/install-nix
163156
- shell: nix develop --command bash -x {0}
@@ -183,7 +176,6 @@ jobs:
183176
runs-on: ubuntu-latest
184177
steps:
185178
- uses: actions/checkout@v4
186-
- uses: ./.github/actions/setup-go-for-project
187179
- uses: ./.github/actions/install-nix
188180
- shell: nix develop --command bash -x {0}
189181
run: task check-generate-load-contract-bindings
@@ -230,7 +222,6 @@ jobs:
230222
runs-on: ubuntu-latest
231223
steps:
232224
- uses: actions/checkout@v4
233-
- uses: ./.github/actions/setup-go-for-project
234225
- uses: ./.github/actions/install-nix
235226
- name: Run e2e tests
236227
shell: bash
@@ -240,7 +231,6 @@ jobs:
240231
runs-on: ubuntu-latest
241232
steps:
242233
- uses: actions/checkout@v4
243-
- uses: ./.github/actions/setup-go-for-project
244234
- uses: ./.github/actions/run-monitored-tmpnet-cmd
245235
with:
246236
run: ./scripts/run_task.sh test-load -- --load-timeout=30s
@@ -258,7 +248,6 @@ jobs:
258248
runs-on: ubuntu-latest
259249
steps:
260250
- uses: actions/checkout@v4
261-
- uses: ./.github/actions/setup-go-for-project
262251
- uses: ./.github/actions/run-monitored-tmpnet-cmd
263252
with:
264253
run: ./scripts/run_task.sh test-load-kube-kind -- --load-timeout=30s
@@ -276,7 +265,6 @@ jobs:
276265
runs-on: ubuntu-latest
277266
steps:
278267
- uses: actions/checkout@v4
279-
- uses: ./.github/actions/setup-go-for-project
280268
- uses: ./.github/actions/install-nix
281269
# TODO(marun) Extend testing of robustness beyond deploying a suitable test environment
282270
- name: Deploy kind with chaos mesh

.github/workflows/firewood-load-test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ jobs:
2020
sudo apt-get install -y xz-utils
2121
fi
2222
- uses: actions/checkout@v4
23-
- uses: ./.github/actions/setup-go-for-project
2423
- uses: ./.github/actions/run-monitored-tmpnet-cmd
2524
with:
2625
run: ./scripts/run_task.sh test-load -- --load-timeout=30m --firewood

.github/workflows/self-hosted-load-tests.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ jobs:
3434
sudo apt-get install -y xz-utils
3535
fi
3636
- uses: actions/checkout@v4
37-
- uses: ./.github/actions/setup-go-for-project
3837
- name: Run load test
3938
uses: ./.github/actions/run-monitored-tmpnet-cmd
4039
with:

database/database.go

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,29 @@ type Database interface {
9595
health.Checker
9696
}
9797

98-
// HeightIndex defines the interface for storing and retrieving entries by height.
98+
// HeightIndex defines the interface for storing and retrieving values by height.
9999
type HeightIndex interface {
100-
// Put inserts the entry into the store at the given height.
101-
Put(height uint64, bytes []byte) error
100+
// Put inserts the value into the database at the given height.
101+
//
102+
// If value is nil or an empty slice, then when it's retrieved it may be nil
103+
// or an empty slice.
104+
//
105+
// value is safe to read and modify after calling Put.
106+
Put(height uint64, value []byte) error
102107

103-
// Get retrieves an entry by its height.
108+
// Get retrieves a value by its height.
109+
// Returns [ErrNotFound] if the key is not present in the database.
110+
//
111+
// Returned []byte is safe to read and modify after calling Get.
104112
Get(height uint64) ([]byte, error)
105113

106-
// Has checks if an entry exists at the given height.
114+
// Has checks if a value exists at the given height.
115+
//
116+
// Returns true even if the stored value is nil or empty.
107117
Has(height uint64) (bool, error)
108118

109119
// Close closes the database.
120+
//
121+
// Calling Close after Close returns [ErrClosed].
110122
io.Closer
111123
}

0 commit comments

Comments
 (0)