Skip to content

Commit d4e8ce4

Browse files
authored
fix: tracing ID generation mismatch (#1349)
1 parent b1ed850 commit d4e8ce4

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

contracts/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ node_modules: package.json pnpm-lock.yaml
110110
touch node_modules
111111

112112
build: node_modules | forge
113-
forge build
114-
FOUNDRY_SRC=sdk forge build
113+
forge build --names
114+
forge build sdk --names
115115

116116
test: node_modules test/helpers/SelectorLibrary.sol | forge
117117
forge test -vvv --ffi

contracts/sdk/IpcContract.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ abstract contract IpcExchange is IIpcHandler, Ownable, ReentrancyGuard {
8686
})
8787
);
8888
// Add the message to the list of inflights
89-
bytes32 id = envelope.toHash();
89+
bytes32 id = envelope.toTracingId();
9090
inflightMsgs[id] = envelope;
9191
}
9292

contracts/test/sdk/IpcContract.t.sol

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ contract IpcExchangeTest is Test {
122122
localNonce: 0
123123
});
124124

125-
resultMsg = ResultMsg({outcome: OutcomeType.Ok, id: callEnvelope.toHash(), ret: bytes("")});
125+
resultMsg = ResultMsg({outcome: OutcomeType.Ok, id: callEnvelope.toTracingId(), ret: bytes("")});
126126

127127
resultEnvelope = IpcEnvelope({
128128
kind: IpcMsgKind.Result,
@@ -196,8 +196,8 @@ contract IpcExchangeTest is Test {
196196
vm.deal(address(this), 1000);
197197
exch.performIpcCall_(ipcAddressA, callMsg, 1);
198198
// assert that we stored the correct callEnvelope in the correlation map.
199-
IpcEnvelope memory correlated = exch.getInflight(callEnvelope.toHash());
200-
require(correlated.toHash() == callEnvelope.toHash());
199+
IpcEnvelope memory correlated = exch.getInflight(callEnvelope.toTracingId());
200+
require(correlated.toTracingId() == callEnvelope.toTracingId());
201201

202202
vm.startPrank(gateway);
203203

@@ -213,14 +213,15 @@ contract IpcExchangeTest is Test {
213213
bytes32[] memory ids = new bytes32[](3);
214214
for (uint64 i = 0; i < 3; i++) {
215215
callEnvelope.localNonce = i;
216+
callEnvelope.originalNonce = i;
216217
vm.mockCall(
217218
gateway,
218219
abi.encodeWithSelector(IGateway.sendContractXnetMessage.selector),
219220
abi.encode(callEnvelope)
220221
);
221222
exch.performIpcCall_(ipcAddressA, callMsg, 1);
222223

223-
bytes32 id = callEnvelope.toHash();
224+
bytes32 id = callEnvelope.toTracingId();
224225
require(exch.getInflight(id).value != 0, "envelope not found in correlation map");
225226

226227
ids[i] = id;
@@ -254,8 +255,8 @@ contract IpcExchangeTest is Test {
254255
resultEnvelope.message = abi.encode(resultMsg);
255256

256257
// assert that we stored the correct callEnvelope in the correlation map.
257-
IpcEnvelope memory correlated = exch.getInflight(callEnvelope.toHash());
258-
require(correlated.toHash() == callEnvelope.toHash());
258+
IpcEnvelope memory correlated = exch.getInflight(callEnvelope.toTracingId());
259+
require(correlated.toTracingId() == callEnvelope.toTracingId());
259260

260261
// Simulate an OK incoming result.
261262
exch.handleIpcMessage(resultEnvelope);

0 commit comments

Comments
 (0)