Skip to content

Commit

Permalink
Change mmr ID type to uint256
Browse files Browse the repository at this point in the history
  • Loading branch information
fmkra committed Jun 4, 2024
1 parent c63a678 commit 8140191
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
17 changes: 9 additions & 8 deletions l1/src/L1MessagesSender.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ contract L1MessagesSender is Ownable {
}

/// @param aggregatorId The id of a tree previously created by the aggregators factory
function sendPoseidonMMRTreeToL2(uint256 aggregatorId, uint128 mmrId) external payable {
function sendPoseidonMMRTreeToL2(uint256 aggregatorId, uint256 mmrId) external payable {
address existingAggregatorAddr = aggregatorsFactory.aggregatorsById(
aggregatorId
);
Expand Down Expand Up @@ -98,18 +98,19 @@ contract L1MessagesSender is Ownable {
bytes32 poseidonMMRRoot,
uint128 mmrSize,
uint256 aggregatorId,
uint128 mmrId
uint256 mmrId
) internal {
uint128 aggregatorId_low = uint128(aggregatorId);
uint128 aggregatorId_high = uint128(aggregatorId >> 128);
(uint256 aggregatorIdLow, uint256 aggregatorIdHigh) = aggregatorId.split128();
(uint256 mmrIdLow, uint256 mmrIdHigh) = mmrId.split128();

uint256[] memory message = new uint256[](5);
uint256[] memory message = new uint256[](6);

message[0] = uint256(poseidonMMRRoot);
message[1] = mmrSize;
message[2] = aggregatorId_low;
message[3] = aggregatorId_high;
message[4] = mmrId;
message[2] = aggregatorIdLow;
message[3] = aggregatorIdHigh;
message[4] = mmrIdLow;
message[5] = mmrIdHigh;

// Pass along msg.value
starknetCore.sendMessageToL2{value: msg.value}(
Expand Down
2 changes: 1 addition & 1 deletion l1/test/L1MessagesSender.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ contract L1MessagesSenderTest is Test {
// This aggregator id must exist in the factory
uint256 aggregatorId = 1;

uint128 mmrId = 4;
uint256 mmrId = 4;

// Value must be greater than 0
sender.sendPoseidonMMRTreeToL2{value: 1}(aggregatorId, mmrId);
Expand Down
2 changes: 1 addition & 1 deletion src/core/common.cairo
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
type MmrId = u128;
type MmrId = u256;
type AggregatorId = u256;

0 comments on commit 8140191

Please sign in to comment.