Skip to content

Commit 7f205c3

Browse files
authored
Merge branch 'dev' into feat/snapshot-period
2 parents 7d472b2 + 57ff86f commit 7f205c3

File tree

4 files changed

+21
-14
lines changed

4 files changed

+21
-14
lines changed

relayer-cli/src/utils/proof.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ interface MessageSentData {
55
to: {
66
id: string;
77
};
8+
msgSender: {
9+
id: string;
10+
};
811
data: string;
912
}
1013

@@ -34,12 +37,15 @@ const getMessageDataToRelay = async (
3437
to {
3538
id
3639
}
40+
msgSender {
41+
id
42+
}
3743
data
3844
}
3945
}`
4046
)) as MessageSentsDataResponse;
4147

42-
return [result[`messageSents`][0].to.id, result[`messageSents`][0].data];
48+
return [result[`messageSents`][0].to.id, result[`messageSents`][0].msgSender.id, result[`messageSents`][0].data];
4349
} catch (e) {
4450
console.log(e);
4551
return undefined;

relayer-cli/src/utils/relay.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe("relay", () => {
6161
fetchVeaOutbox = jest.fn().mockReturnValue(veaOutboxMock);
6262

6363
fetchProofAtCount = jest.fn().mockResolvedValue([]);
64-
fetchMessageDataToRelay = jest.fn().mockResolvedValue(["to", "data"]);
64+
fetchMessageDataToRelay = jest.fn().mockResolvedValue(["to", "from", "data"]);
6565

6666
mockWait = jest.fn().mockResolvedValue("receipt");
6767
mockBatchSend = jest.fn().mockResolvedValue({ wait: mockWait });

relayer-cli/src/utils/relay.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ const relay = async (chainId: number, nonce: number, network: Network) => {
5959
getMessageDataToRelay(chainId, veaInboxAddress, nonce),
6060
]);
6161
if (!messageData) throw new DataError("relay message data");
62-
const [to, data] = messageData;
63-
const txn = await veaOutbox.sendMessage(proof, nonce, to, data);
62+
const [to, from, data] = messageData;
63+
const txn = await veaOutbox.sendMessage(proof, nonce, to, from, data);
6464
const receipt = await txn.wait();
6565
return receipt;
6666
};
@@ -127,10 +127,10 @@ const relayBatch = async ({
127127
fetchProofAtCount(chainId, nonce, count, veaInboxAddress),
128128
fetchMessageDataToRelay(chainId, veaInboxAddress, nonce),
129129
]);
130-
const [to, data] = messageData;
130+
const [to, from, data] = messageData;
131131
try {
132-
await veaOutbox.sendMessage.staticCall(proof, nonce, to, data);
133-
const callData = veaOutbox.interface.encodeFunctionData("sendMessage", [proof, nonce, to, data]);
132+
await veaOutbox.sendMessage.staticCall(proof, nonce, to, from, data);
133+
const callData = veaOutbox.interface.encodeFunctionData("sendMessage", [proof, nonce, to, from, data]);
134134
datas.push(callData);
135135
targets.push(veaOutboxAddress);
136136
values.push(0);
@@ -142,6 +142,7 @@ const relayBatch = async ({
142142
}
143143
}
144144
if (batchMessages > 0) {
145+
console.log(targets, datas);
145146
const gasLimit = await batcher.batchSend.estimateGas(targets, values, datas);
146147
const tx = await batcher.batchSend(targets, values, datas, { gasLimit });
147148
const receipt = await tx.wait();
@@ -193,9 +194,9 @@ const relayAllFrom = async (
193194
getProofAtCount(chainId, x, count, veaInboxAddress),
194195
getMessageDataToRelay(chainId, veaInboxAddress, x),
195196
]);
196-
const [to, data] = messageData;
197+
const [to, from, data] = messageData;
197198

198-
const callData = veaOutbox.interface.encodeFunctionData("sendMessage", [proof, x, to, data]);
199+
const callData = veaOutbox.interface.encodeFunctionData("sendMessage", [proof, x, to, from, data]);
199200
datas.push(callData);
200201
targets.push(veaContracts[network].veaOutbox.address);
201202
values.push(0);

relayer-subgraph-inbox/src/vea-inbox.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ export function handleMessageSent(event: MessageSentEvent): void {
3030
let _to = new ByteArray(20);
3131
for (let i = 0; i < 20; i++) _to[i] = msgData[i + 8];
3232

33-
let dataLength = msgData.length - 28;
34-
let _data = new ByteArray(dataLength);
35-
for (let i = 0; i < dataLength; i++) _data[i] = msgData[i + 28];
36-
3733
let _msgSender = new ByteArray(20);
38-
for (let i = 0; i < 20; i++) _msgSender[i] = _data[i + 16];
34+
for (let i = 0; i < 20; i++) _msgSender[i] = msgData[i + 28];
35+
36+
let dataLength = msgData.length - 48;
37+
let _data = new ByteArray(dataLength);
38+
for (let i = 0; i < dataLength; i++) _data[i] = msgData[i + 48];
3939

4040
entity.inbox = event.address;
4141
entity.nonce = BigInt.fromByteArray(_nonce.reverse() as ByteArray);

0 commit comments

Comments
 (0)