Skip to content

Commit

Permalink
README, docs: start writing up a design section
Browse files Browse the repository at this point in the history
  • Loading branch information
karalabe committed Jul 9, 2024
1 parent 20635fa commit 50bbc70
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,20 @@ There are several possible outcomes from this experiment:
- The package turns out simple enough, performant enough and popular enough to be accepted into `go-ethereum` beyond a test.
- Some other unforeseen outcome of the infinite possibilities.

## Development
## Design

This module is primarily developed by @karalabe (and possibly @fjl and @rjl493456442). For discussions, please reach out on the Ethereum Research Discord server.
The `ssz` package splits the responsibility between user code and library code in the way charted below:

![Scope](./docs/scope.svg)

- Users are responsible for creating Go structs they'd like to serialize, which are mapped one-to-one to the *SSZ Container* type. The library does not support runtime defining SSZ containers.
- The *SSZ Vector* and *SSZ List* types are constructed inside the library from user supplied Go arrays and Go slices respectively. The caller is not able to create their own Go types that serialize into a standalone *SSZ Vector* or *SSZ List*.
- Similarly to the *SSZ Vector* and *SSZ List* types, the *SSZ Basic Types* are constructed inside the library from user supplied Go primitive types, or within Go arrays and slices. The caller is not able to create their own Go types that serialize into a standalone *SSZ Basic Type*.
- *SSZ Union* is not implemented as it is an unused (and disliked) feature in Ethereum.

## How to use

First up, you need to add the packag eto your ptoject:
First up, you need to add the package to your project:

```go
go get github.com/karalabe/ssz
Expand Down
7 changes: 0 additions & 7 deletions cmd/sszgen/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ func newGenContext(pkg *types.Package) *genContext {
}
}

func (ctx *genContext) qualifier(path string, obj string) string {
if path == ctx.pkg.Path() {
return obj
}
return fmt.Sprintf("%s.%s", pkgName(path), obj)
}

func (ctx *genContext) addImport(path string, alias string) error {
if path == ctx.pkg.Path() {
return nil
Expand Down
Loading

0 comments on commit 50bbc70

Please sign in to comment.