Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push ${{ matrix.app.name }} Docker image
uses: docker/build-push-action@v6
uses: docker/build-push-action@v7

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Build Docker Images' step
Uses Step
uses 'docker/build-push-action' with ref 'v7', not a pinned commit hash
with:
context: .
file: ${{ matrix.app.dockerfile }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
uses: docker/build-push-action@v7

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Apps release' step
Uses Step
uses 'docker/build-push-action' with ref 'v7', not a pinned commit hash
with:
context: .
file: ${{ needs.parse-tag.outputs.dockerfile }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build evstack:local-dev (cached)
uses: docker/build-push-action@v6
uses: docker/build-push-action@v7

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium test

Unpinned 3rd party Action 'Tests / Code Coverage' step
Uses Step
uses 'docker/build-push-action' with ref 'v7', not a pinned commit hash
with:
context: .
file: apps/testapp/Dockerfile
Expand Down
74 changes: 34 additions & 40 deletions types/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,46 +111,7 @@ func TestAssertValidForNextState(t *testing.T) {
data: &Data{},
expectedError: "dataHash from the header does not match with hash",
},
"last header hash mismatch (first time)": {
state: State{
ChainID: "test-chain",
LastHeaderHash: []byte("hash"),
LastBlockHeight: 1,
LastBlockTime: now,
},
header: &SignedHeader{
Header: Header{
BaseHeader: BaseHeader{
ChainID: "test-chain", Height: 2,
Time: nowUnixNano,
},
DataHash: dataHashForEmptyTxs,
LastHeaderHash: []byte("other-hash"),
},
},
data: &Data{},
expectedError: "",
},
"last header hash mismatch (second time)": {
state: State{
ChainID: "test-chain",
LastHeaderHash: []byte("hash"),
LastBlockHeight: 1,
LastBlockTime: now,
},
header: &SignedHeader{
Header: Header{
BaseHeader: BaseHeader{
ChainID: "test-chain", Height: 2,
Time: nowUnixNano,
},
DataHash: dataHashForEmptyTxs,
LastHeaderHash: []byte("other-hash"),
},
},
data: &Data{},
expectedError: "invalid last header hash",
},

"app hash mismatch": {
state: State{
ChainID: "test-chain",
Expand Down Expand Up @@ -184,4 +145,37 @@ func TestAssertValidForNextState(t *testing.T) {
assert.ErrorContains(t, err, tc.expectedError)
})
}

// The last-header-hash grace period is stateful: the first mismatch is
// tolerated (based-sequencer transition), the second is an error.
// These two calls must run in order on the same global state, so they
// cannot be independent map entries.
t.Run("last header hash mismatch grace period", func(t *testing.T) {
state := State{
ChainID: "test-chain",
LastHeaderHash: []byte("hash"),
LastBlockHeight: 1,
LastBlockTime: now,
}
header := &SignedHeader{
Header: Header{
BaseHeader: BaseHeader{
ChainID: "test-chain", Height: 2,
Time: nowUnixNano,
},
DataHash: dataHashForEmptyTxs,
LastHeaderHash: []byte("other-hash"),
},
}
data := &Data{}

// First mismatch: tolerated (based-sequencer grace period).
err := state.AssertValidForNextState(header, data)
assert.NoError(t, err, "first last-header-hash mismatch should be tolerated")

// Second mismatch on the same state: must be an error.
err = state.AssertValidForNextState(header, data)
assert.ErrorContains(t, err, "invalid last header hash",
"second last-header-hash mismatch should be rejected")
})
}
Loading