Skip to content

Commit e6e7857

Browse files
committed
ci happy
1 parent 936a381 commit e6e7857

File tree

8 files changed

+43
-39
lines changed

8 files changed

+43
-39
lines changed

abis/Client.json

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -527,25 +527,6 @@
527527
],
528528
"anonymous": false
529529
},
530-
{
531-
"type": "event",
532-
"name": "ValidatorLockupPeriodUpdated",
533-
"inputs": [
534-
{
535-
"name": "dealId",
536-
"type": "uint256",
537-
"indexed": true,
538-
"internalType": "uint256"
539-
},
540-
{
541-
"name": "validator",
542-
"type": "address",
543-
"indexed": true,
544-
"internalType": "address"
545-
}
546-
],
547-
"anonymous": false
548-
},
549530
{
550531
"type": "error",
551532
"name": "AccessControlBadConfirmation",

abis/PoRepMarket.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,12 @@
658658
"indexed": true,
659659
"internalType": "address"
660660
},
661+
{
662+
"name": "actualSizeBytes",
663+
"type": "uint256",
664+
"indexed": false,
665+
"internalType": "uint256"
666+
},
661667
{
662668
"name": "provider",
663669
"type": "uint64",

script/Deploy.s.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ contract Deploy is Script, DeployUtils {
5353
(validatorFactory, validatorFactoryImpl, validatorImpl) = _deployValidatorFactory(admin);
5454
(poRepMarket, poRepMarketImpl) = _deployPoRepMarket(admin, validatorFactory, spRegistry);
5555
(clientSmartContract, clientSmartContractImpl) =
56-
_deployClientSmartContract(admin, terminationOracle, porepMarket);
56+
_deployClientSmartContract(admin, terminationOracle, poRepMarket);
5757
(sliOracle, sliOracleImpl) = _deploySLIOracle(admin, oracleAddress);
5858
(sliScorer, sliScorerImpl) = _deploySliScorer(admin, sliOracle);
5959
(spRegistry, spRegistryImpl) = _deploySPRegistry(admin);

src/Client.sol

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,6 @@ contract Client is Initializable, AccessControlUpgradeable, UUPSUpgradeable, Ree
7474
event DatacapSpent(address indexed client, uint256 amount);
7575
// solhint-enable gas-indexed-events
7676

77-
/**
78-
* @notice Emited when lockupPeriod is called
79-
* @param dealId Deal id
80-
* @param validator Validator address
81-
*/
82-
event ValidatorLockupPeriodUpdated(uint256 indexed dealId, address indexed validator);
83-
8477
/**
8578
* @notice Emitted when a datacap is successfully allocated to client contract
8679
* @param allowance Allowance amount

src/Validator.sol

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
pragma solidity =0.8.25;
55

66
import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
7-
import {CommonTypes} from "filecoin-solidity/v0.8/types/CommonTypes.sol";
8-
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
97

108
contract Validator is AccessControlUpgradeable {
119
function initialize(

src/ValidatorFactory.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ contract ValidatorFactory is UUPSUpgradeable, AccessControlUpgradeable {
157157
)
158158
)
159159
);
160-
160+
// forge-lint: disable-next-line(asm-keccak256)
161161
bytes32 salt = keccak256(abi.encode(admin, dealId));
162162
address proxy = Create2.computeAddress(salt, keccak256(initCode), address(this));
163163
$._instances[dealId] = proxy;

test/Client.t.sol

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,6 @@ contract ClientTest is Test {
402402
// solhint-disable-next-line reentrancy
403403
transferParams.operator_data =
404404
hex"828286192710D82A5828000181E203922020F2B9A58BBC9D9856E52EAB85155C1BA298F7E8DF458BD20A3AD767E11572CA221908001A0007E9001A0050334019013186192710D82A5828000181E203922020F2B9A58BBC9D9856E52EAB85155C1BA298F7E8DF458BD20A3AD767E11572CA221950001A0007E9001A009C7E801901318183192710011A005034AC";
405-
vm.expectEmit(true, true, true, true);
406-
emit Client.ValidatorLockupPeriodUpdated(dealId, address(validatorMock));
407405
clientMock.transfer(transferParams, dealId, false);
408406

409407
Client.Deal memory deal = clientMock.getDeal(dealId);
@@ -432,8 +430,6 @@ contract ClientTest is Test {
432430
// termMax + expiration -> 10256305
433431
transferParams.operator_data =
434432
hex"828286192710D82A5828000181E203922020F2B9A58BBC9D9856E52EAB85155C1BA298F7E8DF458BD20A3AD767E11572CA221908001A0007E9001A0050334019013186192710D82A5828000181E203922020F2B9A58BBC9D9856E52EAB85155C1BA298F7E8DF458BD20A3AD767E11572CA221950001A0007E9001A009C7E801901318183192710011A005034AC";
435-
vm.expectEmit(true, true, true, true);
436-
emit Client.ValidatorLockupPeriodUpdated(dealId, address(validatorMock));
437433
vm.prank(clientAddress);
438434
clientMock.transfer(transferParams, dealId, false);
439435

@@ -483,7 +479,7 @@ contract ClientTest is Test {
483479
PoRepMarket.DealProposal({
484480
dealId: 150,
485481
client: clientAddress,
486-
provider: SP2,
482+
provider: SP1,
487483
requirements: SLITypes.SLIThresholds({
488484
retrievabilityPct: 80, bandwidthMbps: 500, latencyMs: 200, indexingPct: 90
489485
}),
@@ -497,7 +493,7 @@ contract ClientTest is Test {
497493
reentrantValidatorMock.setAttackParams(address(client), transferParams, dealId);
498494
vm.prank(clientAddress);
499495
vm.expectRevert(abi.encodeWithSelector(ReentrancyGuard.ReentrancyGuardReentrantCall.selector));
500-
client.transfer(transferParams, dealId, false);
496+
client.transfer(transferParams, dealId, true);
501497
}
502498

503499
function testShouldAddClaimExtensionIdsAfterTransfer() public {
@@ -528,8 +524,6 @@ contract ClientTest is Test {
528524
transferParams.operator_data =
529525
hex"828286192710D82A5828000181E203922020F2B9A58BBC9D9856E52EAB85155C1BA298F7E8DF458BD20A3AD767E11572CA221908001A0007E9001A0050334019013186192710D82A5828000181E203922020F2B9A58BBC9D9856E52EAB85155C1BA298F7E8DF458BD20A3AD767E11572CA221950001A0007E9001A009C7E801901318183192710041A005034AC";
530526
actorIdMock.setDataCapTransferResult(hex"834100410049838201808200808102");
531-
vm.expectEmit(true, true, true, true);
532-
emit Client.ValidatorLockupPeriodUpdated(dealId, address(validatorMock));
533527

534528
vm.prank(clientAddress);
535529
clientMock.transfer(transferParams, dealId, false);
@@ -766,4 +760,36 @@ contract ClientTest is Test {
766760
vm.expectRevert(abi.encodeWithSelector(Client.ValidatorNotSet.selector, dealId));
767761
clientMock.isDataSizeMatching(dealId);
768762
}
763+
764+
function testShouldRevertWhenAlreadyRegisteredDealTransferIsCalledByNotTheClient() public {
765+
vm.prank(clientAddress);
766+
client.transfer(transferParams, dealId, false);
767+
768+
address notTheClient = vm.addr(0x523);
769+
vm.prank(notTheClient);
770+
vm.expectRevert(abi.encodeWithSelector(Client.InvalidClient.selector));
771+
client.transfer(transferParams, dealId, false);
772+
}
773+
774+
function testTransferEmitsDatacapSpent() public {
775+
transferParams.operator_data =
776+
hex"828186192710D82A5828000181E203922020F2B9A58BBC9D9856E52EAB85155C1BA298F7E8DF458BD20A3AD767E11572CA221908001A0007E9001A005033401901318183192710031A005034AC";
777+
778+
vm.expectEmit(true, false, false, true);
779+
emit Client.DatacapSpent(clientAddress, 4096);
780+
781+
vm.prank(clientAddress);
782+
client.transfer(transferParams, dealId, false);
783+
}
784+
785+
function testTransferEmitsDatacapAllocated() public {
786+
transferParams.operator_data =
787+
hex"828186192710D82A5828000181E203922020F2B9A58BBC9D9856E52EAB85155C1BA298F7E8DF458BD20A3AD767E11572CA221908001A0007E9001A005033401901318183192710031A005034AC";
788+
789+
vm.expectEmit(true, false, false, false);
790+
emit Client.DatacapAllocated(4096);
791+
792+
vm.prank(clientAddress);
793+
client.transfer(transferParams, dealId, false);
794+
}
769795
}

test/contracts/PoRepMarketMock.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ contract PoRepMarketMock {
1717
}
1818

1919
// solhint-disable-next-line no-empty-blocks
20-
function completeDeal(uint256) external {
20+
function completeDeal(uint256, uint256) external {
2121
//noop
2222
}
2323
}

0 commit comments

Comments
 (0)