Skip to content
Merged
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
2 changes: 1 addition & 1 deletion contracts/utils/cryptography/TrieProof.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;
pragma solidity ^0.8.26;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

fd -t f "TrieProof.sol" --exec wc -l {} \;

Repository: OpenZeppelin/openzeppelin-contracts

Length of output: 127


🏁 Script executed:

cat -n contracts/utils/cryptography/TrieProof.sol | sed -n '1,100p'

Repository: OpenZeppelin/openzeppelin-contracts

Length of output: 5255


🏁 Script executed:

cat -n contracts/utils/cryptography/TrieProof.sol | sed -n '80,95p'

Repository: OpenZeppelin/openzeppelin-contracts

Length of output: 908


🏁 Script executed:

# Check for any require statements with custom errors
rg "require\(" contracts/utils/cryptography/TrieProof.sol -A 1 -B 1

Repository: OpenZeppelin/openzeppelin-contracts

Length of output: 253


🏁 Script executed:

# Check the full TrieProof.sol file for features that might be version-specific
cat -n contracts/utils/cryptography/TrieProof.sol | sed -n '200,235p'

Repository: OpenZeppelin/openzeppelin-contracts

Length of output: 1789


🏁 Script executed:

# Check for foundry/hardhat configuration files
fd -t f "(foundry|hardhat|truffle)" . --max-one-result -o fd -t f "(\.toml|\.js|\.json)" . | grep -E "(foundry|hardhat|truffle)" | head -20

Repository: OpenZeppelin/openzeppelin-contracts

Length of output: 312


🏁 Script executed:

# Look for foundry.toml or hardhat config
find . -name "foundry.toml" -o -name "hardhat.config.*" | head -5

Repository: OpenZeppelin/openzeppelin-contracts

Length of output: 113


🏁 Script executed:

# Check if there are any solidity version constraints in package.json or similar
find . -name "package.json" -o -name "foundry.toml" | xargs cat 2>/dev/null | grep -i "solidity\|0\.8\."

Repository: OpenZeppelin/openzeppelin-contracts

Length of output: 445


🏁 Script executed:

# Check the exact require syntax used and whether via-ir is mentioned anywhere
rg "via.ir|viaIR" . --type sol --type toml --type json

Repository: OpenZeppelin/openzeppelin-contracts

Length of output: 106


🏁 Script executed:

# Search for any references to compiler settings or pragma requirements
rg "pragma solidity" . --type sol | head -20

Repository: OpenZeppelin/openzeppelin-contracts

Length of output: 106


🏁 Script executed:

cat foundry.toml

Repository: OpenZeppelin/openzeppelin-contracts

Length of output: 659


🏁 Script executed:

cat hardhat.config.js | head -50

Repository: OpenZeppelin/openzeppelin-contracts

Length of output: 1356


🏁 Script executed:

# Check if there's any CI/test configuration that tests with 0.8.26
rg "0\.8\.26" . --type json --type js --type toml

Repository: OpenZeppelin/openzeppelin-contracts

Length of output: 262


🏁 Script executed:

# Search for any workarounds or comments about the require syntax
rg "require\(" contracts/utils/cryptography/TrieProof.sol -B 2 -A 2

Repository: OpenZeppelin/openzeppelin-contracts

Length of output: 374


Revert pragma to ^0.8.27 or refactor the require statement for 0.8.26 compatibility.

The require(err == ProofError.NO_ERROR, TrieProofTraversalError(err)) syntax at line 86 uses the custom error overload that is only supported in Solidity 0.8.26 via the via-ir compilation pipeline. Since the project's default configuration uses the legacy pipeline (IR disabled by default in hardhat.config.js), the code will fail to compile with 0.8.26 unless via-ir is explicitly enabled. The pragma ^0.8.26 misleadingly suggests compatibility with 0.8.26's default compilation mode.

Either revert the pragma to ^0.8.27 or refactor the error handling to work with 0.8.26 legacy pipeline:

require(err == ProofError.NO_ERROR);
if (err != ProofError.NO_ERROR) revert TrieProofTraversalError(err);
🤖 Prompt for AI Agents
contracts/utils/cryptography/TrieProof.sol around line 2 (and specifically the
require at line 86): the current pragma ^0.8.26 combined with the require(err ==
ProofError.NO_ERROR, TrieProofTraversalError(err)) uses custom error overloads
that only work with the via-ir pipeline in 0.8.26 and will fail under the
project's legacy compiler; fix by either (A) change the pragma to ^0.8.27 so the
syntax is supported by the default compiler, or (B) refactor the check to be
compatible with 0.8.26 legacy pipeline by replacing the single overloaded
require with a plain require(err == ProofError.NO_ERROR); followed immediately
by if (err != ProofError.NO_ERROR) revert TrieProofTraversalError(err); ensuring
no other similar overloaded-require usages remain.


import {Bytes} from "../Bytes.sol";
import {Memory} from "../Memory.sol";
Expand Down
Loading