Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
a50cc71
update .gitignore for repomix
shyam-patel-kira Dec 2, 2024
9f24fea
connect stakeManager and JobsManager to use proxy addresses
shyam-patel-kira Dec 2, 2024
cfb0e73
Update deployment script
shyam-patel-kira Dec 2, 2024
6e97a14
differentiate roles from single admin role
shyam-patel-kira Dec 3, 2024
f86c467
nit: spacing
shyam-patel-kira Dec 3, 2024
2bef8fd
Add github actions config for the repo
shyam-patel-kira Dec 19, 2024
ce1ce25
Update .gitignore
shyam-patel-kira Dec 19, 2024
7774cf5
add prettier config; package contract in yarn
shyam-patel-kira Dec 19, 2024
708182e
run CI on PR
shyam-patel-kira Dec 19, 2024
ca373ad
rename the repo secret
shyam-patel-kira Dec 19, 2024
5825350
Update Constants.sol
shyam-patel-kira Dec 19, 2024
5b111a1
Merge pull request #20 from luminolabs/feat/add-roles
shyam-patel-kira Dec 19, 2024
ee9a871
Merge branch 'feat/stakeTokens' of https://github.com/luminolabs/cont…
shyam-patel-kira Dec 19, 2024
60df4fd
fix testcases for jobs and stake manager
shyam-patel-kira Dec 19, 2024
de14346
keep version to prevent warning and build error
shyam-patel-kira Dec 19, 2024
8cd48ff
Update solidity version
shyam-patel-kira Dec 19, 2024
e1e1cf5
add slither report to .gitignore
shyam-patel-kira Dec 20, 2024
f8ecb51
run forge build before running slither checks
shyam-patel-kira Dec 20, 2024
f2afaba
Add deployment to the pipeline
shyam-patel-kira Dec 20, 2024
485fe24
add remappings for correctly using imports
shyam-patel-kira Dec 20, 2024
3b88a0a
Update imports to not use relative path
shyam-patel-kira Dec 20, 2024
44ac481
Update imports to not use relative path
shyam-patel-kira Dec 20, 2024
206fa4f
Update gitmodules and method for dependency installation
shyam-patel-kira Dec 20, 2024
5781b00
remove default module
shyam-patel-kira Dec 20, 2024
8024a17
fix testcases that were broken
shyam-patel-kira Dec 20, 2024
25537a8
Add gas snapshot; update config
shyam-patel-kira Dec 20, 2024
6d890f9
don't exit procses on snapshot
shyam-patel-kira Dec 20, 2024
4e50d46
remove codecov app
shyam-patel-kira Dec 23, 2024
1de43ae
remove --use solc; update .gitignore
shyam-patel-kira Dec 23, 2024
108084f
fix indent
shyam-patel-kira Dec 23, 2024
dc9fff0
remove debug flag
shyam-patel-kira Dec 23, 2024
c0e7189
nit: stlye
shyam-patel-kira Dec 23, 2024
430a08b
remove codecov app
shyam-patel-kira Dec 23, 2024
e188c54
Add remappings.txt
shyam-patel-kira Dec 23, 2024
fc5c4e9
Update upgradable contracts version
shyam-patel-kira Dec 23, 2024
9e16df7
remove remappings forge
shyam-patel-kira Dec 23, 2024
f727471
reinitialize mappings
shyam-patel-kira Dec 23, 2024
e3d9159
remove uploading sarif file
shyam-patel-kira Dec 23, 2024
34becf5
remove lib from git repo
shyam-patel-kira Dec 23, 2024
6b235d3
add lib to repo
shyam-patel-kira Dec 23, 2024
1d72ca7
reset readme
shyam-patel-kira Dec 23, 2024
553bb2e
remove initial files
shyam-patel-kira Dec 23, 2024
c03a716
remove initial files
shyam-patel-kira Dec 23, 2024
80b9b2a
Merge branch 'feat/github-actions' of https://github.com/luminolabs/c…
shyam-patel-kira Dec 23, 2024
937164c
Add unit tests for ACL.sol
shyam-patel-kira Dec 23, 2024
bf08116
Increase stateManager coverage to 100%
shyam-patel-kira Dec 23, 2024
d5f5f90
Increase jobsManager UT coverage
shyam-patel-kira Dec 23, 2024
9d17b84
fix failing testcase for stateManager
shyam-patel-kira Dec 23, 2024
f6db956
Increase stakeManager UT coverage
shyam-patel-kira Dec 23, 2024
4ccb315
restrict initializer's visibility to view
shyam-patel-kira Dec 23, 2024
72ec326
skip deployment script in UT coverage
shyam-patel-kira Dec 23, 2024
4d9323f
Merge pull request #21 from luminolabs/feat/github-actions
shyam-patel-kira Jan 6, 2025
0eb0447
resolve merge conflicts with base
shyam-patel-kira Jan 8, 2025
49365c7
Merge branch 'feat/stakeTokens' into testing/UT-coverage
shyam-patel-kira Jan 8, 2025
5b739ff
revert overwritten changes
shyam-patel-kira Jan 8, 2025
c96f4ea
Merge branch 'testing/UT-coverage' of https://github.com/luminolabs/c…
shyam-patel-kira Jan 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ jobs:
--report debug
--optimize
--optimizer-runs 200
--no-auto-detect
--no-auto-detect
--skip script/DeployUpgradableLuminoProtocol.s.sol
id: coverage

# - name: Upload coverage to Codecov
Expand Down
94 changes: 94 additions & 0 deletions test/ACL.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "forge-std/Test.sol";
import "../src/Core/ACL.sol";

contract ACLTest is Test {
ACL public acl;
address public admin;
address public user1;
address public user2;

// Example role for testing
bytes32 public constant TEST_ROLE = keccak256("TEST_ROLE");

function setUp() public {
admin = address(this);
user1 = address(0x1);
user2 = address(0x2);

acl = new ACL();
}

function testInitialize() public {
acl.initialize(admin);

// Verify admin has DEFAULT_ADMIN_ROLE
assertTrue(acl.hasRole(acl.DEFAULT_ADMIN_ROLE(), admin));

// Verify initialization can't be called twice
bytes memory expectedRevertMessage = abi.encodeWithSignature(
"InvalidInitialization()"
);
vm.expectRevert(expectedRevertMessage);
acl.initialize(user1);
}

function testRoleManagement() public {
acl.initialize(admin);

// Grant role
acl.grantRole(TEST_ROLE, user1);
assertTrue(acl.hasRole(TEST_ROLE, user1));

// Revoke role
acl.revokeRole(TEST_ROLE, user1);
assertFalse(acl.hasRole(TEST_ROLE, user1));

// Test role admin
assertTrue(acl.getRoleAdmin(TEST_ROLE) == acl.DEFAULT_ADMIN_ROLE());
}

function testUnauthorizedAccess() public {
acl.initialize(admin);

// Try to grant role from non-admin account
vm.startPrank(user1);

bytes memory expectedRevertMessage = abi.encodeWithSignature(
"AccessControlUnauthorizedAccount(address,bytes32)",
user1,
acl.DEFAULT_ADMIN_ROLE()
);
vm.expectRevert(expectedRevertMessage);
acl.grantRole(TEST_ROLE, user2);

// Try to revoke role from non-admin account
vm.expectRevert(expectedRevertMessage);
acl.revokeRole(TEST_ROLE, user2);

vm.stopPrank();
}

function testRenounceRole() public {
acl.initialize(admin);

// Grant role to user1
acl.grantRole(TEST_ROLE, user1);
assertTrue(acl.hasRole(TEST_ROLE, user1));

// User1 renounces their role
vm.prank(user1);
acl.renounceRole(TEST_ROLE, user1);
assertFalse(acl.hasRole(TEST_ROLE, user1));

// Try to renounce role for another account (should fail)
vm.prank(user1);
bytes memory expectedRevertMessage = abi.encodeWithSignature(
"AccessControlBadConfirmation()"
);
vm.expectRevert(expectedRevertMessage);
acl.renounceRole(TEST_ROLE, user2);
}
}
Loading
Loading