ArbOS operating system, to run at Layer 2 on Arbitrum chains. Also a compiler for Mini, the language in which ArbOS is written.

Overview

ArbOS and Mini compiler

ArbOS is the "operating system" that runs at Layer 2 on an Arbitrum chain, to manage the chain's operation, maintain security, isolate contracts from each other, manage contract lifecycles, and account for and charge for resource usage.

ArbOS is written in the Mini language. The Mini compiler is also in this repo. It compiles programs written in Mini, generating code to run on the Arbitrum Virtual Machine. The compiler is accompanied by an AVM emulator, with associated debugger and profiler.

To build and test everything, do make clean then make.

Comments
  • Add mixed let statement

    Add mixed let statement

    It would be beneficial to have a mixed let statement, that assigns some fields of a match pattern to new variables, and others to existing variables. One possible syntax for this would be:

    func main() {
        let y = 4;
        (let x, y) = f(y);
    }
    
    func f(y: uint) {
        return (y, y+1);
    }
    

    This would allow the use of fewer local variables for the same logic, saving gas.

    opened by RGates94 4
  • Signed transaction should pay for the cost of verifying their signature

    Signed transaction should pay for the cost of verifying their signature

    ArbOS has to pay the cost of a signature verification for every signed transaction. The transaction should be charged for the gas needed to do that. A simple way to do this would be to deduct the cost of an ecrecoverinstruction from the transaction's gas, when we first set up gas-charging for the transaction.

    Also, before checking a transaction's signature, we should verify that it has requested enough gas to pay for its signature check. If it hasn't, we should fail the transaction before even checking the signature.

    bug enhancement 
    opened by edfelten 3
  • Allow L1 contracts to launch buddy contracts at same address at L2

    Allow L1 contracts to launch buddy contracts at same address at L2

    Support a new incoming message type that any L1 contract can use to deploy a "buddy contract" at L2. The buddy contract will live on the L2 chain at the same address that the originating contract occupies at L1.

    On success or failure, in addition to the normal return code and returndata, ArbOS emits an outgoing message announcing the successful/unsuccessful creation of a buddy contract at a specified address.

    beta2 
    opened by edfelten 3
  • Give better error message on recursive type alias

    Give better error message on recursive type alias

    The language does not (currently) allow type aliases to be recursive. When compiling a source file that defines a recursive type alias, the compiler currently dies with a stack overflow, because the type resolver recurses infinitely.

    The compiler should detect this case and give a sensible error message.

    bug 
    opened by edfelten 3
  • Separate approval of upgrade from triggering it

    Separate approval of upgrade from triggering it

    This separates approving an upgrade, which can only be done by the chain owner, from actually triggering an already-approved upgrade, which anyone can now do.

    Because triggering an upgrade causes the current transaction to end in an unusual way, we require it to be done in a "top-level" tx that was submitted directly from L1. By allowing upgrades to be approved by the chain owner without immediately triggering them, we allow the chain owner to be an L2 contract. This opens up more options for using, e.g., multi-sig and time-delay functionalities to control the upgrade capability. And it help enable tooling to generate and authorize upgrades that is simpler and more error-resistant.

    The approver provides a timestamp after which the upgrade will no longer be triggerable.

    Triggering an already approved (and not timed out) upgrade can now be done by anyone, so it is easy to do directly from L1, which is still required.

    opened by edfelten 2
  • Support versioning of EVM code parsing

    Support versioning of EVM code parsing

    Our EVM code parsing algorithm will probably change over time, as the EVM code format standard evolves. To support this, we should version the parsing algorithm and label each contract (and cached compilation result) with the parsing version that was active at the time it was deployed. That will allow us to avoid (1) reparsing later under a different algorithm, and (2) getting a wrong result from the compilation result cache due to changes in the caching algorithm.

    This will start to matter when EIPs that change code parsing (more significantly than it has already changed) start to get deployed.

    enhancement 
    opened by edfelten 2
  • Function centric codegen

    Function centric codegen

    Makes codegen function-centric so that codegen is module-agnostic. This makes future optimizations possible and enables other refactors to codgen.

    This PR also

    • Reduces the number of backward jumps from 279 to 11 for a 0.5% performance gain
    • Reduces the number of AVM instructions in ArbOS by 12.88%
    • Multi-threads codegen
    • Creates .dot graph files for callgraph viewing
    • Globals can now have attributes & debug info
    • Refactors unused function procedure to not generate code for stdlib funcs
    • Refactors label_gen to be less stateful
    • Removes lifetime parameters from codegen
    • Removes all code relocation & simplifies linking
    • Adds the string datatype
    • Reduces special-casing around closures
    • Improves import error messages and logic
    opened by rachel-bousfield 2
  • Add gas estimation tests

    Add gas estimation tests

    Add tests of gas estimation functionality. The tests do gas estimation through preferred aggregator and non-preferred aggregator, then runs the transaction again for real, with gas amount based on the estimate.

    opened by edfelten 2
  • Preserve account balance across create/create2

    Preserve account balance across create/create2

    This preserves the state of an account, except for contract-related parts, across create or create2 operations that create contracts at the account's address.

    opened by edfelten 2
  • Fix EXTCODE* EVM instructions in constructors

    Fix EXTCODE* EVM instructions in constructors

    According to the EVM spec, the EXTCODE* instructions, when invoked on the address of a contract whose constructor is currently running, should behave as if the address has no code. Previously these used the code of the constructor, which is the specified behavior for the CODE* instructions.

    Fixes #559

    opened by edfelten 2
  • Simplify Console Colors

    Simplify Console Colors

    • Adds color functions for easy string coloring
    • Replaces CompileError colors with proper console color struct
    • Removes all instances of unwieldy color use via the new functions
    opened by rachel-bousfield 2
  • Bump im from 15.0.0 to 15.1.0

    Bump im from 15.0.0 to 15.1.0

    Bumps im from 15.0.0 to 15.1.0.

    Changelog

    Sourced from im's changelog.

    [15.1.0] - 2022-04-29

    Added

    • HashSet now implements From<Vector<A>> and From<&Vector<A>> where A: Clone.

    Fixed

    • Fixed a long standing crash bug in OrdMap/OrdSet. (#154, #143, #152, #124)
    • The union method on maps/sets will now prefer to mutate the larger set (which leads to less work) rather than the first set. (#163)
    • Ensure TreeFocus only implements Send/Sync when the underlying type does. (#157, #158)
    • There was an issue where nodes in very large OrdMaps could overflow when removing an element and cause a panic, which has now been fixed. (#141)
    • Assorted doc cleanup. (#150, #173, #186, #194)
    Commits
    • 71331ea (cargo-release) version 15.1.0
    • 9847c3f Sync im-rc Cargo.toml.
    • 9b8ee6a Remove the now obsolete no-dev-version field from release.toml.
    • 973ad84 Remove the obsolete Travis CI badge.
    • cc065e0 Set rust-version to 1.46.0 in Cargo.toml.
    • 744c626 Appease Clippy.
    • 5c69ba9 Update changelog.
    • 546e59b Bump some deps, fix some warnings.
    • 0b3a7b2 Add Send and Sync bounds for TreeFocus
    • 9c2726a Fix a typo in the docs ("`true" => "`true`")
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies rust 
    opened by dependabot[bot] 0
  • Bump regex from 1.4.5 to 1.5.5

    Bump regex from 1.4.5 to 1.5.5

    Bumps regex from 1.4.5 to 1.5.5.

    Changelog

    Sourced from regex's changelog.

    1.5.5 (2022-03-08)

    This releases fixes a security bug in the regex compiler. This bug permits a vector for a denial-of-service attack in cases where the regex being compiled is untrusted. There are no known problems where the regex is itself trusted, including in cases of untrusted haystacks.

    1.5.4 (2021-05-06)

    This release fixes another compilation failure when building regex. This time, the fix is for when the pattern feature is enabled, which only works on nightly Rust. CI has been updated to test this case.

    1.5.3 (2021-05-01)

    This releases fixes a bug when building regex with only the unicode-perl feature. It turns out that while CI was building this configuration, it wasn't actually failing the overall build on a failed compilation.

    1.5.2 (2021-05-01)

    This release fixes a performance bug when Unicode word boundaries are used. Namely, for certain regexes on certain inputs, it's possible for the lazy DFA to stop searching (causing a fallback to a slower engine) when it doesn't actually need to.

    [PR #768](rust-lang/regex#768) fixes the bug, which was originally reported in ripgrep#1860.

    1.5.1 (2021-04-30)

    This is a patch release that fixes a compilation error when the perf-literal feature is not enabled.

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies rust 
    opened by dependabot[bot] 0
  • Bump num-bigint from 0.4.2 to 0.4.3

    Bump num-bigint from 0.4.2 to 0.4.3

    Bumps num-bigint from 0.4.2 to 0.4.3.

    Changelog

    Sourced from num-bigint's changelog.

    Release 0.4.3 (2021-11-02)

    Contributors: @​arvidn, @​cuviper, @​guidovranken

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies rust 
    opened by dependabot[bot] 0
  • Bump crossbeam-utils from 0.8.4 to 0.8.8

    Bump crossbeam-utils from 0.8.4 to 0.8.8

    Bumps crossbeam-utils from 0.8.4 to 0.8.8.

    Release notes

    Sourced from crossbeam-utils's releases.

    crossbeam-utils 0.8.8

    • Fix a bug when unstable loom support is enabled. (#787)

    crossbeam-utils 0.8.7

    • Add AtomicCell<{i*,u*}>::{fetch_max,fetch_min}. (#785)
    • Add AtomicCell<{i*,u*,bool}>::fetch_nand. (#785)
    • Fix unsoundness of AtomicCell<{i,u}64> arithmetics on 32-bit targets that support Atomic{I,U}64 (#781)

    crossbeam-utils 0.8.6

    • Re-add AtomicCell<{i,u}64>::{fetch_add,fetch_sub,fetch_and,fetch_or,fetch_xor} that were accidentally removed in 0.8.0 0.7.1 on targets that do not support Atomic{I,U}64. (#767)
    • Re-add AtomicCell<{i,u}128>::{fetch_add,fetch_sub,fetch_and,fetch_or,fetch_xor} that were accidentally removed in 0.8.0 0.7.1. (#767)

    crossbeam-utils 0.8.5

    • Add AtomicCell::fetch_update (#704)
    • Support targets that do not have atomic CAS on stable Rust (#698)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies rust 
    opened by dependabot[bot] 0
  • Bump crossbeam-deque from 0.8.0 to 0.8.1

    Bump crossbeam-deque from 0.8.0 to 0.8.1

    Bumps crossbeam-deque from 0.8.0 to 0.8.1.

    Release notes

    Sourced from crossbeam-deque's releases.

    crossbeam-deque 0.8.1

    Changelog

    Sourced from crossbeam-deque's changelog.

    Version 0.8.1

    • Support targets that do not have atomic CAS on stable Rust (#698)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies rust 
    opened by dependabot[bot] 0
Releases(v0.9.0)
Owner
Offchain Labs
Offchain Labs
Rust library provides a standalone implementation of the ROS (Robot Operating System) core

ROS-core implementation in Rust This Rust library provides a standalone implementation of the ROS (Robot Operating System) core. It allows you to run

Patrick Wieschollek 3 Apr 26, 2023
Rust based magic-string with source map chains support

enhanced-magic-string Rust implementation of https://www.npmjs.com/package/magic-string with original sourcemap chain support. license. This project i

Farm 3 Nov 5, 2023
The Rust Compiler Collection is a collection of compilers for various languages, written with The Rust Programming Language.

rcc The Rust Compiler Collection is a collection of compilers for various languages, written with The Rust Programming Language. Compilers Language Co

null 2 Jan 17, 2022
The compiler for Gera, a statically typed and garbage collected programming language.

Gera The compiler for Gera, a satically typed and garbage collected programming language. Currently WIP (Work in progress). Progress This is a rough o

null 4 Oct 26, 2023
Multi-platform desktop app to download and run Large Language Models(LLM) locally in your computer.

Multi-platform desktop app to download and run Large Language Models(LLM) locally in your computer ?? Download | Give it a Star ⭐ | Share it on Twitte

Julio Andres 73 Jun 15, 2023
Stack-based programming language which emulates the look and feel of the 60s

Cauchemar Cauchemar is a stack-based programming language inspired by FORTH but more arcane. Emulates the look and feel of a programming language from

Yuki Langley 4 Dec 29, 2022
Elemental System Designs is an open source project to document system architecture design of popular apps and open source projects that we want to study

Elemental System Designs is an open source project to document system architecture design of popular apps and open source projects that we want to study

Jason Shin 9 Apr 10, 2022
Take your first step in writing a compiler. Implemented in Rust.

first-step-rust Take your first step in writing a compiler, using Rust. Building from Source Make sure the Rust toolchain is installed on your compute

PKU Compiler Course 13 Aug 28, 2022
P523 is a classic compiler course taught by R. Kent Dybvig.

P523 is a classic compiler course taught by R. Kent Dybvig. This repo implements the course using Rust, provides a framework to help you master P523.

Sirius Demon 44 Dec 26, 2022
Bril: A Compiler Intermediate Representation for Learning

Bril: A Compiler Intermediate Representation for Learning Bril (the Big Red Intermediate Language) is a compiler IR made for teaching CS 6120, a grad

Lesley Lai 0 Dec 5, 2022
The first cesil transpiler/compiler in 50 years!

CesilC CESIL, or Computer Education in Schools Instruction Language, is a programming language designed to introduce pupils in British secondary schoo

null 5 Aug 6, 2022
A rust version of "the super tiny compiler"

The (Rust) super tiny compiler This project is a rust version of the super tiny compiler (the original one (JS) was created by Jamie Kyle). The output

Eduardo Stuart 6 Dec 25, 2022
A tool & library to help you with the compiler course.

Compiler Course Helper Support: eliminate left recursion (require grammar with no cycles or ϵ-production) calculate nullable, first sets, follow, sets

水夕 4 May 2, 2022
Rust lib for fetching official protoc (Protocol Buffer compiler) releases

protoc-fetcher Rust library for fetching official Protocol Buffer compiler (protoc) releases, pegged to a specific version. protoc-fetcher downloads a

Arcanyx Technical Wizardry LLC 2 Sep 5, 2022
A additional Rust compiler pass to detect memory safe bugs of Rust programs.

SafeDrop A additional Rust compiler pass to detect memory safe bugs of Rust programs. SafeDrop performs path-sensitive and field-sensitive inter-proce

Artisan-Lab  (Fn*) 5 Nov 25, 2022
Harvest Moon: (More) Friends of Mineral Town event script compiler

mary This is a script compiler for Harvest Moon: Friends of Mineral Town and Harvest Moon: More Friends of Mineral Town for the GBA. The end goal is f

Nat (Stan) 5 Oct 23, 2023
Quickly set up a `probe-run` + `defmt` + `flip-link` embedded project

app-template Quickly set up a probe-run + defmt + flip-link embedded project Dependencies 1. flip-link: $ cargo install flip-link 2. probe-run: $ # ma

Knurling 201 Dec 29, 2022
probe-run is a custom Cargo runner that transparently runs Rust firmware on an embedded device

probe-run Runs embedded programs just like native ones probe-run is a custom Cargo runner that transparently runs Rust firmware on an embedded device.

Knurling 483 Jan 7, 2023
TypeRust - simple Rust playground where you can build or run your Rust code and share it with others

Rust playground Welcome to TypeRust! This is a simple Rust playground where you can build or run your Rust code and share it with others. There are a

Kirill Vasiltsov 28 Dec 12, 2022