Skip to content

contract lowering#1183

Merged
sbillig merged 20 commits intoargotorg:masterfrom
sbillig:contract-mir
Dec 18, 2025
Merged

contract lowering#1183
sbillig merged 20 commits intoargotorg:masterfrom
sbillig:contract-mir

Conversation

@sbillig
Copy link
Collaborator

@sbillig sbillig commented Dec 12, 2025

No description provided.

@sbillig sbillig force-pushed the contract-mir branch 2 times, most recently from 8d95f2d to e96988e Compare December 14, 2025 17:31
@cburgdorf cburgdorf mentioned this pull request Dec 17, 2025
@sbillig sbillig marked this pull request as ready for review December 18, 2025 06:21
@sbillig sbillig requested a review from cburgdorf December 18, 2025 06:22
@sbillig
Copy link
Collaborator Author

sbillig commented Dec 18, 2025

@cburgdorf There are some codegen issues that need to be worked through to make this work still, but I think it's in a good state for merging.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements "contract lowering" - a major feature that adds ABI encoding/decoding infrastructure and an effect system to support contract-based smart contract development in Fe. The changes enable:

  1. Solidity-compatible ABI encoding/decoding via new std::abi and core::abi modules
  2. Effect system with effect references (EffectRef, EffectRefMut) and provider kinds (Memory, Storage, Calldata)
  3. Contract lowering that desugars high-level contract items into runtime dispatch functions
  4. Shorthand with expressions that infer effect keys from bound values
  5. Updated MsgVariant trait to support generic ABI specifications

Reviewed changes

Copilot reviewed 135 out of 135 changed files in this pull request and generated no comments.

Show a summary per file
File Description
library/std/src/lib.fe Exports new abi module
library/std/src/evm/memory_input.fe Implements ByteInput trait for memory-backed byte streams
library/std/src/evm/calldata.fe Implements ByteInput trait for calldata
library/std/src/evm.fe Exports calldata and memory_input modules
library/std/src/abi/sol.fe Implements Solidity ABI encoder/decoder
library/std/src/abi.fe Exports sol ABI implementation
library/core/src/storage_map.fe Adds StorageKey impl for 2-tuples
library/core/src/ptr.fe Adds STRIDE constant to Ptr trait and updates documentation
library/core/src/num.fe Adds __u256_as_usize and __u256_as_isize intrinsics
library/core/src/message.fe Updates MsgVariant trait to be generic over ABI and adds Args type
library/core/src/lib.fe Exports new abi and effect_ref modules, adds new intrinsics
library/core/src/intrinsic.fe Adds intrinsics for ABI/effect system support
library/core/src/effect_ref.fe Defines effect reference traits and pointer types
library/core/src/abi.fe Implements core ABI traits and type-level encoding/decoding
crates/mir/src/monomorphize.rs Updates monomorphization to track effect provider kinds
crates/mir/src/lower/*.rs Adds effect system support to MIR lowering
crates/mir/src/ir.rs Adds EffectProviderKind and updates value origins
crates/mir/src/hash.rs Updates hashing to include effect kinds
crates/mir/src/core_lib.rs Adds effect pointer helper types
crates/hir/src/core/lower/*.rs Adds contract and message lowering
crates/hir/src/core/semantic/mod.rs Adds contract effect system support
crates/hir/src/core/span/*.rs Adds contract lowering span tracking
crates/hir/src/core/hir_def/*.rs Updates HIR definitions for effects
crates/parser/src/parser/*.rs Implements shorthand with expression parsing
crates/parser/test_files/syntax_node/exprs/with.* Tests for shorthand with syntax
test_files/** Numerous test files for contract lowering and effects

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

/// Best-effort slot size computation for types in storage.
fn ty_storage_slots(&self, ty: TyId<'db>) -> Option<u64> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this method should handle enum and probably tuple types as well (even though tuples will be rewritten as structs so I'm not entirely sure if it is needed here)

expression: output
input_file: tests/fixtures/effect_ptr_domains.fe
---
function bump(foo) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe this should be named bump_eff_stor .

Copy link
Collaborator

@cburgdorf cburgdorf left a comment

Choose a reason for hiding this comment

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

Looks great. I left two comments inline.

@sbillig sbillig merged commit d2aac2f into argotorg:master Dec 18, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants