Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
7c0e6e4
feat: `worstcase` package for validity checking
ARR4N Jun 8, 2025
2d2b12e
wip
StephenButtolph Jun 9, 2025
068d02a
Make things work
StephenButtolph Jun 9, 2025
c531b1f
more fixes
StephenButtolph Jun 9, 2025
3323052
nit
StephenButtolph Jun 9, 2025
1bbbf5d
merged
StephenButtolph Jun 9, 2025
8c13c27
fix FATAL in bootstrapping
StephenButtolph Jun 9, 2025
0e779a6
Merge branch 'arr4n/strevm-poc' into StephenButtolph/strevm-poc
ARR4N Jun 10, 2025
9ba54f1
Merge branch 'arr4n/strevm-poc' into StephenButtolph/strevm-poc
ARR4N Jun 10, 2025
c3e160e
Merge branch 'arr4n/strevm-poc' into StephenButtolph/strevm-poc
ARR4N Jun 11, 2025
9c068d5
Do not expose unexecuted txs over the RPC
StephenButtolph Jun 11, 2025
1b37a75
Merge branch 'StephenButtolph/strevm-poc' of github.com:ava-labs/stre…
StephenButtolph Jun 11, 2025
b50028a
Merge branch 'arr4n/strevm-poc' into StephenButtolph/strevm-poc
ARR4N Jun 12, 2025
203fa4d
Remove unused block deletion
StephenButtolph Jun 12, 2025
136522d
Merge branch 'arr4n/strevm-poc' into StephenButtolph/strevm-poc
ARR4N Jun 14, 2025
50cda47
Merge branch 'arr4n/strevm-poc' into StephenButtolph/strevm-poc
ARR4N Jun 16, 2025
4b67ed4
Merge branch 'arr4n/strevm-poc' into StephenButtolph/strevm-poc
ARR4N Jun 16, 2025
f34d354
Add block context verification
StephenButtolph Jun 17, 2025
3bc28f3
Add block building stub
StephenButtolph Jun 17, 2025
64741e2
Add VerifyBlockAncestors hook
StephenButtolph Jun 17, 2025
25242cc
Cleanup the blocks map on reject
StephenButtolph Jun 17, 2025
ecff938
Fix multiple iterations
StephenButtolph Jun 17, 2025
d5397bc
Use stdlib rather than custom type
StephenButtolph Jun 17, 2025
cb515d8
Merge branch 'arr4n/strevm-poc' into StephenButtolph/strevm-poc
StephenButtolph Jun 18, 2025
4a82f04
wip
StephenButtolph Jun 24, 2025
9c48d50
wip
StephenButtolph Jun 24, 2025
797da31
comments
StephenButtolph Jun 24, 2025
b104885
more hooks
StephenButtolph Jun 24, 2025
06ce124
Include receipts
StephenButtolph Jun 24, 2025
4aa88ff
merged
StephenButtolph Jun 24, 2025
b6e1701
wip
StephenButtolph Jun 24, 2025
3ce2e9c
fix
StephenButtolph Jun 24, 2025
d9b9474
nits
StephenButtolph Jun 24, 2025
5ae6bb3
chore: repo setup incl. CI, license, etc. (#3)
ARR4N Jun 25, 2025
03d6c0a
fix: remove `golangci-lint` config only needed by `libevm` (#4)
ARR4N Jun 25, 2025
b586245
fix: `golangci-lint` enforces comments on exported identifiers (#6)
ARR4N Jun 25, 2025
07807e2
wip
StephenButtolph Jun 25, 2025
74ccf47
feat: `intmath` package (#5)
ARR4N Jun 27, 2025
04d5104
feat: `adaptor` package (#7)
ARR4N Jun 27, 2025
540e3ad
merged
StephenButtolph Jul 7, 2025
bfe8d91
Remove ToEngine channel
StephenButtolph Jul 8, 2025
db02f10
wip
StephenButtolph Jul 11, 2025
bbd4462
update avalanchego dep
StephenButtolph Jul 17, 2025
3b70781
feat: `proxytime` package (#8)
ARR4N Jul 23, 2025
c07db95
feat: `gastime` package
ARR4N Jul 23, 2025
4f6ed22
update dependencies
StephenButtolph Aug 13, 2025
01d692c
merged
StephenButtolph Aug 13, 2025
29dacde
merged
StephenButtolph Aug 13, 2025
74a0891
wip add p2p networking support
StephenButtolph Aug 26, 2025
d9448d9
update avalanchego
StephenButtolph Aug 26, 2025
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
59 changes: 59 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Go

on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
# If adding a new job, add it to the `needs` list of the `go` job as this is
# what gates PRs.
go:
runs-on: ubuntu-latest
needs: [go_test, go_generate, go_tidy]
steps:
- run: echo "Dependencies successful"

go_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- run: go test ./...

go_generate:
env:
EXCLUDE_REGEX: "ava-labs/libevm/(accounts/usbwallet/trezor)$"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"

- name: Run `go generate`
run: go list ./... | grep -Pv "${EXCLUDE_REGEX}" | xargs go generate;

- name: git diff
run: git diff --exit-code

go_tidy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- run: go mod tidy
- run: git diff --exit-code
52 changes: 52 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: lint

on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

permissions:
# Required: allow read access to the content for analysis.
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
pull-requests: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
# If adding a new linter: (a) create a new job; and (b) add it to the `needs`
# list of the `lint` job as this is what gates PRs.
lint:
runs-on: ubuntu-latest
needs: [golangci-lint, yamllint, shellcheck]
steps:
- run: echo "Dependencies successful"

golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.63.3

yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: yamllint -c .yamllint.yml .

shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run ShellCheck
uses: ludeeus/[email protected]
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode
101 changes: 101 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# This file configures github.com/golangci/golangci-lint.

run:
timeout: 20m
tests: true

linters:
enable:
# Every available linter at the time of writing was considered (quickly) and
# inclusion was liberal. Linters are good at detecting code smells, but if
# we find that a particular one causes too many false positives then we can
# configure it better or, as a last resort, remove it.
- containedctx
- errcheck
- forcetypeassert
- gci
- gocheckcompilerdirectives
- gofmt
- goheader
- goimports
- gomodguard
- gosec
- govet
- ineffassign
# TODO(arr4n): investigate ireturn
- misspell
- nakedret
- nestif
- nilerr
- nolintlint
- reassign
- revive
- sloglint
- staticcheck
- tagliatelle
- testableexamples
- testifylint
- thelper
- tparallel
- unconvert
- usestdlibvars
- unused
- whitespace

linters-settings:
gci:
custom-order: true
sections:
- standard
- default
- localmodule
# The rest of these break developer expections, in increasing order of
# divergence, so are at the end to increase the chance of being seen.
- alias
- dot
- blank
goheader:
template-path: .license-header

gomodguard:
blocked:
modules:
- github.com/ethereum/go-ethereum:
reason: "Use ava-labs/libevm instead"
- github.com/ava-labs/coreth:
reason: "Avoid dependency loop"
- github.com/ava-labs/subnet-evm:
reason: "Avoid dependency loop"
revive:
rules:
- name: unused-parameter
# Method parameters may be required by interfaces and forcing them to be
# named _ is of questionable benefit.
disabled: true
- name: exported
severity: error
disabled: false
exclude: [""]
arguments:
- "sayRepetitiveInsteadOfStutters"
- name: package-comments
severity: warning
disabled: false

issues:
include:
# Many of the default exclusions are because, verbatim "Annoying issue",
# which defeats the point of a linter.
- EXC0002
- EXC0004
- EXC0005
- EXC0006
- EXC0007
- EXC0008
- EXC0009
- EXC0010
- EXC0011
- EXC0012
- EXC0013
- EXC0014
- EXC0015
2 changes: 2 additions & 0 deletions .license-header
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Copyright (C) {{ MOD-YEAR-RANGE }}, Ava Labs, Inc. All rights reserved.
See the file LICENSE for licensing terms.
9 changes: 9 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
extends: default

rules:
document-start: disable
line-length: disable
comments:
min-spaces-from-content: 1
truthy:
check-keys: false
66 changes: 66 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
Copyright (C) 2025, Ava Labs, Inc. All rights reserved.

Ecosystem License
Version: 1.1

Subject to the terms herein, Ava Labs, Inc. (**"Ava Labs"**) hereby grants you
a limited, royalty-free, worldwide, non-sublicensable, non-transferable,
non-exclusive license to use, copy, modify, create derivative works based on,
and redistribute the Software, in source code, binary, or any other form,
including any modifications or derivative works of the Software (collectively,
**"Licensed Software"**), in each case subject to this Ecosystem License
(**"License"**).

This License applies to all copies, modifications, derivative works, and any
other form or usage of the Licensed Software. You will include and display
this License, without modification, with all uses of the Licensed Software,
regardless of form.

You will use the Licensed Software solely (i) in connection with the Avalanche
Public Blockchain platform, having a NetworkID of 1 (Mainnet) or 5 (Fuji), and
associated blockchains, comprised exclusively of the Avalanche X-Chain,
C-Chain, P-Chain and any subnets linked to the P-Chain ("Avalanche Authorized
Platform") or (ii) for non-production, testing or research purposes within the
Avalanche ecosystem, in each case, without any commercial application
("Non-Commercial Use"); provided that this License does not permit use of the
Licensed Software in connection with (a) any forks of the Avalanche Authorized
Platform or (b) in any manner not operationally connected to the Avalanche
Authorized Platform other than, for the avoidance of doubt, the limited
exception for Non-Commercial Use. Ava Labs may publicly announce changes or
additions to the Avalanche Authorized Platform, which may expand or modify
usage of the Licensed Software. Upon such announcement, the Avalanche
Authorized Platform will be deemed to be the then-current iteration of such
platform.

You hereby acknowledge and agree to the terms set forth at
www.avalabs.org/important-notice.

If you use the Licensed Software in violation of this License, this License
will automatically terminate and Ava Labs reserves all rights to seek any
remedy for such violation.

Except for uses explicitly permitted in this License, Ava Labs retains all
rights in the Licensed Software, including without limitation the ability to
modify it.

Except as required or explicitly permitted by this License, you will not use
any Ava Labs names, logos, or trademarks without Ava Labs’ prior written
consent.

You may use this License for software other than the "Licensed Software"
specified above, as long as the only change to this License is the definition
of the term "Licensed Software."

The Licensed Software may reference third party components. You acknowledge
and agree that these third party components may be governed by a separate
license or terms and that you will comply with them.

**TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE LICENSED SOFTWARE IS PROVIDED
ON AN "AS IS" BASIS, AND AVA LABS EXPRESSLY DISCLAIMS AND EXCLUDES ALL
REPRESENTATIONS, WARRANTIES AND OTHER TERMS AND CONDITIONS, WHETHER EXPRESS OR
IMPLIED, INCLUDING WITHOUT LIMITATION BY OPERATION OF LAW OR BY CUSTOM,
STATUTE OR OTHERWISE, AND INCLUDING, BUT NOT LIMITED TO, ANY IMPLIED WARRANTY,
TERM, OR CONDITION OF NON-INFRINGEMENT, MERCHANTABILITY, TITLE, OR FITNESS FOR
PARTICULAR PURPOSE. YOU USE THE LICENSED SOFTWARE AT YOUR OWN RISK. AVA LABS
EXPRESSLY DISCLAIMS ALL LIABILITY (INCLUDING FOR ALL DIRECT, CONSEQUENTIAL OR
OTHER DAMAGES OR LOSSES) RELATED TO ANY USE OF THE LICENSED SOFTWARE.**
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# strevm

`strevm` is the reference implementation of Streaming Asynchronous Execution (SAE) of EVM blocks, as described in [ACP](https://github.com/avalanche-foundation/ACPs) 194.
`strevm` is the reference implementation of Streaming Asynchronous Execution (SAE) of EVM blocks, as described in [ACP-194](https://github.com/avalanche-foundation/ACPs/tree/main/ACPs/194-streaming-asynchronous-execution).
It is under active development and there are currently no guarantees about the stability of its Go APIs.
26 changes: 24 additions & 2 deletions adaptor/adaptor.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (C) 2025, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

// Package adaptor provides a generic alternative to the Snowman [block.ChainVM]
// interface, which doesn't require the block to be aware of the VM
// implementation.
Expand All @@ -13,6 +16,12 @@ import (
"github.com/ava-labs/avalanchego/snow/engine/snowman/block"
)

// Enforce optional interfaces
var (
_ block.BuildBlockWithContextChainVM = adaptor[BlockProperties]{}
_ block.WithVerifyContext = Block[BlockProperties]{}
)

// ChainVM defines the functionality required in order to be converted into a
// Snowman VM. See the respective methods on [block.ChainVM] and [snowman.Block]
// for detailed documentation.
Expand All @@ -21,9 +30,12 @@ type ChainVM[BP BlockProperties] interface {

GetBlock(context.Context, ids.ID) (BP, error)
ParseBlock(context.Context, []byte) (BP, error)
BuildBlockWithContext(context.Context, *block.Context) (BP, error)
BuildBlock(context.Context) (BP, error)

// Transferred from [snowman.Block].
// Transferred from [snowman.Block] and [block.WithVerifyContext].
ShouldVerifyBlockWithContext(context.Context, BP) (bool, error)
VerifyBlockWithContext(context.Context, *block.Context, BP) error
VerifyBlock(context.Context, BP) error
AcceptBlock(context.Context, BP) error
RejectBlock(context.Context, BP) error
Expand All @@ -46,7 +58,7 @@ type BlockProperties interface {
// Convert transforms a generic [ChainVM] into a standard [block.ChainVM]. All
// [snowman.Block] values returned by methods of the returned chain will be of
// the concrete type [Block] with type parameter `BP`.
func Convert[BP BlockProperties](vm ChainVM[BP]) block.ChainVM {
func Convert[BP BlockProperties](vm ChainVM[BP]) *adaptor[BP] {
return &adaptor[BP]{vm}
}

Expand Down Expand Up @@ -79,10 +91,20 @@ func (vm adaptor[BP]) ParseBlock(ctx context.Context, blockBytes []byte) (snowma
return vm.newBlock(vm.ChainVM.ParseBlock(ctx, blockBytes))
}

func (vm adaptor[BP]) BuildBlockWithContext(ctx context.Context, blockContext *block.Context) (snowman.Block, error) {
return vm.newBlock(vm.ChainVM.BuildBlockWithContext(ctx, blockContext))
}

func (vm adaptor[BP]) BuildBlock(ctx context.Context) (snowman.Block, error) {
return vm.newBlock(vm.ChainVM.BuildBlock(ctx))
}

func (b Block[BP]) ShouldVerifyWithContext(ctx context.Context) (bool, error) {
return b.vm.ShouldVerifyBlockWithContext(ctx, b.b)
}
func (b Block[BP]) VerifyWithContext(ctx context.Context, blockContext *block.Context) error {
return b.vm.VerifyBlockWithContext(ctx, blockContext, b.b)
}
func (b Block[BP]) Verify(ctx context.Context) error { return b.vm.VerifyBlock(ctx, b.b) }
func (b Block[BP]) Accept(ctx context.Context) error { return b.vm.AcceptBlock(ctx, b.b) }
func (b Block[BP]) Reject(ctx context.Context) error { return b.vm.RejectBlock(ctx, b.b) }
Expand Down
Loading