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

Refactor tx raw commands #2404

Merged
merged 6 commits into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- Refactored old `tx raw` commands to drop the `raw` subcommand.
Replaced `--src-` and `--dst-` flag prefixes in old `tx raw` commands with more meaningful prefixes.
Removed commands `tx raw update-client`, `tx raw upgrade-client`, `tx raw upgrade-client` and
`tx raw create-client`.
([#2376](https://github.com/informalsystems/ibc-rs/issues/2376))
2 changes: 1 addition & 1 deletion ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ __Note__: This assumes you are running this the first time, if not, please ensur
__Note__: If this is the first time you're running this command, the `informaldev/ibc-0:[RELEASE TAG]` and `informaldev/ibc-1:[RELEASE TAG]` container images will be pulled from the Docker Hub. For instructions on how to update these images in Docker Hub please see the [upgrading the release](#upgrading-chains) section.


5. Run the command below to execute the relayer end to end (e2e) test. This command will execute the `e2e.sh` on the relayer container. The script will configure the light clients for both chains, add the private keys for both chains and run transactions on both chains (e.g. create-client transaction).
5. Run the command below to execute the relayer end to end (e2e) test. This command will execute the `e2e.sh` on the relayer container. The script will configure the light clients for both chains, add the private keys for both chains and run transactions on both chains (e.g. create client transaction).

`docker exec relayer /bin/sh -c /relayer/e2e.sh`

Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/adr-010-unified-cli-arguments-hermes.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ __Tx__

* `health-check`

### Tx
### Tx

__conn-init__

Expand Down
66 changes: 33 additions & 33 deletions e2e/e2e/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class TxChanOpenInitRes:
port_id: PortId


@cmd("tx raw chan-open-init")
@cmd("tx chan-open-init")
@dataclass
class TxChanOpenInit(Cmd[TxChanOpenInitRes]):
dst_chain_id: ChainId
Expand All @@ -27,9 +27,9 @@ class TxChanOpenInit(Cmd[TxChanOpenInitRes]):
ordering: Optional[Ordering] = None

def args(self) -> List[str]:
args = ["--dst-chain", self.dst_chain_id, "--src-chain", self.src_chain_id,
"--dst-conn", self.connection_id,
"--dst-port", self.dst_port_id, "--src-port", self.src_port_id]
args = ["--b-chain", self.dst_chain_id, "--a-chain", self.src_chain_id,
"--b-connection", self.connection_id,
"--b-port", self.dst_port_id, "--a-port", self.src_port_id]

if self.ordering is not None:
args.extend(['--ordering', str(self.ordering)])
Expand All @@ -53,7 +53,7 @@ class TxChanOpenTryRes:
port_id: PortId


@cmd("tx raw chan-open-try")
@cmd("tx chan-open-try")
@dataclass
class TxChanOpenTry(Cmd[TxChanOpenTryRes]):
dst_chain_id: ChainId
Expand All @@ -65,10 +65,10 @@ class TxChanOpenTry(Cmd[TxChanOpenTryRes]):
ordering: Optional[Ordering] = None

def args(self) -> List[str]:
args = ["--dst-chain", self.dst_chain_id, "--src-chain", self.src_chain_id,
"--dst-conn", self.connection_id,
"--dst-port", self.dst_port_id, "--src-port", self.src_port_id,
"--src-chan", self.src_channel_id]
args = ["--b-chain", self.dst_chain_id, "--a-chain", self.src_chain_id,
"--b-connection", self.connection_id,
"--b-port", self.dst_port_id, "--a-port", self.src_port_id,
"--a-channel", self.src_channel_id]

if self.ordering is not None:
args.extend(['--ordering', str(self.ordering)])
Expand All @@ -92,7 +92,7 @@ class TxChanOpenAckRes:
port_id: PortId


@cmd("tx raw chan-open-ack")
@cmd("tx chan-open-ack")
@dataclass
class TxChanOpenAck(Cmd[TxChanOpenAckRes]):
dst_chain_id: ChainId
Expand All @@ -104,11 +104,11 @@ class TxChanOpenAck(Cmd[TxChanOpenAckRes]):
src_channel_id: ChannelId

def args(self) -> List[str]:
args = ["--dst-chain", self.dst_chain_id, "--src-chain", self.src_chain_id,
"--dst-conn", self.connection_id,
"--dst-port", self.dst_port_id, "--src-port", self.src_port_id,
"--dst-chan", self.dst_channel_id,
"--src-chan", self.src_channel_id]
args = ["--b-chain", self.dst_chain_id, "--a-chain", self.src_chain_id,
"--b-connection", self.connection_id,
"--b-port", self.dst_port_id, "--a-port", self.src_port_id,
"--b-channel", self.dst_channel_id,
"--a-channel", self.src_channel_id]

return args

Expand All @@ -129,7 +129,7 @@ class TxChanOpenConfirmRes:
port_id: PortId


@cmd("tx raw chan-open-confirm")
@cmd("tx chan-open-confirm")
@dataclass
class TxChanOpenConfirm(Cmd[TxChanOpenConfirmRes]):
dst_chain_id: ChainId
Expand All @@ -141,11 +141,11 @@ class TxChanOpenConfirm(Cmd[TxChanOpenConfirmRes]):
src_channel_id: ChannelId

def args(self) -> List[str]:
args = ["--dst-chain", self.dst_chain_id, "--src-chain", self.src_chain_id,
"--dst-conn", self.connection_id,
"--dst-port", self.dst_port_id, "--src-port", self.src_port_id,
"--dst-chan", self.dst_channel_id,
"--src-chan", self.src_channel_id]
args = ["--b-chain", self.dst_chain_id, "--a-chain", self.src_chain_id,
"--b-connection", self.connection_id,
"--b-port", self.dst_port_id, "--a-port", self.src_port_id,
"--b-channel", self.dst_channel_id,
"--a-channel", self.src_channel_id]

return args

Expand All @@ -165,7 +165,7 @@ class TxChanCloseInitRes:
port_id: PortId


@cmd("tx raw chan-close-init")
@cmd("tx chan-close-init")
@dataclass
class TxChanCloseInit(Cmd[TxChanCloseInitRes]):
dst_chain_id: ChainId
Expand All @@ -177,11 +177,11 @@ class TxChanCloseInit(Cmd[TxChanCloseInitRes]):
src_chan_id: ChannelId

def args(self) -> List[str]:
args = ["--dst-chain", self.dst_chain_id, "--src-chain", self.src_chain_id,
"--dst-conn", self.dst_conn_id,
"--dst-port", self.dst_port_id, "--src-port", self.src_port_id,
"--dst-chan", self.dst_chan_id,
"--src-chan", self.src_chan_id]
args = ["--b-chain", self.dst_chain_id, "--a-chain", self.src_chain_id,
"--b-connection", self.dst_conn_id,
"--b-port", self.dst_port_id, "--a-port", self.src_port_id,
"--b-channel", self.dst_chan_id,
"--a-channel", self.src_chan_id]

return args

Expand All @@ -202,7 +202,7 @@ class TxChanCloseConfirmRes:
port_id: PortId


@cmd("tx raw chan-close-confirm")
@cmd("tx chan-close-confirm")
@dataclass
class TxChanCloseConfirm(Cmd[TxChanCloseConfirmRes]):
dst_chain_id: ChainId
Expand All @@ -214,11 +214,11 @@ class TxChanCloseConfirm(Cmd[TxChanCloseConfirmRes]):
src_chan_id: ChannelId

def args(self) -> List[str]:
args = ["--dst-chain", self.dst_chain_id, "--src-chain", self.src_chain_id,
"--dst-conn", self.dst_conn_id,
"--dst-port", self.dst_port_id, "--src-port", self.src_port_id,
"--dst-chan", self.dst_chan_id,
"--src-chan", self.src_chan_id]
args = ["--b-chain", self.dst_chain_id, "--a-chain", self.src_chain_id,
"--b-connection", self.dst_conn_id,
"--b-port", self.dst_port_id, "--a-port", self.src_port_id,
"--b-channel", self.dst_chan_id,
"--a-channel", self.src_chan_id]

return args

Expand Down
4 changes: 2 additions & 2 deletions e2e/e2e/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ClientCreated:


@dataclass
@cmd("tx raw create-client")
@cmd("create client")
class TxCreateClient(Cmd[ClientCreated]):
dst_chain_id: ChainId
src_chain_id: ChainId
Expand All @@ -37,7 +37,7 @@ class ClientUpdated:


@dataclass
@cmd("tx raw update-client")
@cmd("update client")
class TxUpdateClient(Cmd[ClientUpdated]):
dst_chain_id: ChainId
dst_client_id: ClientId
Expand Down
34 changes: 17 additions & 17 deletions e2e/e2e/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class TxConnInitRes:
connection_id: ConnectionId


@cmd("tx raw conn-init")
@cmd("tx conn-init")
@dataclass
class TxConnInit(Cmd[TxConnInitRes]):
dst_chain_id: ChainId
Expand All @@ -22,8 +22,8 @@ class TxConnInit(Cmd[TxConnInitRes]):
src_client_id: ClientId

def args(self) -> List[str]:
return ["--dst-chain", self.dst_chain_id, "--src-chain", self.src_chain_id,
"--dst-client", self.dst_client_id, "--src-client", self.src_client_id]
return ["--b-chain", self.dst_chain_id, "--a-chain", self.src_chain_id,
"--b-client", self.dst_client_id, "--a-client", self.src_client_id]

def process(self, result: Any) -> TxConnInitRes:
return from_dict(TxConnInitRes, result['OpenInitConnection'])
Expand All @@ -36,7 +36,7 @@ class TxConnTryRes:
connection_id: ConnectionId


@cmd("tx raw conn-try")
@cmd("tx conn-try")
@dataclass
class TxConnTry(Cmd[TxConnTryRes]):
dst_chain_id: ChainId
Expand All @@ -46,9 +46,9 @@ class TxConnTry(Cmd[TxConnTryRes]):
src_conn_id: ConnectionId

def args(self) -> List[str]:
return ["--dst-chain", self.dst_chain_id, "--src-chain", self.src_chain_id,
"--dst-client", self.dst_client_id, "--src-client", self.src_client_id,
"--src-conn", self.src_conn_id]
return ["--b-chain", self.dst_chain_id, "--a-chain", self.src_chain_id,
"--b-client", self.dst_client_id, "--a-client", self.src_client_id,
"--a-connection", self.src_conn_id]

def process(self, result: Any) -> TxConnTryRes:
return from_dict(TxConnTryRes, result['OpenTryConnection'])
Expand All @@ -61,7 +61,7 @@ class TxConnAckRes:
connection_id: ConnectionId


@cmd("tx raw conn-ack")
@cmd("tx conn-ack")
@dataclass
class TxConnAck(Cmd[TxConnAckRes]):
dst_chain_id: ChainId
Expand All @@ -72,10 +72,10 @@ class TxConnAck(Cmd[TxConnAckRes]):
src_conn_id: ConnectionId

def args(self) -> List[str]:
return ["--dst-chain", self.dst_chain_id, "--src-chain", self.src_chain_id,
"--dst-client", self.dst_client_id, "--src-client", self.src_client_id,
"--dst-conn", self.dst_conn_id,
"--src-conn", self.src_conn_id]
return ["--b-chain", self.dst_chain_id, "--a-chain", self.src_chain_id,
"--b-client", self.dst_client_id, "--a-client", self.src_client_id,
"--b-connection", self.dst_conn_id,
"--a-connection", self.src_conn_id]

def process(self, result: Any) -> TxConnAckRes:
return from_dict(TxConnAckRes, result['OpenAckConnection'])
Expand All @@ -88,7 +88,7 @@ class TxConnConfirmRes:
connection_id: ConnectionId


@cmd("tx raw conn-confirm")
@cmd("tx conn-confirm")
@dataclass
class TxConnConfirm(Cmd[TxConnConfirmRes]):
dst_chain_id: ChainId
Expand All @@ -99,10 +99,10 @@ class TxConnConfirm(Cmd[TxConnConfirmRes]):
src_conn_id: ConnectionId

def args(self) -> List[str]:
return ["--dst-chain", self.dst_chain_id, "--src-chain", self.src_chain_id,
"--dst-client", self.dst_client_id, "--src-client", self.src_client_id,
"--dst-conn", self.dst_conn_id,
"--src-conn", self.src_conn_id]
return ["--b-chain", self.dst_chain_id, "--a-chain", self.src_chain_id,
"--b-client", self.dst_client_id, "--a-client", self.src_client_id,
"--b-connection", self.dst_conn_id,
"--a-connection", self.src_conn_id]

def process(self, result: Any) -> TxConnConfirmRes:
return from_dict(TxConnConfirmRes, result['OpenConfirmConnection'])
Expand Down
22 changes: 11 additions & 11 deletions e2e/e2e/packet.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TxPacketSendRes:
packet: Packet


@cmd("tx raw ft-transfer")
@cmd("tx ft-transfer")
@dataclass
class TxPacketSend(Cmd[TxPacketSendRes]):
dst_chain_id: ChainId
Expand All @@ -36,10 +36,10 @@ class TxPacketSend(Cmd[TxPacketSendRes]):

def args(self) -> List[str]:
args = [
"--dst-chain", self.dst_chain_id,
"--src-chain", self.src_chain_id,
"--src-port", self.src_port,
"--src-chan", self.src_channel,
"--receiver-chain", self.dst_chain_id,
"--sender-chain", self.src_chain_id,
"--sender-port", self.src_port,
"--sender-channel", self.src_channel,
"--amount", str(self.amount),
"--timeout-height-offset", str(self.height_offset),
]
Expand All @@ -66,7 +66,7 @@ class TxPacketRecvRes:
ack: Hex


@cmd("tx raw packet-recv")
@cmd("tx packet-recv")
@dataclass
class TxPacketRecv(Cmd[TxPacketRecvRes]):
dst_chain_id: ChainId
Expand All @@ -75,7 +75,7 @@ class TxPacketRecv(Cmd[TxPacketRecvRes]):
src_channel: ChannelId

def args(self) -> List[str]:
return ["--dst-chain", self.dst_chain_id, "--src-chain", self.src_chain_id, "--src-port", self.src_port, "--src-chan", self.src_channel]
return ["--receiver-chain", self.dst_chain_id, "--sender-chain", self.src_chain_id, "--sender-port", self.src_port, "--sender-channel", self.src_channel]

def process(self, result: Any) -> TxPacketRecvRes:
entry = find_entry(result, 'WriteAcknowledgement')
Expand All @@ -90,7 +90,7 @@ class TxPacketTimeoutRes:
packet: Packet


@cmd("tx raw packet-recv")
@cmd("tx packet-recv")
@dataclass
class TxPacketTimeout(Cmd[TxPacketTimeoutRes]):
dst_chain_id: ChainId
Expand All @@ -99,7 +99,7 @@ class TxPacketTimeout(Cmd[TxPacketTimeoutRes]):
src_channel: ChannelId

def args(self) -> List[str]:
return ["--dst-chain", self.dst_chain_id, "--src-chain", self.src_chain_id, "--src-port", self.src_port, "--src-chan", self.src_channel]
return ["--receiver-chain", self.dst_chain_id, "--sender-chain", self.src_chain_id, "--sender-port", self.src_port, "--sender-channel", self.src_channel]

def process(self, result: Any) -> TxPacketTimeoutRes:
entry = find_entry(result, 'TimeoutPacket')
Expand All @@ -115,7 +115,7 @@ class TxPacketAckRes:
packet: Packet


@cmd("tx raw packet-ack")
@cmd("tx packet-ack")
@dataclass
class TxPacketAck(Cmd[TxPacketAckRes]):
dst_chain_id: ChainId
Expand All @@ -124,7 +124,7 @@ class TxPacketAck(Cmd[TxPacketAckRes]):
src_channel: ChannelId

def args(self) -> List[str]:
return ["--dst-chain", self.dst_chain_id, "--src-chain", self.src_chain_id, "--src-port", self.src_port, "--src-chan", self.src_channel]
return ["--receiver-chain", self.dst_chain_id, "--sender-chain", self.src_chain_id, "--sender-port", self.src_port, "--sender-channel", self.src_channel]

def process(self, result: Any) -> TxPacketAckRes:
entry = find_entry(result, 'AcknowledgePacket')
Expand Down
Loading