-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into ap/cons-rotation-docs
- Loading branch information
Showing
20 changed files
with
604 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ jobs: | |
check-latest: true | ||
- name: Install runsim | ||
run: go install github.com/cosmos/tools/cmd/[email protected] | ||
- uses: actions/cache@v3 | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/go/bin | ||
key: ${{ runner.os }}-go-runsim-binary | ||
|
@@ -54,7 +54,7 @@ jobs: | |
with: | ||
go-version: "1.21" | ||
check-latest: true | ||
- uses: actions/cache@v3 | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/go/bin | ||
key: ${{ runner.os }}-go-runsim-binary | ||
|
@@ -73,7 +73,7 @@ jobs: | |
with: | ||
go-version: "1.21" | ||
check-latest: true | ||
- uses: actions/cache@v3 | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/go/bin | ||
key: ${{ runner.os }}-go-runsim-binary | ||
|
@@ -92,7 +92,7 @@ jobs: | |
with: | ||
go-version: "1.21" | ||
check-latest: true | ||
- uses: actions/cache@v3 | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/go/bin | ||
key: ${{ runner.os }}-go-runsim-binary | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ jobs: | |
check-latest: true | ||
- name: Install runsim | ||
run: go install github.com/cosmos/tools/cmd/[email protected] | ||
- uses: actions/cache@v3 | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/go/bin | ||
key: ${{ runner.os }}-go-runsim-binary | ||
|
@@ -54,7 +54,7 @@ jobs: | |
with: | ||
go-version: "1.21" | ||
check-latest: true | ||
- uses: actions/cache@v3 | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/go/bin | ||
key: ${{ runner.os }}-go-runsim-binary | ||
|
@@ -73,7 +73,7 @@ jobs: | |
with: | ||
go-version: "1.21" | ||
check-latest: true | ||
- uses: actions/cache@v3 | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/go/bin | ||
key: ${{ runner.os }}-go-runsim-binary | ||
|
@@ -92,7 +92,7 @@ jobs: | |
with: | ||
go-version: "1.21" | ||
check-latest: true | ||
- uses: actions/cache@v3 | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/go/bin | ||
key: ${{ runner.os }}-go-runsim-binary | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ jobs: | |
check-latest: true | ||
- name: Install runsim | ||
run: go install github.com/cosmos/tools/cmd/[email protected] | ||
- uses: actions/cache@v3 | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/go/bin | ||
key: ${{ runner.os }}-go-runsim-binary | ||
|
@@ -39,7 +39,7 @@ jobs: | |
with: | ||
go-version: "1.21" | ||
check-latest: true | ||
- uses: actions/cache@v3 | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/go/bin | ||
key: ${{ runner.os }}-go-runsim-binary | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ jobs: | |
- run: make build | ||
- name: Install runsim | ||
run: go install github.com/cosmos/tools/cmd/[email protected] | ||
- uses: actions/cache@v3 | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/go/bin | ||
key: ${{ runner.os }}-go-runsim-binary | ||
|
@@ -41,7 +41,7 @@ jobs: | |
with: | ||
go-version: "1.21" | ||
check-latest: true | ||
- uses: actions/cache@v3 | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/go/bin | ||
key: ${{ runner.os }}-go-runsim-binary | ||
|
@@ -58,7 +58,7 @@ jobs: | |
with: | ||
go-version: "1.21" | ||
check-latest: true | ||
- uses: actions/cache@v3 | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/go/bin | ||
key: ${{ runner.os }}-go-runsim-binary | ||
|
@@ -76,7 +76,7 @@ jobs: | |
with: | ||
go-version: "1.21" | ||
check-latest: true | ||
- uses: actions/cache@v3 | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/go/bin | ||
key: ${{ runner.os }}-go-runsim-binary | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package store | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestGetStoreProof(t *testing.T) { | ||
tests := []struct { | ||
storeInfos []StoreInfo | ||
}{ | ||
{[]StoreInfo{ | ||
{"key1", CommitID{1, []byte("value1")}}, | ||
}}, | ||
{[]StoreInfo{ | ||
{"key2", CommitID{1, []byte("value2")}}, | ||
{"key1", CommitID{1, []byte("value1")}}, | ||
}}, | ||
{[]StoreInfo{ | ||
{"key3", CommitID{1, []byte("value3")}}, | ||
{"key2", CommitID{1, []byte("value2")}}, | ||
{"key1", CommitID{1, []byte("value1")}}, | ||
}}, | ||
{[]StoreInfo{ | ||
{"key2", CommitID{1, []byte("value2")}}, | ||
{"key1", CommitID{1, []byte("value1")}}, | ||
{"key3", CommitID{1, []byte("value3")}}, | ||
}}, | ||
{[]StoreInfo{ | ||
{"key4", CommitID{1, []byte("value4")}}, | ||
{"key1", CommitID{1, []byte("value1")}}, | ||
{"key3", CommitID{1, []byte("value3")}}, | ||
{"key2", CommitID{1, []byte("value2")}}, | ||
}}, | ||
} | ||
|
||
for i, tc := range tests { | ||
// create a commit info | ||
ci := CommitInfo{ | ||
Version: 1, | ||
Timestamp: time.Now(), | ||
StoreInfos: tc.storeInfos, | ||
} | ||
commitHash := ci.Hash() | ||
// make sure the store infos are sorted | ||
require.Equal(t, ci.StoreInfos[0].Name, "key1") | ||
for _, si := range tc.storeInfos { | ||
// get the proof | ||
_, proof, err := ci.GetStoreProof(si.Name) | ||
require.NoError(t, err, "test case %d", i) | ||
// verify the proof | ||
expRoots, err := proof.Run([][]byte{si.CommitID.Hash}) | ||
require.NoError(t, err, "test case %d", i) | ||
require.Equal(t, commitHash, expRoots[0], "test case %d", i) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.