-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic IdentityUpdates contract (#154)
## Resolves #155 ## tl;dr - Adds IdentityUpdates smart contract - Adds the contract address to the test configuration
- Loading branch information
Showing
9 changed files
with
409 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.13; | ||
|
||
contract IdentityUpdates { | ||
event IdentityUpdateCreated( | ||
bytes32 inboxId, | ||
bytes update, | ||
uint64 sequenceId | ||
); | ||
|
||
uint64 sequenceId; | ||
|
||
function addIdentityUpdate(bytes32 inboxId, bytes memory update) public { | ||
sequenceId++; | ||
|
||
emit IdentityUpdateCreated(inboxId, update, sequenceId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.13; | ||
|
||
import {Test, console} from "forge-std/Test.sol"; | ||
import {IdentityUpdates} from "../src/IdentityUpdates.sol"; | ||
|
||
contract IdentityUpdatesTest is Test { | ||
IdentityUpdates public identityUpdates; | ||
|
||
function setUp() public { | ||
identityUpdates = new IdentityUpdates(); | ||
} | ||
|
||
function test_AddIdentityUpdate1k() public { | ||
bytes32 inboxId = bytes32( | ||
0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef | ||
); | ||
bytes memory message = new bytes(1024); | ||
for (uint256 i = 0; i < message.length; i++) { | ||
message[i] = bytes1(uint8(i % 256)); // Set each byte to its index modulo 256 | ||
} | ||
|
||
identityUpdates.addIdentityUpdate(inboxId, message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.