Skip to content

Commit

Permalink
Add delayedack filter by type
Browse files Browse the repository at this point in the history
  • Loading branch information
zale144 committed Apr 23, 2024
1 parent 964ae3e commit 1d66088
Show file tree
Hide file tree
Showing 23 changed files with 417 additions and 171 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Features

- (delayedack) [#850](https://github.com/dymensionxyz/dymension/issues/850) Add type filter for delayedack
- (delayedack) [#728](https://github.com/dymensionxyz/dymension/issues/728) Create eibc order on err ack from rollapp
- (delayedack) [#672](https://github.com/dymensionxyz/dymension/issues/672) Delayedack invariant for finalized and reverted packets
- (evm) [#668](https://github.com/dymensionxyz/dymension/issues/668) Integrate virtual frontier bank contract
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/golang/protobuf v1.5.3
github.com/gorilla/mux v1.8.1
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/osmosis-labs/osmosis/v15 v15.2.1
github.com/osmosis-labs/osmosis/v15 v15.2.0
github.com/spf13/cast v1.5.0
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
Expand Down
6 changes: 1 addition & 5 deletions proto/dymension/common/rollapp_packet.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package dymensionxyz.dymension.common;
import "gogoproto/gogo.proto";
import "ibc/core/channel/v1/channel.proto";
import "dymension/common/status.proto";
import "dymension/common/type.proto";

option go_package = "github.com/dymensionxyz/dymension/v3/x/common/types";

Expand All @@ -14,11 +15,6 @@ message RollappPacket {
Status status = 4;
uint64 ProofHeight = 5;
bytes relayer = 6;
enum Type {
ON_RECV = 0;
ON_ACK = 1;
ON_TIMEOUT = 2;
}
Type type = 7;
// stores the result of onAck, onTimeout or onRecv/writeAck
string error = 8;
Expand Down
3 changes: 0 additions & 3 deletions proto/dymension/common/status.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ package dymensionxyz.dymension.common;

import "gogoproto/gogo.proto";


option go_package = "github.com/dymensionxyz/dymension/v3/x/common/types";


enum Status {
PENDING = 0;
FINALIZED = 1;
REVERTED = 3;
}

13 changes: 13 additions & 0 deletions proto/dymension/common/type.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax = "proto3";
package dymensionxyz.dymension.common;

import "gogoproto/gogo.proto";

option go_package = "github.com/dymensionxyz/dymension/v3/x/common/types";

enum Type {
ON_RECV = 0;
ON_ACK = 1;
ON_TIMEOUT = 2;
UNDEFINED = -1;
}
7 changes: 3 additions & 4 deletions proto/dymension/delayedack/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "dymension/delayedack/params.proto";
import "dymension/common/status.proto";
import "dymension/common/type.proto";
import "dymension/common/rollapp_packet.proto";

option go_package = "github.com/dymensionxyz/dymension/v3/x/delayedack/types";
Expand All @@ -21,8 +22,6 @@ service Query {
rpc GetPackets(QueryRollappPacketsRequest) returns (QueryRollappPacketListResponse) {
option (google.api.http).get = "/dymensionxyz/dymension/delayedack/packets/{rollappId}/{status}";
}


}

// QueryParamsRequest is request type for the Query/Params RPC method.
Expand All @@ -34,11 +33,11 @@ message QueryParamsResponse {
Params params = 1 [(gogoproto.nullable) = false];
}


message QueryRollappPacketsRequest {
string rollappId = 1;
common.Status status = 2;
cosmos.base.query.v1beta1.PageRequest pagination = 3;
common.Type type = 3;
cosmos.base.query.v1beta1.PageRequest pagination = 4;
}

message QueryRollappPacketListResponse {
Expand Down
6 changes: 3 additions & 3 deletions x/common/types/packet_uid.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package types

import fmt "fmt"
import "fmt"

// PacketUID is a unique identifier for an Rollapp IBC packet on the hub
type PacketUID struct {
Type RollappPacket_Type
Type Type
RollappHubPort string
RollappHubChannel string
Sequence uint64
}

// NewPacketUID creates a new PacketUID with the provided details.
func NewPacketUID(packetType RollappPacket_Type, hubPort string, hubChannel string, sequence uint64) PacketUID {
func NewPacketUID(packetType Type, hubPort string, hubChannel string, sequence uint64) PacketUID {
return PacketUID{
Type: packetType,
RollappHubPort: hubPort,
Expand Down
4 changes: 2 additions & 2 deletions x/common/types/rollapp_packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ func (r RollappPacket) RestoreOriginalTransferTarget() (RollappPacket, error) {
}
if r.OriginalTransferTarget != "" { // It can be empty if the eibc order was never fulfilled
switch r.Type {
case RollappPacket_ON_RECV:
case Type_ON_RECV:
transferPacketData.Receiver = r.OriginalTransferTarget
case RollappPacket_ON_ACK, RollappPacket_ON_TIMEOUT:
case Type_ON_ACK, Type_ON_TIMEOUT:

Check warning on line 45 in x/common/types/rollapp_packet.go

View check run for this annotation

Codecov / codecov/patch

x/common/types/rollapp_packet.go#L45

Added line #L45 was not covered by tests
transferPacketData.Sender = r.OriginalTransferTarget
}
r.Packet.Data = transferPacketData.GetBytes()
Expand Down
105 changes: 37 additions & 68 deletions x/common/types/rollapp_packet.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 76 additions & 0 deletions x/common/types/type.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1d66088

Please sign in to comment.