Skip to content

Commit

Permalink
fix(evm): typo in event (#3375)
Browse files Browse the repository at this point in the history
  • Loading branch information
hussein-aitlahcen authored Dec 13, 2024
2 parents 66b0316 + a4cc30b commit d607730
Show file tree
Hide file tree
Showing 15 changed files with 172 additions and 184 deletions.
10 changes: 5 additions & 5 deletions cosmwasm/union-ibc/core/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ pub mod events {
pub const CLOSE_CONFIRM: &str = "channel_close_confirm";
}
pub mod packet {
pub const SEND: &str = "send_packet";
pub const RECV: &str = "recv_packet";
pub const INTENT_RECV: &str = "intent_recv_packet";
pub const ACK: &str = "ack_packet";
pub const TIMEOUT: &str = "timeout_packet";
pub const SEND: &str = "packet_send";
pub const RECV: &str = "packet_recv";
pub const INTENT_RECV: &str = "intent_packet_recv";
pub const ACK: &str = "packet_ack";
pub const TIMEOUT: &str = "packet_timeout";
pub const BATCH_SEND: &str = "batch_send";
pub const BATCH_ACKS: &str = "batch_acks";
}
Expand Down
12 changes: 6 additions & 6 deletions evm/contracts/core/02-client/IBCClient.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import "../24-host/IBCCommitment.sol";
import "../02-client/IIBCClient.sol";

library IBCClientLib {
event ClientRegistered(string clientType, address clientAddress);
event ClientCreated(string clientType, uint32 clientId);
event ClientUpdated(uint32 clientId, uint64 height);
event RegisterClient(string clientType, address clientAddress);
event CreateClient(string clientType, uint32 clientId);
event UpdateClient(uint32 clientId, uint64 height);
event Misbehaviour(uint32 clientId);
}

Expand All @@ -28,7 +28,7 @@ abstract contract IBCClient is IBCStore, IIBCClient {
revert IBCErrors.ErrClientTypeAlreadyExists();
}
clientRegistry[clientType] = address(client);
emit IBCClientLib.ClientRegistered(clientType, address(client));
emit IBCClientLib.RegisterClient(clientType, address(client));
}

/**
Expand All @@ -51,7 +51,7 @@ abstract contract IBCClient is IBCStore, IIBCClient {
commitments[IBCCommitment.consensusStateCommitmentKey(
clientId, update.height
)] = update.consensusStateCommitment;
emit IBCClientLib.ClientCreated(msg_.clientType, clientId);
emit IBCClientLib.CreateClient(msg_.clientType, clientId);
return clientId;
}

Expand All @@ -68,7 +68,7 @@ abstract contract IBCClient is IBCStore, IIBCClient {
commitments[IBCCommitment.consensusStateCommitmentKey(
msg_.clientId, update.height
)] = update.consensusStateCommitment;
emit IBCClientLib.ClientUpdated(msg_.clientId, update.height);
emit IBCClientLib.UpdateClient(msg_.clientId, update.height);
}

/**
Expand Down
32 changes: 13 additions & 19 deletions evm/contracts/core/04-channel/IBCPacket.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ library IBCPacketLib {
0x0100000000000000000000000000000000000000000000000000000000000000;
bytes32 public constant COMMITMENT_NULL = bytes32(uint256(0));

event SendPacket(IBCPacket packet);
event RecvPacket(IBCPacket packets, address maker, bytes makerMsg);
event RecvIntentPacket(IBCPacket packet, address maker, bytes makerMsg);
event WriteAcknowledgement(IBCPacket packet, bytes acknowledgement);
event AcknowledgePacket(
IBCPacket packet, bytes acknowledgement, address maker
);
event TimeoutPacket(IBCPacket packet, address maker);
event PacketSend(IBCPacket packet);
event PacketRecv(IBCPacket packet, address maker, bytes makerMsg);
event IntentPacketRecv(IBCPacket packet, address maker, bytes makerMsg);
event WriteAck(IBCPacket packet, bytes acknowledgement);
event PacketAck(IBCPacket packet, bytes acknowledgement, address maker);
event PacketTimeout(IBCPacket packet, address maker);

function commitAcksMemory(
bytes[] memory acks
Expand Down Expand Up @@ -171,7 +169,7 @@ abstract contract IBCPacketImpl is IBCStore, IIBCPacket {
}
commitments[commitmentKey] = IBCPacketLib.COMMITMENT_MAGIC;

emit IBCPacketLib.SendPacket(packet);
emit IBCPacketLib.PacketSend(packet);

return packet;
}
Expand Down Expand Up @@ -256,17 +254,15 @@ abstract contract IBCPacketImpl is IBCStore, IIBCPacket {
if (intent) {
acknowledgement =
module.onRecvIntentPacket(packet, maker, makerMsg);
emit IBCPacketLib.RecvIntentPacket(packet, maker, makerMsg);
emit IBCPacketLib.IntentPacketRecv(packet, maker, makerMsg);
} else {
acknowledgement =
module.onRecvPacket(packet, maker, makerMsg);
emit IBCPacketLib.RecvPacket(packet, maker, makerMsg);
emit IBCPacketLib.PacketRecv(packet, maker, makerMsg);
}
if (acknowledgement.length > 0) {
_writeAcknowledgement(commitmentKey, acknowledgement);
emit IBCPacketLib.WriteAcknowledgement(
packet, acknowledgement
);
emit IBCPacketLib.WriteAck(packet, acknowledgement);
}
}
}
Expand Down Expand Up @@ -328,7 +324,7 @@ abstract contract IBCPacketImpl is IBCStore, IIBCPacket {
packet.destinationChannel, IBCPacketLib.commitPacket(packet)
);
_writeAcknowledgement(commitmentKey, acknowledgement);
emit IBCPacketLib.WriteAcknowledgement(packet, acknowledgement);
emit IBCPacketLib.WriteAck(packet, acknowledgement);
}

function acknowledgePacket(
Expand Down Expand Up @@ -374,9 +370,7 @@ abstract contract IBCPacketImpl is IBCStore, IIBCPacket {
module.onAcknowledgementPacket(
packet, acknowledgement, msg_.relayer
);
emit IBCPacketLib.AcknowledgePacket(
packet, acknowledgement, msg_.relayer
);
emit IBCPacketLib.PacketAck(packet, acknowledgement, msg_.relayer);
}
}

Expand Down Expand Up @@ -420,7 +414,7 @@ abstract contract IBCPacketImpl is IBCStore, IIBCPacket {
revert IBCErrors.ErrTimeoutHeightNotReached();
}
module.onTimeoutPacket(packet, msg_.relayer);
emit IBCPacketLib.TimeoutPacket(packet, msg_.relayer);
emit IBCPacketLib.PacketTimeout(packet, msg_.relayer);
}

function verifyCommitment(
Expand Down
7 changes: 2 additions & 5 deletions evm/evm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,6 @@ _: {
[profile.script]
src = "scripts"
bytecode_hash = "none"
cbor_metadata = false
sparse_mode = false
[profile.test]
test = "tests/src"
Expand Down Expand Up @@ -207,7 +204,7 @@ _: {
network = "holesky";
rpc-url = "https://holesky.drpc.org";
private-key = ''"$1"'';
extra-args = ''--verify --verifier etherscan --etherscan-api-key "$2"'';
extra-args = ''--verify --verifier sourcify --verifier-url https://sourcify.dev/server'';
}
{
network = "scroll-testnet";
Expand Down Expand Up @@ -523,7 +520,7 @@ _: {
runtimeInputs = [ self'.packages.forge ];
text = ''
${ensureAtRepositoryRoot}
FOUNDRY_LIBS=["${evmLibs}"] FOUNDRY_PROFILE="test" FOUNDRY_TEST="evm/tests/src" forge test -vvvv --match-path evm/tests/src/02-client/CosmosInCosmosClient.t.sol --gas-report "$@"
FOUNDRY_LIBS=["${evmLibs}"] FOUNDRY_PROFILE="test" FOUNDRY_TEST="evm/tests/src" forge test -vvv --gas-report "$@"
'';
};

Expand Down
8 changes: 4 additions & 4 deletions evm/tests/src/02-client/IBCClient.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ contract IBCClientTests is Test {
vm.pauseGasMetering();
vm.assume(impl != address(0));
vm.expectEmit();
emit IBCClientLib.ClientRegistered(typ, impl);
emit IBCClientLib.RegisterClient(typ, impl);
vm.resumeGasMetering();
handler.registerClient(typ, ILightClient(impl));
}
Expand All @@ -31,7 +31,7 @@ contract IBCClientTests is Test {
) public {
vm.assume(impl != address(0));
vm.expectEmit();
emit IBCClientLib.ClientRegistered(typ, impl);
emit IBCClientLib.RegisterClient(typ, impl);
handler.registerClient(typ, ILightClient(impl));
vm.expectRevert(IBCErrors.ErrClientTypeAlreadyExists.selector);
handler.registerClient(typ, ILightClient(impl));
Expand All @@ -43,7 +43,7 @@ contract IBCClientTests is Test {
vm.pauseGasMetering();
handler.registerClient(msg_.clientType, lightClient);
vm.expectEmit();
emit IBCClientLib.ClientCreated(msg_.clientType, 0);
emit IBCClientLib.CreateClient(msg_.clientType, 0);
vm.resumeGasMetering();
handler.createClient(msg_);
}
Expand Down Expand Up @@ -87,7 +87,7 @@ contract IBCClientTests is Test {
handler.registerClient(msg_.clientType, lightClient);
uint32 clientId = handler.createClient(msg_);
vm.expectEmit();
emit IBCClientLib.ClientUpdated(0, 1);
emit IBCClientLib.UpdateClient(0, 1);
vm.resumeGasMetering();
handler.updateClient(
IBCMsgs.MsgUpdateClient({
Expand Down
20 changes: 10 additions & 10 deletions evm/tests/src/04-channel/IBCPacket.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,10 @@ contract IBCPacketTests is Test {
lightClient.pushValidMembership();
for (uint8 i = 0; i < nbPackets; i++) {
vm.expectEmit();
emit IBCPacketLib.RecvPacket(
emit IBCPacketLib.PacketRecv(
msg_.packets[i], msg_.relayer, msg_.relayerMsgs[i]
);
emit IBCPacketLib.WriteAcknowledgement(
emit IBCPacketLib.WriteAck(
msg_.packets[i], TestModuleLib.ACKNOWLEDGEMENT
);
}
Expand Down Expand Up @@ -464,10 +464,10 @@ contract IBCPacketTests is Test {
createReceiveIntentPacket(sourceChannel, message, nbPackets);
for (uint8 i = 0; i < nbPackets; i++) {
vm.expectEmit();
emit IBCPacketLib.RecvIntentPacket(
emit IBCPacketLib.IntentPacketRecv(
msg_.packets[i], msg_.marketMaker, msg_.marketMakerMsgs[i]
);
emit IBCPacketLib.WriteAcknowledgement(
emit IBCPacketLib.WriteAck(
msg_.packets[i], TestModuleLib.ACKNOWLEDGEMENT
);
}
Expand Down Expand Up @@ -575,7 +575,7 @@ contract IBCPacketTests is Test {
}
for (uint8 i = 0; i < nbPackets; i++) {
vm.expectEmit();
emit IBCPacketLib.AcknowledgePacket(
emit IBCPacketLib.PacketAck(
msg_.packets[i], abi.encodePacked(i), msg_.relayer
);
}
Expand Down Expand Up @@ -748,7 +748,7 @@ contract IBCPacketTests is Test {
lightClient.pushValidNonMembership();
lightClient.setLatestTimestamp(uint64(timestamp) + k);
vm.expectEmit();
emit IBCPacketLib.TimeoutPacket(msg_.packet, msg_.relayer);
emit IBCPacketLib.PacketTimeout(msg_.packet, msg_.relayer);
vm.resumeGasMetering();
handler.timeoutPacket(msg_);
vm.pauseGasMetering();
Expand Down Expand Up @@ -832,7 +832,7 @@ contract IBCPacketTests is Test {
lightClient.setLatestHeight(uint64(height) + k);
msg_.proofHeight = uint64(height) + k;
vm.expectEmit();
emit IBCPacketLib.TimeoutPacket(msg_.packet, msg_.relayer);
emit IBCPacketLib.PacketTimeout(msg_.packet, msg_.relayer);
vm.resumeGasMetering();
handler.timeoutPacket(msg_);
vm.pauseGasMetering();
Expand Down Expand Up @@ -911,15 +911,15 @@ contract IBCPacketTests is Test {
module.pauseAck();
for (uint8 i = 0; i < nbPackets; i++) {
vm.expectEmit();
emit IBCPacketLib.RecvPacket(
emit IBCPacketLib.PacketRecv(
msg_.packets[i], msg_.relayer, msg_.relayerMsgs[i]
);
}
handler.recvPacket(msg_);
for (uint8 i = 0; i < nbPackets; i++) {
bytes memory ack = abi.encodePacked(i);
vm.expectEmit();
emit IBCPacketLib.WriteAcknowledgement(msg_.packets[i], ack);
emit IBCPacketLib.WriteAck(msg_.packets[i], ack);
vm.prank(address(module));
vm.resumeGasMetering();
handler.writeAcknowledgement(msg_.packets[i], ack);
Expand Down Expand Up @@ -950,7 +950,7 @@ contract IBCPacketTests is Test {
module.pauseAck();
for (uint8 i = 0; i < nbPackets; i++) {
vm.expectEmit();
emit IBCPacketLib.RecvPacket(
emit IBCPacketLib.PacketRecv(
msg_.packets[i], msg_.relayer, msg_.relayerMsgs[i]
);
}
Expand Down
Loading

0 comments on commit d607730

Please sign in to comment.