Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M05 #27

Merged
merged 29 commits into from
Jul 31, 2023
Merged

M05 #27

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
682ffe0
added atomic upgrade contract
sfeyal Jun 12, 2023
6e561d1
Merge branch 'L06' into L12
sfeyal Jun 12, 2023
674eba7
Merge branch 'collecting-storage-internal-functions' into L12
sfeyal Jun 19, 2023
120212d
atomic-engine-update-contract
sfeyal Jun 19, 2023
d8f3670
Merge remote-tracking branch 'origin/L11' into L12
sfeyal Jun 20, 2023
834b7ad
handle factory
sfeyal Jun 20, 2023
fe314b5
factory solution
sfeyal Jun 21, 2023
515f589
fixed typo added test
sfeyal Jun 21, 2023
c4f039f
gas report
sfeyal Jun 21, 2023
2fee41d
fixed typos
sfeyal Jun 21, 2023
5ee0b46
naming and doc string
sfeyal Jun 21, 2023
b96ebb0
operator initial value address(0)
sfeyal Jun 21, 2023
4015f68
fixed event typo
sfeyal Jun 21, 2023
5a05c3e
Achanged DD_ALLOWED_SENDER_ONCHAIN_INDEX value
sfeyal Jun 21, 2023
22fd462
added an internal function to protected to add an allowed sender
sfeyal Jun 22, 2023
39f2150
readme fix
sfeyal Jun 22, 2023
dc7f46a
another fix
sfeyal Jun 22, 2023
1f8f68b
small cr fix
sfeyal Jun 22, 2023
53335c0
deleted checks in init function
sfeyal Jun 22, 2023
c750127
fixed a bug when the engine is disabled when adding a new sender from…
sfeyal Jun 24, 2023
b4cd9e2
SphereXEngine.sol typos
ArielTM Jun 25, 2023
852aa44
addAllowedSenderOnChain returnsIfNotActivated
sfeyal Jun 29, 2023
57bc44e
added grantSenderAdderRole function
sfeyal Jun 29, 2023
74112e8
removed super and fixed test
sfeyal Jun 29, 2023
e48ae7a
audit fixes
sfeyal Jul 4, 2023
68ca9c2
rename init function
sfeyal Jul 4, 2023
8680010
deleted L12 changes
sfeyal Jul 4, 2023
f0ae51b
Merge branch 'collecting-storage-internal-functions' into M05
sfeyal Jul 4, 2023
052bb05
addAllowedSenderOnChain document flow
sfeyal Jul 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/SphereXEngine.sol
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ contract SphereXEngine is ISphereXEngine, AccessControlDefaultAdminRules {
emit RemovedAllowedPatterns(patterns);
}

function grantSenderAdderRole(address newSenderAdder) external onlyOperator {
super._grantRole(SENDER_ADDER_ROLE, newSenderAdder);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is super necessary? I think it's just when you have the same function name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, and fixed test

}

// ============ CF ============

/**
Expand Down
24 changes: 24 additions & 0 deletions test/SphereXProtected.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -390,4 +390,28 @@ contract SphereXProtectedTest is Test, CFUtils {
vm.expectRevert("SphereX error: disallowed sender");
SomeContract(someContract).someFunc();
}

function test_grantSenderAdderRoleOnlyOperator() public {
spherex_engine.revokeRole(spherex_engine.OPERATOR_ROLE(), address(this));
spherex_engine.grantRole(spherex_engine.OPERATOR_ROLE(), address(1));
vm.prank(address(1));
spherex_engine.grantSenderAdderRole(address(costumer_contract));

allowed_cf_storage = [int256(13), ADD_ALLOWED_SENDER_ONCHAIN_INDEX, -ADD_ALLOWED_SENDER_ONCHAIN_INDEX];
addAllowedPattern();
allowed_cf_storage = [int256(13), ADD_ALLOWED_SENDER_ONCHAIN_INDEX, -ADD_ALLOWED_SENDER_ONCHAIN_INDEX, -13];
addAllowedPattern();
allowed_cf_storage = [int256(100), -100];
addAllowedPattern();
address someContract = costumer_contract.factory();
SomeContract(someContract).someFunc();
}

function test_grantSenderAdderRoleAdminRevert() public {
spherex_engine.revokeRole(spherex_engine.OPERATOR_ROLE(), address(this));
spherex_engine.grantRole(spherex_engine.OPERATOR_ROLE(), address(1));

vm.expectRevert("SphereX error: operator required");
spherex_engine.grantSenderAdderRole(address(costumer_contract));
}
}
ArielTM marked this conversation as resolved.
Show resolved Hide resolved