Skip to content

Commit

Permalink
Merge branch 'dev' into fix/CAN-540
Browse files Browse the repository at this point in the history
  • Loading branch information
nicosampler committed Oct 7, 2024
2 parents faf473a + 6b0de7c commit 0e0c90e
Show file tree
Hide file tree
Showing 36 changed files with 78 additions and 264 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/setup-node@v4
with:
cache: pnpm
node-version: '20.5.1'
node-version: '20.18.0'

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
Expand Down
33 changes: 33 additions & 0 deletions examples/sample-foundry-project/cannonfile.withcloned.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name = "owned-greeter"
version = "1.0.0"
description = "Simple greeter project that can be owned"
keywords = ["sample", "greeter", "owned"]

[setting.salt]
defaultValue = "owned-greeter"

[provision.usd]
source = "mintable-token@permissionless-mint"
options.symbol = "USD"
options.name = "Mintable USD"
options.salt = "usd"

[provision.oracle_manager]
source = "oracle-manager"
options.salt = "0x3330363734343032330000000000000000000000000000000000000000000000-oracle"
options.owner = "0x6E1613B5c68B4Cf2A58400D8019a97849A678139"

[provision.chainlink]
source = "chainlink"

[contract.Greeter]
artifact = "Greeter"
args = ['0x70997970C51812dc3A010C7d01b50e0d17dc79C8']
salt = "<%= settings.salt %>"

# Call Greeter.setGreeting
[invoke.setGreeting]
target = ["Greeter"]
func = "setGreeting"
from = '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'
args = [0, "hello world!"]
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"npmClient": "pnpm",
"packages": ["packages/*"],
"exact": true,
"version": "2.18.0"
"version": "2.18.1"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint:fix:js": "prettier --write '{packages,examples}/**/*.{js,ts}' && eslint --fix '{packages,examples}/**/*.{js,ts}'",
"lint:fix:sol": "prettier --write '{packages,examples}/*/{contracts,src}/**/*.sol'",
"lint:fix": "pnpm run '/^lint:fix:(js|sol)/'",
"build": "pnpm -r --filter @usecannon/builder --filter @usecannon/cli --filter hardhat-cannon --filter @usecannon/api run build",
"build": "pnpm -r --if-present run clean && pnpm -r --filter @usecannon/builder --filter @usecannon/cli --filter hardhat-cannon --filter @usecannon/api run build",
"watch": "pnpm -r --parallel --filter @usecannon/builder --filter @usecannon/cli run watch",
"version-alpha": "lerna version prerelease --no-private",
"version-patch": "lerna version patch --no-private",
Expand Down
1 change: 1 addition & 0 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"scripts": {
"db-prepare": "cp ../indexer/src/db.ts ./src/db/keys.ts",
"build": "tsc -p tsconfig.json",
"clean": "rm -rf ./dist",
"start": "node dist/src/index.js",
"dev": "NODE_ENV=development ts-node-dev src/index.ts"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/builder/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@usecannon/builder",
"version": "2.18.0",
"version": "2.18.1",
"description": "Assembles cannonfile.toml manifests into cannon packages.",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
Expand All @@ -12,6 +12,7 @@
"test": "jest",
"build": "tsc -p tsconfig.build.json && rollup -c",
"watch": "tsc -p tsconfig.build.json -w",
"clean": "rm -rf ./dist",
"prepublishOnly": "npm run build",
"docgen": "typedoc"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "@usecannon/cli",
"version": "2.18.0",
"version": "2.18.1",
"description": "Utility for instantly loading cannon packages in standalone contexts",
"main": "dist/src/index.js",
"scripts": {
"build": "tsc -p tsconfig.build.json",
"watch": "tsc -p tsconfig.build.json -w",
"clean": "rm -rf ./dist",
"prepublishOnly": "pnpm run build",
"test": "jest",
"test-e2e-prepare": "git submodule update --init --recursive",
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/src/commands/alter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ describe('alter', () => {
jest.spyOn(localLoader, 'read').mockImplementation(mockReadDeploy);

// Call the 'alter' function with the necessary arguments
await alter(packageName, subpkg, chainId, cliSettings, preset, testPkgData.meta, command, targets, runtimeOverrides);
await alter(packageName, subpkg, chainId, cliSettings, testPkgData.meta, command, targets, runtimeOverrides);

expect(CannonStorage.prototype.readDeploy as jest.Mock<any, any>).toHaveBeenCalledWith(packageName, chainId);
expect(CannonStorage.prototype.putDeploy as jest.Mock<any, any>).toHaveBeenCalledWith(newTestPkgData);
Expand All @@ -145,7 +145,7 @@ describe('alter', () => {
const targets = ['TestContract', '0x2222222222222222222222222222222222222222'];

// Call the 'alter' function with the necessary arguments
await alter(packageName, subpkg, chainId, cliSettings, preset, testPkgData.meta, command, targets, runtimeOverrides);
await alter(packageName, subpkg, chainId, cliSettings, testPkgData.meta, command, targets, runtimeOverrides);

expect(CannonStorage.prototype.readDeploy as jest.Mock<any, any>).toHaveBeenCalledWith(packageName, chainId);
expect(CannonStorage.prototype.putDeploy as jest.Mock<any, any>).toHaveBeenCalledWith(testPkgData);
Expand All @@ -168,7 +168,7 @@ describe('alter', () => {
jest.spyOn(ChainDefinition.prototype, 'getState').mockResolvedValue(hash);

// Call the 'alter' function with the necessary arguments
await alter(packageName, subpkg, chainId, cliSettings, preset, testPkgData.meta, command, targets, runtimeOverrides);
await alter(packageName, subpkg, chainId, cliSettings, testPkgData.meta, command, targets, runtimeOverrides);

expect(CannonStorage.prototype.readDeploy as jest.Mock<any, any>).toHaveBeenCalledWith(packageName, chainId);
expect(CannonStorage.prototype.putDeploy as jest.Mock<any, any>).toHaveBeenCalledWith(testPkgData);
Expand All @@ -190,7 +190,7 @@ describe('alter', () => {
const targets = ['provision.dummyStep'];

// Call the 'alter' function with the necessary arguments
await alter(packageName, subpkg, chainId, cliSettings, preset, testPkgData.meta, command, targets, runtimeOverrides);
await alter(packageName, subpkg, chainId, cliSettings, testPkgData.meta, command, targets, runtimeOverrides);

expect(CannonStorage.prototype.readDeploy as jest.Mock<any, any>).toHaveBeenCalledWith(packageName, chainId);
expect(CannonStorage.prototype.putDeploy as jest.Mock<any, any>).toHaveBeenCalledWith(testPkgData);
Expand All @@ -212,7 +212,7 @@ describe('alter', () => {
const targets: string[] = ['TestContract', '0x2222222222222222222222222222222222222222'];

// Call the 'alter' function with the necessary arguments
await alter(packageName, subpkg, chainId, cliSettings, preset, testPkgData.meta, command, targets, runtimeOverrides);
await alter(packageName, subpkg, chainId, cliSettings, testPkgData.meta, command, targets, runtimeOverrides);

expect(CannonStorage.prototype.readDeploy as jest.Mock<any, any>).toHaveBeenCalledWith(packageName, chainId);
expect(CannonStorage.prototype.putDeploy as jest.Mock<any, any>).toHaveBeenCalledWith(testPkgData);
Expand Down
18 changes: 1 addition & 17 deletions packages/cli/src/commands/alter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
ActionKinds,
addOutputsToContext,
} from '@usecannon/builder';
import { bold, yellow } from 'chalk';
import Debug from 'debug';
import _ from 'lodash';
import * as viem from 'viem';
Expand All @@ -29,7 +28,6 @@ export async function alter(
subpkg: string[],
chainId: number,
cliSettings: CliSettings,
presetArg: string,
meta: any,
command:
| 'set-url'
Expand All @@ -43,20 +41,7 @@ export async function alter(
targets: string[],
runtimeOverrides: Partial<ChainBuilderRuntime>
) {
// Handle deprecated preset specification
let { fullPackageRef } = new PackageReference(packageRef);

// Once preset arg is removed from the cli args we can remove this logic
if (presetArg) {
fullPackageRef = `${fullPackageRef.split('@')[0]}@${presetArg}`;
warn(
yellow(
bold(
'The --preset option will be deprecated soon. Reference presets in the package reference using the format name:version@preset'
)
)
);
}
const { fullPackageRef } = new PackageReference(packageRef);

const { provider } = await resolveProvider({ action: ProviderAction.ReadProvider, quiet: true, cliSettings, chainId });
const resolver = await createDefaultReadRegistry(cliSettings);
Expand Down Expand Up @@ -316,7 +301,6 @@ export async function alter(
[],
chainId,
cliSettings,
presetArg,
meta,
'migrate-212',
targets,
Expand Down
16 changes: 1 addition & 15 deletions packages/cli/src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ interface Params {
getSigner?: (addr: viem.Address) => Promise<CannonSigner>;
getDefaultSigner?: () => Promise<CannonSigner>;
projectDirectory?: string;
presetArg?: string;
overrideResolver?: CannonRegistry;
wipe?: boolean;
persist?: boolean;
Expand All @@ -69,7 +68,6 @@ export async function build({
getArtifact,
getSigner,
getDefaultSigner,
presetArg,
overrideResolver,
wipe = false,
persist = true,
Expand Down Expand Up @@ -102,19 +100,7 @@ export async function build({
);

const { fullPackageRef, packageRef } = packageReference;
const { name, version } = packageReference;
const preset = presetArg || packageReference.preset;

// Handle deprecated preset specification
if (presetArg) {
warn(
yellow(
bold(
'The --preset option will be deprecated soon. Reference presets in the package reference using the format name:version@preset'
)
)
);
}
const { name, version, preset } = packageReference;

const cliSettings = resolveCliSettings({ registryPriority });
const filteredSettings = await filterSettings(cliSettings);
Expand Down
4 changes: 0 additions & 4 deletions packages/cli/src/commands/config/forge/common/evm.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import type { Option as ForgeEVMOption } from '../../types';

export const forgeEvmOptions: ForgeEVMOption[] = [
{
flags: '--forge.rpc-url <url>',
description: 'Fetch state over a remote endpoint instead of starting from an empty state.',
},
{
flags: '--forge.fork-url <url>',
description:
Expand Down
45 changes: 0 additions & 45 deletions packages/cli/src/commands/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ export const commandsConfig: CommandsConfig = {
flags: '--registry-priority <registry>',
description: 'Change the default registry to read from first. Default: onchain',
},
{
flags: '--preset <preset>',
description: 'Load an alternate setting preset',
},
{
flags: '--logs',
description: 'Show RPC logs instead of an interactive prompt',
Expand Down Expand Up @@ -110,11 +106,6 @@ export const commandsConfig: CommandsConfig = {
description: 'Port which the JSON-RPC server will be exposed. [default: 0]',
defaultValue: ANVIL_PORT_DEFAULT_VALUE,
},
{
flags: '-p --preset <preset>',
description:
'(DEPRECATED) The preset label for storing the build with the given settings. Declare a preset in your cannonfile instead.',
},
{
flags: '--dry-run',
description: 'Simulate building on a local fork rather than deploying on the real network',
Expand Down Expand Up @@ -196,10 +187,6 @@ export const commandsConfig: CommandsConfig = {
description: 'Chain ID of deployment to verify',
defaultValue: '1',
},
{
flags: '-p --preset <preset>',
description: '(DEPRECATED) Preset of the deployment to verify',
},
...debugVerbosity,
],
},
Expand All @@ -222,10 +209,6 @@ export const commandsConfig: CommandsConfig = {
description: 'Chain ID of deployment to verify',
defaultValue: '13370',
},
{
flags: '-p --preset <preset>',
description: '(DEPRECATED) Preset of the deployment to verify',
},
{
flags: '--match-contract <name>',
description: 'Regex of contracts to match. Default: compare all contracts',
Expand Down Expand Up @@ -274,10 +257,6 @@ export const commandsConfig: CommandsConfig = {
flags: '--provider-url [url]',
description: '(DEPRECATED) RPC endpoint to fork off of',
},
{
flags: '-p --preset <preset>',
description: '(DEPRECATED) Preset of the deployment to alter',
},
...debugVerbosity,
],
},
Expand Down Expand Up @@ -345,10 +324,6 @@ export const commandsConfig: CommandsConfig = {
flags: '--chain-id <number>',
description: 'The chain ID of the package to publish',
},
{
flags: '--preset <preset>',
description: 'The preset of the packages to publish',
},
{
flags: '-t --tags <tags>',
description: 'Comma separated list of labels for your package',
Expand Down Expand Up @@ -566,10 +541,6 @@ export const commandsConfig: CommandsConfig = {
description: 'Chain ID of the variant to inspect',
defaultValue: '13370',
},
{
flags: '-p --preset <preset>',
description: '(DEPRECATED) Preset of the variant to inspect',
},
{
flags: '-j --json',
description: 'Output as JSON',
Expand Down Expand Up @@ -649,10 +620,6 @@ export const commandsConfig: CommandsConfig = {
flags: '-b --block-number <value>',
description: 'The block to simulate when the call is on',
},
{
flags: '-p --preset <preset>',
description: '(DEPRECATED) Preset of the variant to trace',
},
{
flags: '-n --rpc-url [url]',
description: 'RPC endpoint to fork off of',
Expand Down Expand Up @@ -693,10 +660,6 @@ export const commandsConfig: CommandsConfig = {
flags: '--provider-url [url]',
description: '(DEPRECATED) RPC endpoint to decode on',
},
{
flags: '-p --preset <preset>',
description: '(DEPRECATED) Preset of the variant to inspect',
},
{
flags: '-j --json',
description: 'Output as JSON',
Expand Down Expand Up @@ -731,10 +694,6 @@ export const commandsConfig: CommandsConfig = {
flags: '-c --chain-id',
description: 'Chain ID to connect to and run fork tests with',
},
{
flags: '-p --preset <preset>',
description: '(DEPRECATED) The preset label for storing the build with the given settings',
},
{
flags: '--wipe',
description: 'Clear the existing deployment state and start this deploy from scratch.',
Expand Down Expand Up @@ -777,10 +736,6 @@ export const commandsConfig: CommandsConfig = {
flags: '--provider-url [url]',
description: '(DEPRECATED) RPC endpoint to fork off of',
},
{
flags: '-p --preset <preset>',
description: '(DEPRECATED) Load an alternate setting preset',
},
{
flags: '--mnemonic <phrase>',
description: 'Use the specified mnemonic to initialize a chain of signers while running',
Expand Down
Loading

0 comments on commit 0e0c90e

Please sign in to comment.