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

Add Godocs for All Packages #386

Merged
merged 1 commit into from
Jul 28, 2023
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
1 change: 1 addition & 0 deletions api/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ go_test(
deps = [
"//chain-abstraction:protocol",
"//challenge-manager/challenge-tree/mock",
"@com_github_ethereum_go_ethereum//common",
"@com_github_gorilla_mux//:mux",
"@in_gopkg_d4l3k_messagediff_v1//:messagediff_v1",
],
Expand Down
3 changes: 3 additions & 0 deletions api/server.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Package api defines an API server for BOLD, allowig retrieval of information
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo, allowing

// from both the assertion chain and the challenge manager contracts in order to
// understand ongoing challenges.
package api

import (
Expand Down
4 changes: 2 additions & 2 deletions chain-abstraction/execution_state.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Package protocol
// From: Nitro validator/execution_state.go
// Package protocol a series of interfaces for interacting with Arbitrum chains' rollup
// and challenge contracts via a developer-friendly, high-level API.
package protocol

import (
Expand Down
1 change: 1 addition & 0 deletions chain-abstraction/sol-implementation/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ go_test(
deps = [
"//chain-abstraction:protocol",
"//layer2-state-provider",
"//solgen/go/rollupgen",
"//state-commitments/history",
"//testing",
"//testing/setup:setup_lib",
Expand Down
1 change: 1 addition & 0 deletions challenge-manager/challenge-tree/mock/edge.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package mock includes specific mock setups for edge types used in internal tests.
package mock

import (
Expand Down
5 changes: 4 additions & 1 deletion challenge-manager/challenge-tree/tree.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Package challengetree includes logic for keeping track of honest edges within a challenge
// with utilities for computing cumulative path timers for said edges. This is helpful during
// the confirmation process needed by edge trackers.
//
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE

package challengetree

import (
Expand Down
2 changes: 1 addition & 1 deletion challenge-manager/edge-tracker/tracker.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE

// package edgetracker contains the logic for tracking an edge in the challenge manager. It keeps
// Package edgetracker contains the logic for tracking an edge in the challenge manager. It keeps
// track of edges created and their own state transitions until an eventual confirmation.
package edgetracker

Expand Down
4 changes: 3 additions & 1 deletion challenge-manager/manager.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Package challengemanager includes the main entrypoint for setting up a BOLD
// challenge manager instance and challenging assertions onchain.
//
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE

package challengemanager

import (
Expand Down
1 change: 1 addition & 0 deletions challenge-manager/types/interfaces.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package types includes types and interfaces specific to the challenge manager instance.
package types

import (
Expand Down
5 changes: 4 additions & 1 deletion containers/fsm/fsm.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Package fsm defines a generic, finite state machine in Go that is extremely simple
// and type-safe. It is used by edge tracker goroutines to keep track of the edge states
// and transition to confirmation.
//
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE

package fsm

import (
Expand Down
5 changes: 4 additions & 1 deletion containers/option/option_type.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Package option defines a generic option type as a way of representing "nothingness"
// or "something" in a type-safe way. This is useful for representing optional values
// without the need for nil checks or pointers.
//
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE

package option

type Option[T any] struct {
Expand Down
3 changes: 2 additions & 1 deletion containers/slice.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Package containers defines generic data structures to be used in the BOLD repository.
//
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE

package containers

import "fmt"
Expand Down
4 changes: 3 additions & 1 deletion containers/threadsafe/slice.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Package threadsafe defines generic, threadsafe analogues of common data structures
// in Go such as maps, slices, and sets for use in BOLD with an intuitive API.
//
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE

package threadsafe

import "sync"
Expand Down
5 changes: 4 additions & 1 deletion layer2-state-provider/provider.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Package l2stateprovider defines a dependency which provides L2 states and proofs
// needed for the challenge manager to interact with Arbitrum chains' rollup and challenge
// contracts.
//
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE

package l2stateprovider

import (
Expand Down
4 changes: 3 additions & 1 deletion math/math.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Package math defines utilities for performing operations critical to the
// computations performed during a challenge in BOLD.
//
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE

package math

import (
Expand Down
5 changes: 4 additions & 1 deletion runtime/retry.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Package runtime defines utilities that deal with managing lifecycles of functions
// and important behaviors at the application runtime, such as retrying failed
// functions until they succeed.
//
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE

package retry

import (
Expand Down
6 changes: 4 additions & 2 deletions state-commitments/history/commitments.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Package history defines the primitive HistoryCommitment type in the BOLD
// protocol.
//
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE

package commitments
package history

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion state-commitments/history/commitments_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE

package commitments
package history

import (
"fmt"
Expand Down
4 changes: 3 additions & 1 deletion state-commitments/inclusion-proofs/inclusion_proofs.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Package inclusionproofs defines a series of utilities for generating and verifying
// traditional Merkle proofs of data.
//
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE

package inclusionproofs

import (
Expand Down
2 changes: 1 addition & 1 deletion state-commitments/prefix-proofs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ go_test(
embed = [":prefix-proofs"],
deps = [
"//solgen/go/mocksgen",
"//testing/toys/state-provider",
"//testing/mocks/state-provider",
"@com_github_ethereum_go_ethereum//accounts/abi/bind",
"@com_github_ethereum_go_ethereum//accounts/abi/bind/backends",
"@com_github_ethereum_go_ethereum//common",
Expand Down
2 changes: 1 addition & 1 deletion state-commitments/prefix-proofs/prefix_proofs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"github.com/OffchainLabs/bold/solgen/go/mocksgen"
prefixproofs "github.com/OffchainLabs/bold/state-commitments/prefix-proofs"
statemanager "github.com/OffchainLabs/bold/testing/toys/state-provider"
statemanager "github.com/OffchainLabs/bold/testing/mocks/state-provider"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/ethereum/go-ethereum/common"
Expand Down
2 changes: 1 addition & 1 deletion testing/endtoend/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ go_test(
"//layer2-state-provider",
"//testing",
"//testing/endtoend/internal/backend",
"//testing/toys/state-provider",
"//testing/mocks/state-provider",
"@com_github_ethereum_go_ethereum//accounts/abi/bind",
"@com_github_ethereum_go_ethereum//common",
"@com_github_stretchr_testify//require",
Expand Down
2 changes: 1 addition & 1 deletion testing/endtoend/basic_local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
l2stateprovider "github.com/OffchainLabs/bold/layer2-state-provider"
challenge_testing "github.com/OffchainLabs/bold/testing"
"github.com/OffchainLabs/bold/testing/endtoend/internal/backend"
statemanager "github.com/OffchainLabs/bold/testing/toys/state-provider"
statemanager "github.com/OffchainLabs/bold/testing/mocks/state-provider"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/require"
Expand Down
3 changes: 2 additions & 1 deletion testing/endtoend/helpers.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Package endtoend includes e2e tests for BOLD challenges and assertion posting.
//
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE

package endtoend

import (
Expand Down
3 changes: 2 additions & 1 deletion testing/mocks/mocks.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Package mocks includes simple mocks for unit testing BOLD.
//
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE

package mocks

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ go_library(
"execution_engine.go",
"layer2_state_provider.go",
],
importpath = "github.com/OffchainLabs/bold/testing/toys/state-provider",
importpath = "github.com/OffchainLabs/bold/testing/mocks/state-provider",
visibility = ["//visibility:public"],
deps = [
"//chain-abstraction:protocol",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE
package toys
package stateprovider

import (
"encoding/binary"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE
package toys
package stateprovider

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Package stateprovider defines smarter mocks for testing purposes that can simulate a layer 2
// state provider and and layer 2 state execution.
//
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE
package toys
package stateprovider

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE
package toys
package stateprovider

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion testing/setup/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ go_library(
"//solgen/go/mocksgen",
"//solgen/go/rollupgen",
"//testing",
"//testing/toys/state-provider",
"//testing/mocks/state-provider",
"@com_github_ethereum_go_ethereum//accounts/abi/bind",
"@com_github_ethereum_go_ethereum//accounts/abi/bind/backends",
"@com_github_ethereum_go_ethereum//common",
Expand Down
5 changes: 3 additions & 2 deletions testing/setup/rollup_stack.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Package setup prepares a simulated backend for testing.
//
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE

package setup

import (
Expand All @@ -16,7 +17,7 @@ import (
"github.com/OffchainLabs/bold/solgen/go/mocksgen"
"github.com/OffchainLabs/bold/solgen/go/rollupgen"
challenge_testing "github.com/OffchainLabs/bold/testing"
statemanager "github.com/OffchainLabs/bold/testing/toys/state-provider"
statemanager "github.com/OffchainLabs/bold/testing/mocks/state-provider"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/ethereum/go-ethereum/common"
Expand Down
2 changes: 2 additions & 0 deletions testing/setup/simulated-backend/simulated_backend_wrapper.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Package simulated_backend prepares a wrapper for transaction testing.
//
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE
package simulated_backend
Expand Down
3 changes: 2 additions & 1 deletion testing/tx.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Package challenge_testing includes all non-production code used in BOLD.
//
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE

package challenge_testing

import (
Expand Down
2 changes: 2 additions & 0 deletions time/time_reference.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Package time defines abstractions for time-related operations in BOLD.
//
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE
package time
Expand Down