Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cmwaters committed Nov 7, 2024
1 parent cf4f661 commit 940492d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
11 changes: 9 additions & 2 deletions app/test/check_tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,18 @@ func TestCheckTx(t *testing.T) {
checkType: abci.CheckTxType_New,
getTx: func() []byte {
signer := createSigner(t, kr, accs[10], encCfg.TxConfig, 11)
blob, err := share.NewV1Blob(share.RandomBlobNamespace(), []byte("data"), testnode.RandomAddress().(sdk.AccAddress))
blob, err := share.NewV1Blob(share.RandomBlobNamespace(), []byte("data"), signer.Account(accs[10]).Address())
require.NoError(t, err)
blobTx, _, err := signer.CreatePayForBlobs(accs[10], []*share.Blob{blob}, opts...)
require.NoError(t, err)
return blobTx
blob, err = share.NewV1Blob(share.RandomBlobNamespace(), []byte("data"), testnode.RandomAddress().(sdk.AccAddress))
require.NoError(t, err)
bTx, _, err := tx.UnmarshalBlobTx(blobTx)
require.NoError(t, err)
bTx.Blobs[0] = blob
blobTxBytes, err := tx.MarshalBlobTx(bTx.Tx, bTx.Blobs[0])
require.NoError(t, err)
return blobTxBytes
},
expectedABCICode: blobtypes.ErrInvalidBlobSigner.ABCICode(),
},
Expand Down
3 changes: 2 additions & 1 deletion app/test/process_proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,9 @@ func TestProcessProposal(t *testing.T) {
falseAddr := testnode.RandomAddress().(sdk.AccAddress)
blob, err := share.NewV1Blob(ns1, data, falseAddr)
require.NoError(t, err)
msg, err := blobtypes.NewMsgPayForBlobs(addr.String(), appconsts.LatestVersion, blob)
msg, err := blobtypes.NewMsgPayForBlobs(falseAddr.String(), appconsts.LatestVersion, blob)
require.NoError(t, err)
msg.Signer = addr.String()

rawTx, err := signer.CreateTx([]sdk.Msg{msg}, user.SetGasLimit(100000), user.SetFee(100000))
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion x/blob/types/payforblob.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func ValidateBlobs(blobs ...*share.Blob) error {
// ValidateBlobShareVersion validates any share version specific rules
func ValidateBlobShareVersion(signer sdk.AccAddress, blobs ...*share.Blob) error {
for _, blob := range blobs {
if blob.ShareVersion() != share.ShareVersionOne && !bytes.Equal(blob.Signer(), []byte(signer)) {
if blob.ShareVersion() == share.ShareVersionOne && !bytes.Equal(blob.Signer(), []byte(signer)) {
return ErrInvalidBlobSigner.Wrapf("blob signer %X does not match msgPFB signer %X", blob.Signer(), signer)
}
}
Expand Down

0 comments on commit 940492d

Please sign in to comment.