Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stylus: add compilation target config, support multiple targets in wasm store #2463

Merged
merged 103 commits into from
Aug 19, 2024

Conversation

magicxyyz
Copy link
Contributor

@magicxyyz magicxyyz commented Jul 9, 2024

Resolves: NIT-2631
Resolves: NIT-2695

This PR:

  • adds support for storing stylus program compilation output for multiple targets
  • adds wasm store schema version check
  • currently, only assembly for local target and wavm (module) will be generated and stored upon program activation
  • similarly, when recording statedb, only local target and wavm assemblies will be included in the recording
  • uses stylus for wat2wasm and removes go-wasmer

Based on: #2417
Pulls: OffchainLabs/go-ethereum#339

@cla-bot cla-bot bot added the s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA. label Jul 9, 2024
Copy link
Collaborator

@PlasmaPower PlasmaPower left a comment

Choose a reason for hiding this comment

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

One small request for a comment but other than that LGTM

@@ -56,17 +55,21 @@ pub fn target_cache_set(name: String, description: String, native: bool) -> Resu
}
return Err(eyre!(err_message));
}
InitCache::set_target(target.clone())
*TARGET_NATIVE.write() = target.clone();
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd still add a comment to target_cache_set explaining everything this function does, because it kind of does two things in one. It both populates TARGET_CACHE, but if native is set, it also populates TARGET_NATIVE which isn't really a cache or related to TARGET_CACHE.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added a following comment:

/// Populates `TARGET_CACHE` inserting target specified by `description` under `name` key.
/// Additionally, if `native` is set it sets `TARGET_NATIVE` to the specified target.

Let me know if that's good / precise enough :)

PlasmaPower
PlasmaPower previously approved these changes Aug 16, 2024
Copy link
Collaborator

@PlasmaPower PlasmaPower left a comment

Choose a reason for hiding this comment

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

LGTM

@PlasmaPower
Copy link
Collaborator

The docker build seems to be failing with

#120 6.294 nitro: error while loading shared libraries: libwasmer.so: cannot open shared object file: No such file or directory

and it's not failing on master https://github.com/OffchainLabs/nitro/actions/runs/10423011222/job/28868789568

Did we accidentally introduce a new wasmer-go dependency?

@PlasmaPower
Copy link
Collaborator

It looks like it's from arbos/programs/testcompile.go. Perhaps that should be a rust test instead?

Copy link
Contributor

@tsahee tsahee left a comment

Choose a reason for hiding this comment

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

LGTM

PlasmaPower
PlasmaPower previously approved these changes Aug 17, 2024
Copy link
Collaborator

@PlasmaPower PlasmaPower left a comment

Choose a reason for hiding this comment

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

LGTM but now has conflicts with master

Copy link
Collaborator

@PlasmaPower PlasmaPower left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@tsahee tsahee left a comment

Choose a reason for hiding this comment

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

LGTM

@PlasmaPower PlasmaPower merged commit 4f1f432 into master Aug 19, 2024
14 checks passed
@PlasmaPower PlasmaPower deleted the stylus_target_wasm_store branch August 19, 2024 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design-approved s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants