Skip to content

Commit

Permalink
build: update prophet-core dependency and `solidity-exporter-action…
Browse files Browse the repository at this point in the history
…` workflows (#57)

* feat: update prophet core

* build: update Prophet dependency

* refactor: lint

* build: update Prophet dependency

* ci: update solidity exporter action workflows

* refactor: lint

---------

Co-authored-by: 0xJabberwock <[email protected]>
  • Loading branch information
0xShaito and 0xJabberwock authored Aug 10, 2024
1 parent 1197c32 commit e52f8cc
Show file tree
Hide file tree
Showing 66 changed files with 439 additions and 533 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Canary Release

on: workflow_dispatch

jobs:
export:
name: Generate Interfaces And Contracts

runs-on: ubuntu-latest
strategy:
matrix:
export_type: ['interfaces', 'all']

env:
PROJECT_NAME: '@defi-wonderland/prophet-modules'
EXPORT_NAME: ${{ matrix.export_type == 'interfaces' && '-interfaces' || '' }}

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Install Node
uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org'
node-version: 20.x
cache: 'yarn'

- name: Install dependencies
run: yarn --frozen-lockfile

- name: Build project and generate out directory
run: yarn build

- name: Update version
run: yarn version --new-version "0.0.0-${GITHUB_SHA::8}" --no-git-tag-version

- name: Export Solidity - Export Type ${{ matrix.export_type }}
uses: defi-wonderland/[email protected]
with:
package_name: ${{ env.PROJECT_NAME }}
out: 'out'
interfaces: 'solidity/interfaces'
contracts: 'solidity/contracts'
libraries: "solidity/libraries"
export_type: '${{ matrix.export_type }}'

- name: Publish to NPM - Export Type ${{ matrix.export_type }}
run: cd export/${{ env.PROJECT_NAME }}${{ env.EXPORT_NAME }} && npm publish --access public --tag canary
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
49 changes: 0 additions & 49 deletions .github/workflows/interfaces-canary.yml

This file was deleted.

50 changes: 0 additions & 50 deletions .github/workflows/interfaces-production.yml

This file was deleted.

55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Production Release

on:
release:
types: [published]

jobs:
release:
name: Release

runs-on: ubuntu-latest
strategy:
matrix:
export_type: ['interfaces', 'all']

env:
PROJECT_NAME: '@defi-wonderland/prophet-modules'
EXPORT_NAME: ${{ matrix.export_type == 'interfaces' && '-interfaces' || '' }}

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Install Node
uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org'
node-version: 20.x
cache: 'yarn'

- name: Install dependencies
run: yarn --frozen-lockfile

- name: Build project and generate out directory
run: yarn build

- name: Export Solidity - Export Type ${{ matrix.export_type }}
uses: defi-wonderland/[email protected]
with:
package_name: ${{ env.PROJECT_NAME }}
out: 'out'
interfaces: 'solidity/interfaces'
contracts: 'solidity/contracts'
libraries: "solidity/libraries"
export_type: '${{ matrix.export_type }}'

- name: Publish to NPM - Export Type ${{ matrix.export_type }}
run: cd export/${{ env.PROJECT_NAME }}${{ env.EXPORT_NAME }} && npm publish --access public --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"package.json": "sort-package-json"
},
"dependencies": {
"@defi-wonderland/prophet-core-contracts": "0.0.0-d01bc1a0",
"@defi-wonderland/prophet-core": "0.0.0-2e39539b",
"@openzeppelin/contracts": "4.9.5",
"solmate": "https://github.com/transmissions11/solmate.git#bfc9c25865a274a7827fea5abf6e4fb64fc64e6c"
},
Expand Down
4 changes: 2 additions & 2 deletions solidity/contracts/extensions/AccountingExtension.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol';
import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol';
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import {EnumerableSet} from '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';

import {Validator} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Validator.sol';
import {Validator} from '@defi-wonderland/prophet-core/solidity/contracts/Validator.sol';

import {IAccountingExtension} from '../../interfaces/extensions/IAccountingExtension.sol';

Expand Down
2 changes: 1 addition & 1 deletion solidity/contracts/extensions/BondEscalationAccounting.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol';
import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol';
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';

import {AccountingExtension} from './AccountingExtension.sol';
Expand Down
14 changes: 5 additions & 9 deletions solidity/contracts/modules/dispute/BondEscalationModule.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

// solhint-disable-next-line no-unused-import
import {IModule, Module} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Module.sol';
import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol';
import {IModule, Module} from '@defi-wonderland/prophet-core/solidity/contracts/Module.sol';
import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol';
import {FixedPointMathLib} from 'solmate/utils/FixedPointMathLib.sol';

import {IBondEscalationModule} from '../../../interfaces/modules/dispute/IBondEscalationModule.sol';
Expand Down Expand Up @@ -339,12 +338,9 @@ contract BondEscalationModule is Module, IBondEscalationModule {
}

/// @inheritdoc IModule
function validateParameters(bytes calldata _encodedParameters)
external
pure
override(Module, IModule)
returns (bool _valid)
{
function validateParameters(
bytes calldata _encodedParameters
) external pure override(Module, IModule) returns (bool _valid) {
RequestParameters memory _params = decodeRequestData(_encodedParameters);
_valid = address(_params.accountingExtension) != address(0) && address(_params.bondToken) != address(0)
&& _params.bondSize != 0 && _params.bondEscalationDeadline != 0 && _params.maxNumberOfEscalations != 0
Expand Down
14 changes: 5 additions & 9 deletions solidity/contracts/modules/dispute/BondedDisputeModule.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

// solhint-disable-next-line no-unused-import
import {IModule, Module} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Module.sol';
import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol';
import {IModule, Module} from '@defi-wonderland/prophet-core/solidity/contracts/Module.sol';
import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol';

import {IBondedDisputeModule} from '../../../interfaces/modules/dispute/IBondedDisputeModule.sol';

Expand Down Expand Up @@ -105,12 +104,9 @@ contract BondedDisputeModule is Module, IBondedDisputeModule {
}

/// @inheritdoc IModule
function validateParameters(bytes calldata _encodedParameters)
external
pure
override(Module, IModule)
returns (bool _valid)
{
function validateParameters(
bytes calldata _encodedParameters
) external pure override(Module, IModule) returns (bool _valid) {
RequestParameters memory _params = decodeRequestData(_encodedParameters);
_valid = address(_params.accountingExtension) != address(0) && address(_params.bondToken) != address(0)
&& _params.bondSize != 0;
Expand Down
14 changes: 5 additions & 9 deletions solidity/contracts/modules/dispute/CircuitResolverModule.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

// solhint-disable-next-line no-unused-import
import {IModule, Module} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Module.sol';
import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol';
import {IModule, Module} from '@defi-wonderland/prophet-core/solidity/contracts/Module.sol';
import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol';

import {IProphetVerifier} from '../../../interfaces/IProphetVerifier.sol';
import {ICircuitResolverModule} from '../../../interfaces/modules/dispute/ICircuitResolverModule.sol';
Expand Down Expand Up @@ -94,12 +93,9 @@ contract CircuitResolverModule is Module, ICircuitResolverModule {
}

/// @inheritdoc IModule
function validateParameters(bytes calldata _encodedParameters)
external
view
override(Module, IModule)
returns (bool _valid)
{
function validateParameters(
bytes calldata _encodedParameters
) external view override(Module, IModule) returns (bool _valid) {
RequestParameters memory _params = decodeRequestData(_encodedParameters);
_valid = address(_params.accountingExtension) != address(0) && address(_params.bondToken) != address(0)
&& _params.bondSize != 0 && _targetHasBytecode(_params.verifier) && _params.callData.length != 0;
Expand Down
14 changes: 5 additions & 9 deletions solidity/contracts/modules/dispute/RootVerificationModule.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

// solhint-disable-next-line no-unused-import
import {IModule, Module} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Module.sol';
import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol';
import {IModule, Module} from '@defi-wonderland/prophet-core/solidity/contracts/Module.sol';
import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol';

import {IRootVerificationModule} from '../../../interfaces/modules/dispute/IRootVerificationModule.sol';
import {MerkleLib} from '../../libraries/MerkleLib.sol';
Expand Down Expand Up @@ -92,12 +91,9 @@ contract RootVerificationModule is Module, IRootVerificationModule {
}

/// @inheritdoc IModule
function validateParameters(bytes calldata _encodedParameters)
external
pure
override(Module, IModule)
returns (bool _valid)
{
function validateParameters(
bytes calldata _encodedParameters
) external pure override(Module, IModule) returns (bool _valid) {
RequestParameters memory _params = decodeRequestData(_encodedParameters);
_valid = address(_params.accountingExtension) != address(0) && address(_params.bondToken) != address(0)
&& address(_params.treeVerifier) != address(0) && _params.bondSize != 0 && _params.treeData.length != 0
Expand Down
14 changes: 5 additions & 9 deletions solidity/contracts/modules/finality/CallbackModule.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

// solhint-disable-next-line no-unused-import
import {IModule, Module} from '@defi-wonderland/prophet-core-contracts/solidity/contracts/Module.sol';
import {IOracle} from '@defi-wonderland/prophet-core-contracts/solidity/interfaces/IOracle.sol';
import {IModule, Module} from '@defi-wonderland/prophet-core/solidity/contracts/Module.sol';
import {IOracle} from '@defi-wonderland/prophet-core/solidity/interfaces/IOracle.sol';

import {IProphetCallback} from '../../../interfaces/IProphetCallback.sol';
import {ICallbackModule} from '../../../interfaces/modules/finality/ICallbackModule.sol';
Expand Down Expand Up @@ -35,12 +34,9 @@ contract CallbackModule is Module, ICallbackModule {
}

/// @inheritdoc IModule
function validateParameters(bytes calldata _encodedParameters)
external
view
override(Module, IModule)
returns (bool _valid)
{
function validateParameters(
bytes calldata _encodedParameters
) external view override(Module, IModule) returns (bool _valid) {
RequestParameters memory _params = decodeRequestData(_encodedParameters);
_valid = _params.data.length != 0 && _targetHasBytecode(_params.target);
}
Expand Down
Loading

0 comments on commit e52f8cc

Please sign in to comment.