Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Multibuild"
name: "CI Multibuild"

on:
workflow_dispatch:
Expand All @@ -13,7 +13,7 @@ jobs:
uses: "actions/checkout@v4"

- name: "Install Bun"
uses: "oven-sh/setup-bun@v1"
uses: "oven-sh/setup-bun@v2"

- name: "Install the Node.js dependencies"
run: "bun install"
Expand All @@ -22,5 +22,5 @@ jobs:
uses: "PaulRBerg/foundry-multibuild@v1"
with:
min: "0.8.19"
max: "0.8.26"
max: "0.8.30"
skip-test: "true"
24 changes: 12 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
- "staging"

jobs:
lint:
check:
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
Expand All @@ -26,17 +26,17 @@ jobs:
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Bun"
uses: "oven-sh/setup-bun@v1"
uses: "oven-sh/setup-bun@v2"

- name: "Install the Node.js dependencies"
run: "bun install"

- name: "Lint the code"
run: "bun run lint"
- name: "Run the full checks"
run: "bun run full-check"

- name: "Add lint summary"
run: |
echo "## Lint result" >> $GITHUB_STEP_SUMMARY
- name: "Add check summary"
run: | # shell
echo "## Check result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY

build:
Expand All @@ -46,7 +46,7 @@ jobs:
uses: "actions/checkout@v4"

- name: "Install Bun"
uses: "oven-sh/setup-bun@v1"
uses: "oven-sh/setup-bun@v2"

- name: "Install the Node.js dependencies"
run: "bun install"
Expand All @@ -58,12 +58,12 @@ jobs:
run: "forge build"

- name: "Add build summary"
run: |
run: | # shell
echo "## Build result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY

test:
needs: ["lint", "build"]
needs: ["check", "build"]
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
Expand All @@ -73,7 +73,7 @@ jobs:
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Bun"
uses: "oven-sh/setup-bun@v1"
uses: "oven-sh/setup-bun@v2"

- name: "Install the Node.js dependencies"
run: "bun install"
Expand All @@ -82,6 +82,6 @@ jobs:
run: "forge test"

- name: "Add test summary"
run: |
run: | # shell
echo "## Tests result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
2 changes: 1 addition & 1 deletion .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
sync-release-branch:
runs-on: "ubuntu-latest"
if: "startsWith(github.ref, 'refs/tags/v4.')"
if: startsWith(github.ref, 'refs/tags/v4.') != false
steps:
- name: "Check out the repo"
uses: "actions/checkout@v4"
Expand Down
11 changes: 3 additions & 8 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
{
"extends": "solhint:recommended",
"rules": {
"code-complexity": "off",
"compiler-version": ["error", ">=0.8.19"],
"const-name-snakecase": "off",
"contract-name-camelcase": "off",
"func-name-mixedcase": "off",
"func-visibility": ["error", { "ignoreConstructors": true }],
"gas-custom-errors": "off",
"function-max-lines": "off",
"gas-strict-inequalities": "off",
"max-line-length": ["error", 132],
"no-console": "off",
"no-global-import": "off",
"no-inline-assembly": "off",
"not-rely-on-time": "off",
"use-natspec": "off",
"var-name-mixedcase": "off"
}
}
11 changes: 4 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"[solidity]": {
"editor.defaultFormatter": "NomicFoundation.hardhat-solidity"
},
"[toml]": {
"editor.defaultFormatter": "tamasfe.even-better-toml"
},
"solidity.formatter": "forge"
"solidity.formatter": "forge",
"[json][jsonc][yaml]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[solidity]": { "editor.defaultFormatter": "NomicFoundation.hardhat-solidity" },
"[toml]": { "editor.defaultFormatter": "tamasfe.even-better-toml" }
}
44 changes: 34 additions & 10 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Full reference https://github.com/foundry-rs/foundry/tree/master/config
# Full reference: https://github.com/foundry-rs/foundry/tree/master/crates/config

[profile.default]
allow_internal_expect_revert = true
auto_detect_solc = false
bytecode_hash = "none"
evm_version = "shanghai"
bytecode_hash = "ipfs"
evm_version = "shanghai" # needed for greater coverage of EVM chains
fuzz = { runs = 256 }
optimizer = true
optimizer_runs = 10_000
out = "out"
solc = "0.8.26"
solc = "0.8.30"
src = "src"
test = "test"

Expand Down
25 changes: 16 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"url": "https://github.com/PaulRBerg/prb-math/issues"
},
"devDependencies": {
"forge-std": "github:foundry-rs/forge-std#v1.8.2",
"prettier": "^3.3.2",
"solhint": "^5.0.1"
"forge-std": "github:foundry-rs/forge-std#v1.9.7",
"prettier": "^3.6.2",
"solhint": "^6.0.0"
},
"files": [
"src",
Expand All @@ -35,14 +35,21 @@
"publishConfig": {
"access": "public"
},
"repository": "github:PaulRBerg/prb-math",
"repository": {
"type": "git",
"url": "git+https://github.com/PaulRBerg/prb-math.git"
},
"scripts": {
"build": "forge build",
"clean": "rm -rf cache out",
"lint": "bun run lint:sol && bun run prettier:check",
"lint:sol": "forge fmt --check && bun solhint \"{src,test}/**/*.sol\"",
"prettier:check": "prettier --check \"**/*.{json,md,yml}\"",
"prettier:write": "prettier --write \"**/*.{json,md,yml}\"",
"clean": "bunx del-cli cache out",
"forge-check": "forge fmt --check",
"forge-write": "forge fmt",
"full-check": "bun run prettier-check && bun run solhint-check && bun run forge-check",
"full-write": "bun run prettier-write && bun run solhint-write && bun run forge-write",
"prettier-check": "prettier --check \"**/*.{json,md,yml}\"",
"prettier-write": "prettier --write \"**/*.{json,md,yml}\"",
"solhint-check": "solhint \"{src,test}/**/*.sol\"",
"solhint-write": "solhint --fix \"{src,test}/**/*.sol\"",
"test": "forge test"
}
}
1 change: 0 additions & 1 deletion remappings.txt

This file was deleted.

4 changes: 2 additions & 2 deletions src/sd59x18/Math.sol
Original file line number Diff line number Diff line change
Expand Up @@ -522,12 +522,12 @@ function log2(SD59x18 x) pure returns (SD59x18 result) {

// Calculate the fractional part via the iterative approximation.
// The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.
int256 DOUBLE_UNIT = 2e18;
int256 doubleUnit = 2e18;
for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {
y = (y * y) / uUNIT;

// Is y^2 >= 2e18 and so in the range [2e18, 4e18)?
if (y >= DOUBLE_UNIT) {
if (y >= doubleUnit) {
// Add the 2^{-m} factor to the logarithm.
resultInt = resultInt + delta;

Expand Down
Loading