From eae76c962b69d207a64323cc8b5b542eebc23938 Mon Sep 17 00:00:00 2001 From: Sean Darcy Date: Fri, 14 Mar 2025 08:48:34 +1100 Subject: [PATCH 1/2] Pass msg sender through factory as operator --- contracts/ServiceNodeContribution.sol | 3 ++- contracts/ServiceNodeContributionFactory.sol | 3 ++- contracts/test/ServiceNodeContributionEchidnaTest.sol | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/contracts/ServiceNodeContribution.sol b/contracts/ServiceNodeContribution.sol index 7c79369..e3f69a2 100644 --- a/contracts/ServiceNodeContribution.sol +++ b/contracts/ServiceNodeContribution.sol @@ -100,13 +100,14 @@ contract ServiceNodeContribution is Shared, IServiceNodeContribution { IServiceNodeRewards.BLSSignatureParams memory sig, IServiceNodeRewards.ServiceNodeParams memory params, IServiceNodeRewards.ReservedContributor[] memory reserved, + address _operator, bool _manualFinalize ) nzAddr(_stakingRewardsContract) nzUint(_maxContributors) { stakingRewardsContract = IServiceNodeRewards(_stakingRewardsContract); stakingRequirement = stakingRewardsContract.stakingRequirement(); SESH = IERC20(stakingRewardsContract.designatedToken()); maxContributors = _maxContributors; - operator = tx.origin; // NOTE: Creation is delegated by operator through factory + operator = _operator; address nilBeneficiary = address(0); _resetUpdateAndContribute(key, sig, params, reserved, _manualFinalize, nilBeneficiary, 0); } diff --git a/contracts/ServiceNodeContributionFactory.sol b/contracts/ServiceNodeContributionFactory.sol index 50dd692..2bcd2ed 100644 --- a/contracts/ServiceNodeContributionFactory.sol +++ b/contracts/ServiceNodeContributionFactory.sol @@ -38,12 +38,13 @@ contract ServiceNodeContributionFactory is Initializable, Ownable2StepUpgradeabl sig, params, reserved, + msg.sender, manualFinalize ); result = address(newContract); deployedContracts[result] = true; - emit NewServiceNodeContributionContract(result, params.serviceNodePubkey, tx.origin); + emit NewServiceNodeContributionContract(result, params.serviceNodePubkey, msg.sender); return result; } diff --git a/contracts/test/ServiceNodeContributionEchidnaTest.sol b/contracts/test/ServiceNodeContributionEchidnaTest.sol index 173abba..9945671 100644 --- a/contracts/test/ServiceNodeContributionEchidnaTest.sol +++ b/contracts/test/ServiceNodeContributionEchidnaTest.sol @@ -75,6 +75,7 @@ contract ServiceNodeContributionEchidnaTest { /*sig*/ blsSig, /*serviceNodeParams*/ snParams, /*reserved*/ reserved, + /*operator*/ snOperator, /*manualFinalize*/ false ); From 9d97d58358f220e6c139e5918de6b6ba5f945ba7 Mon Sep 17 00:00:00 2001 From: Doyle Date: Mon, 24 Mar 2025 10:57:33 +1100 Subject: [PATCH 2/2] Add natspec comment for _operator in multi-contrib contract --- contracts/ServiceNodeContribution.sol | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contracts/ServiceNodeContribution.sol b/contracts/ServiceNodeContribution.sol index e3f69a2..989948c 100644 --- a/contracts/ServiceNodeContribution.sol +++ b/contracts/ServiceNodeContribution.sol @@ -88,6 +88,10 @@ contract ServiceNodeContribution is Shared, IServiceNodeContribution { /// key, a signature and the fee the operator is charging. /// @param reserved The new array of reserved contributors with their /// proportion of stake they must fulfill in the node. + /// @param _operator The owner and operator of the node that will be + /// deployed from this multi-contribution contract and consequently the + /// recipient of the operator fee and admin access control of the + /// multi-contribution contract. /// @param _manualFinalize Configure if the contract automatically (or does /// not) finalize the contract upon receipt of a contribution that /// funds the total required staking requirement of the contract.