Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove CompletedOutgoingTxs from unsigned batch and contract calls lookups #556

Merged
merged 3 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 0 additions & 11 deletions module/x/gravity/keeper/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,6 @@ func (k Keeper) getLastOutgoingBatchByTokenType(ctx sdk.Context, token common.Ad
// GetUnsignedBatchTxs returns all batches for which the specified validator has not submitted confirmations in ascending nonce order
func (k Keeper) GetUnsignedBatchTxs(ctx sdk.Context, val sdk.ValAddress) []*types.BatchTx {
var unconfirmed []*types.BatchTx
k.IterateCompletedOutgoingTxsByType(ctx, types.BatchTxPrefixByte, func(_ []byte, cotx types.OutgoingTx) bool {
sig := k.getEthereumSignature(ctx, cotx.GetStoreIndex(), val)
if len(sig) == 0 {
batch, ok := cotx.(*types.BatchTx)
if !ok {
panic(sdkerrors.Wrapf(types.ErrInvalid, "couldn't cast to batch tx for completed tx %s", cotx))
}
unconfirmed = append(unconfirmed, batch)
}
return false
})
k.IterateOutgoingTxsByType(ctx, types.BatchTxPrefixByte, func(_ []byte, otx types.OutgoingTx) bool {
sig := k.getEthereumSignature(ctx, otx.GetStoreIndex(), val)
if len(sig) == 0 {
Expand Down
12 changes: 0 additions & 12 deletions module/x/gravity/keeper/contract_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,6 @@ import (

func (k Keeper) GetUnsignedContractCallTxs(ctx sdk.Context, val sdk.ValAddress) []*types.ContractCallTx {
var unconfirmed []*types.ContractCallTx
k.IterateCompletedOutgoingTxsByType(ctx, types.ContractCallTxPrefixByte, func(_ []byte, cotx types.OutgoingTx) bool {
sig := k.getEthereumSignature(ctx, cotx.GetStoreIndex(), val)
if len(sig) == 0 {
call, ok := cotx.(*types.ContractCallTx)
if !ok {
panic(sdkerrors.Wrapf(types.ErrInvalid, "couldn't cast to contract call for completed tx %s", cotx))
}
unconfirmed = append(unconfirmed, call)
}
return false
})

k.IterateOutgoingTxsByType(ctx, types.ContractCallTxPrefixByte, func(_ []byte, otx types.OutgoingTx) bool {
sig := k.getEthereumSignature(ctx, otx.GetStoreIndex(), val)
if len(sig) == 0 {
Expand Down
Loading