Skip to content

Commit

Permalink
fix: failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanchriswhite committed Jul 8, 2024
1 parent c0d84fc commit 6d831f7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 11 additions & 5 deletions tests/integration/tokenomics/relay_mining_difficulty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/pokt-network/poktroll/cmd/poktrolld/cmd"
"github.com/pokt-network/poktroll/pkg/crypto/protocol"
testutilevents "github.com/pokt-network/poktroll/testutil/events"
"github.com/pokt-network/poktroll/testutil/integration"
testutil "github.com/pokt-network/poktroll/testutil/integration"
Expand All @@ -28,7 +29,7 @@ func init() {
}

func TestUpdateRelayMiningDifficulty_NewServiceSeenForTheFirstTime(t *testing.T) {
var claimWindowOpenBlockHash, proofWindowOpenBlockHash []byte
var claimWindowOpenBlockHash, proofWindowOpenBlockHash, proofPathSeedBlockHash []byte

// Create a new integration app
integrationApp := integration.NewCompleteIntegrationApp(t)
Expand Down Expand Up @@ -89,7 +90,7 @@ func TestUpdateRelayMiningDifficulty_NewServiceSeenForTheFirstTime(t *testing.T)
createProofMsg := prooftypes.MsgSubmitProof{
SupplierAddress: integrationApp.DefaultSupplier.Address,
SessionHeader: session.Header,
Proof: getProof(t, trie),
Proof: getProof(t, trie, proofPathSeedBlockHash, session.GetHeader().GetSessionId()),
}
result = integrationApp.RunMsg(t,
&createProofMsg,
Expand Down Expand Up @@ -202,11 +203,16 @@ func prepareSMST(
// getProof returns a proof for the given session for the empty path.
// If there is only one relay in the trie, the proof will be for that single
// relay since it is "closest" to any path provided, empty or not.
func getProof(t *testing.T, trie *smt.SMST) []byte {
func getProof(
t *testing.T,
trie *smt.SMST,
pathSeedBlockHash []byte,
sessionId string,
) []byte {
t.Helper()

emptyPath := make([]byte, trie.PathHasherSize())
proof, err := trie.ProveClosest(emptyPath)
path := protocol.GetPathForProof(pathSeedBlockHash, sessionId)
proof, err := trie.ProveClosest(path)
require.NoError(t, err)

proofBz, err := proof.Marshal()
Expand Down
2 changes: 2 additions & 0 deletions x/proof/keeper/msg_server_submit_proof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ func TestMsgServer_SubmitProof_Success(t *testing.T) {
// will be part of the session.
sessionHeader := keepers.GetSessionHeader(ctx, t, appAddr, service, 1)

expectedMerkleProofPath := protocol.GetPathForProof(blockHeaderHash, sessionHeader.GetSessionId())

// Construct a proof message server from the proof keeper.
srv := keeper.NewMsgServerImpl(*keepers.Keeper)

Expand Down

0 comments on commit 6d831f7

Please sign in to comment.