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

feat: Performing service downtime check #139

Merged
merged 23 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
11 changes: 10 additions & 1 deletion .gitleaksignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,13 @@ f1e395c1b3dae68fb7a74f9e493d7115d5784bf3:scripts/deployment/l2/globals_gnosis_ma
0d4c8861511c4430649434ffe878799a3a9bd136:scripts/deployment/l2/globals_gnosis_chiado.json:generic-api-key:1
0d4c8861511c4430649434ffe878799a3a9bd136:scripts/deployment/l2/globals_gnosis_chiado.json:generic-api-key:2
6f313cbb0917d4d8f44295884dbf70aa58008a03:scripts/deployment/l2/globals_gnosis_chiado.json:generic-api-key:2
6f313cbb0917d4d8f44295884dbf70aa58008a03:scripts/deployment/l2/globals_gnosis_chiado.json:generic-api-key:1
6f313cbb0917d4d8f44295884dbf70aa58008a03:scripts/deployment/l2/globals_gnosis_chiado.json:generic-api-key:1
4b2749c036e684682089b3b5ab57d75041fb7a03:scripts/deployment/l2/globals_polygon_mumbai.json:generic-api-key:1
20a061b4aa92431dae2000a29b0168daa5af471e:scripts/deployment/l2/globals_polygon_mumbai.json:generic-api-key:2
4b2749c036e684682089b3b5ab57d75041fb7a03:scripts/deployment/l2/globals_polygon_mumbai.json:generic-api-key:2
08e2ef7d21dc119fc4ae119771ac4f5888d3d3fc:scripts/deployment/l2/globals_gnosis_mainnet.json:generic-api-key:1
08e2ef7d21dc119fc4ae119771ac4f5888d3d3fc:scripts/deployment/l2/globals_gnosis_mainnet.json:generic-api-key:2
f876f6e96465e05f30236366a6cac1ed7b2017d8:scripts/deployment/l2/globals_gnosis_mainnet.json:generic-api-key:1
f876f6e96465e05f30236366a6cac1ed7b2017d8:scripts/deployment/l2/globals_gnosis_mainnet.json:generic-api-key:2
eee7f30c9db1ea16fd4300ff73d182ba639c978c:scripts/deployment/l2/globals_gnosis_chiado.json:generic-api-key:1
eee7f30c9db1ea16fd4300ff73d182ba639c978c:scripts/deployment/l2/globals_gnosis_chiado.json:generic-api-key:2
284 changes: 228 additions & 56 deletions contracts/staking/ServiceStakingBase.sol

Large diffs are not rendered by default.

17 changes: 7 additions & 10 deletions contracts/test/ReentrancyStakingAttacker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,17 @@ interface IServiceStaking {
/// @param serviceId Service Id.
function unstake(uint256 serviceId) external;

/// @dev Checkpoint to allocate rewards up until a current time.
/// @return All staking service Ids.
/// @return All staking updated nonces.
/// @return Number of reward-eligible staking services during current checkpoint period.
/// @return Eligible service Ids.
/// @return Eligible service rewards.
/// @return success True, if the checkpoint was successful.
/// @return All staking service Ids (including evicted ones during within a current epoch).
/// @return All staking updated nonces (including evicted ones during within a current epoch).
/// @return Set of eligible service Ids.
/// @return Corresponding set of eligible service rewards.
/// @return evictServiceIds Evicted service Ids.
function checkpoint() external returns (
uint256[] memory,
uint256[][] memory,
uint256[] memory,
uint256,
uint256[] memory,
uint256[] memory,
bool
uint256[] memory evictServiceIds
);
}

Expand Down
6 changes: 5 additions & 1 deletion scripts/audit_chains/audit_contracts_setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,11 @@ async function main() {
for (let j = 0; j < contracts.length; j++) {
console.log("Checking " + contracts[j]["name"]);
const execSync = require("child_process").execSync;
execSync("scripts/audit_chains/audit_repo_contract.sh " + network + " " + contracts[j]["name"] + " " + contracts[j]["address"]);
try {
execSync("scripts/audit_chains/audit_repo_contract.sh " + network + " " + contracts[j]["name"] + " " + contracts[j]["address"]);
} catch (err) {
err.stderr.toString();
}
}
}
// ################################# /VERIFY CONTRACTS WITH REPO #################################
Expand Down
2 changes: 1 addition & 1 deletion scripts/deployment/l2/globals_gnosis_chiado.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"contractVerification":true,"useLedger":false,"derivationPath":"m/44'/60'/2'/0/0","providerName":"chiado","gasPriceInGwei":"3","gnosisSafeAddress":"0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552","gnosisSafeProxyFactoryAddress":"0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2","baseURI":"https://gateway.autonolas.tech/ipfs/","serviceRegistryName":"Service Registry","serviceRegistrySymbol":"AUTONOLAS-SERVICE-V1","AMBContractProxyForeignAddress":"0x87A19d769D875964E9Cd41dDBfc397B2543764E6","bridgeMediatorAddress":"0x670Ac235EE13C0B2a5065282bBB0c61cfB354592","bridgeMediatorMockTimelockAddress":"0x0a50009D55Ed5700ac8FF713709d5Ad5fa843896","serviceRegistryAddress":"0x31D3202d8744B16A120117A053459DDFAE93c855","serviceManagerAddress":"0x29086141ecdc310058fc23273F8ef7881d20C2f7","gnosisSafeMultisigImplementationAddress":"0xeB49bE5DF00F74bd240DE4535DDe6Bc89CEfb994","gnosisSafeSameAddressMultisigImplementationAddress":"0xE16adc7777B7C2a0d35033bd3504C028AB28EE8b","operatorWhitelistAddress":"0x6f7661F52fE1919996d0A4F68D09B344093a349d","serviceRegistryTokenUtilityAddress":"0xc2c7E40674f1C7Bb99eFe5680Efd79842502bED4","serviceManagerTokenAddress":"0xc965a32185590Eb5a5fffDba29E96126b7650eDe","olasAddress":"0xE40AE73aa0Ed3Ec35fdAF56e01FCd0D1Ff1d9AB6","multisigProxyHash130":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000","serviceStakingParams":{"maxNumServices":"100","rewardsPerSecond":"1000000000000000","minStakingDeposit":"50000000000000000000","livenessPeriod":"86400","livenessRatio":"700000000000000","numAgentInstances":"1","agentIds":["12"],"threshold":"0","configHash":"0x0000000000000000000000000000000000000000000000000000000000000000"},"serviceStakingTokenAddress":"0x0338893fB1A1D9Df03F72CC53D8f786487d3D03E","serviceStakingNativeTokenAddress":"0x6d9b08701Af43D68D991c074A27E4d90Af7f2276"}
{"contractVerification":true,"useLedger":false,"derivationPath":"m/44'/60'/2'/0/0","providerName":"chiado","gasPriceInGwei":"3","gnosisSafeAddress":"0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552","gnosisSafeProxyFactoryAddress":"0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2","baseURI":"https://gateway.autonolas.tech/ipfs/","serviceRegistryName":"Service Registry","serviceRegistrySymbol":"AUTONOLAS-SERVICE-V1","AMBContractProxyForeignAddress":"0x87A19d769D875964E9Cd41dDBfc397B2543764E6","bridgeMediatorAddress":"0x670Ac235EE13C0B2a5065282bBB0c61cfB354592","bridgeMediatorMockTimelockAddress":"0x0a50009D55Ed5700ac8FF713709d5Ad5fa843896","serviceRegistryAddress":"0x31D3202d8744B16A120117A053459DDFAE93c855","serviceManagerAddress":"0x29086141ecdc310058fc23273F8ef7881d20C2f7","gnosisSafeMultisigImplementationAddress":"0xeB49bE5DF00F74bd240DE4535DDe6Bc89CEfb994","gnosisSafeSameAddressMultisigImplementationAddress":"0xE16adc7777B7C2a0d35033bd3504C028AB28EE8b","operatorWhitelistAddress":"0x6f7661F52fE1919996d0A4F68D09B344093a349d","serviceRegistryTokenUtilityAddress":"0xc2c7E40674f1C7Bb99eFe5680Efd79842502bED4","serviceManagerTokenAddress":"0xc965a32185590Eb5a5fffDba29E96126b7650eDe","olasAddress":"0xE40AE73aa0Ed3Ec35fdAF56e01FCd0D1Ff1d9AB6","multisigProxyHash130":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000","serviceStakingParams":{"maxNumServices":"100","rewardsPerSecond":"1000000000000000","minStakingDeposit":"50000000000000000000","maxNumInactivityPeriods":"3","livenessPeriod":"86400","livenessRatio":"700000000000000","numAgentInstances":"1","agentIds":["12"],"threshold":"0","configHash":"0x0000000000000000000000000000000000000000000000000000000000000000"},"serviceStakingTokenAddress":"0x0338893fB1A1D9Df03F72CC53D8f786487d3D03E","serviceStakingNativeTokenAddress":"0x6d9b08701Af43D68D991c074A27E4d90Af7f2276"}
1 change: 1 addition & 0 deletions scripts/deployment/l2/globals_gnosis_mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"maxNumServices": "100",
"rewardsPerSecond": "385802469136",
"minStakingDeposit": "50000000000000000000",
"maxNumInactivityPeriods": "3",
"livenessPeriod": "86400",
"livenessRatio": "520833333333333",
"numAgentInstances": "1",
Expand Down
2 changes: 1 addition & 1 deletion scripts/deployment/l2/globals_polygon_mainnet.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"contractVerification":true,"useLedger":true,"derivationPath":"m/44'/60'/2'/0/0","providerName":"polygon","gasPriceInGwei":"270","timelockAddress":"0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE","gnosisSafeAddress":"0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552","gnosisSafeProxyFactoryAddress":"0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2","fxRootAddress":"0xfe5e5D361b2ad62c541bAb87C45a0B9B018389a2","bridgeMediatorAddress":"0x9338b5153AE39BB89f50468E608eD9d764B755fD","baseURI":"https://gateway.autonolas.tech/ipfs/","serviceRegistryName":"Service Registry L2","serviceRegistrySymbol":"AUTONOLAS-SERVICE-L2-V1","serviceRegistryAddress":"0xE3607b00E75f6405248323A9417ff6b39B244b50","serviceManagerAddress":"0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE","gnosisSafeMultisigImplementationAddress":"0x3d77596beb0f130a4415df3D2D8232B3d3D31e44","gnosisSafeSameAddressMultisigImplementationAddress":"0xd8BCC126ff31d2582018715d5291A508530587b0","multisigProxyHash130":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000"}
{"contractVerification":true,"useLedger":true,"derivationPath":"m/44'/60'/2'/0/0","providerName":"polygon","gasPriceInGwei":"270","timelockAddress":"0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE","gnosisSafeAddress":"0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552","gnosisSafeProxyFactoryAddress":"0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2","fxRootAddress":"0xfe5e5D361b2ad62c541bAb87C45a0B9B018389a2","bridgeMediatorAddress":"0x9338b5153AE39BB89f50468E608eD9d764B755fD","baseURI":"https://gateway.autonolas.tech/ipfs/","serviceRegistryName":"Service Registry L2","serviceRegistrySymbol":"AUTONOLAS-SERVICE-L2-V1","serviceRegistryAddress":"0xE3607b00E75f6405248323A9417ff6b39B244b50","serviceManagerAddress":"0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE","gnosisSafeMultisigImplementationAddress":"0x3d77596beb0f130a4415df3D2D8232B3d3D31e44","gnosisSafeSameAddressMultisigImplementationAddress":"0xd8BCC126ff31d2582018715d5291A508530587b0","multisigProxyHash130":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000", "olasAddress": "0xFEF5d947472e72Efbb2E388c730B7428406F2F95"}
2 changes: 1 addition & 1 deletion scripts/deployment/l2/globals_polygon_mumbai.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"contractVerification":true,"useLedger":false,"derivationPath":"m/44'/60'/2'/0/0","providerName":"polygonMumbai","gasPriceInGwei":"2","gnosisSafeAddress":"0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552","gnosisSafeProxyFactoryAddress":"0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2","fxRootAddress":"0x3d1d3E34f7fB6D26245E6640E1c50710eFFf15bA","bridgeMediatorAddress":"0x17806E2a12d5E0F48C9803cd397DB3F044DA3b77","baseURI":"https://gateway.autonolas.tech/ipfs/","serviceRegistryName":"Service Registry","serviceRegistrySymbol":"AUTONOLAS-SERVICE-V1","serviceRegistryAddress":"0xf805DfF246CC208CD2F08ffaD242b7C32bc93623","serviceManagerAddress":"0x43d28764bB39936185c84906983fB57A8A905a4F","gnosisSafeMultisigImplementationAddress":"0x9dEc6B62c197268242A768dc3b153AE7a2701396","gnosisSafeSameAddressMultisigImplementationAddress":"0xd6AA4Ec948d84f6Db8EEf25104CeE0Ecd280C74e","operatorWhitelistAddress":"0x118173028162C1b7c6Bf8488bd5dA2abd7c30F9D","serviceRegistryTokenUtilityAddress":"0x131b5551c81e9B3E89E9ACE30A5B3D45144E3e42","serviceManagerTokenAddress":"0xE16adc7777B7C2a0d35033bd3504C028AB28EE8b","multisigProxyHash130":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000"}
{"contractVerification":true,"useLedger":false,"derivationPath":"m/44'/60'/2'/0/0","providerName":"polygonMumbai","gasPriceInGwei":"2","gnosisSafeAddress":"0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552","gnosisSafeProxyFactoryAddress":"0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2","fxRootAddress":"0x3d1d3E34f7fB6D26245E6640E1c50710eFFf15bA","bridgeMediatorAddress":"0x17806E2a12d5E0F48C9803cd397DB3F044DA3b77","baseURI":"https://gateway.autonolas.tech/ipfs/","serviceRegistryName":"Service Registry","serviceRegistrySymbol":"AUTONOLAS-SERVICE-V1","serviceRegistryAddress":"0xf805DfF246CC208CD2F08ffaD242b7C32bc93623","serviceManagerAddress":"0x43d28764bB39936185c84906983fB57A8A905a4F","gnosisSafeMultisigImplementationAddress":"0x9dEc6B62c197268242A768dc3b153AE7a2701396","gnosisSafeSameAddressMultisigImplementationAddress":"0xd6AA4Ec948d84f6Db8EEf25104CeE0Ecd280C74e","operatorWhitelistAddress":"0x118173028162C1b7c6Bf8488bd5dA2abd7c30F9D","serviceRegistryTokenUtilityAddress":"0x131b5551c81e9B3E89E9ACE30A5B3D45144E3e42","serviceManagerTokenAddress":"0xE16adc7777B7C2a0d35033bd3504C028AB28EE8b","multisigProxyHash130":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000","olasAddress": "0x81e7Ac2D5aCA991aef9187a34C0A536FA526dD0F"}
Loading
Loading