Skip to content

Commit

Permalink
Merge pull request #755 from lukso-network/develop
Browse files Browse the repository at this point in the history
chore(release): v0.12.0-rc.0
  • Loading branch information
CJ42 authored Oct 18, 2023
2 parents a85be61 + e2ec65a commit 8cb1f99
Show file tree
Hide file tree
Showing 332 changed files with 13,285 additions and 8,953 deletions.
43 changes: 39 additions & 4 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# This workflow benchmark the gas usage of Universal Profile for common interactions

# It compare the gas cost of the changes made between:
# - a feature branch (where a PR is opened)
# - a target branch (where the PR will be merged)
name: 🆙 📊 Universal Profile Benchmark

on:
Expand All @@ -22,7 +24,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Checkout base branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.base.sha }}
fetch-depth: 0

- name: Use Node.js '16.15.0'
uses: actions/setup-node@v2
Expand All @@ -37,11 +43,40 @@ jobs:
run: npx hardhat compile

- name: 🧪 Run Benchmark tests
run: npm run test:benchmark
# Rename the file to be able to generate benchmark JSON report
run: |
npm run test:benchmark
mv gas_benchmark_result.json gas_benchmark_before.json
- name: Checkout current branch
uses: actions/checkout@v3
# Do not run `git clean -ffdx && git reset --hard HEAD` to prevent removing `gas_benchmark_before.json`
with:
clean: false

- name: Use Node.js '16.15.0'
uses: actions/setup-node@v2
with:
node-version: "16.15.0"
cache: "npm"

- name: 📦 Install dependencies
run: npm ci

- name: 🏗️ Build contract artifacts
run: npx hardhat compile

- name: 🧪 Run Benchmark tests
run: |
npm run test:benchmark
mv gas_benchmark_result.json gas_benchmark_after.json
- name: 📊 Generate Benchmark Report
run: npx hardhat gas-benchmark --compare gas_benchmark_after.json --against gas_benchmark_before.json

- name: 💬 Add Gas Report as comment in PR
uses: peter-evans/create-or-update-comment@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body-file: "./benchmark.md"
body-file: "./gas_benchmark.md"
13 changes: 12 additions & 1 deletion .github/workflows/build-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ jobs:
- name: 🧪 run import/requires tests
run: npm run test:importRequire

- name: 📚 generate ABI docs
run: npm run build:docs

- name: 🔍 check if ABI auto-generated docs need to be updated
run: |-
if [[ $(git diff --name-only) != "" ]];
then
echo "Error: Please generate ABI docs after making changes to Solidity code and Natspec comments!"
exit 1
fi
test-suites:
strategy:
matrix:
Expand All @@ -53,7 +64,6 @@ jobs:
"upinit",
"lsp1",
"lsp2",
"lsp4",
"lsp6",
"lsp6init",
"lsp7",
Expand All @@ -65,6 +75,7 @@ jobs:
"lsp11",
"lsp11init",
"lsp17",
"lsp17extensions",
"lsp20",
"lsp20init",
"lsp23",
Expand Down
37 changes: 26 additions & 11 deletions .github/workflows/solc_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
name: Solidity Compiler Versions

on:
workflow_dispatch:

# Used to check pragma settings for `.sol` files are correct before releasing
push:
branches:
- "develop"
# compare gas diff only when editing Solidity smart contract code
paths:
- "contracts/**/*.sol"

pull_request:
types: [opened]

Expand All @@ -16,10 +26,9 @@ jobs:
strategy:
matrix:
solc: [
# TODO: wait for a patch release of @erc725/smart-contracts to compile on these 3 versions
# "0.8.5",
# "0.8.6",
# "0.8.7",
"0.8.5",
"0.8.6",
"0.8.7",
"0.8.8",
"0.8.9",
"0.8.10",
Expand Down Expand Up @@ -55,17 +64,23 @@ jobs:
solc-select install ${{ matrix.solc }}
solc-select use ${{ matrix.solc }}
- name: Compare versions to filter contracts to compile
uses: madhead/semver-utils@latest
id: comparison
with:
version: ${{ matrix.solc }}
compare-to: 0.8.12

- name: Compile Smart Contracts
run: |
if [[ ${{ matrix.solc }} < 0.8.12 ]]
if [[ "<" == "${{ steps.comparison.outputs.comparison-result }}" ]]
then
solc $(ls contracts/**/*.sol | grep -v "Compatible") --allow-paths $(pwd)/node_modules/ \
@erc725/smart-contracts/=node_modules/@erc725/smart-contracts/ \
@openzeppelin/=node_modules/@openzeppelin/ \
solidity-bytes-utils/=node_modules/solidity-bytes-utils/
solc $(ls contracts/**/*.sol | grep -v "Compatible" | grep -v "Extension4337") --allow-paths $(pwd)/node_modules/ \
@=node_modules/@ \
solidity-bytes-utils/=node_modules/solidity-bytes-utils/ \
../=$(pwd)/contracts/
else
solc contracts/**/*.sol \
@erc725/smart-contracts/=node_modules/@erc725/smart-contracts/ \
@openzeppelin/=node_modules/@openzeppelin/ \
@=node_modules/@ \
solidity-bytes-utils/=node_modules/solidity-bytes-utils/
fi;
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ out/
forge-cache/

# generated gas benchmark
benchmark.md
gas_benchmark.md

# Exclude build output folders
/common
Expand Down
5 changes: 4 additions & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
"private-vars-leading-underscore": ["error", { "strict": false }],
"imports-on-top": "error",
"visibility-modifier-order": "error",
"no-unused-import": "error",
"no-global-import": "error",
"reason-string": ["warn", { "maxLength": 120 }],
"avoid-low-level-calls": "off",
"no-empty-blocks": "off"
"no-empty-blocks": ["error", { "ignoreConstructors": true }],
"custom-errors": "off"
}
}
84 changes: 81 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,55 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [0.12.0-rc.0](https://github.com/lukso-network/lsp-smart-contracts/compare/v0.11.1...v0.12.0-rc.0) (2023-10-18)

### ⚠ BREAKING CHANGES

- remove `LSP4Compatibility` contract + ERC20 Compatible token interfaces `ILSP7CompatibleERC20` / `ILSP8CompatibleERC721` (#749)
- add extra parameter `requestor` to `lsp20VerifyCall` (#753)
- Roll back to old `LSP1UniversalReceiverDelegate` Interface and functions (#741)
- remove `isEncodedArray(...)` from `LSP2utils.sol` (#746)
- add callee params to lsp20 & EXECUTE_RELAY_CALL permission & mapping reentrancyStatus (#729)
- set LSP8 TokenId Type on deployment / initialization (#712)
- re-change param name from `allowNonLSP1Recipient` to `force`

### Deprecation

- re-change param name from `allowNonLSP1Recipient` to `force` ([d59a2ff](https://github.com/lukso-network/lsp-smart-contracts/commit/d59a2ff4712a5373ce72ba1ccd63b2d796f60cd9))
- remove `isEncodedArray(...)` from `LSP2utils.sol` ([#746](https://github.com/lukso-network/lsp-smart-contracts/issues/746)) ([1ff7cd4](https://github.com/lukso-network/lsp-smart-contracts/commit/1ff7cd4e34a91c53ce72f19fb8d469d2ae0c9a09))
- remove `LSP4Compatibility` contract + ERC20 Compatible token interfaces `ILSP7CompatibleERC20` / `ILSP8CompatibleERC721` ([#749](https://github.com/lukso-network/lsp-smart-contracts/issues/749)) ([b038412](https://github.com/lukso-network/lsp-smart-contracts/commit/b038412c99d5149f25a83156322539e817e1575b))
- Roll back to old `LSP1UniversalReceiverDelegate` Interface and functions ([#741](https://github.com/lukso-network/lsp-smart-contracts/issues/741)) ([dab41a1](https://github.com/lukso-network/lsp-smart-contracts/commit/dab41a1baf61876865191424a5e19548845f1630))
- set LSP8 TokenId Type on deployment / initialization ([#712](https://github.com/lukso-network/lsp-smart-contracts/issues/712)) ([67cb333](https://github.com/lukso-network/lsp-smart-contracts/commit/67cb3333256e31a0c432a9bcd62f08e83e969222))

### Features

- add `_afterTokenTransfer` hook in LSP7 + LSP8 ([4e3adc2](https://github.com/lukso-network/lsp-smart-contracts/commit/4e3adc24e233138b8f1471320e3b1bb3307ef524))
- add `data` param in `_before` and `_after` token transfer hooks ([0cd0976](https://github.com/lukso-network/lsp-smart-contracts/commit/0cd097604193957aeb2d6bf181d9193719621eac))
- add `callee` params to lsp20 & `EXECUTE_RELAY_CALL` permission & `mapping reentrancyStatus` ([#729](https://github.com/lukso-network/lsp-smart-contracts/issues/729)) ([0ae4c83](https://github.com/lukso-network/lsp-smart-contracts/commit/0ae4c83d80227e53c614d46dce96f8b727822839))
- add lsp20 to `acceptOwnership` in LSP0 ([#747](https://github.com/lukso-network/lsp-smart-contracts/issues/747)) ([804779a](https://github.com/lukso-network/lsp-smart-contracts/commit/804779a5f7ac76b21695a00c622a7c0e5801192a))
- allow `endingTimestamp` to be 0 ([a8c730f](https://github.com/lukso-network/lsp-smart-contracts/commit/a8c730f608fdd585c94b69704272bdaec938a565))
- allow `renounceOwnership()` through LSP6 ([dd74b56](https://github.com/lukso-network/lsp-smart-contracts/commit/dd74b56af54cc01a5e28b50feac2ce6659403cda))
- allow sending value when using `setData(..)` through the LSP6 ([#725](https://github.com/lukso-network/lsp-smart-contracts/issues/725)) ([624c4a6](https://github.com/lukso-network/lsp-smart-contracts/commit/624c4a6dfa0c5c83c94f0b5e952adc783098d12c))
- create Extension4337 ([#735](https://github.com/lukso-network/lsp-smart-contracts/issues/735)) ([d1df1d0](https://github.com/lukso-network/lsp-smart-contracts/commit/d1df1d0c106f47bd24427f1c20c3423a00bb993c))
- add extra parameter `requestor` to `lsp20VerifyCall` ([#753](https://github.com/lukso-network/lsp-smart-contracts/pull/753)) ([f82626d](https://github.com/lukso-network/lsp-smart-contracts/commit/f82626d5f64efd396a40690687dfb5a2dc9c036e))

### Bug Fixes

- add `receive()` function in LSP7 & LSP8 to silent compiler warning ([#711](https://github.com/lukso-network/lsp-smart-contracts/pull/711)) ([e6fb55d](https://github.com/lukso-network/lsp-smart-contracts/commit/e6fb55d9acc7bd63b9d66920f2f346ecf812c289))
- bug in dodoc config, incorrect signature ([06b1f04](https://github.com/lukso-network/lsp-smart-contracts/commit/06b1f04f83158f27efb19670ed81f566d7b151ba))
- return `bytes32(0)` when permission value retrieved is not exactly 32 bytes long ([7422ab0](https://github.com/lukso-network/lsp-smart-contracts/commit/7422ab053b27f1139dc8b917218bebd2407009b9))
- ts configs and tests ([#733](https://github.com/lukso-network/lsp-smart-contracts/issues/733)) ([a977312](https://github.com/lukso-network/lsp-smart-contracts/commit/a977312f99a3f957e581f5b502ef818f033f3846))
- update logic to check against controller permissions when setting its Allowed Calls or ERC725Y Data Keys ([#734](https://github.com/lukso-network/lsp-smart-contracts/issues/734)) ([0d43077](https://github.com/lukso-network/lsp-smart-contracts/commit/0d43077a96b542f645d50cf9389f26c292c8b39e))

## [0.11.1](https://github.com/lukso-network/lsp-smart-contracts/compare/v0.11.0-rc.1...v0.11.0) (2023-09-07)

### ⚠ BREAKING CHANGES

- Include LSP20 in interfaceId calculation ([#668](https://github.com/lukso-network/lsp-smart-contracts/pull/668)), from: `0x3e89ad98` to `0x24871b3d`
- change visibility of `_reentrancyStatus` state variable from `private` to `internal` in `LSP6KeyManagerCore` ([#651](https://github.com/lukso-network/lsp-smart-contracts/pull/651))

- change data key for `SupportedStandards` from `LSP3UniversalProfile` to `LSP3Profile` in `LSP3Constants.sol` and `constants.ts` ([#664](https://github.com/lukso-network/lsp-smart-contracts/pull/664))

- Include LSP20 in interfaceId calculation ([#668](https://github.com/lukso-network/lsp-smart-contracts/pull/668)), from: `0x3e89ad98` to `0x24871b3d`.

- Return instead of revert when the `LSP1UniversalReceiverDelegateUP` is not able to register LSP5-LSP10 data keys. ([#672](https://github.com/lukso-network/lsp-smart-contracts/pull/672))

Expand All @@ -22,20 +66,54 @@ All notable changes to this project will be documented in this file. See [standa

- Remove `LSP0Utils.sol`. ([#683](https://github.com/lukso-network/lsp-smart-contracts/pull/683))

- Change token LSP1 notification data format from `abi.encodepacked` to `abi.encode`. ([#699](https://github.com/lukso-network/lsp-smart-contracts/pull/699))
- Add LSP17 in inheritance of LSP7 and LSP8 ([#697](https://github.com/lukso-network/lsp-smart-contracts/pull/697))

- Change token LSP1 notification data format from `abi.encodePacked` to `abi.encode`. ([#699](https://github.com/lukso-network/lsp-smart-contracts/pull/699))

- Notify Operator via LSP1 in `authorizeOperator` in LSP7 and LSP8. ([#700](https://github.com/lukso-network/lsp-smart-contracts/pull/700))

### Features

- Add LSP25ExecuteRelayCall as its seperate standard. ([#678](https://github.com/lukso-network/lsp-smart-contracts/pull/678))
- Mark multiple functions as `virtual` across the smart contracts, so that their behaviour can be overriden through inheritance [#644](https://github.com/lukso-network/lsp-smart-contracts/pull/644).

- Change visibility of `_reentrancyStatus` state variable from `private` to `internal` in `LSP6KeyManagerCore` ([#651](https://github.com/lukso-network/lsp-smart-contracts/pull/651))

- Create implementation of `LSP23LinkedContractsFactory` ([#658](https://github.com/lukso-network/lsp-smart-contracts/pull/658))

- Add external call (= hook) to LSP1 in LSP14 `renounceOwnership` function ([#663](https://github.com/lukso-network/lsp-smart-contracts/pull/663))

- Add `LSP25ExecuteRelayCall` as its separate standard. ([#678](https://github.com/lukso-network/lsp-smart-contracts/pull/678))

- Add `getOperatorsOf(address)` function to LSP7 ([#698](https://github.com/lukso-network/lsp-smart-contracts/pull/698))

- Add LSP17 in inheritance of LSP7 and LSP8 ([#697](https://github.com/lukso-network/lsp-smart-contracts/pull/697))

- Notify Operator via LSP1 in authorizeOperator in LSP7 and LSP8. (https://github.com/lukso-network/lsp-smart-contracts/pull/700)

### Perfs

- Improve deployment + runtime cost of LSP6 Key Manager by replacing calldata slices with `abi.decode` when verifying `ERC725X.execute(uint256,address,uint256,bytes)` calldata payloads ([#682](https://github.com/lukso-network/lsp-smart-contracts/pull/682))

### Bug Fixes

- Add lock guard when transferring ownership in LSP14 ([#645](https://github.com/lukso-network/lsp-smart-contracts/pull/645))

- Delete pending when confirming renounce ownership the second time ([#646](https://github.com/lukso-network/lsp-smart-contracts/pull/646))

- Disallowing setting LSP6 Key Manager as a LSP17 extension in setData paths in Key Manager ([#648](https://github.com/lukso-network/lsp-smart-contracts/pull/648))

- Add check for `length == 0` when checking for Allowed ERC725Y Data Keys in Key Manager to prevent mask from allowing any data keys ([#659](https://github.com/lukso-network/lsp-smart-contracts/pull/659))

- Use bitwise OR `|` operator in `LSP6Utils` function `combinePermissions(...)` to prevent from adding same permission twice and generate incorrect `bytes32` permission value ([#660](https://github.com/lukso-network/lsp-smart-contracts/pull/660))

- Resolve inheritance of `LSP8Burnable` to include LSP4 ([#661](https://github.com/lukso-network/lsp-smart-contracts/pull/661))

- Refactor `_fallbackLSP17Extendable` function to enable to run code after it is called + prevent potential solc bug "storage write removal". ([#674](https://github.com/lukso-network/lsp-smart-contracts/pull/674))

- Update lsp8 compatible approve() logic to allow operators themselves to authorize operators. ([#681](https://github.com/lukso-network/lsp-smart-contracts/pull/681))

- Add input validations for LSP6, LSP1 and LSP17 data keys when setting data in `LSP6SetDataModule` ([#679](https://github.com/lukso-network/lsp-smart-contracts/pull/679))

### Build

- upgrade `@erc725/smart-contracts` version to 5.2.0 ([#696](https://github.com/lukso-network/lsp-smart-contracts/pull/696))
Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ When merging a branch to `develop` PRs should be squashed into one conventional

## Solidity Code Comments

A good level of documentation is crucial for understanding the intended behaviour of the smart contracts and for identifying any potential discrepancies between the implementation and the intended behaviour.

When making contributions, each smart contracts and functions should be well-documented, with clear comments explaining the purpose and functionality of each function and module.

When changing or adding NatSpec comments to any `function`, `error` or `event` in any contract make sure to adhere to the following guidelines:

1. `@dev` and `@notice` tags can both contain text descriptions and two types of lists: bullet points or numbered lists. Make sure that those tags always start with text descriptions first, not with lists.
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ import {
ERC725YDataKeys,
PERMISSIONS,
ALL_PERMISSIONS,
LSP8_TOKEN_ID_TYPES,
LSP25_VERSION,
ErrorSelectors,
EventSigHashes,
Expand Down Expand Up @@ -106,14 +107,20 @@ See the [issue related to Hardhat Typescript + ES Modules](https://hardhat.org/h

### Typescript types

The following additional typescript types are also available.
The following additional typescript types are also available, including types for the JSON format of the LSP3 Profile and LSP4 Digital Asset metadata.

```ts
import {
LSP2ArrayKey,
LSPSupportedStandard,
LSP6PermissionName,
LSPErrorInfo,
LSP3ProfileMetadataJSON,
LSP3ProfileMetadata,
LSP4DigitalAssetMetadataJSON,
LSP4DigitalAssetMetadata,
ImageMetadata,
LinkMetadata,
AssetMetadata,
} from "@lukso/lsp-smart-contracts/constants";
```

Expand All @@ -130,6 +137,7 @@ The following audits and formal verification were conducted. All high-level issu
- Runtime Verification - Formal Verification, 2023-02-20, Final Result: [RuntimeVerification_formalVerification_2023_02_20.pdf](./audits/RuntimeVerification_formalVerification_2023_02_20.pdf)
- Trust Audit, 2023-04-13, Final Result: [Trust_audit_2023_04_13.pdf](./audits/Trust_audit_2023_04_13.pdf)
- Watchpug Audit, 2023-04-21, Final Result: [Watchpug_audit_2023_04_21.pdf](./audits/Watchpug_audit_2023_04_21.pdf)
- Code4Rena Audit Contest, 2023-06-30 to 2023-07-14, Final Result: [See Code4Rena audit report on Code4rena.com website](https://code4rena.com/reports/2023-06-lukso)

## Contributors ✨

Expand Down
3 changes: 3 additions & 0 deletions audits/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Smart Contracts Audits

In addition to the audits reports in pdf available in this page, you can find the audit report of the **Code4Rena audit contest** at the following link: [https://code4rena.com/reports/2021-05-lukso](https://code4rena.com/reports/2021-05-lukso)
Loading

0 comments on commit 8cb1f99

Please sign in to comment.