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

building binary without rust stdlib #58

Open
templexxx opened this issue Mar 3, 2023 · 3 comments
Open

building binary without rust stdlib #58

templexxx opened this issue Mar 3, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@templexxx
Copy link
Collaborator

templexxx commented Mar 3, 2023

syscalls:

stdlib:

cat std_sys_list | tr ' ' '\n' | sort -u
4001
4005
4006
4045
4076
4078
4085
4091
4116
4119
4125
4140
4146
4167
4188
4193
4194
4195
4203
4206
4210
4218
4220
4236
4238
4246
4252
4263
4283
4293
4338

no_std: write exit brk

4004
4045
4001

30 vs 3

thanks to @shelmesky. I used his releases(a little program which is hello world level), and listed syscalls in them.

no_std could help us to reduce much of the workload in syscall implementation.

The syscalls needed by no_std will be tier1, and others will be tier2

@templexxx templexxx added the enhancement New feature or request label Mar 3, 2023
@jolestar jolestar added the help wanted Extra attention is needed label Mar 16, 2023
@shelmesky
Copy link
Contributor

Advantages and disadvantages of using no_std.

Advantage:

  1. the dependency on system calls is greatly reduced, keeping only the necessary memory allocation and IO handling, so that either layer2's mips simulator or layer1's mips simulator can greatly reduce the work of implementing system calls, as too many system calls can add uncertainty.
  2. because the default compilation target: mipsel-unknown-linux-musl, which has a dependency on the C library, brings with it a dependency on the signalling class system calls, and the C library layer will have to be considered later in order to justify the whole fraud proof process. Now with target: mipsel-unkonwn-none, the C library is bypassed directly, reducing the uncertainty and dependency on the signal class system calls.
  3. the MoveVM and block handling code has been streamlined, keeping only the necessary parts, reducing dependencies and code size. Because we know that geth, inside cannon, is also streamlined and does not use the full version.
  4. use memory to exchange data rather than through the filesystem. The filesystem is more complex to implement on layer1.

Disadvantages:

  1. requires streamlining and modifying the MoveVM and block handling code, as the no_std library has to be adapted.
  2. Instead of using the file system to exchange data, the simulator is not as versatile when using memory.

@templexxx
Copy link
Collaborator Author

Advantages and disadvantages of using no_std.

Advantage:

  1. the dependency on system calls is greatly reduced, keeping only the necessary memory allocation and IO handling, so that either layer2's mips simulator or layer1's mips simulator can greatly reduce the work of implementing system calls, as too many system calls can add uncertainty.
  2. because the default compilation target: mipsel-unknown-linux-musl, which has a dependency on the C library, brings with it a dependency on the signalling class system calls, and the C library layer will have to be considered later in order to justify the whole fraud proof process. Now with target: mipsel-unkonwn-none, the C library is bypassed directly, reducing the uncertainty and dependency on the signal class system calls.
  3. the MoveVM and block handling code has been streamlined, keeping only the necessary parts, reducing dependencies and code size. Because we know that geth, inside cannon, is also streamlined and does not use the full version.
  4. use memory to exchange data rather than through the filesystem. The filesystem is more complex to implement on layer1.

Disadvantages:

  1. requires streamlining and modifying the MoveVM and block handling code, as the no_std library has to be adapted.
  2. Instead of using the file system to exchange data, the simulator is not as versatile when using memory.

@shelmesky

there are two things I want to clarify:

  1. we are using MIPS not MIPSEL in present, MIPSEL is little endian
  2. for example codes(tiny programer) could I use mips-unknown-none diretcly? And how to specify OS?

@shelmesky
Copy link
Contributor

shelmesky commented Mar 20, 2023

Because until now, the target mipsel-unknown-none was the only target supported by Rust without an operating system and without a C library.

This is the only target that supports the no_std feature.

And for the no_std feature, there is no OS and no C library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants