Skip to content

Commit

Permalink
ignore old automation & fix minor vrf
Browse files Browse the repository at this point in the history
  • Loading branch information
RensR committed Dec 4, 2023
1 parent 5aa336a commit d8765f6
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 1 deletion.
5 changes: 5 additions & 0 deletions contracts/.solhintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# 344 warnings
#./src/v0.8/automation

# Ignore frozen Automation code
./src/v0.8/automation/v1_2
./src/v0.8/automation/v1_3
./src/v0.8/automation/v2_0

# Ignore Functions v1.0.0 code that was frozen after audit
./src/v0.8/functions/v1_0_0

Expand Down
2 changes: 1 addition & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"prepublishOnly": "pnpm compile && ./scripts/prepublish_generate_abi_folder",
"publish-beta": "pnpm publish --tag beta",
"publish-prod": "npm dist-tag add @chainlink/[email protected] latest",
"solhint": "solhint --max-warnings 376 \"./src/v0.8/**/*.sol\""
"solhint": "solhint --max-warnings 180 \"./src/v0.8/**/*.sol\""
},
"files": [
"src/v0.8",
Expand Down
2 changes: 2 additions & 0 deletions contracts/src/v0.8/ValidatorProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ contract ValidatorProxy is AggregatorValidatorInterface, TypeAndVersionInterface
current = s_currentAggregator.target;
hasProposal = s_currentAggregator.hasNewProposal;
proposed = s_proposedAggregator;
return (current, hasProposal, proposed);
}

/** VALIDATOR CONFIGURATION FUNCTIONS **/
Expand Down Expand Up @@ -216,6 +217,7 @@ contract ValidatorProxy is AggregatorValidatorInterface, TypeAndVersionInterface
current = s_currentValidator.target;
hasProposal = s_currentValidator.hasNewProposal;
proposed = s_proposedValidator;
return (current, hasProposal, proposed);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions contracts/src/v0.8/transmission/dev/ERC-4337/Paymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ contract Paymaster is IPaymaster, ConfirmedOwner {
extraCost = directFundingData.topupAmount;
}
}
return extraCost;
}

/// @dev Deducts user subscription balance after execution.
Expand All @@ -116,6 +117,7 @@ contract Paymaster is IPaymaster, ConfirmedOwner {

function _getCostJuels(uint256 costWei) internal view returns (uint256 costJuels) {
costJuels = (1e18 * costWei) / uint256(_getFeedData());
return costJuels;
}

function _getFeedData() internal view returns (int256) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ library SCALibrary {
hashOfEncoding
)
);
return fullHash;
}

function _recoverSignature(bytes memory signature, bytes32 fullHash) internal pure returns (address) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@ contract SmartContractAccountFactory {
}

emit ContractCreated(scaAddress);

return scaAddress;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ library SmartContractAccountHelper {
SCA.executeTransactionFromEntryPoint.selector,
abi.encode(endContract, value, block.timestamp + deadline, data)
);
return encoding;
}

function getFullHashForSigning(bytes32 userOpHash, address scaAddress) public view returns (bytes32) {
Expand All @@ -29,6 +30,7 @@ library SmartContractAccountHelper {
address entryPoint
) public pure returns (bytes memory initCode) {
initCode = bytes.concat(INITIALIZE_CODE, abi.encode(owner, entryPoint));
return initCode;
}

function getInitCode(
Expand All @@ -46,6 +48,7 @@ library SmartContractAccountHelper {
initializeCodeWithConstructor
)
);
return initCode;
}

/// @dev Computes the smart contract address that results from a CREATE2 operation, per EIP-1014.
Expand Down
1 change: 1 addition & 0 deletions contracts/src/v0.8/vrf/KeepersVRFConsumer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ contract KeepersVRFConsumer is KeeperCompatibleInterface, VRFConsumerBaseV2 {
* @return upkeepNeeded true if and only if at least UPKEEP_INTERVAL seconds have elapsed since the last upkeep or since construction
* of the contract.
*/
// solhint-disable-next-line chainlink-solidity/explicit-returns
function checkUpkeep(
bytes calldata /* checkData */
) external view override returns (bool upkeepNeeded, bytes memory /* performData */) {
Expand Down
7 changes: 7 additions & 0 deletions contracts/src/v0.8/vrf/VRF.sol
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ contract VRF {
while (x_ >= FIELD_SIZE) {
x_ = uint256(keccak256(abi.encodePacked(x_)));
}
return x_;
}

// Hash b to a random point which hopefully lies on secp256k1. The y ordinate
Expand All @@ -223,6 +224,7 @@ contract VRF {
p[1] = FIELD_SIZE - p[1];
}
}
return p;
}

// Domain-separation tag for initial hash in _hashToCurve. Corresponds to
Expand All @@ -248,6 +250,7 @@ contract VRF {
while (!_isOnCurve(rv)) {
rv = _newCandidateSecp256k1Point(abi.encodePacked(rv[0]));
}
return rv;
}

/** *********************************************************************
Expand Down Expand Up @@ -294,6 +297,7 @@ contract VRF {
uint256 num2 = mulmod(FIELD_SIZE - x2, z1, FIELD_SIZE);
(x3, z3) = (addmod(num1, num2, FIELD_SIZE), mulmod(z1, z2, FIELD_SIZE));
}
return (x3, z3);
}

// Returns x1/z1*x2/z2=(x1x2)/(z1z2), in projective coordinates on P¹(𝔽ₙ)
Expand All @@ -304,6 +308,7 @@ contract VRF {
uint256 z2
) internal pure returns (uint256 x3, uint256 z3) {
(x3, z3) = (mulmod(x1, x2, FIELD_SIZE), mulmod(z1, z2, FIELD_SIZE));
return (x3, z3);
}

/** **************************************************************************
Expand Down Expand Up @@ -385,6 +390,7 @@ contract VRF {
sz = dx;
}
}
return (sx, sy, sz);
}

// p1+p2, as affine points on secp256k1.
Expand Down Expand Up @@ -577,5 +583,6 @@ contract VRF {
proof.zInv
);
output = uint256(keccak256(abi.encode(VRF_RANDOM_OUTPUT_HASH_PREFIX, proof.gamma)));
return output;
}
}
1 change: 1 addition & 0 deletions contracts/src/v0.8/vrf/VRFCoordinatorV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, TypeAndVersionInterface, VRFCo
// The seed actually used by the VRF machinery, mixing in the blockhash
uint256 actualSeed = uint256(keccak256(abi.encodePacked(proof.seed, blockHash)));
randomness = VRF._randomValueFromVRFProof(proof, actualSeed); // Reverts on failure
return (keyHash, requestId, randomness);
}

/*
Expand Down

0 comments on commit d8765f6

Please sign in to comment.