Skip to content
Closed
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
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ members = [
[workspace.package]
authors = ["Aurora Labs <hello@aurora.dev>"]
edition = "2021"
version = "2.1.3"
version = "2.1.4"
description = "Aurora Ethereum Virtual Machine implementation written in pure Rust"
categories = ["no-std", "compilers", "cryptography::cryptocurrencies"]
keywords = ["aurora-evm", "evm", "ethereum", "blockchain", "no_std"]
Expand All @@ -22,4 +22,4 @@ auto_impl = "1.0"
primitive-types = { version = "0.13", default-features = false }
rlp = { version = "0.6", default-features = false, features = ["derive"] }
sha3 = { version = "0.10", default-features = false }
serde = { version = "1.0", features = ["derive"] }
serde = { version = "1.0", default-features = false, features = ["derive"] }
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot Nov 24, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

No-std compatibility: serde now excludes std by default.

Adding default-features = false to serde prevents the standard library from being pulled into smart contract builds while preserving the derive feature for macros. This aligns with the project's no-std support declaration and the existing pattern used for other dependencies (e.g., rlp, sha3, primitive-types).

Verify that the derive feature alone is sufficient for all serde usage across the codebase. Specifically, confirm that no code relies on serde's alloc or std features. Run the following to identify potential gaps:


🏁 Script executed:

#!/bin/bash
# Search for serde feature attributes or conditional compilation that might expect std
rg -n "serde.*std|#\[cfg.*serde" --type rust

Length of output: 1199


🏁 Script executed:

#!/bin/bash
# 1. Check if 'with-serde' feature is defined in Cargo.toml
echo "=== Checking for 'with-serde' feature in Cargo.toml ==="
rg -n "with-serde|features\s*=" Cargo.toml | head -20

# 2. Search for direct serde::ser or serde::de calls (runtime serialization)
echo -e "\n=== Searching for runtime serde usage (ser/de calls) ==="
rg -n "serde::(ser|de)::|\.serialize\(|\.deserialize\(" --type rust | head -20

# 3. Check if any code directly imports serde types beyond derive
echo -e "\n=== Checking for direct serde type imports ==="
rg -n "use serde::" --type rust

Length of output: 4470


🏁 Script executed:

#!/bin/bash
# 1. Get full Cargo.toml to see feature definitions
echo "=== Full Cargo.toml contents ==="
cat Cargo.toml

# 2. Check if evm-tests is a dev-dependency or separate crate
echo -e "\n=== Cargo.toml workspace members ==="
rg -n "\[workspace\]|\[\[bin\]\]|members\s*=" Cargo.toml | head -20

# 3. Check evm-tests/Cargo.toml to see its own serde dependency
echo -e "\n=== evm-tests serde configuration ==="
find . -name Cargo.toml -path "*/evm-tests/*" -o -path "*/evm-tests/Cargo.toml" | head -5

Length of output: 1116


🏁 Script executed:

#!/bin/bash
# 1. Check evm-tests/jsontests/Cargo.toml dependencies
echo "=== evm-tests/jsontests/Cargo.toml ==="
cat evm-tests/jsontests/Cargo.toml

# 2. Check evm/Cargo.toml for serde usage
echo -e "\n=== evm/Cargo.toml ==="
cat evm/Cargo.toml

# 3. Check evm-tests/ethjson/Cargo.toml if it exists
echo -e "\n=== evm-tests/ethjson/Cargo.toml ==="
if [ -f evm-tests/ethjson/Cargo.toml ]; then
  cat evm-tests/ethjson/Cargo.toml
else
  echo "File not found"
fi

Length of output: 2579


Serde configuration introduces compilation failure: workspace dependency missing required "std" feature.

The root workspace now provides serde with only the derive feature, but evm/Cargo.toml attempts to enable serde/std when the std feature is activated (line in evm's feature definition). This creates an unsatisfiable dependency.

Fix required:

Add "std" to serde features in workspace Cargo.toml line 25:

serde = { version = "1.0", default-features = false, features = ["derive", "std"] }

This maintains no-std compatibility for environments that don't use the std feature while allowing standard library usage when needed.

🤖 Prompt for AI Agents
In Cargo.toml around line 25, the workspace serde declaration disables default
features but only enables "derive", which conflicts with evm/Cargo.toml's
optional use of serde with the "std" feature; update the workspace serde
features to include "std" in addition to "derive" so that enabling std in
subcrates can satisfy the dependency (i.e., add "std" to the features list for
serde in the workspace Cargo.toml).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@aleksuss what do you think?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check evm/Cargo.toml to verify serde/std feature usage
echo "=== evm/Cargo.toml contents ==="
cat evm/Cargo.toml

# Also check for any feature definitions that enable serde/std
echo -e "\n=== Checking for serde feature usage in evm crate ==="
rg -n 'serde.*std|features.*=.*\[.*"std"' evm/Cargo.toml

Length of output: 1461


@aleksuss Thank you for confirming! I can see that evm/Cargo.toml line 38 does try to enable serde/std when the std feature is active.

However, I want to flag a potential concern with the suggested fix: adding "std" to the workspace serde features list would enable std unconditionally, which would defeat the purpose of this PR (enabling serde usage without std in smart contracts).

# This would ALWAYS enable std:
serde = { version = "1.0", default-features = false, features = ["derive", "std"] }

Could you verify if there's an actual compilation error with the current configuration? The pattern used here (workspace with default-features = false, subcrate enabling features via feature flags) is the same pattern used successfully for other dependencies like sha3, rlp, and primitive-types.

If there is a compilation error, consider these alternatives:

  1. Specify serde features in the subcrate directly instead of in the workspace
  2. Make serde non-workspace dependency in evm/Cargo.toml to have full control
  3. Verify the Rust/Cargo version supports this pattern (current toolchain is 1.82.0)

Would you like me to help investigate further or test a different approach?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would pass the features in the member crates only. In the workspace Cargo.toml I would use:

serde = { version = "1.0", default-features = false }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Make sense. FYI: @vlad9486

10 changes: 6 additions & 4 deletions evm/src/executor/stack/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,8 @@ impl<'config, 'precompiles, S: StackState<'config>, P: PrecompileSet>
}
}

let code_hash = H256::from_slice(Keccak256::digest(&init_code).as_slice());
let code_hash =
H256::from_slice(<[u8; 32]>::from(Keccak256::digest(&init_code)).as_slice());
let address = self.create_address(CreateScheme::Create2 {
caller,
code_hash,
Expand Down Expand Up @@ -887,14 +888,15 @@ impl<'config, 'precompiles, S: StackState<'config>, P: PrecompileSet>
hasher.update(&caller[..]);
hasher.update(&salt[..]);
hasher.update(&code_hash[..]);
H256::from_slice(hasher.finalize().as_slice()).into()
H256::from_slice(<[u8; 32]>::from(hasher.finalize()).as_slice()).into()
}
CreateScheme::Legacy { caller } => {
let nonce = self.nonce(caller);
let mut stream = rlp::RlpStream::new_list(2);
stream.append(&caller);
stream.append(&nonce);
H256::from_slice(Keccak256::digest(stream.out()).as_slice()).into()
H256::from_slice(<[u8; 32]>::from(Keccak256::digest(stream.out())).as_slice())
.into()
}
CreateScheme::Fixed(address) => address,
}
Expand Down Expand Up @@ -1492,7 +1494,7 @@ impl<'config, S: StackState<'config>, P: PrecompileSet> Handler
return H256::default();
}
let code = self.code(address);
H256::from_slice(Keccak256::digest(code).as_slice())
H256::from_slice(<[u8; 32]>::from(Keccak256::digest(code)).as_slice())
}

/// Get account code
Expand Down
4 changes: 2 additions & 2 deletions evm/src/runtime/eval/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn sha3<H: Handler>(runtime: &mut Runtime) -> Control<H> {
};

let ret = Keccak256::digest(data.as_slice());
push_h256!(runtime, H256::from_slice(ret.as_slice()));
push_h256!(runtime, H256::from_slice(<[u8; 32]>::from(ret).as_slice()));

Control::Continue
}
Expand Down Expand Up @@ -432,7 +432,7 @@ pub fn create<H: Handler>(runtime: &mut Runtime, is_create2: bool, handler: &mut

let scheme = if is_create2 {
pop_h256!(runtime, salt);
let code_hash = H256::from_slice(Keccak256::digest(&code).as_slice());
let code_hash = H256::from_slice(<[u8; 32]>::from(Keccak256::digest(&code)).as_slice());
CreateScheme::Create2 {
caller: runtime.context.address,
salt,
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.81.0"
channel = "1.82.0"
components = ["rustfmt", "clippy"]