Skip to content

Commit

Permalink
fix(ct): make the SphinxAuth contract friendly to local tests (sphinx…
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-goldman authored Sep 4, 2023
1 parent 8da0494 commit 5de8fa5
Show file tree
Hide file tree
Showing 17 changed files with 345 additions and 326,633 deletions.
8 changes: 8 additions & 0 deletions .changeset/stale-vans-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@sphinx-labs/contracts': patch
'@sphinx-labs/executor': patch
'@sphinx-labs/plugins': patch
'@sphinx-labs/core': patch
---

Make the SphinxAuth contract friendly to local development
7 changes: 5 additions & 2 deletions packages/contracts/contracts/SphinxAuth.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { Semver, Version } from "./Semver.sol";

/**
* @title SphinxAuth
* @custom:version 0.2.0
* @custom:version 0.2.1
*/
contract SphinxAuth is AccessControlEnumerableUpgradeable, Semver {
bytes32 private constant PROPOSER_ROLE = keccak256("ProposerRole");
Expand All @@ -46,6 +46,10 @@ contract SphinxAuth is AccessControlEnumerableUpgradeable, Semver {

ISphinxManager public manager;

/**
* @notice The number of owners that must sign an auth root in order for it to be executable
* in this contract.
*/
uint256 public threshold;

string public projectName;
Expand Down Expand Up @@ -681,7 +685,6 @@ contract SphinxAuth is AccessControlEnumerableUpgradeable, Semver {
bytes32 _verifyingRole,
bytes[] memory _signatures
) private view {
if (_threshold == 0) revert ThresholdCannotBeZero();
if (_signatures.length < _threshold) revert NotEnoughSignatures();

AuthState memory authState = authStates[_authRoot];
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/contracts/SphinxManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { SphinxManagerEvents } from "./SphinxManagerEvents.sol";

/**
* @title SphinxManager
* @custom:version 0.2.0
* @custom:version 0.2.1
* @notice This contract contains the logic for managing the entire lifecycle of a project's
* deployments. It contains the functionality for approving and executing deployments and
* exporting proxies out of the Sphinx system if desired. It exists as a single
Expand Down
326,450 changes: 1 addition & 326,449 deletions packages/contracts/src/prev-build-info.json

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions packages/core/src/config/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ import {
VALID_MANAGER_VERSIONS,
VALID_TEST_MANAGER_VERSIONS,
} from './types'
import { CONTRACT_SIZE_LIMIT, Keyword, keywords } from '../constants'
import {
CONTRACT_SIZE_LIMIT,
CURRENT_SPHINX_MANAGER_VERSION,
Keyword,
keywords,
} from '../constants'
import {
getStorageType,
extendStorageLayout,
Expand Down Expand Up @@ -3076,11 +3081,7 @@ export const getConfigCache = async (

const managerVersion: SemverVersion = isManagerDeployed_
? await SphinxManager.version()
: {
major: 0,
minor: 2,
patch: 0,
}
: CURRENT_SPHINX_MANAGER_VERSION

// Get a mapping of call hashes to their current nonces. We'll use this later to determine which
// call actions to skip in the deployment, if any.
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ export const contractKindHashes: { [contractKind: string]: string } = {
proxy: DEFAULT_PROXY_TYPE_HASH,
}

export type ValidManagerVersion = 'v0.2.0'
export type ValidManagerVersion = 'v0.2.1'
export const VALID_TEST_MANAGER_VERSIONS = ['v9.9.9']
export const VALID_MANAGER_VERSIONS = ['v0.2.0']
export const VALID_MANAGER_VERSIONS = ['v0.2.1']

export type Project = string | 'all'

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const FUNDER_ROLE = ethers.keccak256(ethers.toUtf8Bytes('FUNDER_ROLE'))
export const CURRENT_SPHINX_MANAGER_VERSION = {
major: 0,
minor: 2,
patch: 0,
patch: 1,
}

export const CURRENT_SPHINX_AUTH_VERSION = CURRENT_SPHINX_MANAGER_VERSION
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,7 @@ export const getEmptyCanonicalConfig = (
owners: [],
ownerThreshold: 0,
proposers: [],
managerVersion: 'v0.2.0',
managerVersion: 'v0.2.1',
},
contracts: {},
chainStates,
Expand Down
2 changes: 1 addition & 1 deletion packages/executor/test/Executor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe('Remote executor', () => {
testnets: [network],
mainnets: [],
proposers: [owner.address],
managerVersion: 'v0.2.0',
managerVersion: 'v0.2.1',
},
contracts: {
[proxyReferenceName]: {
Expand Down
7 changes: 1 addition & 6 deletions packages/plugins/contracts/foundry/Sphinx.sol
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,7 @@ abstract contract Sphinx {
manager.initiateUpgrade{ gas: 1000000 }(targets, proofs);

// Execute all the set storage actions
executeBatchActions(
setStorageActions,
true,
manager,
bufferedGasLimit
);
executeBatchActions(setStorageActions, true, manager, bufferedGasLimit);

// Complete the upgrade
manager.finalizeUpgrade{ gas: 1000000 }(targets, proofs);
Expand Down
10 changes: 5 additions & 5 deletions packages/plugins/contracts/foundry/SphinxConstants.sol

Large diffs are not rendered by default.

13 changes: 2 additions & 11 deletions packages/plugins/contracts/foundry/SphinxUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -233,21 +233,12 @@ contract SphinxUtils is
string memory configUri,
HumanReadableAction[] memory readableActions,
string memory warnings
) = abi.decode(
remainingBundleInfo,
(string, HumanReadableAction[], string)
);
) = abi.decode(remainingBundleInfo, (string, HumanReadableAction[], string));

if (bytes(warnings).length > 0) {
console.log(StdStyle.yellow(warnings));
}
return
BundleInfo(
configUri,
decodedActionBundle,
decodedTargetBundle,
readableActions
);
return BundleInfo(configUri, decodedActionBundle, decodedTargetBundle, readableActions);
} else {
(string memory errors, string memory warnings) = abi.decode(data, (string, string));
if (bytes(warnings).length > 0) {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/sphinx/Website.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const config: UserConfigWithOptions = {
testnets: ['arbitrum-goerli', 'optimism-goerli', 'goerli'],
mainnets: ['ethereum', 'optimism'],
proposers: [ownerAddress],
managerVersion: 'v0.2.0',
managerVersion: 'v0.2.1',
},
contracts: {
MyContract: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const config: UserSphinxConfig = {
proposers: [ethers.ZeroAddress],
mainnets: [],
testnets: ['optimism-goerli', 'arbitrum-goerli'],
managerVersion: 'v0.2.0',
managerVersion: 'v0.2.1',
},
contracts: {
IncorrectConstructorArgOverrides: {
Expand Down
Loading

0 comments on commit 5de8fa5

Please sign in to comment.