Skip to content

Commit 6910be9

Browse files
committed
refactor: clean up comments and improve code readability in TxAtomicSimple contract
1 parent 64adcea commit 6910be9

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

src/core/TxAtomicSimple.sol

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,29 @@ import "./IBCKeeper.sol";
1111

1212
import "../proto/cross/core/atomic/simple/AtomicSimple.sol";
1313

14-
/**
15-
* @title TxAtomicSimple
16-
* @notice simple-commit プロトコル対応の PacketHandler 実装
17-
*/
14+
// TxAtomicSimple implements PacketHandler that supports simple-commit protocol
1815
abstract contract TxAtomicSimple is IBCKeeper, PacketHandler, ContractRegistry {
19-
// simple-commit プロトコル上の participant index
16+
// it's defined at simple-commit protocol
2017
uint8 private constant txIndexParticipant = 1;
2118

2219
event OnContractCall(bytes tx_id, uint8 tx_index, bool success, bytes ret);
2320
event OnTimeoutPacket(bytes tx_id, uint8 tx_index, uint64 sequence);
2421

2522
/// @inheritdoc PacketHandler
2623
function handlePacket(Packet memory packet) internal virtual override returns (bytes memory acknowledgement) {
27-
// ルーティング先モジュール解決(1回だけ)
2824
IContractModule module = getModule(packet);
2925

30-
// PacketData のデコード
3126
PacketData.Data memory pd = PacketData.decode(packet.data);
3227
require(pd.payload.length != 0, "decoding error");
3328

3429
Any.Data memory anyPayload = Any.decode(pd.payload);
35-
// type_url チェック(/cross.core.atomic.simple.PacketDataCall)
3630
require(
3731
sha256(bytes(anyPayload.type_url)) == sha256(bytes("/cross.core.atomic.simple.PacketDataCall")),
3832
"got unexpected type_url"
3933
);
4034

41-
// 具体 payload へデコード
4235
PacketDataCall.Data memory pdc = PacketDataCall.decode(anyPayload.value);
4336

44-
// コール実行 & ACK 生成
4537
PacketAcknowledgementCall.Data memory ack;
4638
try module.onContractCall(
4739
CrossContext(pdc.tx_id, txIndexParticipant, pdc.tx.signers), pdc.tx.call_info
@@ -73,7 +65,6 @@ abstract contract TxAtomicSimple is IBCKeeper, PacketHandler, ContractRegistry {
7365
emit OnTimeoutPacket("", txIndexParticipant, packet.sequence);
7466
}
7567

76-
// ---- ACK エンコード補助 ----
7768
function packPacketAcknowledgementCall(PacketAcknowledgementCall.Data memory ack)
7869
internal
7970
pure

0 commit comments

Comments
 (0)