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

all: add GOOS=wasip1 GOARCH=wasm port #58141

Closed
johanbrandhorst opened this issue Jan 30, 2023 · 97 comments
Closed

all: add GOOS=wasip1 GOARCH=wasm port #58141

johanbrandhorst opened this issue Jan 30, 2023 · 97 comments

Comments

@johanbrandhorst
Copy link
Member

johanbrandhorst commented Jan 30, 2023

Background

The WebAssembly System Interface (WASI, https://wasi.dev/) is gaining popularity as a compile-once-run-anywhere target for developer and cloud native applications. Many cloud providers are offering services that make it possible to execute WASI directly inside familiar orchestration frameworks like Kubernetes (https://learn.microsoft.com/en-us/azure/aks/use-wasi-node-pools, https://docs.krustlet.dev/howto/), or on edge compute platforms (https://developer.fastly.com/learning/compute/, https://blog.cloudflare.com/announcing-wasi-on-workers/) and the popular developer tool Docker has beta support for executing wasi directly (https://docs.docker.com/desktop/wasm/). For Go to remain relevant in a hypothetical world where this becomes a significant part of software delivery, it must support compiling code to the Wasm binary format and the WASI syscall API.

Proposal

We propose adding a new port, GOOS=wasip1 GOARCH=wasm, that targets the wasi_snapshot_preview1 syscall API. We further propose allowing the use of the go:wasmimport compiler directive in the syscall package, in addition to the currently allowed runtime and syscall/js packages.

Discussion

Go already supports WebAssembly (Wasm) through the existing GOOS=js GOARCH=wasm port, and the implementation of this proposal would reuse the existing Wasm architecture code and change the interface with which the compiled code interacts with the outside world. It builds on the accepted proposal (#38248) for a go:wasmimport compiler directive for defining Wasm host function imports. The compiled code would be a “Command”, executing func main and running until exit, similar to the existing js/wasm port.

Syscall API target

Today, implementing WASI means implementing the wasi_snapshot_preview1 API described in the spec. However, this interface is evolving without the insurance of backward compatibility. A “preview2” version is already being worked on. Should the Go compiler support the old one for now, and switch to the new one in the future, or should we name the new GOOS such that we can add new GOOS’s for new WASI APIs? We propose that we assume the wasi_snapshot_preview1 API for now and that future releases of Go may add support for newer syscall APIs under a different GOOS (e.g. GOOS=wasip2 for wasi_snapshot_preview2).

Maintainers

Since this is a new port and the porting policy requires at least two maintainers, Evan Phoenix (@evanphx), Julien Fabre (@Pryz) and I (@johanbrandhorst) are volunteering to be maintainers of this port.

Testing

The wasi/wasm port will be tested by executing the standard library tests using an established WASI VM, such as Wasmtime. This software has precompiled binaries available for download, which can be used to set up a builder for the trybots, similar to how NodeJS is used for the js/wasm port.

What happens to the js/wasm port?

The existing js/wasm port will remain relevant for the purposes of compiling Go Wasm for running in a JavaScript VM and using the syscall/js interface for interacting with the JS world. Both ports will coexist, and should eventually require minimal differences in compiler and syscall code. See the discussion on rewriting wasm_exec.js for more information.

A note on capabilities

wasi_snapshot_preview1 is limited in ways that may be surprising to users, for example, it is not possible to open a network socket with the APIs defined in the spec. The initial implementation of the wasi target will aim to implement as much of the standard library as possible, but there will be big gaps.

Related issues

This would close #31105, which has mostly been a discussion issue.

Future work

WASI Preview2

As the second snapshot of the WASI standard matures, we will aim to add support for the new standard. This will unlock new functionality such as networking sockets and ensure that Go’s WASI support remains relevant for users. This could be done in any new major release of the Go toolchain, but not in a minor revision.

Considering the upcoming changes in preview 2, it is a legitimate question to ask whether the work to add support for wasi_snapshot_preview1 is worth doing; could we simply wait for the next standard iteration? We believe the work to be useful because at this time, all compilers are targeting preview 1, and preview 2 seems far from being fully completed. We also believe that runtimes will provide polyfills to preview 1 while preview 2 is in the process of being implemented (see this Wasmtime issue). Finally, the next version of the WASI standard is split into multiple components, and it is possible that specifications for each component will be finalized at different times, with preview 1 remaining the de-facto fallback for components that are not yet fully specified or implemented by runtimes yet.

Rewriting wasm_exec.js as WASI and unifying syscall interfaces

The existing js/wasm port has a custom syscall interface implemented by wasm_exec.js and run on any JavaScript VM. Now that a standard is emerging, the js/wasm target should reuse the same syscall interface, allowing parts of the syscall interface between wasi and js to be unified to reduce maintenance burden. This would require implementing a WASI interface shim in wasm_exec.js, which is a significant undertaking, and thus out of scope of this initial WASI work.

WASI Libraries (AKA Reactors)

The WASI concept of libraries allow compiled binaries to expose single functions for consumption from the host. This is not something that will be supported in the initial WASI port, as it requires a concept of marking Go functions as exported (i.e. //go:wasmexport), and somehow facilitating the execution of a single function. For more discussions on why this is complicated, see #42372.

GOOS=none GOARCH=wasm

Binary wasm can run without any particular knowledge of its host, perhaps using something like GOOS=none, similar to Rust’s wasm32-unknown-unknown target. This proposal does not propose any such port be added, but it may be something to consider in the future. The name “none” is, of course, not decided.

Authors

@johanbrandhorst, @Pryz, @evanphx, @achille-roussel

@gopherbot gopherbot added this to the Proposal milestone Jan 30, 2023
@prattmic
Copy link
Member

prattmic commented Jan 30, 2023

I like the idea of using GOOS=wasi to distinguish from GOOS=js. It seems like a natural place to select wasi.

The obvious concern here to me is the instability of the API of wasi_snapshot_preview1. Is wasi_snapshot_preview2 planning to be backwards compatible with wasi_snapshot_preview1 binaries? (It sounds like no?). If not, I am concerned by GOOS=wasi changing APIs between versions because I suspect (a) some users will want preview2 ASAP to use new feature, and (b) some users will want to keep preview1 because their wasm runtime doesn't support preview2 yet. These are in direct conflict with one another.

As a workaround, we could have GOWASI=preview1, or something like that, similar to GOARM, GOAMD64, etc.

What is the timeline for a "stable" version of WASI? The other end of the spectrum would be to say that GOOS=wasi is not stable (hidden behind a GOEXPERIMENT maybe?) and will change compatibility arbitrarily from release-to-release until there is a stable version of WASI to target.

@prattmic
Copy link
Member

From https://github.com/WebAssembly/WASI: "The WebAssembly System Interface is not a monolithic standard system interface, but is instead a modular collection of standardized APIs. None of the APIs are required to be implemented to have a compliant runtime. Instead, host environments can choose which APIs make sense for their use cases."

Will there be some minimum requirements that the Go runtime will require from the host environment? Or will Go still work even if the host environment provides no APIs?

@codefromthecrypt
Copy link

@prattmic while not documented really, the usual way features are disabled is via syscall.ENOSYS errors.

For example, when source is compiled with GOARCH=wasm GOOS=js and let's say wazero is running it, if that code tries to access the filesystem and the filesystem is disabled, the wazero host functions return an ENOSYS error which the compiled code expects and returns an error message like "not implemented in js"

In the case of WASI, and specifically the most implemented version of it (snapshot-01), there are error codes which map to syscall.Errno here https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-errno-enumu16

@johanbrandhorst
Copy link
Member Author

The obvious concern here to me is the instability of the API of wasi_snapshot_preview1. Is wasi_snapshot_preview2 planning to be backwards compatible with wasi_snapshot_preview1 binaries? (It sounds like no?). If not, I am concerned by GOOS=wasi changing APIs between versions because I suspect (a) some users will want preview2 ASAP to use new feature, and (b) some users will want to keep preview1 because their wasm runtime doesn't support preview2 yet. These are in direct conflict with one another.

The existing js/wasm port has generally taken a conservative approach to including new features, and we would seek to emulate that. We don't yet know what would be the threshold for switching over to preview2, but it would likely be year(s) in the future. A GOWASI environment variable as suggested may be considered, but it shouldn't be necessary in the near term.

I will note also that the existing js/wasm port is still considered experimental and can introduce breaking changes at any time. The wasi/wasm port would similarly not provide any backwards compatibility guarantees. It would seem appropriate for this to remain the case until a stable WASI API spec is available and implemented in runtimes at least.

Will there be some minimum requirements that the Go runtime will require from the host environment? Or will Go still work even if the host environment provides no APIs?

Go binaries compiled with GOOS=wasi would require the host to provide the full wasi_snapshot_preview1 API. A hypothetical GOOS=none GOARCH=wasm could be introduced to avoid any host dependencies, but it's not currently part of our planning.

@prattmic
Copy link
Member

prattmic commented Jan 30, 2023

@codefromthecrypt:

@prattmic while not documented really, the usual way features are disabled is via syscall.ENOSYS errors.

@johanbrandhorst:

Go binaries compiled with GOOS=wasi would require the host to provide the full wasi_snapshot_preview1 API.

These seem a bit contradictory?

I'm specifically wondering about APIs which the Go runtime cannot run without at all. e.g., we may require clock_get_time to implement runtime.nanotime, because the runtime more-or-less can't run without a source of time [1]. I'm wondering if there are other cases.

It doesn't seem like we'd need to require all APIs. e.g., fd_sync wouldn't be called by Go unless the program explicitly calls os.File.Sync/syscall.Sync. Those returning an error seems fine to me.

[1] OK, maybe not a perfect example, since technically -tags=faketime doesn't require a time source.

@johanbrandhorst
Copy link
Member Author

I'm not sure what you're asking exactly, the way I see this being implemented is by translating syscalls in the code to the relevant host API calls. Sure you could build a wasi binary that doesn't use all of the API and it'd work fine on a host that only implements the part of the API that's used, but I don't think the implementation should need to do any sort of feature capability negotiation with the host - if the API returns ENOSYS then the function call fails up the stack. Does that sound okay?

For your specific example, I guess if clock_get_time isn't implemented it would fail very quickly at runtime, not try to get by without a clock source.

@ianlancetaylor
Copy link
Contributor

At the very least for documentation purposes I think we want to be able to write down which APIs must be implemented in order to run simple Go programs.

@johanbrandhorst
Copy link
Member Author

At the very least for documentation purposes I think we want to be able to write down which APIs must be implemented in order to run simple Go programs.

Not that I disagree, but I'm a little confused by this inquiry - are we expecting users to implement their own partial implementations of wasi_snapshot_preview1 in the hopes of running simple Go programs? It's tempting to say that any Go compiled wasi binary requires the host to provide the API defined by the spec. What is the purpose of defining a minimal API used by simple Go programs?

@codefromthecrypt
Copy link

@ianlancetaylor

At the very least for documentation purposes I think we want to be able to write down which APIs must be implemented in order to run simple Go programs.

I think initially it would look like TinyGo, which implements a subset of wasi. Here's a list of functions that are used and who uses them https://wazero.io/specs/#wasi and here's an example simple cat program. Hope it helps!

$ wasm2wat ./cmd/wazero/testdata/cat/cat-tinygo.wasm|grep 'import "wasi'
  (import "wasi_snapshot_preview1" "fd_write" (func $runtime.fd_write (type 0)))
  (import "wasi_snapshot_preview1" "clock_time_get" (func $runtime.clock_time_get (type 1)))
  (import "wasi_snapshot_preview1" "args_sizes_get" (func $runtime.args_sizes_get (type 2)))
  (import "wasi_snapshot_preview1" "args_get" (func $runtime.args_get (type 2)))
  (import "wasi_snapshot_preview1" "proc_exit" (func $runtime.proc_exit (type 3)))
  (import "wasi_snapshot_preview1" "environ_get" (func $__imported_wasi_snapshot_preview1_environ_get (type 2)))
  (import "wasi_snapshot_preview1" "environ_sizes_get" (func $__imported_wasi_snapshot_preview1_environ_sizes_get (type 2)))
  (import "wasi_snapshot_preview1" "fd_close" (func $__imported_wasi_snapshot_preview1_fd_close (type 4)))
  (import "wasi_snapshot_preview1" "fd_fdstat_get" (func $__imported_wasi_snapshot_preview1_fd_fdstat_get (type 2)))
  (import "wasi_snapshot_preview1" "fd_filestat_get" (func $__imported_wasi_snapshot_preview1_fd_filestat_get (type 2)))
  (import "wasi_snapshot_preview1" "fd_prestat_get" (func $__imported_wasi_snapshot_preview1_fd_prestat_get (type 2)))
  (import "wasi_snapshot_preview1" "fd_prestat_dir_name" (func $__imported_wasi_snapshot_preview1_fd_prestat_dir_name (type 5)))
  (import "wasi_snapshot_preview1" "fd_read" (func $__imported_wasi_snapshot_preview1_fd_read (type 0)))
  (import "wasi_snapshot_preview1" "fd_seek" (func $__imported_wasi_snapshot_preview1_fd_seek (type 6)))
  (import "wasi_snapshot_preview1" "path_open" (func $__imported_wasi_snapshot_preview1_path_open (type 7)))

@dmitshur
Copy link
Contributor

CC @golang/release.

@prattmic
Copy link
Member

At the very least for documentation purposes I think we want to be able to write down which APIs must be implemented in order to run simple Go programs.

Not that I disagree, but I'm a little confused by this inquiry - are we expecting users to implement their own partial implementations of wasi_snapshot_preview1 in the hopes of running simple Go programs?

I haven't been following wasm/wasi super closely, so maybe I've misunderstood, but I thought that wasm/wasi was commonly using in "sandboxing"-type scenarios, where presumably the operator wants to limit the APIs that the sandboxed program has access to. Documenting the minimum requirements for the Go runtime itself makes it clear to those building a sandbox what the most restricted set of APIs they can provide is (and if that is still too permissive, maybe Go programs aren't a good sandboxee target).

@johanbrandhorst
Copy link
Member Author

johanbrandhorst commented Jan 30, 2023

I haven't been following wasm/wasi super closely, so maybe I've misunderstood, but I thought that wasm/wasi was commonly using in "sandboxing"-type scenarios, where presumably the operator wants to limit the APIs that the sandboxed program has access to. Documenting the minimum requirements for the Go runtime itself makes it clear to those building a sandbox what the most restricted set of APIs they can provide is (and if that is still too permissive, maybe Go programs aren't a good sandboxee target).

This is a great point, and I agree. Thank you. Do we have a rough idea of the syscalls required by the runtime today? I expect to get exact information would require an experimental implementation (which we are working on), but I could add a preliminary list to the proposal. The TinyGo information is presumably not going to be representative of the behavior of gc?

@prattmic
Copy link
Member

prattmic commented Jan 30, 2023

I think it is fine to figure out in prototyping, the list doesn't need to be in the proposal.

FWIW, quickly looking through https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#modules, the only ones that look really important to me are clock_get_time, and proc_exit. The args and environ ones could be optional, but the implementation will need to be careful to check for errors (it would be easy to assume they wouldn't fail).

Some sort of I/O (fd_read, fd_write) shouldn't technically be required, though in practice almost any program probably wants to use stdin/stdout/stderr.

@prattmic
Copy link
Member

Hm, one more problem I see is that https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#modules does not seem to implement any kind of timer/sleep/wait. Am I missing something? It seems like that will require the Go runtime to spin when there is nothing else to do.

@evanphx
Copy link
Contributor

evanphx commented Jan 30, 2023

@prattmic There is poll_oneoff which includes both clock and fd event types, so we'd use that. https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-eventtype-enumu8

@johanbrandhorst
Copy link
Member Author

The latest CNCF annual survey describes WebAssembly as "the future", though it is unclear whether that's within a JS runtime environment or WASI.

@Mossaka
Copy link

Mossaka commented Feb 1, 2023

Hey there, I am very excited for this proposal!

We also believe that runtimes will provide polyfills to preview 1 while preview 2 is in the process of being implemented

This is indeed true. Please see this repo where the community is building a polyfill adapter for wasi preview1 modules to call preview2 functions.

@rsc
Copy link
Contributor

rsc commented Feb 1, 2023

This proposal has been added to the active column of the proposals project
and will now be reviewed at the weekly proposal review meetings.
— rsc for the proposal review group

@johanbrandhorst
Copy link
Member Author

I just made a minor change to the proposal. In addition to the previous statement, I added

We further propose allowing the use of the go:wasmimport compiler directive in the syscall package, in addition to the currently allowed runtime and syscall/js packages.

This will be necessary to define the syscall methods used to interact with the WASI host through the go:wasmimport compiler directive.

@aclements
Copy link
Member

The compiler/runtime team at Google is generally supportive of WASI support. It seems like a good idea and an important direction for WASM.

Our one big question is how to set things up for preview2 in the future. @prattmic suggested a GOWASI environment variable to parallel GO386/GOAMD64/etc. That would be our first GO$GOOS variable, and it's not "additive" in the way that the GO$GOARCH variables are (e.g., amd64 but with more instructions), but it's certainly worth considering. Another option is that we put it in GOOS itself, like GOOS=wasip1. My impression is that WASI preview1 and WASI preview2 kind of are different operating systems, rather than a base layer with additions in preview2, which suggests using different GOOS values to me.

@rsc
Copy link
Contributor

rsc commented Feb 8, 2023

We already adapt OS implementations based on what's available, like using newer functions on Windows if they are present in the DLL, or falling back to older system calls on Linux when a newer one returns ENOSYS. Do we think preview1 and preview2 will be close enough to make that same approach feasible?

One possibility is to use GOOS=wasi for preview1 and then decide when preview2 is more settled whether that needs to be a separate GOOS or can be incorporated into GOOS=wasi.

@codefromthecrypt
Copy link

codefromthecrypt commented Feb 8, 2023

Do we think preview1 and preview2 will be close enough to make that same approach feasible?

TL;DR; I think they are too different because component model changes things. We should not assume the same approach will be best both for snapshot01 and snapshot02

WASI preview1 was a continuation of CloudABI and preview2 is a complete rewrite.

preview1 has a relatively straightforward, albeit monolithic ABI. All functions are in the same wasi_snapshot_preview1 and only depend on WebAssembly Core 1.0 features.

what's being called preview2 is a complete redo, which is based on the finalizing component model. Component model is a change to the binary format of WebAssembly. Specific to WASI, this splits various modules such as wasi-filesystem. There will be an adapter to forward snapshot01 to this new model.

For what its worth, the wazero team will be implementing component model and WASI snapshot 2 when they are ready, just likely not until the end of the year. As we learn more, we can help advise.

@gedw99
Copy link

gedw99 commented May 31, 2023

sone high level integration questions:

Does this change how wasm is setup for the browser ? We will be compiling to wasi ?

The wasm.js file won’t be needed anymore ?

@cherrymui
Copy link
Member

It doesn't change how it works for browsers, which is GOOS=js GOARACH=wasm, and it still needs wasm_exec.js.

@jakebailey
Copy link

Note that since it's still wasm, you can of course still run it in the browser, but the "OS" side of things shifts from that JS shim to providing an imports object that contains a wasi_snapshot_preview1 property when instantiating the compiled wasm module.

E.g. I've managed to run Go WASI in the browser by using a library that implements all of the calls: https://github.com/jakebailey/esbuild-playground/blob/e7734ada3405ea29225b4d063d76d6d0ff294daf/src/esbuild/wasiWorker.ts#L75

You can also do the same thing in Node, either via similar libraries to wasi-js or @wasmer/wasi, or just https://nodejs.org/api/wasi.html.

As a sidenote, the latter idea of using Node's WASI module would make another interesting builder (cc @johanbrandhorst).

@johanbrandhorst
Copy link
Member Author

johanbrandhorst commented Jun 1, 2023

Longer term we aim to rewrite wasm_exec.js in terms of the wasi syscall API (as much as possible) to remove differences between the different OS implementations. Would you be interested in contributing this 😄?

Interesting thought Jake, that would indeed be another valuable environment to test against. I don't have any plans on doing this in the short term but contributions are always accepted 😄.

mhutchinson pushed a commit to google/certificate-transparency-go that referenced this issue Jun 1, 2023
Fix building when the new `wasip1` port is being used.
This is a new target that will be introduced by go 1.21.

For more details golang/go#58141

Signed-off-by: Flavio Castelli <fcastelli@suse.com>
@gedw99
Copy link

gedw99 commented Jun 1, 2023

wasm_exec.js

Would be good as wasm_exec.js is kind of a mess . I am guessing because it had to cope with the evolution of golang and wasm over the years.

Maybe a wasi_exec.js should be used for go 1.21.1 going forward and wasm_exec.js for all previous versions. Just thinking out loud so that there is a clean break. Am speaking in terms of browsers btw.

@gedw99
Copy link

gedw99 commented Jun 1, 2023

Note that since it's still wasm, you can of course still run it in the browser, but the "OS" side of things shifts from that JS shim to providing an imports object that contains a wasi_snapshot_preview1 property when instantiating the compiled wasm module.

E.g. I've managed to run Go WASI in the browser by using a library that implements all of the calls: https://github.com/jakebailey/esbuild-playground/blob/e7734ada3405ea29225b4d063d76d6d0ff294daf/src/esbuild/wasiWorker.ts#L75

You can also do the same thing in Node, either via similar libraries to wasi-js or @wasmer/wasi, or just https://nodejs.org/api/wasi.html.

As a sidenote, the latter idea of using Node's WASI module would make another interesting builder (cc @johanbrandhorst).

I would love to try this @jakebailey
If there is anything I can work on or try out it would be awesome.

breadyzhang pushed a commit to breadyzhang/certificate-transparency-go that referenced this issue Jun 2, 2023
Fix building when the new `wasip1` port is being used.
This is a new target that will be introduced by go 1.21.

For more details golang/go#58141

Signed-off-by: Flavio Castelli <fcastelli@suse.com>
breadyzhang pushed a commit to breadyzhang/certificate-transparency-go that referenced this issue Jun 2, 2023
Fix building when the new `wasip1` port is being used.
This is a new target that will be introduced by go 1.21.

For more details golang/go#58141

Signed-off-by: Flavio Castelli <fcastelli@suse.com>
breadyzhang pushed a commit to breadyzhang/certificate-transparency-go that referenced this issue Jun 2, 2023
Fix building when the new `wasip1` port is being used.
This is a new target that will be introduced by go 1.21.

For more details golang/go#58141

Signed-off-by: Flavio Castelli <fcastelli@suse.com>
breadyzhang pushed a commit to breadyzhang/certificate-transparency-go that referenced this issue Jun 2, 2023
Fix building when the new `wasip1` port is being used.
This is a new target that will be introduced by go 1.21.

For more details golang/go#58141

Signed-off-by: Flavio Castelli <fcastelli@suse.com>
breadyzhang pushed a commit to breadyzhang/certificate-transparency-go that referenced this issue Jun 2, 2023
Fix building when the new `wasip1` port is being used.
This is a new target that will be introduced by go 1.21.

For more details golang/go#58141

Signed-off-by: Flavio Castelli <fcastelli@suse.com>
@gopherbot
Copy link

Change https://go.dev/cl/503756 mentions this issue: internal/releasetargets: regenerate all ports for Go 1.21

gopherbot pushed a commit to golang/build that referenced this issue Jun 15, 2023
It's a no-op since the only newly added port is wasip1/wasm,
and we won't be making binary releases for it at this time.

For golang/go#40561.
For golang/go#58141.

Change-Id: I0c9932fdfca0842c6860bca0cdbc4b1d64fdefff
Reviewed-on: https://go-review.googlesource.com/c/build/+/503756
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
phbnf pushed a commit to google/certificate-transparency-go that referenced this issue Jun 23, 2023
* Create additional conditions to determine log results and if a log should be submitted when minInclusions > 0.

* modify chromeLike unit test to better fit the actual use case and refine how safeSubmissionState decides which SCTs to insert in the results

* update changelog

* Remove MaxSubmissions and set maxSubmissionsPerGroup from the minGroups value

* Set max submissions per operator in ctpolicy package

* Removed  to reduce complexity and confusion.

* Resolving comments

- move base into switch expression

- change maxSubmissionsPerGroup to maxSubmissionsPerOperator

* Use MinDistinctOperators instead of MaxSubmissionsPerOperator to reduce confusion

* Add zOS build support (#1088)

* Add support for WASI port (#1089)

Fix building when the new `wasip1` port is being used.
This is a new target that will be introduced by go 1.21.

For more details golang/go#58141

Signed-off-by: Flavio Castelli <fcastelli@suse.com>

* update changelog

* fix changelog merge issues

* My merge conflict mishap reverted the change to have groups be a map[string]int so I am reverting it back to the updated state

* replace groupNeeds with minSubmissions and change the name of groups to groupsSubmitted

groupNeeds was used for the old chrome policy when we required SCTs from specific groups. It's not necessary anymore with the new policies so a single integer (minSubmissions) should be suffice.

groups is changed to groupsSubmitted to make it easier to understand upon a glance.

* change minSubmissions since it gets changed after initialization

* Change dayDuration to use time.Hour for easier understanding

* Resolve comments

* add comments to clarify reservedSubmissions

---------

Co-authored-by: Freddy Zhang <zhangfreddy@google.com>
Co-authored-by: onlywork1984 <102848417+onlywork1984@users.noreply.github.com>
Co-authored-by: Flavio Castelli <flavio@castelli.me>
maisem pushed a commit to tailscale/golang-x-crypto that referenced this issue Jul 11, 2023
Updates golang/go#32840
Updates golang/go#58141

Change-Id: Ib4425c1743d417920745205586af250dbf80c7e4
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/485695
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
gopherbot pushed a commit to golang/website that referenced this issue Jul 18, 2023
Updates golang/go#58141.

Change-Id: I7cfa8045ad9d27f1cc97bffb4ee2ac1a8c79e7c1
Reviewed-on: https://go-review.googlesource.com/c/website/+/495535
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Achille Roussel <achille.roussel@gmail.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Tianon Gravi (Andrew) <admwiggin@gmail.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
@mar1n3r0
Copy link

mar1n3r0 commented Jul 19, 2023

It doesn't change how it works for browsers, which is GOOS=js GOARACH=wasm, and it still needs wasm_exec.js.

Interesting. Can we access the DOM and the local file system of the host at the same time from wasi?

To give more context. I am currently hosting js based wasm on IPFS as means of p2p dapps. The wasm is hosted locally by each peer. Because I don't have access to the local host I can't connect to a CRDT database from within the browser and so had to fork the IPFS daemon which serves as a backend in that case called by the wasm locally.

@johanbrandhorst
Copy link
Member Author

The DOM is not automatically accessible to WASI compiled Wasm binaries (there is no syscall/js for WASI).

@mar1n3r0
Copy link

The DOM is not automatically accessible to WASI compiled Wasm binaries (there is no syscall/js for WASI).

So theoretically it would be possible if syscall/js is ported?

@johanbrandhorst
Copy link
Member Author

Wasm runtimes can define any APIs they like, and with go:wasmimport you can write Go wrappers around the APIs (a third party syscall/js, if you will). It seems impractical to me. In any case, this issue is not the right forum for this discussion. Please do not bump it.

dennwc added a commit to dennwc/yaegi that referenced this issue Sep 2, 2023
Adds wasip1 to known OS list, introduced in golang/go#58141. Without this change, yaegi extract may fail.
BiiChris pushed a commit to BiiChris/crypto that referenced this issue Sep 15, 2023
Updates golang/go#32840
Updates golang/go#58141

Change-Id: Ib4425c1743d417920745205586af250dbf80c7e4
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/485695
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
dennwc added a commit to dennwc/yaegi that referenced this issue Sep 26, 2023
Adds wasip1 to known OS list, introduced in golang/go#58141. Without this change, yaegi extract may fail.

(cherry picked from commit c7dbccf)
traefiker pushed a commit to traefik/yaegi that referenced this issue Sep 26, 2023
Adds `wasip1` to known OS list, introduced in golang/go#58141.

Without this change, `yaegi extract` may fail on Go 1.21 with the following message:
```
type-checking package "time" failed (<GOROOT>/src/time/zoneinfo_wasip1.go:8:5: platformZoneSources redeclared in this block)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Accepted
Development

No branches or pull requests