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

Rename from SpecialOps to SpecOps #14

Merged
merged 1 commit into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
SpecialOps
SpecOps
Copyright 2024 Arran Schlosberg
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SpecialOps [![Go](https://github.com/solidifylabs/specialops/actions/workflows/go.yml/badge.svg)](https://github.com/solidifylabs/specialops/actions/workflows/go.yml) [![Go Reference](https://pkg.go.dev/badge/github.com/solidifylabs/specialops.svg)](https://pkg.go.dev/github.com/solidifylabs/specialops)
# SpecOps [![Go](https://github.com/solidifylabs/specops/actions/workflows/go.yml/badge.svg)](https://github.com/solidifylabs/specops/actions/workflows/go.yml) [![Go Reference](https://pkg.go.dev/badge/github.com/solidifylabs/specops.svg)](https://pkg.go.dev/github.com/solidifylabs/specops)

> `specialops` is a low-level, domain-specific language (and compiler) for crafting [Ethereum VM](https://ethereum.org/en/developers/docs/evm) bytecode in Go.
> `specops` is a low-level, domain-specific language (and compiler) for crafting [Ethereum VM](https://ethereum.org/en/developers/docs/evm) bytecode in Go.

This is a _very_ early release. In fact, it's just a weekend project gone rogue
so is less than a week old.
Expand Down Expand Up @@ -44,22 +44,22 @@ bytecode unchanged.

### Documentation

The [`specialops` Go
documentation](https://pkg.go.dev/github.com/solidifylabs/specialops) covers all
The [`specops` Go
documentation](https://pkg.go.dev/github.com/solidifylabs/specops) covers all
functionality.

## Examples

### Hello world

TODO: link to Go playground; for now, here's the [real implementation](https://github.com/solidifylabs/specialops/blob/41efe932c9a85e45ce705b231577447e6c944487/examples_test.go#L12).
TODO: link to Go playground; for now, here's the [real implementation](https://github.com/solidifylabs/specops/blob/41efe932c9a85e45ce705b231577447e6c944487/examples_test.go#L12).

The `specialops` Go package has a minimal footprint to allow for dot-importing,
The `specops` Go package has a minimal footprint to allow for dot-importing,
making all exported symbols available. TODO: expand on the implications,
rationale, and recommendations as this goes against the style guide.

```go
import . github.com/solidifylabs/specialops
import . github.com/solidifylabs/specops


Expand Down Expand Up @@ -98,14 +98,14 @@ result, err := results()

### Other examples

- [Verbatim reimplementation of well-known contracts](https://github.com/solidifylabs/specialops/blob/41efe932c9a85e45ce705b231577447e6c944487/examples_test.go#L34)
- [Verbatim reimplementation of well-known contracts](https://github.com/solidifylabs/specops/blob/41efe932c9a85e45ce705b231577447e6c944487/examples_test.go#L34)
* EIP-1167 Minimal Proxy ([original](https://eips.ethereum.org/EIPS/eip-1167#specification))
* 0age/metamorphic ([original](https://github.com/0age/metamorphic/blob/55adac1d2487046002fc33a5dff7d669b5419a3a/contracts/MetamorphicContractFactory.sol#L55))
- [Monte Carlo approximation of pi](https://github.com/solidifylabs/specialops/blob/41efe932c9a85e45ce705b231577447e6c944487/examples_test.go#L158)
- [`sqrt()`](https://github.com/solidifylabs/specialops/blob/41efe932c9a85e45ce705b231577447e6c944487/examples_test.go#L246) as seen ~~on TV~~ in `prb-math` ([original](https://github.com/PaulRBerg/prb-math/blob/5b6279a0cf7c1b1b6a5cc96082811f7ef620cf60/src/Common.sol#L595))
- [Monte Carlo approximation of pi](https://github.com/solidifylabs/specops/blob/41efe932c9a85e45ce705b231577447e6c944487/examples_test.go#L158)
- [`sqrt()`](https://github.com/solidifylabs/specops/blob/41efe932c9a85e45ce705b231577447e6c944487/examples_test.go#L246) as seen ~~on TV~~ in `prb-math` ([original](https://github.com/PaulRBerg/prb-math/blob/5b6279a0cf7c1b1b6a5cc96082811f7ef620cf60/src/Common.sol#L595))

## Acknowledgements

Some of SpecialOps was, of course, inspired by
Some of SpecOps was, of course, inspired by
[Huff](https://github.com/huff-language). I hope to provide something different,
of value, and to inspire them too.
4 changes: 2 additions & 2 deletions compile.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package specialops
package specops

import (
"bytes"
"fmt"

"github.com/ethereum/go-ethereum/core/vm"

"github.com/solidifylabs/specialops/types"
"github.com/solidifylabs/specops/types"
)

// A splice is a (possibly empty) buffer of bytecode, followed by either a
Expand Down
4 changes: 2 additions & 2 deletions examples_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package specialops
package specops

import (
"fmt"
Expand Down Expand Up @@ -33,7 +33,7 @@ func Example_helloWorld() {

func ExampleCode_wellKnown() {
// This example demonstrates some well-known bytecode examples implemented
// with `specialops`:
// with `specops`:
//
// - EIP-1167 Minimal Proxy Contract
// - 0age/metamorphic Metamorphic contract constructor https://github.com/0age/metamorphic/blob/55adac1d2487046002fc33a5dff7d669b5419a3a/contracts/MetamorphicContractFactory.sol#L55
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/solidifylabs/specialops
module github.com/solidifylabs/specops

go 1.20

Expand Down
4 changes: 2 additions & 2 deletions internal/opcopy/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// The opcopy binary generates a Go file for use in the `specialops` package.
// The opcopy binary generates a Go file for use in the `specops` package.
// It mirrors all EVM opcodes that don't have special representations, and
// provides a mapping from all opcodes to the number of values they pop/push
// from the stack.
Expand Down Expand Up @@ -63,7 +63,7 @@ func run() error {
}
}

tmpl := template.Must(template.New("go").Parse(`package specialops
tmpl := template.Must(template.New("go").Parse(`package specops

//
// GENERATED CODE - DO NOT EDIT
Expand Down
2 changes: 1 addition & 1 deletion opcodes.gen.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package specialops
package specops

//
// GENERATED CODE - DO NOT EDIT
Expand Down
4 changes: 2 additions & 2 deletions run.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package specialops
package specops

import (
"fmt"
Expand All @@ -7,7 +7,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/params"
"github.com/solidifylabs/specialops/runopts"
"github.com/solidifylabs/specops/runopts"
)

// Run calls c.Compile() and runs the compiled bytecode on a freshly
Expand Down
2 changes: 1 addition & 1 deletion runopts/debugger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"testing"

"github.com/ethereum/go-ethereum/core/vm"
. "github.com/solidifylabs/specialops"
. "github.com/solidifylabs/specops"
)

func TestDebugger(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions runopts/runopts.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Package runopts provides configuration options for specialops.Code.Run().
// Package runopts provides configuration options for specops.Code.Run().
package runopts

import (
Expand All @@ -7,7 +7,7 @@ import (
)

// A Configuration carries all values that can be modified to configure a call
// to specialops.Code.Run(). It is intially set by Run() and then passed to all
// to specops.Code.Run(). It is intially set by Run() and then passed to all
// Options to be modified.
type Configuration struct {
// vm.NewEVM()
Expand Down
6 changes: 3 additions & 3 deletions specialops.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Package specialops implements a DSL for crafting raw EVM bytecode. It
// Package specops implements a DSL for crafting raw EVM bytecode. It
// provides "special" opcodes as drop-in replacements for regular ones, e.g.
// JUMPDEST labels, PUSH<N> aliases, and DUP/SWAP from the bottom of the stack.
// It also provides pseudo opcodes that act as compiler hints.
Expand All @@ -7,7 +7,7 @@
// available in the importing package, allowing a mnemonic-style programming
// environment akin to writing assembly. As a result, there are few top-level
// identifiers.
package specialops
package specops

import (
"encoding/binary"
Expand All @@ -19,7 +19,7 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/holiman/uint256"

"github.com/solidifylabs/specialops/types"
"github.com/solidifylabs/specops/types"
)

// Code is a slice of Bytecoders; it is itself a Bytecoder, allowing for
Expand Down
4 changes: 2 additions & 2 deletions specialops_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package specialops
package specops

import (
"bytes"
Expand All @@ -11,7 +11,7 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/google/go-cmp/cmp"
"github.com/holiman/uint256"
"github.com/solidifylabs/specialops/types"
"github.com/solidifylabs/specops/types"
)

// mustRunByteCode propagates arguments to runBytecode, calling log.Fatal() on
Expand Down
2 changes: 1 addition & 1 deletion stack.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package specialops
package specops

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion types/types.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Package types defines types used by the specialops package, which is intended
// Package types defines types used by the specops package, which is intended
// to be dot-imported so requires a minimal footprint of exported symbols.
package types

Expand Down
Loading