Skip to content

Commit

Permalink
Merge pull request #16 from OpenZeppelin/plat-2063-add-skipabivalidat…
Browse files Browse the repository at this point in the history
…ion-flag-to-platform-as-code

Add skip ABI validation flag
  • Loading branch information
shahnami authored Jul 30, 2023
2 parents 07740af + c986d35 commit 6d44552
Show file tree
Hide file tree
Showing 14 changed files with 152 additions and 101 deletions.
2 changes: 1 addition & 1 deletion examples/platform-test-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
],
"license": "MIT",
"devDependencies": {
"@openzeppelin/platform-as-code": "^1.3.1",
"@openzeppelin/platform-as-code": "^1.3.2",
"serverless": "^3.20.0"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"typescript": "^4.9.5"
},
"dependencies": {
"@openzeppelin/platform-sdk": "^0.1.0",
"@openzeppelin/platform-sdk": "^0.2.0",
"keccak256": "^1.0.6",
"lodash": "^4.17.21",
"prompt": "^1.3.0"
Expand Down
19 changes: 10 additions & 9 deletions src/cmd/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export default class PlatformDeploy {
const formattedResources = {
actions:
withResources.actions.length > 0
? withResources.actions.map((a) => `${a.stackResourceId ?? a.name} (${a.actionkId})`)
? withResources.actions.map((a) => `${a.stackResourceId ?? a.name} (${a.actionId})`)
: undefined,
monitors:
withResources.monitors.length > 0
Expand Down Expand Up @@ -781,6 +781,7 @@ export default class PlatformDeploy {
name: match.name,
abi: addressRule && addressRule.abi,
paused: match.paused,
skipABIValidation: match.skipABIValidation,
alertThreshold: match.alertThreshold,
autotaskTrigger: match.notifyConfig?.autotaskId,
alertTimeoutMs: match.notifyConfig?.timeoutMs,
Expand Down Expand Up @@ -901,7 +902,7 @@ export default class PlatformDeploy {
encodedZippedCode: code,
});
const { codeDigest } = await client.get({
actionId: match.actionkId,
actionId: match.actionId,
});

const isSchedule = (
Expand Down Expand Up @@ -932,15 +933,15 @@ export default class PlatformDeploy {
) {
return {
name: match.stackResourceId!,
id: match.actionkId,
id: match.actionId,
success: false,
response: match,
notice: `Skipped ${match.stackResourceId} - no changes detected`,
};
}

const updatesAction = await client.update({
actionId: match.actionkId,
actionId: match.actionId,
name: action.name,
paused: action.paused,
trigger: {
Expand All @@ -954,19 +955,19 @@ export default class PlatformDeploy {
if (newDigest === codeDigest) {
return {
name: match.stackResourceId!,
id: match.actionkId,
id: match.actionId,
success: true,
notice: `Skipped code upload - no changes detected for ${match.stackResourceId}`,
response: updatesAction,
};
} else {
await client.updateCodeFromFolder({
actionId: match.actionkId,
actionId: match.actionId,
path: action.path,
});
return {
name: match.stackResourceId!,
id: match.actionkId,
id: match.actionId,
success: true,
response: updatesAction,
};
Expand Down Expand Up @@ -1000,14 +1001,14 @@ export default class PlatformDeploy {
});
return {
name: stackResourceId,
id: createdAction.actionkId,
id: createdAction.actionId,
success: true,
response: createdAction,
};
},
// on remove
async (actions: PlatformAction[]) => {
await Promise.all(actions.map(async (a) => await client.delete({ actionId: a.actionkId })));
await Promise.all(actions.map(async (a) => await client.delete({ actionId: a.actionId })));
},
undefined,
output,
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export default class PlatformInfo {
'Actions',
this.resources.actions,
listActions,
(resource: PlatformAction) => `${resource.stackResourceId}: ${resource.actionkId}`,
(resource: PlatformAction) => `${resource.stackResourceId}: ${resource.actionId}`,
stdOut.actions,
);

Expand Down
2 changes: 1 addition & 1 deletion src/cmd/invoke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default class PlatformInvoke {
const platformAction = getEquivalentResourceByKey<PlatformAction>(this.options.function!, list);
if (platformAction) {
const response = await client.runAction({
actionId: platformAction.actionkId,
actionId: platformAction.actionId,
data: payload,
});
this.log.notice(JSON.stringify(response, null, 2));
Expand Down
6 changes: 3 additions & 3 deletions src/cmd/remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ export default class PlatformRemove {
async (actions: PlatformAction[]) => {
await Promise.all(
actions.map(async (e) => {
this.log.progress('component-remove-extra', `Removing ${e.stackResourceId} (${e.actionkId}) from Platform`);
await actionClient.delete({ actionId: e.actionkId });
this.log.success(`Removed ${e.stackResourceId} (${e.actionkId})`);
this.log.progress('component-remove-extra', `Removing ${e.stackResourceId} (${e.actionId}) from Platform`);
await actionClient.delete({ actionId: e.actionId });
this.log.success(`Removed ${e.stackResourceId} (${e.actionId})`);
}),
);
},
Expand Down
4 changes: 4 additions & 0 deletions src/types/docs-schemas/definitions.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,10 @@
"required": ["amount", "window-seconds"]
},
"paused": { "type": "boolean" },
"skip-abi-validation": {
"type": "boolean",
"description": "A boolean value that indicates whether the UI should skip ABI validation checks. Enable this if you wish to use custom or partial ABIs for your monitors."
},
"action-condition": { "$ref": "definitions.schema.json#/definitions/action", "format": "uri-reference" },
"action-trigger": { "$ref": "definitions.schema.json#/definitions/action", "format": "uri-reference" },
"confirm-level": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## skip-abi-validation Type

`boolean`
49 changes: 34 additions & 15 deletions src/types/docs/definitions-definitions-blockmonitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@

# 0 Properties

| Property | Type | Required | Nullable | Defined by |
| :------------------------------------ | :-------- | :------- | :------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [name](#name) | `string` | Required | cannot be null | [Definitions](definitions-definitions-blockmonitor-properties-name.md "definitions.schema.json#/definitions/blockMonitor/properties/name") |
| [type](#type) | `string` | Required | cannot be null | [Definitions](definitions-definitions-blockmonitor-properties-type.md "definitions.schema.json#/definitions/blockMonitor/properties/type") |
| [network](#network) | `string` | Required | cannot be null | [Definitions](definitions-definitions-network.md "definitions.schema.json#/definitions/blockMonitor/properties/network") |
| [addresses](#addresses) | `array` | Required | cannot be null | [Definitions](definitions-definitions-blockmonitor-properties-addresses.md "definitions.schema.json#/definitions/blockMonitor/properties/addresses") |
| [abi](#abi) | Merged | Optional | cannot be null | [Definitions](definitions-definitions-abitype.md "definitions.schema.json#/definitions/blockMonitor/properties/abi") |
| [alert-threshold](#alert-threshold) | `object` | Optional | cannot be null | [Definitions](definitions-definitions-blockmonitor-properties-alertthreshold.md "definitions.schema.json#/definitions/blockMonitor/properties/alert-threshold") |
| [paused](#paused) | `boolean` | Optional | cannot be null | [Definitions](definitions-definitions-blockmonitor-properties-paused.md "definitions.schema.json#/definitions/blockMonitor/properties/paused") |
| [action-condition](#action-condition) | `object` | Optional | cannot be null | [Definitions](definitions-definitions-action.md "definitions.schema.json#/definitions/blockMonitor/properties/action-condition") |
| [action-trigger](#action-trigger) | `object` | Optional | cannot be null | [Definitions](definitions-definitions-action.md "definitions.schema.json#/definitions/blockMonitor/properties/action-trigger") |
| [confirm-level](#confirm-level) | Merged | Optional | cannot be null | [Definitions](definitions-definitions-blockmonitor-properties-confirm-level.md "definitions.schema.json#/definitions/blockMonitor/properties/confirm-level") |
| [notify-config](#notify-config) | `object` | Required | cannot be null | [Definitions](definitions-definitions-blockmonitor-properties-notifyconfig.md "definitions.schema.json#/definitions/blockMonitor/properties/notify-config") |
| [conditions](#conditions) | `object` | Optional | cannot be null | [Definitions](definitions-definitions-blockmonitor-properties-conditions.md "definitions.schema.json#/definitions/blockMonitor/properties/conditions") |
| [risk-category](#risk-category) | `string` | Optional | cannot be null | [Definitions](definitions-definitions-riskcategory.md "definitions.schema.json#/definitions/blockMonitor/properties/risk-category") |
| Property | Type | Required | Nullable | Defined by |
| :------------------------------------------ | :-------- | :------- | :------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [name](#name) | `string` | Required | cannot be null | [Definitions](definitions-definitions-blockmonitor-properties-name.md "definitions.schema.json#/definitions/blockMonitor/properties/name") |
| [type](#type) | `string` | Required | cannot be null | [Definitions](definitions-definitions-blockmonitor-properties-type.md "definitions.schema.json#/definitions/blockMonitor/properties/type") |
| [network](#network) | `string` | Required | cannot be null | [Definitions](definitions-definitions-network.md "definitions.schema.json#/definitions/blockMonitor/properties/network") |
| [addresses](#addresses) | `array` | Required | cannot be null | [Definitions](definitions-definitions-blockmonitor-properties-addresses.md "definitions.schema.json#/definitions/blockMonitor/properties/addresses") |
| [abi](#abi) | Merged | Optional | cannot be null | [Definitions](definitions-definitions-abitype.md "definitions.schema.json#/definitions/blockMonitor/properties/abi") |
| [alert-threshold](#alert-threshold) | `object` | Optional | cannot be null | [Definitions](definitions-definitions-blockmonitor-properties-alertthreshold.md "definitions.schema.json#/definitions/blockMonitor/properties/alert-threshold") |
| [paused](#paused) | `boolean` | Optional | cannot be null | [Definitions](definitions-definitions-blockmonitor-properties-paused.md "definitions.schema.json#/definitions/blockMonitor/properties/paused") |
| [skip-abi-validation](#skip-abi-validation) | `boolean` | Optional | cannot be null | [Definitions](definitions-definitions-blockmonitor-properties-skip-abi-validation.md "definitions.schema.json#/definitions/blockMonitor/properties/skip-abi-validation") |
| [action-condition](#action-condition) | `object` | Optional | cannot be null | [Definitions](definitions-definitions-action.md "definitions.schema.json#/definitions/blockMonitor/properties/action-condition") |
| [action-trigger](#action-trigger) | `object` | Optional | cannot be null | [Definitions](definitions-definitions-action.md "definitions.schema.json#/definitions/blockMonitor/properties/action-trigger") |
| [confirm-level](#confirm-level) | Merged | Optional | cannot be null | [Definitions](definitions-definitions-blockmonitor-properties-confirm-level.md "definitions.schema.json#/definitions/blockMonitor/properties/confirm-level") |
| [notify-config](#notify-config) | `object` | Required | cannot be null | [Definitions](definitions-definitions-blockmonitor-properties-notifyconfig.md "definitions.schema.json#/definitions/blockMonitor/properties/notify-config") |
| [conditions](#conditions) | `object` | Optional | cannot be null | [Definitions](definitions-definitions-blockmonitor-properties-conditions.md "definitions.schema.json#/definitions/blockMonitor/properties/conditions") |
| [risk-category](#risk-category) | `string` | Optional | cannot be null | [Definitions](definitions-definitions-riskcategory.md "definitions.schema.json#/definitions/blockMonitor/properties/risk-category") |

## name

Expand Down Expand Up @@ -210,6 +211,24 @@ any of

`boolean`

## skip-abi-validation

A boolean value that indicates whether the UI should skip ABI validation checks. Enable this if you wish to use custom or partial ABIs for your monitors.

`skip-abi-validation`

* is optional

* Type: `boolean`

* cannot be null

* defined in: [Definitions](definitions-definitions-blockmonitor-properties-skip-abi-validation.md "definitions.schema.json#/definitions/blockMonitor/properties/skip-abi-validation")

### skip-abi-validation Type

`boolean`

## action-condition


Expand Down
Loading

0 comments on commit 6d44552

Please sign in to comment.