-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial commit * added queries and unit tests * added cli * fix parse error * fix parse error 2 * fix lint and test errors * ran make generate * update index for keygen * refactor query name * refactor key calculation * refactor lib name
- Loading branch information
Showing
15 changed files
with
848 additions
and
130 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
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
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
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,47 @@ | ||
package keeper | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
"github.com/zeta-chain/zetacore/x/observer/types" | ||
) | ||
|
||
func TestKeeper_BlameByIdentifier(t *testing.T) { | ||
keeper, ctx := SetupKeeper(t) | ||
var chainId int64 = 97 | ||
var nonce uint64 = 101 | ||
digest := "85f5e10431f69bc2a14046a13aabaefc660103b6de7a84f75c4b96181d03f0b5" | ||
|
||
index := types.GetBlameIndex(chainId, nonce, digest, 123) | ||
|
||
keeper.SetBlame(ctx, &types.Blame{ | ||
Index: index, | ||
FailureReason: "failed to join party", | ||
Nodes: nil, | ||
}) | ||
|
||
blameRecords, found := keeper.GetBlame(ctx, index) | ||
require.True(t, found) | ||
require.Equal(t, index, blameRecords.Index) | ||
} | ||
|
||
func TestKeeper_BlameByChainAndNonce(t *testing.T) { | ||
keeper, ctx := SetupKeeper(t) | ||
var chainId int64 = 97 | ||
var nonce uint64 = 101 | ||
digest := "85f5e10431f69bc2a14046a13aabaefc660103b6de7a84f75c4b96181d03f0b5" | ||
|
||
index := types.GetBlameIndex(chainId, nonce, digest, 123) | ||
|
||
keeper.SetBlame(ctx, &types.Blame{ | ||
Index: index, | ||
FailureReason: "failed to join party", | ||
Nodes: nil, | ||
}) | ||
|
||
blameRecords, found := keeper.GetBlamesByChainAndNonce(ctx, chainId, int64(nonce)) | ||
require.True(t, found) | ||
require.Equal(t, 1, len(blameRecords)) | ||
require.Equal(t, index, blameRecords[0].Index) | ||
} |
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.