Skip to content

Commit 28f2661

Browse files
committed
test: update horizon tests after cleanup
Signed-off-by: Tomás Migone <[email protected]>
1 parent 392047c commit 28f2661

File tree

14 files changed

+19
-1335
lines changed

14 files changed

+19
-1335
lines changed

packages/horizon/test/unit/GraphBase.t.sol

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { GraphPayments } from "contracts/payments/GraphPayments.sol";
1414
import { GraphTallyCollector } from "contracts/payments/collectors/GraphTallyCollector.sol";
1515
import { IHorizonStaking } from "@graphprotocol/interfaces/contracts/horizon/IHorizonStaking.sol";
1616
import { HorizonStaking } from "contracts/staking/HorizonStaking.sol";
17-
import { HorizonStakingExtension } from "contracts/staking/HorizonStakingExtension.sol";
1817
import { IHorizonStakingTypes } from "@graphprotocol/interfaces/contracts/horizon/internal/IHorizonStakingTypes.sol";
1918
import { MockGRTToken } from "../../contracts/mocks/MockGRTToken.sol";
2019
import { EpochManagerMock } from "contracts/mocks/EpochManagerMock.sol";
@@ -43,7 +42,6 @@ abstract contract GraphBaseTest is IHorizonStakingTypes, Utils, Constants {
4342
GraphTallyCollector graphTallyCollector;
4443

4544
HorizonStaking private stakingBase;
46-
HorizonStakingExtension private stakingExtension;
4745

4846
address subgraphDataServiceLegacyAddress = makeAddr("subgraphDataServiceLegacyAddress");
4947
address subgraphDataServiceAddress = makeAddr("subgraphDataServiceAddress");
@@ -86,7 +84,6 @@ abstract contract GraphBaseTest is IHorizonStakingTypes, Utils, Constants {
8684
vm.label({ account: address(payments), newLabel: "GraphPayments" });
8785
vm.label({ account: address(escrow), newLabel: "PaymentsEscrow" });
8886
vm.label({ account: address(staking), newLabel: "HorizonStaking" });
89-
vm.label({ account: address(stakingExtension), newLabel: "HorizonStakingExtension" });
9087
vm.label({ account: address(graphTallyCollector), newLabel: "GraphTallyCollector" });
9188

9289
// Ensure caller is back to the original msg.sender
@@ -194,12 +191,7 @@ abstract contract GraphBaseTest is IHorizonStakingTypes, Utils, Constants {
194191
escrow = PaymentsEscrow(escrowProxyAddress);
195192
}
196193

197-
stakingExtension = new HorizonStakingExtension(address(controller), subgraphDataServiceLegacyAddress);
198-
stakingBase = new HorizonStaking(
199-
address(controller),
200-
address(stakingExtension),
201-
subgraphDataServiceLegacyAddress
202-
);
194+
stakingBase = new HorizonStaking(address(controller), address(0), subgraphDataServiceLegacyAddress);
203195

204196
graphTallyCollector = new GraphTallyCollector(
205197
"GraphTallyCollector",

packages/horizon/test/unit/shared/horizon-staking/HorizonStakingShared.t.sol

Lines changed: 17 additions & 686 deletions
Large diffs are not rendered by default.

packages/horizon/test/unit/staking/allocation/allocation.t.sol

Lines changed: 0 additions & 33 deletions
This file was deleted.

packages/horizon/test/unit/staking/allocation/close.t.sol

Lines changed: 0 additions & 116 deletions
This file was deleted.

packages/horizon/test/unit/staking/allocation/collect.t.sol

Lines changed: 0 additions & 81 deletions
This file was deleted.

packages/horizon/test/unit/staking/delegation/legacyWithdraw.t.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import "forge-std/Test.sol";
55

66
import { IHorizonStakingMain } from "@graphprotocol/interfaces/contracts/horizon/internal/IHorizonStakingMain.sol";
77
import { IHorizonStakingTypes } from "@graphprotocol/interfaces/contracts/horizon/internal/IHorizonStakingTypes.sol";
8-
import { IHorizonStakingExtension } from "@graphprotocol/interfaces/contracts/horizon/internal/IHorizonStakingExtension.sol";
98
import { LinkedList } from "../../../../contracts/libraries/LinkedList.sol";
109

1110
import { HorizonStakingTest } from "../HorizonStaking.t.sol";

packages/horizon/test/unit/staking/governance/governance.t.sol

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,6 @@ contract HorizonStakingGovernanceTest is HorizonStakingTest {
3939
staking.setDelegationSlashingEnabled();
4040
}
4141

42-
function testGovernance_ClearThawingPeriod(uint32 thawingPeriod) public useGovernor {
43-
// simulate previous thawing period
44-
_setStorage_DeprecatedThawingPeriod(thawingPeriod);
45-
46-
_clearThawingPeriod();
47-
}
48-
49-
function testGovernance_ClearThawingPeriod_NotGovernor() public useIndexer {
50-
bytes memory expectedError = abi.encodeWithSignature("ManagedOnlyGovernor()");
51-
vm.expectRevert(expectedError);
52-
staking.clearThawingPeriod();
53-
}
54-
5542
function testGovernance__SetMaxThawingPeriod(uint64 maxThawingPeriod) public useGovernor {
5643
_setMaxThawingPeriod(maxThawingPeriod);
5744
}

packages/horizon/test/unit/staking/provision/provision.t.sol

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,6 @@ contract HorizonStakingProvisionTest is HorizonStakingTest {
9696
staking.provision(users.indexer, subgraphDataServiceAddress, amount, maxVerifierCut, thawingPeriod);
9797
}
9898

99-
function testProvision_RevertWhen_VerifierIsNotSubgraphDataServiceDuringTransitionPeriod(
100-
uint256 amount
101-
) public useIndexer useStake(amount) {
102-
// simulate the transition period
103-
_setStorage_DeprecatedThawingPeriod(THAWING_PERIOD_IN_BLOCKS);
104-
105-
// oddly we use subgraphDataServiceLegacyAddress as the subgraph service address
106-
// so subgraphDataServiceAddress is not the subgraph service ¯\_(ツ)_/¯
107-
bytes memory expectedError = abi.encodeWithSignature(
108-
"HorizonStakingInvalidVerifier(address)",
109-
subgraphDataServiceAddress
110-
);
111-
vm.expectRevert(expectedError);
112-
staking.provision(users.indexer, subgraphDataServiceAddress, amount, 0, 0);
113-
}
114-
11599
function testProvision_AddTokensToProvision(
116100
uint256 amount,
117101
uint32 maxVerifierCut,

packages/horizon/test/unit/staking/serviceProvider/serviceProvider.t.sol

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -101,37 +101,6 @@ contract HorizonStakingServiceProviderTest is HorizonStakingTest {
101101
assertEq(providerTokensAvailable, amount);
102102
}
103103

104-
function testServiceProvider_HasStake(
105-
uint256 amount
106-
) public useIndexer useProvision(amount, MAX_PPM, MAX_THAWING_PERIOD) {
107-
assertTrue(staking.hasStake(users.indexer));
108-
109-
_thaw(users.indexer, subgraphDataServiceAddress, amount);
110-
skip(MAX_THAWING_PERIOD + 1);
111-
_deprovision(users.indexer, subgraphDataServiceAddress, 0);
112-
staking.unstake(amount);
113-
114-
assertFalse(staking.hasStake(users.indexer));
115-
}
116-
117-
function testServiceProvider_GetIndexerStakedTokens(
118-
uint256 amount
119-
) public useIndexer useProvision(amount, MAX_PPM, MAX_THAWING_PERIOD) {
120-
assertEq(staking.getIndexerStakedTokens(users.indexer), amount);
121-
122-
_thaw(users.indexer, subgraphDataServiceAddress, amount);
123-
// Does not discount thawing tokens
124-
assertEq(staking.getIndexerStakedTokens(users.indexer), amount);
125-
126-
skip(MAX_THAWING_PERIOD + 1);
127-
_deprovision(users.indexer, subgraphDataServiceAddress, 0);
128-
// Does not discount thawing tokens
129-
assertEq(staking.getIndexerStakedTokens(users.indexer), amount);
130-
131-
staking.unstake(amount);
132-
assertEq(staking.getIndexerStakedTokens(users.indexer), 0);
133-
}
134-
135104
function testServiceProvider_RevertIf_InvalidDelegationFeeCut(
136105
uint256 cut,
137106
uint8 paymentTypeInput

0 commit comments

Comments
 (0)