Showing preview only (1,420K chars total). Download the full file or copy to clipboard to get everything.
Repository: topos-protocol/topos
Branch: main
Commit: 3b5815932db0
Files: 355
Total size: 1.3 MB
Directory structure:
gitextract_hgeg_lhv/
├── .cargo/
│ ├── audit.toml
│ └── config.toml
├── .config/
│ └── nextest.toml
├── .dockerignore
├── .github/
│ ├── CODEOWNERS
│ ├── ISSUE_TEMPLATE/
│ │ └── bug_report.md
│ ├── actions/
│ │ └── install-rust/
│ │ └── action.yml
│ └── workflows/
│ ├── coverage.yml
│ ├── doc.yml
│ ├── docker_build_push.yml
│ ├── docker_utils.yml
│ ├── pr-checking.yml
│ ├── quality.yml
│ ├── release.yml
│ ├── sequencer_topos_core_contract_test.yml
│ └── test.yml
├── .gitignore
├── CHANGELOG.md
├── Cargo.toml
├── Cross.toml
├── Dockerfile
├── LICENSE
├── README.md
├── cliff.toml
├── crates/
│ ├── topos/
│ │ ├── Cargo.toml
│ │ ├── build.rs
│ │ ├── src/
│ │ │ ├── components/
│ │ │ │ ├── mod.rs
│ │ │ │ ├── node/
│ │ │ │ │ ├── commands/
│ │ │ │ │ │ ├── init.rs
│ │ │ │ │ │ ├── status.rs
│ │ │ │ │ │ └── up.rs
│ │ │ │ │ ├── commands.rs
│ │ │ │ │ ├── mod.rs
│ │ │ │ │ ├── services/
│ │ │ │ │ │ └── status.rs
│ │ │ │ │ └── services.rs
│ │ │ │ ├── regtest/
│ │ │ │ │ ├── commands/
│ │ │ │ │ │ └── spam.rs
│ │ │ │ │ ├── commands.rs
│ │ │ │ │ └── mod.rs
│ │ │ │ └── setup/
│ │ │ │ ├── commands/
│ │ │ │ │ └── subnet.rs
│ │ │ │ ├── commands.rs
│ │ │ │ └── mod.rs
│ │ │ ├── lib.rs
│ │ │ ├── main.rs
│ │ │ ├── options/
│ │ │ │ └── input_format.rs
│ │ │ └── options.rs
│ │ └── tests/
│ │ ├── cert_delivery.rs
│ │ ├── config.rs
│ │ ├── node.rs
│ │ ├── regtest.rs
│ │ ├── setup.rs
│ │ ├── snapshots/
│ │ │ ├── node__help_display.snap
│ │ │ ├── push_certificate__help_display.snap
│ │ │ └── regtest__regtest_spam_help_display.snap
│ │ └── utils.rs
│ ├── topos-certificate-spammer/
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── config/
│ │ │ └── target_nodes_example.json
│ │ └── src/
│ │ ├── config.rs
│ │ ├── error.rs
│ │ ├── lib.rs
│ │ └── utils.rs
│ ├── topos-clock/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ ├── lib.rs
│ │ └── time.rs
│ ├── topos-config/
│ │ ├── Cargo.toml
│ │ ├── assets/
│ │ │ └── genesis-example.json
│ │ └── src/
│ │ ├── base.rs
│ │ ├── edge/
│ │ │ └── command.rs
│ │ ├── edge.rs
│ │ ├── genesis/
│ │ │ ├── mod.rs
│ │ │ └── tests.rs
│ │ ├── lib.rs
│ │ ├── node.rs
│ │ ├── sequencer.rs
│ │ ├── tce/
│ │ │ ├── broadcast.rs
│ │ │ ├── p2p.rs
│ │ │ └── synchronization.rs
│ │ └── tce.rs
│ ├── topos-core/
│ │ ├── .rustfmt.toml
│ │ ├── Cargo.toml
│ │ ├── build.rs
│ │ ├── proto/
│ │ │ ├── buf.yaml
│ │ │ └── topos/
│ │ │ ├── p2p/
│ │ │ │ └── info.proto
│ │ │ ├── shared/
│ │ │ │ └── v1/
│ │ │ │ ├── certificate.proto
│ │ │ │ ├── checkpoints.proto
│ │ │ │ ├── frost.proto
│ │ │ │ ├── signature.proto
│ │ │ │ ├── stark_proof.proto
│ │ │ │ ├── subnet.proto
│ │ │ │ ├── uuid.proto
│ │ │ │ └── validator_id.proto
│ │ │ ├── tce/
│ │ │ │ └── v1/
│ │ │ │ ├── api.proto
│ │ │ │ ├── console.proto
│ │ │ │ ├── double_echo.proto
│ │ │ │ ├── gossipsub.proto
│ │ │ │ └── synchronization.proto
│ │ │ └── uci/
│ │ │ └── v1/
│ │ │ └── certification.proto
│ │ ├── src/
│ │ │ ├── api/
│ │ │ │ ├── graphql/
│ │ │ │ │ ├── certificate.rs
│ │ │ │ │ ├── checkpoint.rs
│ │ │ │ │ ├── errors.rs
│ │ │ │ │ ├── filter.rs
│ │ │ │ │ ├── mod.rs
│ │ │ │ │ ├── query.rs
│ │ │ │ │ └── subnet.rs
│ │ │ │ ├── grpc/
│ │ │ │ │ ├── checkpoints/
│ │ │ │ │ │ ├── errors.rs
│ │ │ │ │ │ ├── mod.rs
│ │ │ │ │ │ └── positions.rs
│ │ │ │ │ ├── conversions/
│ │ │ │ │ │ ├── shared/
│ │ │ │ │ │ │ └── v1/
│ │ │ │ │ │ │ ├── certificate.rs
│ │ │ │ │ │ │ ├── signature.rs
│ │ │ │ │ │ │ ├── subnet.rs
│ │ │ │ │ │ │ ├── uuid.rs
│ │ │ │ │ │ │ └── validator_id.rs
│ │ │ │ │ │ ├── tce/
│ │ │ │ │ │ │ └── v1/
│ │ │ │ │ │ │ ├── api.rs
│ │ │ │ │ │ │ ├── mod.rs
│ │ │ │ │ │ │ └── synchronization.rs
│ │ │ │ │ │ └── uci/
│ │ │ │ │ │ └── v1/
│ │ │ │ │ │ └── uci.rs
│ │ │ │ │ ├── generated/
│ │ │ │ │ │ ├── topos.p2p.rs
│ │ │ │ │ │ ├── topos.shared.v1.rs
│ │ │ │ │ │ ├── topos.tce.v1.rs
│ │ │ │ │ │ └── topos.uci.v1.rs
│ │ │ │ │ └── mod.rs
│ │ │ │ └── mod.rs
│ │ │ ├── errors.rs
│ │ │ ├── lib.rs
│ │ │ ├── test.rs
│ │ │ ├── types/
│ │ │ │ └── stream.rs
│ │ │ ├── types.rs
│ │ │ └── uci/
│ │ │ ├── certificate.rs
│ │ │ ├── certificate_id.rs
│ │ │ ├── mod.rs
│ │ │ └── subnet_id.rs
│ │ └── tests/
│ │ └── tce_layer.rs
│ ├── topos-crypto/
│ │ ├── Cargo.toml
│ │ ├── src/
│ │ │ ├── hash.rs
│ │ │ ├── keys.rs
│ │ │ ├── keystore.rs
│ │ │ ├── lib.rs
│ │ │ ├── messages.rs
│ │ │ ├── signatures.rs
│ │ │ └── validator_id.rs
│ │ └── tests/
│ │ └── messages.rs
│ ├── topos-metrics/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ ├── api.rs
│ │ ├── double_echo.rs
│ │ ├── lib.rs
│ │ ├── p2p.rs
│ │ ├── storage.rs
│ │ └── tests.rs
│ ├── topos-node/
│ │ ├── Cargo.toml
│ │ ├── build.rs
│ │ └── src/
│ │ ├── lib.rs
│ │ ├── main.rs
│ │ └── process.rs
│ ├── topos-p2p/
│ │ ├── Cargo.toml
│ │ ├── src/
│ │ │ ├── behaviour/
│ │ │ │ ├── discovery.rs
│ │ │ │ ├── gossip.rs
│ │ │ │ ├── grpc/
│ │ │ │ │ ├── connection.rs
│ │ │ │ │ ├── error.rs
│ │ │ │ │ ├── event.rs
│ │ │ │ │ ├── handler/
│ │ │ │ │ │ ├── event.rs
│ │ │ │ │ │ └── protocol.rs
│ │ │ │ │ ├── handler.rs
│ │ │ │ │ ├── proxy.rs
│ │ │ │ │ └── stream.rs
│ │ │ │ ├── grpc.rs
│ │ │ │ ├── peer_info.rs
│ │ │ │ └── topos.rs
│ │ │ ├── behaviour.rs
│ │ │ ├── client.rs
│ │ │ ├── command.rs
│ │ │ ├── config.rs
│ │ │ ├── constants.rs
│ │ │ ├── error.rs
│ │ │ ├── event.rs
│ │ │ ├── lib.rs
│ │ │ ├── network.rs
│ │ │ ├── runtime/
│ │ │ │ ├── handle_command.rs
│ │ │ │ ├── handle_event/
│ │ │ │ │ ├── discovery.rs
│ │ │ │ │ ├── gossipsub.rs
│ │ │ │ │ ├── grpc.rs
│ │ │ │ │ └── peer_info.rs
│ │ │ │ ├── handle_event.rs
│ │ │ │ └── mod.rs
│ │ │ └── tests/
│ │ │ ├── behaviour/
│ │ │ │ ├── grpc.rs
│ │ │ │ └── mod.rs
│ │ │ ├── bootstrap.rs
│ │ │ ├── command/
│ │ │ │ ├── mod.rs
│ │ │ │ └── random_peer.rs
│ │ │ ├── mod.rs
│ │ │ └── support/
│ │ │ ├── macros.rs
│ │ │ └── mod.rs
│ │ └── tests/
│ │ └── support/
│ │ └── network.rs
│ ├── topos-sequencer/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ ├── app_context.rs
│ │ └── lib.rs
│ ├── topos-sequencer-subnet-client/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ ├── lib.rs
│ │ └── subnet_contract.rs
│ ├── topos-sequencer-subnet-runtime/
│ │ ├── Cargo.toml
│ │ ├── src/
│ │ │ ├── certification.rs
│ │ │ ├── lib.rs
│ │ │ └── proxy.rs
│ │ └── tests/
│ │ ├── common/
│ │ │ ├── abi.rs
│ │ │ ├── mod.rs
│ │ │ └── subnet_test_data.rs
│ │ └── subnet_contract.rs
│ ├── topos-tce/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ ├── app_context/
│ │ │ ├── api.rs
│ │ │ ├── network.rs
│ │ │ └── protocol.rs
│ │ ├── app_context.rs
│ │ ├── events.rs
│ │ ├── lib.rs
│ │ └── tests/
│ │ ├── api.rs
│ │ ├── mod.rs
│ │ └── network.rs
│ ├── topos-tce-api/
│ │ ├── Cargo.toml
│ │ ├── src/
│ │ │ ├── graphql/
│ │ │ │ ├── builder.rs
│ │ │ │ ├── filter.rs
│ │ │ │ ├── mod.rs
│ │ │ │ ├── query.rs
│ │ │ │ ├── routes.rs
│ │ │ │ └── tests.rs
│ │ │ ├── grpc/
│ │ │ │ ├── builder.rs
│ │ │ │ ├── console.rs
│ │ │ │ ├── messaging.rs
│ │ │ │ ├── mod.rs
│ │ │ │ └── tests.rs
│ │ │ ├── lib.rs
│ │ │ ├── metrics/
│ │ │ │ ├── builder.rs
│ │ │ │ └── mod.rs
│ │ │ ├── runtime/
│ │ │ │ ├── builder.rs
│ │ │ │ ├── client.rs
│ │ │ │ ├── commands.rs
│ │ │ │ ├── error.rs
│ │ │ │ ├── events.rs
│ │ │ │ ├── mod.rs
│ │ │ │ ├── sync_task.rs
│ │ │ │ └── tests.rs
│ │ │ ├── stream/
│ │ │ │ ├── commands.rs
│ │ │ │ ├── errors.rs
│ │ │ │ ├── mod.rs
│ │ │ │ ├── tests/
│ │ │ │ │ └── utils.rs
│ │ │ │ └── tests.rs
│ │ │ └── tests.rs
│ │ └── tests/
│ │ ├── grpc/
│ │ │ ├── certificate_precedence.rs
│ │ │ └── mod.rs
│ │ └── runtime.rs
│ ├── topos-tce-broadcast/
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── benches/
│ │ │ ├── double_echo.rs
│ │ │ └── task_manager.rs
│ │ └── src/
│ │ ├── constant.rs
│ │ ├── double_echo/
│ │ │ ├── broadcast_state/
│ │ │ │ └── status.rs
│ │ │ ├── broadcast_state.rs
│ │ │ └── mod.rs
│ │ ├── event.rs
│ │ ├── lib.rs
│ │ ├── sampler/
│ │ │ └── mod.rs
│ │ ├── task_manager/
│ │ │ ├── mod.rs
│ │ │ └── task.rs
│ │ └── tests/
│ │ ├── mod.rs
│ │ ├── task.rs
│ │ └── task_manager.rs
│ ├── topos-tce-gatekeeper/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ ├── builder.rs
│ │ ├── client.rs
│ │ ├── lib.rs
│ │ └── tests.rs
│ ├── topos-tce-proxy/
│ │ ├── Cargo.toml
│ │ ├── src/
│ │ │ ├── client.rs
│ │ │ ├── lib.rs
│ │ │ └── worker.rs
│ │ └── tests/
│ │ └── tce_tests.rs
│ ├── topos-tce-storage/
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ └── src/
│ │ ├── client.rs
│ │ ├── constant.rs
│ │ ├── epoch/
│ │ │ ├── mod.rs
│ │ │ └── tables.rs
│ │ ├── errors.rs
│ │ ├── fullnode/
│ │ │ ├── locking.rs
│ │ │ └── mod.rs
│ │ ├── index/
│ │ │ └── mod.rs
│ │ ├── lib.rs
│ │ ├── rocks/
│ │ │ ├── constants.rs
│ │ │ ├── db.rs
│ │ │ ├── db_column.rs
│ │ │ ├── iterator.rs
│ │ │ ├── map.rs
│ │ │ └── types.rs
│ │ ├── rocks.rs
│ │ ├── store.rs
│ │ ├── tests/
│ │ │ ├── checkpoints.rs
│ │ │ ├── db_columns.rs
│ │ │ ├── mod.rs
│ │ │ ├── pending_certificates.rs
│ │ │ ├── position.rs
│ │ │ ├── rocks.rs
│ │ │ └── support/
│ │ │ ├── columns.rs
│ │ │ ├── folder.rs
│ │ │ └── mod.rs
│ │ ├── types.rs
│ │ └── validator/
│ │ ├── mod.rs
│ │ └── tables.rs
│ ├── topos-tce-synchronizer/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ ├── builder.rs
│ │ ├── checkpoints_collector/
│ │ │ ├── error.rs
│ │ │ ├── mod.rs
│ │ │ ├── tests/
│ │ │ │ └── integration.rs
│ │ │ └── tests.rs
│ │ └── lib.rs
│ ├── topos-telemetry/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ ├── lib.rs
│ │ └── tracing.rs
│ ├── topos-test-sdk/
│ │ ├── Cargo.toml
│ │ ├── build.rs
│ │ ├── proc_macro_sdk/
│ │ │ ├── Cargo.toml
│ │ │ └── src/
│ │ │ └── lib.rs
│ │ ├── proto/
│ │ │ └── behaviour/
│ │ │ ├── helloworld.proto
│ │ │ └── noop.proto
│ │ └── src/
│ │ ├── certificates/
│ │ │ └── mod.rs
│ │ ├── crypto.rs
│ │ ├── grpc/
│ │ │ ├── behaviour/
│ │ │ │ ├── helloworld.rs
│ │ │ │ └── noop.rs
│ │ │ └── mod.rs
│ │ ├── lib.rs
│ │ ├── networking/
│ │ │ └── mod.rs
│ │ ├── p2p/
│ │ │ └── mod.rs
│ │ ├── sequencer/
│ │ │ └── mod.rs
│ │ ├── storage/
│ │ │ └── mod.rs
│ │ └── tce/
│ │ ├── gatekeeper.rs
│ │ ├── mod.rs
│ │ ├── p2p.rs
│ │ ├── protocol.rs
│ │ ├── public_api.rs
│ │ └── synchronizer.rs
│ └── topos-wallet/
│ ├── Cargo.toml
│ └── src/
│ ├── error.rs
│ └── lib.rs
├── docs/
│ ├── .gitignore
│ ├── README.md
│ ├── architecture/
│ │ ├── certificates_collector.md
│ │ ├── checkpoints_collector.md
│ │ ├── gatekeeper.md
│ │ └── synchronizer.md
│ ├── book.toml
│ └── src/
│ ├── README.md
│ ├── SUMMARY.md
│ ├── glossary.md
│ ├── test.md
│ └── topos-node.md
├── grafana/
│ └── benchmarks-dashboard.json
├── rust-toolchain
├── rustfmt.toml
└── scripts/
└── check_readme.sh
================================================
FILE CONTENTS
================================================
================================================
FILE: .cargo/audit.toml
================================================
[advisories]
ignore = []
================================================
FILE: .cargo/config.toml
================================================
[alias]
xclippy = [
"clippy", "--workspace", "--tests", "--all-targets", "--all-features", "--",
"-Wclippy::all",
"-Wclippy::disallowed-methods",
]
================================================
FILE: .config/nextest.toml
================================================
[profile.default]
slow-timeout = { period = "60s", terminate-after = 1 }
leak-timeout = "10s"
[test-groups]
serial-integration = { max-threads = 1 }
[[profile.default.overrides]]
filter = 'test(serial_integration::)'
test-group = 'serial-integration'
================================================
FILE: .dockerignore
================================================
# Ignore everything
**
# Allow Rust source code
!src
!crates
!tests
!Cargo.*
!tools/init.sh
!tools/node_config
!tools/node_config/**/*
!tools/liveness.sh
!tools/config/nextest.toml
!.git
!LICENSE
================================================
FILE: .github/CODEOWNERS
================================================
* @topos-protocol/protocol
# Crypto Internals
/crates/topos-crypto/ @topos-protocol/protocol @topos-protocol/crypto @Nashtare
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug Report
about: Create a report to help us solve bugs!
labels: bug
---
<!--
✰ Thanks for opening an issue! ✰
Before submitting please review the template.
Please also ensure that this is not a duplicate issue :)
-->
## Summary
<!-- Concisely describe the issue -->
## Steps to Reproduce
<!-- What commands in order should someone run to reproduce your problem? -->
## Expected behavior
<!-- A clear and concise description of what you expected to happen -->
## Screenshots
<!-- If applicable, add screenshots to help explain your problem. -->
## Version
- OS Name: [e.g. Ubuntu]
- OS Version [e.g. 20.04]
- CLI Version (output of `topos --version`)
## Additional context
<!-- Add any other context about the problem here. -->
================================================
FILE: .github/actions/install-rust/action.yml
================================================
name: 'Install Rust toolchain'
description: 'Install a rust toolchain and cache the crates index'
inputs:
toolchain:
description: 'Default toolchain to install'
required: false
default: 'stable'
target:
description: 'Default target to add'
required: false
default: 'x86_64-unknown-linux-gnu'
msrv:
description: 'Enable rust-toolchain version for msrv'
required: false
type: boolean
default: false
lockfiles:
description: 'Path glob for Cargo.lock files to use as cache keys'
required: false
default: '**/Cargo.lock'
components:
description: 'Components to install'
required: false
tools:
description: 'Tools to install'
required: false
default: nextest,protoc
AWS_ACCESS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true
with_cache:
required: false
type: boolean
default: true
runs:
using: composite
steps:
- name: Environment
shell: bash
run: |
rustup target add ${{ inputs.target }}
if ${{ inputs.msrv }}; then
rustup override unset
rustup show
else
rustup set profile minimal
rustup update "${{ inputs.toolchain }}" --no-self-update
rustup override set "${{ inputs.toolchain }}"
fi
if [ ! -z "${{ inputs.components }}" ]; then
rustup component add $(echo ${{ inputs.components }}|sed 's/,/ /')
fi
echo CARGO_TERM_COLOR="always" >> "$GITHUB_ENV"
# Disable incremental compilation.
#
# Incremental compilation is useful as part of an edit-build-test-edit cycle,
# as it lets the compiler avoid recompiling code that hasn't changed. However,
# on CI, we're not making small edits; we're almost always building the entire
# project from scratch. Thus, incremental compilation on CI actually
# introduces *additional* overhead to support making future builds
# faster...but no future builds will ever occur in any given CI environment.
#
# See https://matklad.github.io/2021/09/04/fast-rust-builds.html#ci-workflow
# for details.
echo CARGO_INCREMENTAL=0 >> "$GITHUB_ENV"
# Allow more retries for network requests in cargo (downloading crates) and
# rustup (installing toolchains). This should help to reduce flaky CI failures
# from transient network timeouts or other issues.
cat >> "$GITHUB_ENV" <<EOF
CARGO_NET_RETRY=10
RUSTUP_MAX_RETRIES=10
EOF
# Don't emit giant backtraces in the CI logs.
echo RUST_BACKTRACE=short >> "$GITHUB_ENV"
echo RUSTFLAGS="-D warnings" >> "$GITHUB_ENV"
echo RUSTDOCFLAGS="-D warnings" >> "$GITHUB_ENV"
if ${{ inputs.with_cache }}; then
cat >> "$GITHUB_ENV" <<EOF
RUSTC_WRAPPER=sccache
EOF
fi
cat >> "$GITHUB_ENV" <<EOF
CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
EOF
cat >> "$GITHUB_ENV" <<EOF
AWS_SHARED_CREDENTIALS_FILE=${{ github.workspace }}/.aws/credentials
SCCACHE_S3_KEY_PREFIX=topos
SCCACHE_BUCKET=cicd-devnet-1-sccache
SCCACHE_REGION=us-east-1
EOF
- name: Run sccache-cache
if: ${{ inputs.with_cache == 'true' }}
uses: mozilla-actions/sccache-action@v0.0.3
- name: Configure AWS credentials for cicd-devnet-1 account
if: ${{ inputs.with_cache == 'true' }}
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ inputs.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ inputs.AWS_SECRET_ACCESS_KEY }}
role-to-assume: arn:aws:iam::367397670706:role/CacheBucketAccessRole
role-session-name: RobotToposware-session
aws-region: us-east-1
role-skip-session-tagging: true
role-duration-seconds: 3600
- name: Add profile credentials to .aws/credentials
if: ${{ inputs.with_cache == 'true' }}
shell: bash
run: |
aws configure set aws_access_key_id ${{ env.AWS_ACCESS_KEY_ID }} --profile default
aws configure set aws_secret_access_key ${{ env.AWS_SECRET_ACCESS_KEY }} --profile default
aws configure set aws_session_token ${{ env.AWS_SESSION_TOKEN }} --profile default
- uses: taiki-e/install-action@v2
with:
tool: ${{ inputs.tools }}
================================================
FILE: .github/workflows/coverage.yml
================================================
name: Coverage
on:
push:
branches:
- main
- "!release/**"
paths: crates/**
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths: crates/**
workflow_dispatch:
jobs:
codecov:
name: Code coverage
runs-on: ubuntu-latest-16-core
if: ${{ ! startsWith(github.head_ref, 'release') }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-rust
with:
components: llvm-tools-preview
tools: grcov,nextest,protoc
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY}}
- name: Build
env:
RUSTFLAGS: "-Cinstrument-coverage"
RUSTDOCFLAGS: "-Cinstrument-coverage"
run: cargo build --all
- name: Run tests
env:
RUST_LOG: info
RUSTFLAGS: "-Cinstrument-coverage"
RUSTDOCFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "codecov-instrumentation-%p-%m.profraw"
run: cargo nextest run --workspace --exclude topos-sequencer-subnet-runtime
- name: Run grcov
run: |
grcov . --binary-path target/debug/ -s . \
-t lcov \
--branch \
--ignore-not-existing \
--ignore 'crates/topos-test-sdk/src/grpc/behaviour/*' \
--ignore 'crates/topos-core/src/api/grpc/generated/*' \
--ignore '../**' \
--ignore '/*' \
-o coverage.lcov
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true
================================================
FILE: .github/workflows/doc.yml
================================================
name: Build and host documentation on GH pages
on:
push:
branches:
- main
jobs:
build:
name: Build documentation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: ./.github/actions/install-rust
with:
toolchain: nightly
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY}}
- name: Build Documentation
run: cargo +nightly doc --no-deps --all --all-features
- name: Add index file
run: |
mkdir host-docs
echo "<meta http-equiv=\"refresh\" content=\"0; url=topos\">" > target/doc/index.html
cp -r target/doc/* ./host-docs
- name: Upload documentation
uses: actions/upload-pages-artifact@v2.0.0
with:
path: "host-docs/"
deploy:
name: Deploy documentation
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
================================================
FILE: .github/workflows/docker_build_push.yml
================================================
name: Docker build and push
on:
push:
branches: [main, debug/**]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
release:
types: [created]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
docker:
uses: ./.github/workflows/docker_utils.yml
secrets: inherit
integration-erc20-e2e:
runs-on: ubuntu-latest
needs: docker
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Set environment
run: |
# It's fine to assume a single tag. Our tagging strategy follows a 1:1 mapping of image:tag
tags=${{ needs.docker.outputs.tags }}
echo "docker_tag=${tags#*:}" >> $GITHUB_ENV
shell: bash
- uses: convictional/trigger-workflow-and-wait@v1.6.1
with:
owner: topos-protocol
repo: e2e-tests
github_token: ${{ secrets.ROBOT_PAT_TRIGGER_E2E_WORKFLOWS }}
workflow_file_name: topos:integration-tests.yml
ref: main
wait_interval: 60
client_payload: '{ "topos-docker-tag": "${{ env.docker_tag }}" }'
frontend-erc20-e2e:
runs-on: ubuntu-latest
needs: docker
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Set environment
run: |
# It's fine to assume a single tag. Our tagging strategy follows a 1:1 mapping of image:tag
tags=${{ needs.docker.outputs.tags }}
echo "docker_tag=${tags#*:}" >> $GITHUB_ENV
shell: bash
- uses: convictional/trigger-workflow-and-wait@v1.6.1
with:
owner: topos-protocol
repo: e2e-tests
github_token: ${{ secrets.ROBOT_PAT_TRIGGER_E2E_WORKFLOWS }}
workflow_file_name: frontend:erc20-messaging.yml
ref: main
wait_interval: 60
client_payload: '{ "topos-docker-tag": "${{ env.docker_tag }}" }'
================================================
FILE: .github/workflows/docker_utils.yml
================================================
name: template - docker
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
AWS_SHARED_CREDENTIALS_FILE: "${{ github.workspace }}/.aws/credentials"
on:
workflow_call:
inputs:
# Docker target (test | fmt | lint | topos | etc)
target:
required: false
type: string
default: topos
# Rust toolchain version (stable | nightly)
toolchain_version:
required: false
type: string
default: stable
outputs:
tags:
description: "Docker tags"
value: ${{ jobs.docker.outputs.tags }}
jobs:
docker:
name: Build and push docker image to GitHub Container Registry
runs-on: ubuntu-latest-16-core
outputs:
tags: ${{ steps.meta.outputs.tags }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
with:
short-length: 7
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Configure AWS credentials for cicd-devnet-1 account
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
role-to-assume: arn:aws:iam::367397670706:role/CacheBucketAccessRole
role-session-name: RobotToposware-session
aws-region: us-east-1
role-skip-session-tagging: true
role-duration-seconds: 3600
- name: Add profile credentials to .aws/credentials
run: |
aws configure set aws_access_key_id ${{ env.AWS_ACCESS_KEY_ID }} --profile default
aws configure set aws_secret_access_key ${{ env.AWS_SECRET_ACCESS_KEY }} --profile default
aws configure set aws_session_token ${{ env.AWS_SESSION_TOKEN }} --profile default
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Push to GitHub Container Registry
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
# push only images targeting topos (e.g.: exclude test, lint, etc.)
push: ${{ inputs.target == 'topos' }}
target: ${{ inputs.target }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
secret-files: |
"aws=${{ github.workspace }}/.aws/credentials"
build-args: |
RUSTUP_TOOLCHAIN=${{ inputs.toolchain_version }}
SCCACHE_S3_KEY_PREFIX=${{ inputs.target }}
SCCACHE_BUCKET=cicd-devnet-1-sccache
SCCACHE_REGION=us-east-1
RUSTC_WRAPPER=/usr/local/cargo/bin/sccache
================================================
FILE: .github/workflows/pr-checking.yml
================================================
name: Checking PR semantic
on:
pull_request_target:
types:
- opened
- edited
- synchronize
jobs:
title:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
ignoreLabels: |
release
commits:
name: Validate PR commits
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v5
================================================
FILE: .github/workflows/quality.yml
================================================
name: Quality
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
jobs:
readme:
name: Readme - checking readme compatibility
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: ./.github/actions/install-rust
with:
with_cache: false
tools: cargo-readme
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY}}
- name: checking readme
run: ./scripts/check_readme.sh
audit:
name: Audit - crate security vulnerabilities
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: ./.github/actions/install-rust
with:
with_cache: false
tools: cargo-audit
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY}}
- name: Cargo audit
run: cargo audit
lint:
name: Lint - Clippy
runs-on: ubuntu-latest-16-core
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -Dwarnings
RUST_BACKTRACE: 1
steps:
- name: Checkout topos repo
uses: actions/checkout@v4
- name: Install Rust
uses: ./.github/actions/install-rust
with:
components: clippy
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY}}
- name: Install Protoc
uses: arduino/setup-protoc@v1
- name: Checkout topos-smart-contracts repo
uses: actions/checkout@v4
with:
repository: topos-protocol/topos-smart-contracts
ref: ${{ env.CONTRACTS_REF }}
path: contracts
- name: Set up NodeJS
uses: actions/setup-node@v3
with:
node-version: 16
cache: "npm"
cache-dependency-path: contracts/package-lock.json
- name: Install dependencies
working-directory: contracts
run: npm ci
- name: Build contracts
working-directory: contracts
run: npm run build
- name: Move contract artifacts
run: mv contracts/artifacts ./
- name: Cargo xclippy
run: cargo xclippy
fmt:
name: Check - Format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: ./.github/actions/install-rust
with:
with_cache: false
toolchain: nightly
components: rustfmt
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY}}
- name: Cargo fmt
run: cargo +nightly fmt --all -- --check
msrv:
name: Check - MSRV
runs-on: ubuntu-latest-16-core
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: ./.github/actions/install-rust
with:
msrv: true
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY}}
- name: Cargo check
run: cargo check --workspace --all-features --locked
================================================
FILE: .github/workflows/release.yml
================================================
name: Release
on:
release:
types: [published]
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
RUST_BACKTRACE: short
CARGO: cargo
CROSS_VERSION: v0.2.5
jobs:
release-build:
timeout-minutes: 30
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- build: stable-x86
rust: stable
os: ubuntu-latest-16-core
target: x86_64-unknown-linux-gnu
- build: linux
rust: stable
os: ubuntu-latest-16-core
target: x86_64-unknown-linux-musl
- build: stable-aarch64
rust: stable
os: ubuntu-latest-16-core
target: aarch64-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-rust
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
with_cache: false
- name: Use Cross
if: matrix.os == 'ubuntu-latest-16-core' && matrix.target != ''
shell: bash
run: |
dir="$RUNNER_TEMP/cross-download"
mkdir "$dir"
echo "$dir" >> $GITHUB_PATH
cd "$dir"
curl -LO "https://github.com/cross-rs/cross/releases/download/$CROSS_VERSION/cross-x86_64-unknown-linux-musl.tar.gz"
tar xf cross-x86_64-unknown-linux-musl.tar.gz
echo "CARGO=cross" >> $GITHUB_ENV
- name: Set target variables
shell: bash
run: |
echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV
echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV
- name: Show command used for Cargo
shell: bash
run: |
echo "cargo command is: ${{ env.CARGO }}"
echo "target flag is: ${{ env.TARGET_FLAGS }}"
echo "target dir is: ${{ env.TARGET_DIR }}"
- name: Build release binary
shell: bash
run: |
${{ env.CARGO }} build --release ${{ env.TARGET_FLAGS }}
bin="target/${{ matrix.target }}/release/topos"
echo "BIN=$bin" >> $GITHUB_ENV
- name: Rename binary
shell: bash
run: |
export arch=$(echo ${{ matrix.target }} | cut -d- -f1)
export version=${GITHUB_REF#refs/*/}
echo "arch=${arch}" >> $GITHUB_ENV
echo "version=${version}" >> $GITHUB_ENV
mv $BIN topos-${version}-${arch}
tar -czvf topos-${version}-${arch}.tgz topos-${version}-${arch}
- name: Upload release artifacts for ${{ matrix.target }} architecture
uses: actions/upload-artifact@v3
with:
name: topos-${{ matrix.target }}
if-no-files-found: error
path: |
topos-${{ env.version }}-${{ env.arch }}.tgz
- name: Publish binaries for ${{ matrix.target }} release
uses: softprops/action-gh-release@v1
with:
files: |
topos-${{ env.version }}-${{ env.arch }}.tgz
notify-release:
needs: release-build
runs-on: ubuntu-latest
if: ${{ github.event_name == 'release'}} && ${{ github.event.release.prerelease == 'false' }}
steps:
- name: Send Slack notification
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
"repository": "${{ github.repository }}",
"version": "${{ github.ref }}"
}
env:
SLACK_WEBHOOK_URL: ${{ vars.RELEASE_PIPELINE_SLACK_WEBHOOK_URL }}
================================================
FILE: .github/workflows/sequencer_topos_core_contract_test.yml
================================================
name: Sequencer Topos Core Contract interaction test
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
jobs:
sequencer-contracts-e2e:
runs-on: ubuntu-latest-16-core
steps:
- uses: convictional/trigger-workflow-and-wait@v1.6.1
with:
owner: topos-protocol
repo: e2e-tests
github_token: ${{ secrets.ROBOT_PAT_TRIGGER_E2E_WORKFLOWS }}
workflow_file_name: topos:sequencer-contracts.yml
ref: main
wait_interval: 60
client_payload: '{ "topos-ref": "${{ github.head_ref }}" }'
================================================
FILE: .github/workflows/test.yml
================================================
name: Test
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
test-doc:
name: Test documentation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: ./.github/actions/install-rust
with:
toolchain: nightly
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY}}
- name: Build Documentation
run: cargo +nightly doc --no-deps --all --all-features
test_stable:
runs-on: ubuntu-latest-16-core
strategy:
fail-fast: false
name: stable - Test
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-rust
with:
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY}}
- run: cargo nextest run --workspace --exclude topos-sequencer-subnet-runtime && cargo test --doc --workspace
env:
RUST_LOG: warn,topos=info
test_nightly:
runs-on: ubuntu-latest-16-core
strategy:
fail-fast: false
name: nightly - Test
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-rust
with:
toolchain: nightly
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY}}
- run: cargo nextest run --workspace --exclude topos-sequencer-subnet-runtime && cargo test --doc --workspace
env:
RUST_LOG: topos=warn
cert_delivery:
runs-on: ubuntu-latest-16-core
needs: [test_stable]
strategy:
fail-fast: true
matrix:
value: ["first", "second", "third"]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-rust
with:
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY}}
- run: cargo nextest run cert_delivery --locked --no-default-features
env:
RUST_LOG: topos=warn
================================================
FILE: .gitignore
================================================
# Generated by Cargo
# will have compiled files and executables
/target/
*~
# testing database
/default_db/
/db*/
# These are backup files generated by rustfmt
**/*.rs.bk
# IntelliJ files
.idea
**/*.iml
# VSCode
.vscode
**/tests/databases
# ~~~ START TERRAFORM
# Local .terraform directories
**/.terraform/*
# .tfstate files
*.tfstate
*.tfstate.*
# Crash log files
crash.log
crash.*.log
# Exclude all .tfvars files, which are likely to contain sensitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
*.tfvars
*.tfvars.json
# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json
# Include override files you do wish to add to version control using negated pattern
# !example_override.tf
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*
# Ignore CLI configuration files
.terraformrc
terraform.rc
#k8s
**/kubeconfig
# ~~~ END TERRAFORM
# Subnet integration tests
crates/topos-sequencer-subnet-runtime/tests/temp
# Node modules
**/node_modules
artifacts/
polygon-edge
# macOS directory attributes
**/.DS_Store
tools/node_config/node/test/libp2p/
tools/node_config/node/test/consensus/
================================================
FILE: CHANGELOG.md
================================================

## [0.1.0](https://github.com/topos-protocol/topos/compare/v0.0.11..0.1.0) - 2024-03-25
### ⛰️ Features
- Update smart-contracts to 3.4.0 stable - ([a714493](https://github.com/topos-protocol/topos/commit/a714493dd5aaf235d99f4b903f49a355e0c38d14))
- Add p2p layer health check ([#464](https://github.com/topos-protocol/topos/issues/464)) - ([d2ec941](https://github.com/topos-protocol/topos/commit/d2ec941ec24d3cbc27c11d4fcf6b0495911f85e2))
- Terminate stream if client is dropping the connection ([#463](https://github.com/topos-protocol/topos/issues/463)) - ([2c73f0b](https://github.com/topos-protocol/topos/commit/2c73f0bae1dc25aad504d45dcc789360cce7dbaa))
- Introduce topos-node crate ([#459](https://github.com/topos-protocol/topos/issues/459)) - ([d8db631](https://github.com/topos-protocol/topos/commit/d8db631d970d6b855e5a47f0c561abe8bab9832d))
- Add proper error handling to setup command ([#452](https://github.com/topos-protocol/topos/issues/452)) - ([3335846](https://github.com/topos-protocol/topos/commit/3335846327c9c0f32e85694861f30520a9f2a6c5))
- Remove dht publication ([#449](https://github.com/topos-protocol/topos/issues/449)) - ([7030341](https://github.com/topos-protocol/topos/commit/70303412f139c7fe5ca0d4775f367d27543ac791))
- Add benchmark dns option to spam subcommand ([#448](https://github.com/topos-protocol/topos/issues/448)) - ([90405f3](https://github.com/topos-protocol/topos/commit/90405f3f4bd468c33685158ddddb793b109e3f22))
- Move telemetry-otlp setup into telemetry crate ([#446](https://github.com/topos-protocol/topos/issues/446)) - ([8a15fc4](https://github.com/topos-protocol/topos/commit/8a15fc4c0aa07ba71ca8376f21056949d71e92c5))
### 🐛 Bug Fixes
- *(config)* Fix the parse of edge_path ENV var ([#482](https://github.com/topos-protocol/topos/issues/482)) - ([b2a1af0](https://github.com/topos-protocol/topos/commit/b2a1af06dfa6987261a08ccbc8f05ed1bdc0d0b8))
- *(p2p)* Accept listener connection during bootstrap ([#484](https://github.com/topos-protocol/topos/issues/484)) - ([b8cd730](https://github.com/topos-protocol/topos/commit/b8cd730c2e2a6d2799a5c741b026cf03d9eadd33))
- *(p2p)* Rework ticks of bootstrap query interval ([#483](https://github.com/topos-protocol/topos/issues/483)) - ([5b6ddb8](https://github.com/topos-protocol/topos/commit/5b6ddb80ded50525a27617ca5f7c911525752619))
- Bump smart contract version ([#478](https://github.com/topos-protocol/topos/issues/478)) - ([642203c](https://github.com/topos-protocol/topos/commit/642203c962ede91d821af2b54e5f7bc0d845d407))
- Concurrency insert between pending and delivered ([#467](https://github.com/topos-protocol/topos/issues/467)) - ([bd5e3f5](https://github.com/topos-protocol/topos/commit/bd5e3f52ba00bafa25e0f3ce8b42b326e4fb5ef0))
- Block handling during certificate generation ([#471](https://github.com/topos-protocol/topos/issues/471)) - ([a5299c8](https://github.com/topos-protocol/topos/commit/a5299c80068d6612d1aba162556f9ccd3dd3d0a8))
- Update mio ([#473](https://github.com/topos-protocol/topos/issues/473)) - ([8291740](https://github.com/topos-protocol/topos/commit/82917405e7bf102c06194caadc973f57ac735649))
- Revert update smart contract event ([#470](https://github.com/topos-protocol/topos/issues/470)) - ([c41a51a](https://github.com/topos-protocol/topos/commit/c41a51a2ff86198f44dd6b24ff534507a17cf519))
- Update smart contract event ([#462](https://github.com/topos-protocol/topos/issues/462)) - ([f995859](https://github.com/topos-protocol/topos/commit/f9958599a1da31d7c92a8e8a0e925e79ce6140cb))
- Remove duplicated certificate push on gossipsub ([#458](https://github.com/topos-protocol/topos/issues/458)) - ([b0e88dc](https://github.com/topos-protocol/topos/commit/b0e88dce2b7ea060ce34377b40a10e54edd16e02))
- Add next_pending_certificate on end task ([#455](https://github.com/topos-protocol/topos/issues/455)) - ([2aaa500](https://github.com/topos-protocol/topos/commit/2aaa50071ca14415bb0284930c404659b6c463d8))
### 🚜 Refactor
- Improve delivery timing ([#466](https://github.com/topos-protocol/topos/issues/466)) - ([96e862f](https://github.com/topos-protocol/topos/commit/96e862f5b886a38a5c67590d1e152ab9894d6f15))
- Store instantiation ([#461](https://github.com/topos-protocol/topos/issues/461)) - ([213b8d4](https://github.com/topos-protocol/topos/commit/213b8d482cf6e08ec0f1cae0e9dfd981b156a98d))
- Update error management and config/process ([#460](https://github.com/topos-protocol/topos/issues/460)) - ([cc0c7b5](https://github.com/topos-protocol/topos/commit/cc0c7b538d9f6b91c184db10eedd9d94c4f368fb))
- Move edge config to config crate ([#445](https://github.com/topos-protocol/topos/issues/445)) - ([23cc558](https://github.com/topos-protocol/topos/commit/23cc55887703bac01b7ec26486f47b03316046c1))
- Tce-broadcast config ([#444](https://github.com/topos-protocol/topos/issues/444)) - ([10c3879](https://github.com/topos-protocol/topos/commit/10c3879cd30bf0172996cfbf48ab5c991e767eaf))
### ⚙️ Miscellaneous Tasks
- Update changelog for 0.1.0 - ([65fc8cd](https://github.com/topos-protocol/topos/commit/65fc8cd05d1fdaecd809e92a0643dc02557ad460))
- Update changelog for 0.1.0 - ([a82617a](https://github.com/topos-protocol/topos/commit/a82617a6c653f02a00fc9565f2c5abb42c9b6c26))
- Disable coverage report on release branch (push) - ([09f3663](https://github.com/topos-protocol/topos/commit/09f36639ef62a02a2a84bde8f36a98ce6274ea6f))
- Disable coverage report on release branch (push) - ([e909e22](https://github.com/topos-protocol/topos/commit/e909e22d6dac251e4026816cd8dd5c84851e9db5))
- Disable coverage report on release branch ([#481](https://github.com/topos-protocol/topos/issues/481)) - ([8f10090](https://github.com/topos-protocol/topos/commit/8f10090094bf110670137f73a115bda54f64aba5))
- Update changelog for 0.1.0 - ([c68798e](https://github.com/topos-protocol/topos/commit/c68798eeed366a421a076cc1908aaca8013d80cf))
- Creating CHANGELOG.md for 0.0.11 - ([463f52f](https://github.com/topos-protocol/topos/commit/463f52feb73f10d2a194cf44863842a9f0cf13a0))
- Bumping version 0.1.0 - ([16de6a6](https://github.com/topos-protocol/topos/commit/16de6a675b0fe44afd20526202a2e5178b40994d))
- Update deps ([#474](https://github.com/topos-protocol/topos/issues/474)) - ([264c569](https://github.com/topos-protocol/topos/commit/264c5694980fded79ea0749d03f54a345d90c741))
- Refactor logs and fix typo ([#465](https://github.com/topos-protocol/topos/issues/465)) - ([8044310](https://github.com/topos-protocol/topos/commit/8044310b8ee330d5a14d509137dc4243cb2c2372))
- Removing cache_size ([#472](https://github.com/topos-protocol/topos/issues/472)) - ([b2e4cf8](https://github.com/topos-protocol/topos/commit/b2e4cf88ac0c0b2ee92b7ef120a4c4e97493150c))
- Backport fix of 0.0.11 ([#453](https://github.com/topos-protocol/topos/issues/453)) - ([53328ac](https://github.com/topos-protocol/topos/commit/53328acc813816757c57f3279cbd5f2aa738d2f0))
### Build
- Ignore pr checking name for release ([#480](https://github.com/topos-protocol/topos/issues/480)) - ([cfd8890](https://github.com/topos-protocol/topos/commit/cfd8890a0cb03f25fdaae8b181ab9c33f785e34e))
## [0.0.11](https://github.com/topos-protocol/topos/compare/v0.0.10..v0.0.11) - 2024-02-08
### ⛰️ Features
- Introduce topos-config crate ([#443](https://github.com/topos-protocol/topos/issues/443)) - ([4ff2a23](https://github.com/topos-protocol/topos/commit/4ff2a23e3a05ea3e950763bd4bde3d3ef6ef891b))
- Adding positions to certificate ([#440](https://github.com/topos-protocol/topos/issues/440)) - ([5315710](https://github.com/topos-protocol/topos/commit/531571025a4d81f9d9aa713ca12594756ca56a7e))
- Improve sequencer error handling and shutdown/restart sequence ([#428](https://github.com/topos-protocol/topos/issues/428)) - ([ab8bb9e](https://github.com/topos-protocol/topos/commit/ab8bb9e83afee545c3730f974ae8591c7fc70f3d))
- Update double echo to use pending CF ([#418](https://github.com/topos-protocol/topos/issues/418)) - ([8fb4003](https://github.com/topos-protocol/topos/commit/8fb4003d5579a8fee6d81c463707131959f076c3))
- Use anvil for sequencer tests ([#427](https://github.com/topos-protocol/topos/issues/427)) - ([5b0257b](https://github.com/topos-protocol/topos/commit/5b0257bed685c064c3eafbea2b5c77125e6c9041))
- Update tce config addresses ([#415](https://github.com/topos-protocol/topos/issues/415)) - ([476948f](https://github.com/topos-protocol/topos/commit/476948fa671b431bfa797aabf6b96949ac734db6))
- Remove the register commands macro ([#426](https://github.com/topos-protocol/topos/issues/426)) - ([985d0be](https://github.com/topos-protocol/topos/commit/985d0be0c75ddd1d41e94a172824b706ca0f9c5f))
- Run e2e topos integration workflow ([#408](https://github.com/topos-protocol/topos/issues/408)) - ([f0b7637](https://github.com/topos-protocol/topos/commit/f0b763786aa869454c9e30076ed08d0a456ed319))
- Adding filter on message when non validator ([#405](https://github.com/topos-protocol/topos/issues/405)) - ([b096482](https://github.com/topos-protocol/topos/commit/b0964825a5f386d75507482ee9068e26c9d74fe0))
- Add no-edge-process flag to node init ([#401](https://github.com/topos-protocol/topos/issues/401)) - ([28a553b](https://github.com/topos-protocol/topos/commit/28a553b6d17933bfbcca835640cc0c165bcd0124))
- Refactor peer selection for synchronization ([#382](https://github.com/topos-protocol/topos/issues/382)) - ([6982d33](https://github.com/topos-protocol/topos/commit/6982d336296a9b9ec5eacb025d938b6cb47b6e0a))
- Remove task manager channels ([#391](https://github.com/topos-protocol/topos/issues/391)) - ([f5fa427](https://github.com/topos-protocol/topos/commit/f5fa4276d8a524fd04bbf2a0d1d036d7f5af34bb))
- Add batch message and update double echo ([#383](https://github.com/topos-protocol/topos/issues/383)) - ([f0bc90c](https://github.com/topos-protocol/topos/commit/f0bc90c7480a84c0c12016e748f2a002477f4417))
### 🐛 Bug Fixes
- Fixing wrong use of IntCounterVec ([#442](https://github.com/topos-protocol/topos/issues/442)) - ([fe062a5](https://github.com/topos-protocol/topos/commit/fe062a5bdfa9ade2b94de88cbd6b3946b72a94c3))
- Clippy unused ([#434](https://github.com/topos-protocol/topos/issues/434)) - ([4aa6a9e](https://github.com/topos-protocol/topos/commit/4aa6a9e4723b8aaa2c2da0fdf32d8c8c926f7764))
- Remove an unused channel that was locking the broadcast ([#433](https://github.com/topos-protocol/topos/issues/433)) - ([43c6fe5](https://github.com/topos-protocol/topos/commit/43c6fe5caffd35103b20ec11d7ae2f35b1af98b9))
- RUSTSEC-2024-0003 ([#431](https://github.com/topos-protocol/topos/issues/431)) - ([cad4d76](https://github.com/topos-protocol/topos/commit/cad4d76ccf88be3f1399d371cf9dbdd7211343bc))
- RUSTSEC-2023-0078 ([#429](https://github.com/topos-protocol/topos/issues/429)) - ([35f8930](https://github.com/topos-protocol/topos/commit/35f8930056f641b33c56b4799b8c0cbe6f0a5eda))
- Fixing release notification ([#423](https://github.com/topos-protocol/topos/issues/423)) - ([7503fa7](https://github.com/topos-protocol/topos/commit/7503fa7f2385294f2a12a86eaa521af61fb9bc95))
- Move test abi generation to separate module ([#424](https://github.com/topos-protocol/topos/issues/424)) - ([d4ff358](https://github.com/topos-protocol/topos/commit/d4ff3581d43eabb14c3d977f34b69aee396e98d4))
- Return error from subprocesses ([#422](https://github.com/topos-protocol/topos/issues/422)) - ([53b3229](https://github.com/topos-protocol/topos/commit/53b3229b7e26b7bb9b3a8d97725e7cc86174df9b))
### 🚜 Refactor
- Graphql types to differentiate inputs ([#435](https://github.com/topos-protocol/topos/issues/435)) - ([4b0ec9b](https://github.com/topos-protocol/topos/commit/4b0ec9b2b3b6ab075d1b9bfde54dc8bb179bbde8))
### ⚙️ Miscellaneous Tasks
- Debug 0.0.11 synchronization ([#447](https://github.com/topos-protocol/topos/issues/447)) - ([edf86ee](https://github.com/topos-protocol/topos/commit/edf86ee32f8b34c5b11eecd5b0ed6fe5bdd0191a))
- Update dependencies ([#450](https://github.com/topos-protocol/topos/issues/450)) - ([62126e0](https://github.com/topos-protocol/topos/commit/62126e0417d8d4225eb8bb6eebb7fc0a0f526cc6))
- Remove mention of topos-api from coverage YAML ([#438](https://github.com/topos-protocol/topos/issues/438)) - ([6c7e342](https://github.com/topos-protocol/topos/commit/6c7e342715d86bcbd75e1bcd4054eb4cbeddf5cf))
- Bump version for topos to 0.0.11 ([#439](https://github.com/topos-protocol/topos/issues/439)) - ([917eaf9](https://github.com/topos-protocol/topos/commit/917eaf993336780a373dbcdfea4dd0d8b3e81f50))
- Refactor struct in topos-core ([#437](https://github.com/topos-protocol/topos/issues/437)) - ([acedac7](https://github.com/topos-protocol/topos/commit/acedac7e09094364b5406ee72f9a65241784c478))
- Update crates structure for api/uci and core ([#436](https://github.com/topos-protocol/topos/issues/436)) - ([355b08a](https://github.com/topos-protocol/topos/commit/355b08acf91052564dae65872904950d20b72ebd))
- Fix logs for pending ([#432](https://github.com/topos-protocol/topos/issues/432)) - ([342b2c7](https://github.com/topos-protocol/topos/commit/342b2c71ef0621a93b5f4460abd313f1c8b4c62b))
- Updating double echo for devnet ([#416](https://github.com/topos-protocol/topos/issues/416)) - ([1e91086](https://github.com/topos-protocol/topos/commit/1e91086a68ec01d304c5d8867e8fbcd671798599))
- Fixing clippy warning for 1.75.0 ([#425](https://github.com/topos-protocol/topos/issues/425)) - ([22a3745](https://github.com/topos-protocol/topos/commit/22a374506e087ab9cba68f9e0ed00682df6be6df))
- Refactor push certificate tests and cleanup regtest ([#399](https://github.com/topos-protocol/topos/issues/399)) - ([c60170d](https://github.com/topos-protocol/topos/commit/c60170dc19a9add84648afaf7962252ec77c160f))
- Update signal handle by tce ([#417](https://github.com/topos-protocol/topos/issues/417)) - ([beca28b](https://github.com/topos-protocol/topos/commit/beca28ba224b4a217a147f88142692acd1613a32))
- Cleanup topos tools ([#397](https://github.com/topos-protocol/topos/issues/397)) - ([0820306](https://github.com/topos-protocol/topos/commit/08203062a1cada7470d8b8207539d7a660ece466))
- Adding context on connection to self ([#413](https://github.com/topos-protocol/topos/issues/413)) - ([6e72999](https://github.com/topos-protocol/topos/commit/6e729992202ed4c56a1564cc39755ff1e0766ff8))
- Adding context on connection to self ([#411](https://github.com/topos-protocol/topos/issues/411)) - ([3a799ac](https://github.com/topos-protocol/topos/commit/3a799ac41542bd216a0512d9cf3a634a6ed2af07))
- Adding context to p2p msg received ([#410](https://github.com/topos-protocol/topos/issues/410)) - ([e1b2ccf](https://github.com/topos-protocol/topos/commit/e1b2ccf99a114a60e04c8ed187a8c9bd2cf066e4))
- Adding context to certificate broadcast ([#409](https://github.com/topos-protocol/topos/issues/409)) - ([d170b6b](https://github.com/topos-protocol/topos/commit/d170b6b386005d44457979bcd0a0f2435153f3f2))
- Adding storage context on startup ([#404](https://github.com/topos-protocol/topos/issues/404)) - ([ffae4c6](https://github.com/topos-protocol/topos/commit/ffae4c63d00bb099a49216c2af560f6b59601133))
- Remove audit ignore report ([#407](https://github.com/topos-protocol/topos/issues/407)) - ([70bce47](https://github.com/topos-protocol/topos/commit/70bce479d16c750ff1a322db1e88bfae08303855))
- Update SynchronizerService to remove unwrap ([#403](https://github.com/topos-protocol/topos/issues/403)) - ([b424aa9](https://github.com/topos-protocol/topos/commit/b424aa91f68197134faec742a23eec513cde837f))
- Adding no-color option to CLI ([#402](https://github.com/topos-protocol/topos/issues/402)) - ([4989936](https://github.com/topos-protocol/topos/commit/4989936ae000a85897d805453c91a53f4edd6580))
- Adding cross compilation ([#400](https://github.com/topos-protocol/topos/issues/400)) - ([887762f](https://github.com/topos-protocol/topos/commit/887762f740241d49d2886cd55d6a9da1d3d83e7e))
- Adding openssl as dependency ([#396](https://github.com/topos-protocol/topos/issues/396)) - ([60f873c](https://github.com/topos-protocol/topos/commit/60f873c619b8132a2276634205e3c39561eb3faf))
- Update release action target ([#395](https://github.com/topos-protocol/topos/issues/395)) - ([54db400](https://github.com/topos-protocol/topos/commit/54db40020e8e22d7b100b0b6944a45485e2939a4))
- Update release action target ([#394](https://github.com/topos-protocol/topos/issues/394)) - ([f0f28c3](https://github.com/topos-protocol/topos/commit/f0f28c33a5332232b2921b13051ae5de714cf58b))
- Adding aarch64 image ([#393](https://github.com/topos-protocol/topos/issues/393)) - ([9f48dc8](https://github.com/topos-protocol/topos/commit/9f48dc88582bfbc71cabb2c6bbc27297cc9b87ee))
- Cleanup topos test network setup ([#390](https://github.com/topos-protocol/topos/issues/390)) - ([2820664](https://github.com/topos-protocol/topos/commit/2820664a66bdfe039f1aaa80d79f4ff339c8a65c))
================================================
FILE: Cargo.toml
================================================
[workspace]
resolver = "2"
default-members = ["crates/topos", "crates/topos-node"]
members = [
"crates/*"
]
[workspace.package]
version = "0.1.0"
[workspace.lints.rust]
# Deny
missing_docs = "allow"
# Warn
deprecated-in-future = "warn"
[profile.release]
strip = true
[workspace.dependencies]
topos-core = { path = "./crates/topos-core", default-features = false }
topos-crypto = { path = "./crates/topos-crypto", default-features = false }
topos-metrics = { path = "./crates/topos-metrics/", default-features = false }
# Various utility crates
clap = { version = "4.0", features = ["derive", "env", "string"] }
lazy_static = "1"
rand = { version = "0.8", default-features = false }
rand_core = { version = "0.6", default-features = false }
rand_distr = { version = "0.4", default-features = false }
# Async & Tokio related
async-stream = { version = "0.3", default-features = false }
async-trait = { version = "0.1", default-features = false }
futures = { version = "0.3" }
tokio = { version = "1.24", default-features = false }
tokio-util = { version = "0.7.8" }
tokio-stream = { version = "0.1", default-features = false }
tower = "0.4"
# Blockchain
ethereum-types = { version = "0.13.1"}
secp256k1 = {version = "0.27", features = ["recovery"]}
tiny-keccak = {version = "1.5"}
ethers = {version = "2.0.9", features = ["legacy", "abigen-online"]}
# Log, Tracing & telemetry
opentelemetry = { version = "0.22", features = ["metrics"] }
opentelemetry-otlp = { version = "0.15", features = ["grpc-tonic", "metrics", "tls-roots"] }
opentelemetry_sdk = { version = "0.22" }
prometheus = "0.13.3"
prometheus-client = "0.22"
tracing = { version = "0.1", default-features = false }
tracing-attributes = "0.1"
tracing-opentelemetry = "0.23"
tracing-subscriber = { version = "0.3", default-features = false }
# gRPC
prost = {version = "0.12"}
tonic = { version = "0.11", default-features = false }
tonic-build = { version = "0.11", default-features = false, features = [
"prost", "transport"
] }
# Axum server (GraphQL + Metrics)
axum = "0.6"
async-graphql = "6"
async-graphql-axum = "6"
http = "0.2.9"
tower-http = { version = "0.4", features = ["cors"] }
# P2P related
libp2p = { version = "0.53", default-features = false, features = ["noise"]}
# Serialization & Deserialization
bincode = { version = "1.3", default-features = false }
byteorder = { version = "1.4", default-features = false }
bytes = { version = "1.3", default-features = false }
hex = { version = "0.4", default-features = false }
serde = { version = "1.0", default-features = false }
serde_json = { version = "1.0", default-features = false }
thiserror = { version = "1.0", default-features = false }
uuid = { version = "1.1.2", default-features = false, features = ["v4"] }
base64ct = { version = "1", features = ["alloc"] }
# Network related
backoff = { version = "0.4", features = ["tokio", "futures"] }
hyper = { version = "0.14.26", features = ["full"] }
reqwest = { version = "0.11", features = ["json"] }
# Tests
rstest = { version = "0.17.0", default-features = false }
test-log = { version = "0.2", features = ["trace"] }
env_logger = { version = "0.10.0"} # Needed by test-log to print traces in tests
serial_test = {version = "0.9.0"}
================================================
FILE: Cross.toml
================================================
[build]
pre-build = [
"apt update && apt install -y unzip",
"curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v25.1/protoc-25.1-linux-x86_64.zip && unzip protoc-25.1-linux-x86_64.zip -d /usr/ && chmod 755 /usr/bin/protoc"
]
[target.x86_64-unknown-linux-gnu]
image = "ghcr.io/cross-rs/x86_64-unknown-linux-gnu:main"
[target.aarch64-unknown-linux-gnu]
image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main"
================================================
FILE: Dockerfile
================================================
ARG RUSTUP_TOOLCHAIN=stable
FROM --platform=${BUILDPLATFORM:-linux/amd64} ghcr.io/topos-protocol/rust_builder:bullseye-${RUSTUP_TOOLCHAIN} AS base
ARG FEATURES
# Rust cache
ARG SCCACHE_S3_KEY_PREFIX
ARG SCCACHE_BUCKET
ARG SCCACHE_REGION
ARG RUSTC_WRAPPER
ARG PROTOC_VERSION=22.2
WORKDIR /usr/src/app
FROM --platform=${BUILDPLATFORM:-linux/amd64} base AS build
COPY . .
RUN --mount=type=secret,id=aws,target=/root/.aws/credentials \
--mount=type=cache,id=sccache,target=/root/.cache/sccache \
cargo build --release --no-default-features --features=${FEATURES} \
&& sccache --show-stats
FROM --platform=${BUILDPLATFORM:-linux/amd64} debian:bullseye-slim AS topos
ENV TCE_PORT=9090
ENV USER=topos
ENV UID=10001
ENV PATH="${PATH}:/usr/src/app"
WORKDIR /usr/src/app
COPY --from=build /usr/src/app/target/release/topos .
RUN apt-get update && apt-get install -y \
ca-certificates \
jq \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir /tmp/node_config
RUN mkdir /tmp/shared
ENTRYPOINT ["./topos"]
================================================
FILE: LICENSE
================================================
The Transmission Control Engine (TCE) and Sequencer are licensed under BSL-1.1.
-----------------------------------------------------------------------------
Business Source License 1.1
License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
"Business Source License" is a trademark of MariaDB Corporation Ab.
Parameters
Licensor: zk Foundation
Licensed Work: Code contained within the "topos" repository
Transmission Control Engine (TCE) and Sequencer
The Licensed Work is (c) zk Foundation
Additional Use Grant:
You may use the Licensed Work in a production environment in the following circumstances:
(1) solely for non-malicious use of the Topos Protocol via zk Foundation
promulgated networks for the operation of a node on a network or for the operation
of software in support of connecting a Subnet to a network; and
(2) for non-commercial academic research purposes only.
“Topos Protocol” as used herein means the generalized implementation of “Topos:
A Secure, Trustless, and Decentralized Interoperability Protocol”
(https://arxiv.org/pdf/2206.03481.pdf) distributed by zk Foundation.
A “Subnet” as used herein means a process, set of processes, computer system,
database, or network of systems and/or processes as defined by the Topos Protocol.
For any additional licensing arrangements, please contact zk Foundation at:
info@zkfoundation.io.
Change Date: July 1, 2025
Change License: GPL v3.0
-----------------------------------------------------------------------------
Terms
The Licensor hereby grants you the right to copy, modify, create derivative
works, redistribute, and make non-production use of the Licensed Work. The
Licensor may make an Additional Use Grant, above, permitting limited
production use.
Effective on the Change Date, or the fourth anniversary of the first publicly
available distribution of a specific version of the Licensed Work under this
License, whichever comes first, the Licensor hereby grants you rights under
the terms of the Change License, and the rights granted in the paragraph
above terminate.
If your use of the Licensed Work does not comply with the requirements
currently in effect as described in this License, you must purchase a
commercial license from the Licensor, its affiliated entities, or authorized
resellers, or you must refrain from using the Licensed Work.
All copies of the original and modified Licensed Work, and derivative works
of the Licensed Work, are subject to this License. This License applies
separately for each version of the Licensed Work and the Change Date may vary
for each version of the Licensed Work released by Licensor.
You must conspicuously display this License on each original or modified copy
of the Licensed Work. If you receive the Licensed Work in original or
modified form from a third party, the terms and conditions set forth in this
License apply to your use of that work.
Any use of the Licensed Work in violation of this License will automatically
terminate your rights under this License for the current and all other
versions of the Licensed Work.
This License does not grant you any right in any trademark or logo of
Licensor or its affiliates (provided that you may use a trademark or logo of
Licensor as expressly required by this License).
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
TITLE.
MariaDB hereby grants you permission to use this License’s text to license
your works, and to refer to it using the trademark “Business Source License”,
as long as you comply with the Covenants of Licensor below.
Covenants of Licensor
In consideration of the right to use this License’s text and the “Business
Source License” name and trademark, Licensor covenants to MariaDB, and to all
other recipients of the licensed work to be provided by Licensor:
1. To specify as the Change License the GPL Version 2.0 or any later version,
or a license that is compatible with GPL Version 2.0 or a later version,
where “compatible” means that software provided under the Change License can
be included in a program with software provided under GPL Version 2.0 or a
later version. Licensor may specify additional Change Licenses without
limitation.
2. To either: (a) specify an additional grant of rights to use that does not
impose any additional restriction on the right granted in this License, as
the Additional Use Grant; or (b) insert the text “None”.
3. To specify a Change Date.
4. Not to modify this License in any other way.
-----------------------------------------------------------------------------
Notice
The Business Source License (this document, or the "License") is not an Open
Source license. However, the Licensed Work will eventually be made available
under an Open Source License, as stated in this License.
================================================
FILE: README.md
================================================
<div id="top"></div>
<!-- PROJECT LOGO -->
<br />
<div align="center">
<img src="./.github/assets/topos_logo.png#gh-light-mode-only" alt="Logo" width="200">
<img src="./.github/assets/topos_logo_dark.png#gh-dark-mode-only" alt="Logo" width="200">
<br />
<p align="center">
<b>topos</b> is the unified command line interface to the <a href="https://docs.topos.technology/">Topos</a> protocol.
</p>
</div>
<br />
<div align="center">


[](https://codecov.io/gh/topos-protocol/topos)

[](https://discord.gg/7HZ8F8ykBT)
</div>
## Getting Started
**Install Rust**
The first step is to install Rust along with `cargo` by following the instructions [here](https://doc.rust-lang.org/book/ch01-01-installation.html#installing-rustup-on-linux-or-macos).
**Install `topos`**
```
cargo install topos --git https://github.com/topos-protocol/topos
```
**Try out `topos`!**
```
topos --help
```
Find more about how topos works in the [documentation](https://docs.topos.technology/).
### Topos Docker image
The docker images use `stable` Rust toolchain by default. You can use a different one by defining `RUSTUP_TOOLCHAIN` argument, the list of available toolchain is [here](https://github.com/topos-protocol/topos-ci-docker/pkgs/container/rust_builder)
Build Topos docker image:
```
DOCKER_BUILDKIT=1 docker build . --build-arg RUSTUP_TOOLCHAIN=[...] -t topos:latest
```
Run Topos docker image:
```
docker run -it --rm topos:latest --help
```
## Development
Contributions are very welcomed, the guidelines are outlined in [`CONTRIBUTING.md`](https://github.com/topos-protocol/.github/blob/main/CONTRIBUTING.md).<br />
## Support
Feel free to [open an issue](https://github.com/topos-protocol/topos/issues/new) if you have any feature request or bug report.<br />
If you have any questions, do not hesitate to reach us on [Discord](https://discord.gg/7HZ8F8ykBT)!
## Resources
- Website: <https://toposware.com>
- Technical Documentation: <https://docs.topos.technology/>
- Medium: <https://toposware.medium.com>
- Whitepaper: [Topos: A Secure, Trustless, and Decentralized
Interoperability Protocol](https://arxiv.org/pdf/2206.03481.pdf)
## License
This project is released under the terms specified in the [LICENSE](LICENSE) file.
================================================
FILE: cliff.toml
================================================
# git-cliff ~ configuration file
# https://git-cliff.org/docs/configuration
#
# Lines starting with "#" are comments.
# Configuration options are organized into tables and keys.
# See documentation for more information on available options.
[changelog]
# changelog header
header = """

"""
# template for the changelog body
# https://keats.github.io/tera/docs/#introduction
body = """
{%- macro remote_url() -%}
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
{%- endmacro -%}
{% macro print_commit(commit) -%}
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
{% if commit.breaking %}[**breaking**] {% endif %}\
{{ commit.message | upper_first }} - \
([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))\
{% endmacro -%}
{% if version %}\
{% if previous.version %}\
## [{{ version | trim_start_matches(pat="v") }}]\
({{ self::remote_url() }}/compare/{{ previous.version }}..{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% endif %}\
{% else %}\
## [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | striptags | trim | upper_first }}
{% for commit in commits
| filter(attribute="scope")
| sort(attribute="scope") %}
{{ self::print_commit(commit=commit) }}
{%- endfor -%}
{% raw %}\n{% endraw %}\
{%- for commit in commits %}
{%- if not commit.scope -%}
{{ self::print_commit(commit=commit) }}
{% endif -%}
{% endfor -%}
{% endfor %}\n
"""
# template for the changelog footer
footer = """
"""
# remove the leading and trailing whitespace from the templates
trim = true
# postprocessors
postprocessors = [
{ pattern = '<REPO>', replace = "https://github.com/topos-protocol/topos" }, # replace repository URL
]
[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = true
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
commit_preprocessors = [
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))" },
# Check spelling of the commit with https://github.com/crate-ci/typos
# If the spelling is incorrect, it will be automatically fixed.
{ pattern = '.*', replace_command = 'typos --write-changes -' },
]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat", group = "<!-- 0 -->⛰️ Features" },
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
{ message = "^refactor\\(clippy\\)", skip = true },
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
{ message = "^chore\\(release\\): prepare for", skip = true },
{ message = "^chore\\(deps.*\\)", skip = true },
{ message = "^chore\\(pr\\)", skip = true },
{ message = "^chore\\(pull\\)", skip = true },
{ message = "^chore|^ci", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" },
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
]
# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
filter_commits = false
# regex for matching git tags
tag_pattern = "v[0-9].*"
# regex for skipping tags
skip_tags = "beta|alpha"
# regex for ignoring tags
ignore_tags = "rc|v2.1.0|v2.1.1"
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "newest"
================================================
FILE: crates/topos/Cargo.toml
================================================
[package]
name = "topos"
version = "0.1.0"
edition = "2021"
[lints]
workspace = true
[dependencies]
topos-node = { path = "../topos-node/" }
topos-config = { path = "../topos-config/" }
topos-tce = { path = "../topos-tce/" }
topos-p2p = { path = "../topos-p2p" }
topos-sequencer = { path = "../topos-sequencer" }
topos-core = { workspace = true, features = ["api"] }
topos-certificate-spammer = { path = "../topos-certificate-spammer" }
topos-tce-broadcast = { path = "../topos-tce-broadcast", optional = true }
topos-wallet = { path = "../topos-wallet" }
topos-telemetry = { path = "../topos-telemetry/", features = ["tracing"] }
async-stream.workspace = true
async-trait.workspace = true
clap.workspace = true
hex.workspace = true
futures.workspace = true
opentelemetry.workspace = true
serde.workspace = true
serde_json.workspace = true
tokio = { workspace = true, features = ["full"] }
tokio-util.workspace = true
tonic.workspace = true
tower.workspace = true
tracing = { workspace = true, features = ["log"] }
tracing-opentelemetry.workspace = true
tracing-subscriber = { workspace = true, features = ["env-filter", "json", "ansi", "fmt"] }
uuid.workspace = true
rand.workspace = true
reqwest.workspace = true
thiserror.workspace = true
opentelemetry-otlp = { workspace = true, features = ["grpc-tonic", "metrics", "tls-roots"] }
dirs = "5.0"
tracing-log = { version = "0.1.3", features = ["env_logger"] }
tar = "0.4.38"
flate2 ="1.0.26"
url = "2.3.1"
once_cell = "1.17.1"
regex = "1"
rlp = "0.5.1"
openssl = { version = "0.10.61", features = ["vendored"] }
[dev-dependencies]
toml = "0.7.4"
topos-tce-broadcast = { path = "../topos-tce-broadcast" }
topos-tce-synchronizer = { path = "../topos-tce-synchronizer" }
topos-tce-gatekeeper = { path = "../topos-tce-gatekeeper" }
topos-tce-api = { path = "../topos-tce-api" }
topos-tce-storage = { path = "../topos-tce-storage" }
topos-test-sdk = { path = "../topos-test-sdk" }
serde.workspace = true
serde_json.workspace = true
test-log.workspace = true
env_logger.workspace = true
rand.workspace = true
futures.workspace = true
libp2p = { workspace = true, features = ["identify"] }
assert_cmd = "2.0.6"
insta = { version = "1.21", features = ["json", "redactions"] }
rstest = { workspace = true, features = ["async-timeout"] }
tempfile = "3.8.0"
predicates = "3.0.3"
sysinfo = "0.29.11"
serial_test = {version = "0.9.0"}
[features]
default = []
================================================
FILE: crates/topos/build.rs
================================================
use std::process::Command;
const DEFAULT_VERSION: &str = "detached";
fn main() {
// Set TOPOS_VERSION to HEAD short commit hash if None
if std::option_env!("TOPOS_VERSION").is_none() {
let output = Command::new("git")
.args(["rev-parse", "--short", "HEAD"])
.output()
.expect("failed to access the HEAD commit hash");
let git_hash = String::from_utf8(output.stdout).unwrap();
let topos_version = if git_hash.is_empty() {
DEFAULT_VERSION
} else {
git_hash.as_str()
};
println!("cargo:rustc-env=TOPOS_VERSION={topos_version}");
}
}
================================================
FILE: crates/topos/src/components/mod.rs
================================================
pub(crate) mod node;
pub(crate) mod regtest;
pub(crate) mod setup;
================================================
FILE: crates/topos/src/components/node/commands/init.rs
================================================
use std::path::PathBuf;
use clap::Args;
use serde::Serialize;
use topos_config::node::NodeRole;
#[derive(Args, Debug, Serialize)]
#[command(about = "Setup your node", trailing_var_arg = true)]
#[serde(rename_all = "kebab-case")]
pub struct Init {
/// Name to identify your node
#[arg(long, env = "TOPOS_NODE_NAME", default_value = "default")]
pub name: Option<String>,
/// Role of your node
#[arg(long, value_enum, env = "TOPOS_NODE_ROLE", default_value_t = NodeRole::Validator)]
pub role: NodeRole,
/// Subnet of your node
#[arg(long, env = "TOPOS_NODE_SUBNET", default_value = "topos")]
pub subnet: Option<String>,
/// The path to the SecretsManager config file. Used for Hashicorp Vault.
/// If omitted, the local FS secrets manager is used
#[arg(long, env = "TOPOS_SECRETS_MANAGER")]
pub secrets_config: Option<String>,
/// For certain use cases, we manually provide private keys to a running node, and don't want to
/// rely on polygon-edge during runtime. Example: A sequencer which runs for an external EVM chain
#[arg(long, env = "TOPOS_NO_EDGE_PROCESS", action)]
pub no_edge_process: bool,
/// Installation directory path for Polygon Edge binary
#[clap(from_global)]
pub(crate) edge_path: PathBuf,
}
================================================
FILE: crates/topos/src/components/node/commands/status.rs
================================================
use super::NodeArgument;
use clap::Args;
use serde::Serialize;
#[derive(Args, Debug, Serialize)]
#[command(about = "Get node status")]
pub(crate) struct Status {
#[command(flatten)]
pub(crate) node_args: NodeArgument,
#[arg(long)]
pub(crate) sample: bool,
}
================================================
FILE: crates/topos/src/components/node/commands/up.rs
================================================
use std::path::PathBuf;
use clap::Args;
use serde::Serialize;
#[derive(Args, Clone, Debug, Serialize)]
#[command(about = "Spawn your node")]
#[serde(rename_all = "kebab-case")]
pub struct Up {
/// Name to identify your node
#[arg(long, env = "TOPOS_NODE_NAME", default_value = "default")]
pub name: Option<String>,
/// The path to the SecretsManager config file. Used for Hashicorp Vault.
/// If omitted, the local FS secrets manager is used
#[arg(long, env = "TOPOS_SECRETS_MANAGER")]
pub secrets_config: Option<String>,
/// Defines that an external edge node will be use, replacing the one normally run by the node.
/// Usable for cases where edge endpoint is available as infura (or similar cloud provider) endpoint
#[arg(long, env = "TOPOS_NO_EDGE_PROCESS", action)]
pub no_edge_process: bool,
/// Socket of the opentelemetry agent endpoint.
/// If not provided open telemetry will not be used
#[arg(long, env = "TOPOS_OTLP_AGENT")]
pub otlp_agent: Option<String>,
/// Otlp service name.
/// If not provided open telemetry will not be used
#[arg(long, env = "TOPOS_OTLP_SERVICE_NAME")]
pub otlp_service_name: Option<String>,
/// Installation directory path for Polygon Edge binary
#[clap(from_global)]
pub(crate) edge_path: PathBuf,
}
================================================
FILE: crates/topos/src/components/node/commands.rs
================================================
use std::path::PathBuf;
use clap::{Args, Subcommand};
use serde::Serialize;
mod init;
mod status;
mod up;
pub(crate) use init::Init;
pub(crate) use status::Status;
pub(crate) use up::Up;
#[derive(Args, Debug, Serialize)]
pub(crate) struct NodeArgument {
#[clap(short, long, default_value = "http://[::1]:1340")]
pub(crate) node: String,
}
/// Utility to manage your nodes in the Topos network
#[derive(Args, Debug)]
pub(crate) struct NodeCommand {
#[clap(from_global)]
pub(crate) verbose: u8,
#[clap(from_global)]
pub(crate) no_color: bool,
#[clap(from_global)]
pub(crate) home: PathBuf,
/// Installation directory path for Polygon Edge binary
#[arg(
global = true,
long,
env = "TOPOS_POLYGON_EDGE_BIN_PATH",
default_value = "."
)]
pub(crate) edge_path: PathBuf,
#[clap(subcommand)]
pub(crate) subcommands: Option<NodeCommands>,
}
#[derive(Subcommand, Debug, Serialize)]
pub(crate) enum NodeCommands {
Up(Box<Up>),
Init(Box<Init>),
Status(Status),
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_run() {
assert!(NodeCommands::has_subcommand("up"));
assert!(NodeCommands::has_subcommand("init"));
}
}
================================================
FILE: crates/topos/src/components/node/mod.rs
================================================
use std::{
fs::{create_dir_all, remove_dir_all, OpenOptions},
io::Write,
};
use std::{path::Path, sync::Arc};
use tokio::sync::Mutex;
use tonic::transport::{Channel, Endpoint};
use topos_telemetry::tracing::setup_tracing;
use tower::Service;
use tracing::error;
use self::commands::{NodeCommand, NodeCommands};
use topos_config::node::NodeConfig;
use topos_config::{edge::command::BINARY_NAME, Config};
use topos_core::api::grpc::tce::v1::console_service_client::ConsoleServiceClient;
pub(crate) mod commands;
pub(crate) mod services;
pub(crate) struct NodeService {
pub(crate) console_client: Arc<Mutex<ConsoleServiceClient<Channel>>>,
}
impl NodeService {
pub(crate) fn with_grpc_endpoint(endpoint: &str) -> Self {
Self {
console_client: setup_console_tce_grpc(endpoint),
}
}
}
pub(crate) async fn handle_command(
NodeCommand {
subcommands,
verbose,
no_color,
home,
edge_path,
}: NodeCommand,
) -> Result<(), Box<dyn std::error::Error>> {
match subcommands {
Some(NodeCommands::Init(cmd)) => {
let cmd = *cmd;
let name = cmd.name.clone().expect("No name or default was given");
_ = setup_tracing(verbose, no_color, None, None, env!("TOPOS_VERSION"));
// Construct path to node config
// will be $TOPOS_HOME/node/default/ with no given name
// and $TOPOS_HOME/node/<name>/ with a given name
let node_path = home.join("node").join(&name);
// If the folders don't exist yet, create it
create_dir_all(&node_path).expect("failed to create node folder");
// Check if the config file exists
let config_path = node_path.join("config.toml");
if Path::new(&config_path).exists() {
println!("Config file: {} already exists", config_path.display());
std::process::exit(1);
}
if cmd.no_edge_process {
println!("Init the node without polygon-edge process...");
} else {
// Generate the Edge configuration
match topos_config::edge::generate_edge_config(
edge_path.join(BINARY_NAME),
node_path.clone(),
)
.await
{
Ok(Ok(status)) => {
if let Some(0) = status.code() {
println!("Edge configuration successfully generated");
} else {
println!(
"Edge configuration generation terminated with error status: {:?}",
status
);
remove_dir_all(node_path).expect("failed to remove config folder");
std::process::exit(1);
}
}
Ok(Err(e)) => {
println!("Failed to generate edge config with error {e}");
remove_dir_all(node_path).expect("failed to remove config folder");
std::process::exit(1);
}
Err(_) => {
println!("Failed to generate edge config");
remove_dir_all(node_path).expect("failed to remove config folder");
std::process::exit(1);
}
}
}
let node_config = NodeConfig::create(&home, &name, Some(&cmd));
// Creating the TOML output
let config_toml = match node_config.to_toml() {
Ok(config) => config,
Err(error) => {
println!("Failed to generate TOML config: {error}");
remove_dir_all(node_path).expect("failed to remove config folder");
std::process::exit(1);
}
};
let config_path = node_path.join("config.toml");
let mut node_config_file = OpenOptions::new()
.write(true)
.create(true)
.truncate(true)
.open(config_path)
.expect("failed to create default node file");
node_config_file
.write_all(config_toml.to_string().as_bytes())
.expect("failed to write to default node file");
println!(
"Created node config file at {}/config.toml",
node_path.display()
);
Ok(())
}
Some(NodeCommands::Up(cmd)) => {
let cmd_cloned = cmd.clone();
let command = *cmd;
let name = cmd_cloned
.name
.as_ref()
.expect("No name or default was given for node");
let config = NodeConfig::try_from(&home, name, Some(&command))?;
topos_node::start(
verbose,
no_color,
cmd_cloned.otlp_agent,
cmd_cloned.otlp_service_name,
cmd_cloned.no_edge_process,
config,
)
.await?;
Ok(())
}
Some(NodeCommands::Status(status)) => {
let mut node_service = NodeService::with_grpc_endpoint(&status.node_args.node);
let exit_code = i32::from(!(node_service.call(status).await?));
std::process::exit(exit_code);
}
None => Ok(()),
}
}
fn setup_console_tce_grpc(endpoint: &str) -> Arc<Mutex<ConsoleServiceClient<Channel>>> {
match Endpoint::from_shared(endpoint.to_string()) {
Ok(endpoint) => Arc::new(Mutex::new(ConsoleServiceClient::new(
endpoint.connect_lazy(),
))),
Err(e) => {
error!("Failure to setup the gRPC API endpoint on {endpoint}: {e}");
std::process::exit(1);
}
}
}
================================================
FILE: crates/topos/src/components/node/services/status.rs
================================================
use std::{
future::Future,
io::Error,
pin::Pin,
task::{Context, Poll},
};
use futures::FutureExt;
use topos_core::api::grpc::tce::v1::StatusRequest;
use tower::Service;
use tracing::{debug, error};
use crate::components::node::{commands::Status, NodeService};
impl Service<Status> for NodeService {
type Response = bool;
type Error = std::io::Error;
type Future =
Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send + 'static>>;
fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, _: Status) -> Self::Future {
let client = self.console_client.clone();
async move {
debug!("Sending the request to the TCE server...");
match client.lock().await.status(StatusRequest {}).await {
Ok(status_response) => {
let status = status_response.into_inner();
debug!("Successfully fetched the status {:?} from the TCE", status);
Ok(status.has_active_sample)
}
Err(err) => {
error!("TCE server returned an error: {:?}", err);
Err(Error::new(std::io::ErrorKind::Other, err))
}
}
}
.boxed()
}
}
================================================
FILE: crates/topos/src/components/node/services.rs
================================================
pub(crate) mod status;
================================================
FILE: crates/topos/src/components/regtest/commands/spam.rs
================================================
use clap::Args;
#[derive(Args, Debug)]
#[command(
about = "Run a test topos certificate spammer to send test certificates to the network, \
generating randomly among the `nb_subnets` subnets the batch of `cert_per_batch` \
certificates at every `batch-interval`"
)]
pub struct Spam {
/// The target node api endpoint.
/// Multiple nodes could be specified as comma separated list
/// e.g. `--target-nodes=http://[::1]:1340,http://[::1]:1341`
#[clap(
long,
env = "TOPOS_NETWORK_SPAMMER_TARGET_NODES",
value_delimiter = ','
)]
pub target_nodes: Option<Vec<String>>,
/// Path to json file with list of target nodes as alternative to `--target-nodes`
#[clap(long, env = "TOPOS_NETWORK_SPAMMER_TARGET_NODES_PATH")]
pub target_nodes_path: Option<String>,
/// Seed for generation of local private signing keys and corresponding subnet ids.
#[arg(
long,
env = "TOPOS_NETWORK_SPAMMER_LOCAL_KEY_SEED",
default_value = "1"
)]
pub local_key_seed: u64,
/// Certificates generated in one batch. Batch is generated every `batch-interval` milliseconds.
#[arg(
long,
env = "TOPOS_NETWORK_SPAMMER_CERT_PER_BATCH",
default_value = "1"
)]
pub cert_per_batch: u64,
/// Number of subnets to use for certificate generation. For every certificate subnet id will be picked randomly.
#[arg(
long,
env = "TOPOS_NETWORK_SPAMMER_NUMBER_OF_SUBNETS",
default_value = "1"
)]
pub nb_subnets: u8,
/// Number of batches to generate before finishing execution.
/// If not specified, batches will be generated indefinitely.
#[arg(long, env = "TOPOS_NETWORK_SPAMMER_NUMBER_OF_BATCHES")]
pub nb_batches: Option<u64>,
/// Time interval in milliseconds between generated batches of certificates
#[arg(
long,
env = "TOPOS_NETWORK_SPAMMER_BATCH_INTERVAL",
default_value = "2000"
)]
pub batch_interval: u64,
/// List of generated certificate target subnets. No target subnets by default.
/// For example `--target-subnets=0x3bc19e36ff1673910575b6727a974a9abd80c9a875d41ab3e2648dbfb9e4b518,0xa00d60b2b408c2a14c5d70cdd2c205db8985ef737a7e55ad20ea32cc9e7c417c`
#[arg(
long,
env = "TOPOS_NETWORK_SPAMMER_TARGET_SUBNETS",
value_delimiter = ','
)]
pub target_subnets: Option<Vec<String>>,
/// Socket of the opentelemetry agent endpoint.
/// If not provided open telemetry will not be used
#[arg(long, env = "TOPOS_OTLP_AGENT")]
pub otlp_agent: Option<String>,
/// Otlp service name.
/// If not provided open telemetry will not be used
#[arg(long, env = "TOPOS_OTLP_SERVICE_NAME")]
pub otlp_service_name: Option<String>,
/// Flag to indicate usage of Kubernetes.
#[arg(
long,
env = "TOPOS_NETWORK_SPAMMER_BENCHMARK",
requires = "target_hosts",
requires = "number"
)]
pub benchmark: bool,
/// Template for generating target node entrypoints.
/// e.g. `--hosts="http://validator-{N}:1340"`
#[arg(
long,
env = "TOPOS_NETWORK_SPAMMER_TARGET_HOSTS",
requires = "benchmark"
)]
pub target_hosts: Option<String>,
/// Number of nodes to generate based on the DNS template.
#[arg(long, env = "TOPOS_NETWORK_SPAMMER_NUMBER", requires = "benchmark")]
pub number: Option<u32>,
}
impl Spam {}
================================================
FILE: crates/topos/src/components/regtest/commands.rs
================================================
use clap::{Args, Subcommand};
mod spam;
pub(crate) use spam::Spam;
/// Run test commands (e.g., pushing a certificate to a TCE process)
#[derive(Args, Debug)]
pub(crate) struct RegtestCommand {
#[clap(from_global)]
pub(crate) verbose: u8,
#[clap(subcommand)]
pub(crate) subcommands: Option<RegtestCommands>,
}
#[derive(Subcommand, Debug)]
pub(crate) enum RegtestCommands {
Spam(Box<Spam>),
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_run() {
assert!(RegtestCommands::has_subcommand("spam"));
}
}
================================================
FILE: crates/topos/src/components/regtest/mod.rs
================================================
use self::commands::{RegtestCommand, RegtestCommands};
use opentelemetry::global;
use tokio::{
spawn,
sync::{mpsc, oneshot},
};
use topos_certificate_spammer::{error::Error, CertificateSpammerConfig};
use topos_telemetry::tracing::setup_tracing;
use tracing::{error, info};
pub(crate) mod commands;
pub(crate) async fn handle_command(
RegtestCommand {
verbose,
subcommands,
}: RegtestCommand,
) -> Result<(), Box<dyn std::error::Error>> {
match subcommands {
Some(RegtestCommands::Spam(cmd)) => {
let config = CertificateSpammerConfig {
target_nodes: cmd.target_nodes,
target_nodes_path: cmd.target_nodes_path,
local_key_seed: cmd.local_key_seed,
cert_per_batch: cmd.cert_per_batch,
nb_subnets: cmd.nb_subnets,
nb_batches: cmd.nb_batches,
batch_interval: cmd.batch_interval,
target_subnets: cmd.target_subnets,
benchmark: cmd.benchmark,
target_hosts: cmd.target_hosts,
number: cmd.number,
};
// Setup instrumentation if both otlp agent and otlp service name
// are provided as arguments
setup_tracing(
verbose,
false,
cmd.otlp_agent,
cmd.otlp_service_name,
env!("TOPOS_VERSION"),
)?;
let (shutdown_sender, shutdown_receiver) = mpsc::channel::<oneshot::Sender<()>>(1);
let mut runtime = spawn(topos_certificate_spammer::run(config, shutdown_receiver));
loop {
tokio::select! {
_ = tokio::signal::ctrl_c() => {
info!("Received ctrl_c, shutting down application...");
let (shutdown_finished_sender, shutdown_finished_receiver) = oneshot::channel::<()>();
if let Err(e) = shutdown_sender.send(shutdown_finished_sender).await {
error!("Error sending shutdown signal to Spammer application: {e}");
}
if let Err(e) = shutdown_finished_receiver.await {
error!("Error with shutdown receiver: {e}");
}
info!("Shutdown procedure finished, exiting...");
}
result = &mut runtime =>{
global::shutdown_tracer_provider();
if let Ok(Err(Error::BenchmarkConfig(ref msg))) = result {
error!("Benchmark configuration error:\n{}", msg);
std::process::exit(1);
}
if let Err(ref error) = result {
error!("Unable to execute network spam command due to: {error}");
std::process::exit(1);
}
break;
}
}
}
Ok(())
}
None => Ok(()),
}
}
================================================
FILE: crates/topos/src/components/setup/commands/subnet.rs
================================================
use clap::Args;
use std::path::PathBuf;
#[derive(Args, Debug)]
#[command(about = "Install Polygon Edge node binary")]
pub struct Subnet {
/// Installation directory path for Polygon Edge binary.
/// If not provided, Polygon Edge binary will be installed to the current directory
#[clap(long, env = "TOPOS_SETUP_POLYGON_EDGE_DIR", default_value = ".")]
pub path: PathBuf,
/// Polygon Edge release version. If not provided, latest release version will be installed
#[arg(long, env = "TOPOS_SETUP_SUBNET_RELEASE")]
pub release: Option<String>,
/// Polygon Edge Github repository
#[arg(
long,
env = "TOPOS_SETUP_SUBNET_REPOSITORY",
default_value = "topos-protocol/polygon-edge"
)]
pub repository: String,
/// List all available Polygon Edge release versions without installation
#[arg(long, action)]
pub list_releases: bool,
}
impl Subnet {}
================================================
FILE: crates/topos/src/components/setup/commands.rs
================================================
use clap::{Args, Subcommand};
mod subnet;
pub(crate) use subnet::Subnet;
/// Topos CLI subcommand for the setup of various Topos related components (e.g., installation of Polygon Edge binary)
#[derive(Args, Debug)]
pub(crate) struct SetupCommand {
#[clap(subcommand)]
pub(crate) subcommands: Option<SetupCommands>,
}
#[derive(Subcommand, Debug)]
pub(crate) enum SetupCommands {
Subnet(Box<Subnet>),
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_run() {
assert!(SetupCommands::has_subcommand("subnet"));
}
}
================================================
FILE: crates/topos/src/components/setup/mod.rs
================================================
use self::commands::{SetupCommand, SetupCommands};
use tokio::{signal, spawn};
use tracing::{error, info};
use topos::{install_polygon_edge, list_polygon_edge_releases};
pub(crate) mod commands;
pub(crate) async fn handle_command(
SetupCommand { subcommands }: SetupCommand,
) -> Result<(), Box<dyn std::error::Error>> {
match subcommands {
Some(SetupCommands::Subnet(cmd)) => {
spawn(async move {
if cmd.list_releases {
info!(
"Retrieving release version list from repository: {}",
&cmd.repository
);
if let Err(e) = list_polygon_edge_releases(cmd.repository).await {
error!("Error listing Polygon Edge release versions: {e}");
std::process::exit(1);
} else {
std::process::exit(0);
}
} else {
info!(
"Starting installation of Polygon Edge binary to target path: {}",
&cmd.path.display()
);
println!(
"Starting installation of Polygon Edge binary to target path: {}",
&cmd.path.display()
);
if let Err(e) =
install_polygon_edge(cmd.repository, cmd.release, cmd.path.as_path()).await
{
error!("Error installing Polygon Edge: {e}");
eprintln!("Error installing Polygon Edge: {e}");
std::process::exit(1);
} else {
info!("Polygon Edge installation successful");
println!("Polygon Edge installation successful");
std::process::exit(0);
}
}
});
signal::ctrl_c()
.await
.expect("failed to listen for signals");
Ok(())
}
None => {
error!("No subcommand provided. You can use `--help` to see available subcommands.");
eprintln!("No subcommand provided. You can use `--help` to see available subcommands.");
std::process::exit(1);
}
}
}
================================================
FILE: crates/topos/src/lib.rs
================================================
use flate2::read::GzDecoder;
use serde_json::Value;
use std::collections::HashSet;
use std::fs::File;
use std::io::Write;
use std::path::Path;
use tar::Archive;
use tracing::{error, info};
const GITHUB_REPO_API: &str = "https://api.github.com/repos/";
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("Http client error: {0}")]
Http(reqwest::Error),
#[error("Json parsing error: {0}")]
InvalidJson(serde_json::Error),
#[error("There is no valid Polygon Edge release available")]
NoValidRelease,
#[error("Invalid release metadata")]
InvalidReleaseMetadata,
#[error("File io error: {0}")]
File(std::io::Error),
#[error("Invalid private key")]
InvalidPrivateKey,
#[error("Invalid Validator address")]
InvalidValidatorAddress,
}
fn map_arch(arch: &str) -> &str {
match arch {
"x86" => "x86",
"x86_64" => "amd64",
"aarch64" => "arm64",
_ => "unknown",
}
}
fn map_os(arch: &str) -> &str {
match arch {
"linux" => "linux",
"macos" => "darwin",
"windows" => "windows",
_ => "unknown",
}
}
/// Calculate expected polygon edge binary name for this platform
/// By convention it is in the format `polygon-edge-<cpu architecture>-<operating system>`
fn determine_binary_release_name(release: &PolygonEdgeRelease) -> String {
"polygon-edge".to_string()
+ "_"
+ &release.version[1..]
+ "_"
+ map_os(std::env::consts::OS)
+ "_"
+ map_arch(std::env::consts::ARCH)
+ ".tar.gz"
}
/// Download Polygon Edge binary from repository to requested target directory
async fn download_binary(file_name: &str, uri: &str, target_directory: &Path) -> Result<(), Error> {
info!(
"Downloading binary `{}` to target directory: {}",
file_name,
target_directory.display()
);
let response = reqwest::get(uri).await.map_err(Error::Http)?;
let download_file_path = target_directory.join(Path::new(file_name));
{
//Download file
let mut target_archive_file = File::create(&download_file_path).map_err(|error| {
error!("Unable to create file: {error}");
Error::File(error)
})?;
target_archive_file
.write_all(response.bytes().await.map_err(Error::Http)?.as_ref())
.map_err(Error::File)?;
}
{
// Decompress archive
let archive_file = File::open(&download_file_path).map_err(Error::File)?;
let mut archive = Archive::new(GzDecoder::new(archive_file));
archive.unpack(target_directory).map_err(Error::File)?;
}
// Remove downloaded archive
std::fs::remove_file(&download_file_path).map_err(Error::File)?;
Ok(())
}
#[derive(Debug)]
struct PolygonEdgeRelease {
version: String,
binary: String,
download_url: String,
}
async fn get_available_releases(repository: &str) -> Result<Vec<PolygonEdgeRelease>, Error> {
// Retrieve list of releases
let uri = GITHUB_REPO_API.to_string() + repository + "/releases";
info!("Retrieving Polygon Edge release list {uri}");
let client = reqwest::Client::new();
let body = client
.get(&uri)
.header(reqwest::header::USER_AGENT, "Topos CLI")
.send()
.await
.map_err(Error::Http)?
.text()
.await
.map_err(Error::Http)?;
let body: Vec<Value> = match serde_json::from_str(&body) {
Ok(v) => v,
Err(e) => {
error!("Error parsing release list response: {e}");
return Err(Error::InvalidJson(e));
}
};
if body.is_empty() {
error!("There is no valid Polygon Edge release available");
return Err(Error::NoValidRelease);
}
let mut releases: Vec<PolygonEdgeRelease> = Vec::new();
// Parse all releases
// List of retrieved releases is already sorted, latest release being
// the first one in the list
for release in &body {
let tag_name = release
.get("name")
.ok_or(Error::InvalidReleaseMetadata)?
.to_string()
.replace('\"', "");
let assets = release
.get("assets")
.ok_or(Error::InvalidReleaseMetadata)?
.as_array()
.ok_or(Error::InvalidReleaseMetadata)?;
for asset in assets {
if let Some(name) = asset.get("name").map(|v| v.to_string().replace('\"', "")) {
if let Some(url) = asset
.get("browser_download_url")
.map(|v| v.to_string().replace('\"', ""))
{
releases.push(PolygonEdgeRelease {
binary: name,
download_url: url,
version: tag_name.clone(),
})
}
}
}
}
Ok(releases)
}
/// Get list of releases from github repository
/// Download required release by version, or latest one if desired release was not provided
async fn get_release(
repository: &str,
version: &Option<String>,
) -> Result<PolygonEdgeRelease, Error> {
let releases = get_available_releases(repository).await?;
for release in releases {
let expected_binary = determine_binary_release_name(&release);
if let Some(version) = version {
if &release.version == version && release.binary == expected_binary {
return Ok(release);
}
} else if release.binary == expected_binary {
return Ok(release);
}
}
Err(Error::NoValidRelease)
}
pub async fn install_polygon_edge(
repository: String,
release: Option<String>,
path: &Path,
) -> Result<(), Error> {
// Select release for installation
let release = get_release(repository.as_str(), &release).await?;
info!(
"Selected release: {} from {}",
release.version, release.download_url
);
// Download and install Polygon Edge binary
if let Err(e) = download_binary(&release.binary, &release.download_url, path).await {
error!("Unable to install Polygon Edge binary {e}");
return Err(e);
}
Ok(())
}
pub async fn list_polygon_edge_releases(repository: String) -> Result<(), Error> {
// Retrieve list of available releases from the Github repository
let releases = get_available_releases(&repository).await?;
println!("Available Polygon Edge releases:");
releases
.into_iter()
.map(|r| r.version)
.collect::<HashSet<String>>()
.iter()
.for_each(|r| {
println!(" {}", r);
});
Ok(())
}
================================================
FILE: crates/topos/src/main.rs
================================================
use clap::Parser;
pub(crate) mod components;
pub(crate) mod options;
use crate::options::ToposCommand;
use tracing_log::LogTracer;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
LogTracer::init()?;
let args = options::Opt::parse();
match args.commands {
ToposCommand::Setup(cmd) => components::setup::handle_command(cmd).await,
ToposCommand::Node(cmd) => components::node::handle_command(cmd).await,
ToposCommand::Regtest(cmd) => components::regtest::handle_command(cmd).await,
}
}
================================================
FILE: crates/topos/src/options/input_format.rs
================================================
use clap::ValueEnum;
use serde::Serialize;
#[derive(ValueEnum, Copy, Clone, Debug, Serialize)]
pub(crate) enum InputFormat {
Json,
Plain,
}
================================================
FILE: crates/topos/src/options.rs
================================================
use clap::{Parser, Subcommand};
use std::{ffi::OsString, path::PathBuf};
use crate::components::node::commands::NodeCommand;
use crate::components::regtest::commands::RegtestCommand;
use crate::components::setup::commands::SetupCommand;
pub(crate) mod input_format;
#[derive(Parser, Debug)]
#[clap(name = "topos", about = "Topos CLI")]
pub(crate) struct Opt {
/// Defines the verbosity level
#[arg(
long,
short = 'v',
action = clap::ArgAction::Count,
global = true
)]
pub(crate) verbose: u8,
/// Disable color in logs
#[arg(long, global = true, env = "TOPOS_LOG_NOCOLOR")]
no_color: bool,
/// Home directory for the configuration
#[arg(
long,
env = "TOPOS_HOME",
default_value = get_default_home(),
global = true
)]
pub(crate) home: PathBuf,
#[command(subcommand)]
pub(crate) commands: ToposCommand,
}
/// If no path is given for the --home argument, we use the default one
/// ~/.config/topos for a UNIX subsystem
fn get_default_home() -> OsString {
let mut home = dirs::home_dir().unwrap();
home.push(".config");
home.push("topos");
home.into_os_string()
}
#[derive(Subcommand, Debug)]
pub(crate) enum ToposCommand {
Setup(SetupCommand),
Node(NodeCommand),
Regtest(RegtestCommand),
}
================================================
FILE: crates/topos/tests/cert_delivery.rs
================================================
use futures::{future::join_all, StreamExt};
use libp2p::PeerId;
use rand::seq::{IteratorRandom, SliceRandom};
use rstest::*;
use serial_test::serial;
use std::collections::{HashMap, HashSet};
use std::time::Duration;
use test_log::test;
use tokio::spawn;
use tokio::sync::mpsc;
use tonic::transport::Uri;
use topos_core::{
api::grpc::{
shared::v1::checkpoints::TargetCheckpoint,
tce::v1::{
api_service_client::ApiServiceClient,
console_service_client::ConsoleServiceClient,
watch_certificates_request::OpenStream,
watch_certificates_response::{CertificatePushed, Event},
StatusRequest, SubmitCertificateRequest,
},
},
uci::{Certificate, SubnetId, CERTIFICATE_ID_LENGTH, SUBNET_ID_LENGTH},
};
use topos_test_sdk::{certificates::create_certificate_chains, tce::create_network};
use tracing::{debug, info, warn};
const NUMBER_OF_SUBNETS_PER_CLIENT: usize = 1;
fn get_subset_of_subnets(subnets: &[SubnetId], subset_size: usize) -> Vec<SubnetId> {
let mut rng = rand::thread_rng();
Vec::from_iter(
subnets
.iter()
.cloned()
.choose_multiple(&mut rng, subset_size),
)
}
#[rstest]
#[test(tokio::test)]
#[timeout(Duration::from_secs(10))]
#[serial]
async fn start_a_cluster() {
let mut peers_context = create_network(5, &[]).await;
let mut status: Vec<bool> = Vec::new();
for (_peer_id, client) in peers_context.iter_mut() {
let response = client
.console_grpc_client
.status(StatusRequest {})
.await
.expect("Can't get status");
status.push(response.into_inner().has_active_sample);
}
assert!(status.iter().all(|s| *s));
}
#[rstest]
#[tokio::test]
#[timeout(Duration::from_secs(30))]
#[serial]
// FIXME: This test is flaky, it fails sometimes because of gRPC connection error (StreamClosed)
async fn cert_delivery() {
let subscriber = tracing_subscriber::FmtSubscriber::builder()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.with_test_writer()
.finish();
let _ = tracing::subscriber::set_global_default(subscriber);
let peer_number = 5;
let number_of_certificates_per_subnet = 2;
let number_of_subnets = 3;
let all_subnets: Vec<SubnetId> = (1..=number_of_subnets)
.map(|v| [v as u8; SUBNET_ID_LENGTH].into())
.collect();
// Generate certificates with respect to parameters
let mut subnet_certificates =
create_certificate_chains(all_subnets.as_ref(), number_of_certificates_per_subnet)
.into_iter()
.map(|(s, v)| (s, v.into_iter().map(|v| v.certificate).collect::<Vec<_>>()))
.collect::<HashMap<_, _>>();
debug!(
"Generated certificates for distribution per subnet: {:#?}",
&subnet_certificates
);
// Calculate expected final set of delivered certificates (every subnet should receive certificates that has cross
// chain transaction targeting it)
let mut expected_certificates: HashMap<SubnetId, HashSet<Certificate>> = HashMap::new();
for certificates in subnet_certificates.values() {
for cert in certificates {
for target_subnet in &cert.target_subnets {
expected_certificates
.entry(*target_subnet)
.or_default()
.insert(cert.clone());
}
}
}
warn!("Starting the cluster...");
// List of peers (tce nodes) with their context
let mut peers_context = create_network(peer_number, &[]).await;
warn!("Cluster started, starting clients...");
// Connected tce clients are passing received certificates to this mpsc::Receiver, collect all of them
let mut clients_delivered_certificates: Vec<mpsc::Receiver<(PeerId, SubnetId, Certificate)>> =
Vec::new(); // (Peer Id, Subnet Id, Certificate)
let mut client_tasks: Vec<tokio::task::JoinHandle<()>> = Vec::new(); // Clients connected to TCE API Service run in async tasks
let mut assign_at_least_one_client_to_every_subnet = all_subnets.clone();
for (peer_id, ctx) in peers_context.iter_mut() {
let peer_id = *peer_id;
// Make sure that every subnet is represented (connected through client) to at least 1 peer
// After that assign subnets randomly to clients, 1 subnet per connection to TCE
// as it is assumed that NUMBER_OF_SUBNETS_PER_CLIENT is 1 - that is also realistic case, topos node representing one subnet
let client_subnet_id: SubnetId = if assign_at_least_one_client_to_every_subnet.is_empty() {
get_subset_of_subnets(&all_subnets, NUMBER_OF_SUBNETS_PER_CLIENT).remove(0)
} else {
assign_at_least_one_client_to_every_subnet.pop().unwrap()
};
// Number of subnets one client is representing, normally 1
ctx.connected_subnets = Some(vec![client_subnet_id]);
debug!(
"Opening client for peer id: {} with subnet_ids: {:?}",
&peer_id, &client_subnet_id,
);
// (Peer id, Subnet Id, Certificate)
let (tx, rx) = mpsc::channel::<(PeerId, SubnetId, Certificate)>(
number_of_certificates_per_subnet * number_of_subnets,
);
clients_delivered_certificates.push(rx);
let in_stream_subnet_id = client_subnet_id;
let in_stream = async_stream::stream! {
yield OpenStream {
target_checkpoint: Some(TargetCheckpoint{
target_subnet_ids: vec![in_stream_subnet_id.into()],
positions: Vec::new()
}),
source_checkpoint: None
}.into();
};
// Number of certificates expected to receive for every subnet,
// to know when to close the TCE clients (and finish test)
let mut incoming_certificates_number =
expected_certificates.get(&client_subnet_id).unwrap().len();
// Open client connection to TCE service in separate async tasks
let mut client = ctx.api_grpc_client.clone();
let expected_certificate_debug: Vec<_> = expected_certificates
.get(&client_subnet_id)
.unwrap()
.iter()
.map(|c| c.id)
.collect();
let response = client.watch_certificates(in_stream).await.unwrap();
let client_task = spawn(async move {
debug!(
"Spawning client task for peer: {} waiting for {} certificates: {:?}",
peer_id, incoming_certificates_number, expected_certificate_debug
);
let mut resp_stream = response.into_inner();
while let Some(received) = resp_stream.next().await {
let received = received.unwrap();
if let Some(Event::CertificatePushed(CertificatePushed {
certificate: Some(certificate),
..
})) = received.event
{
debug!(
"Client peer_id: {} certificate id: {} delivered to subnet id {}, ",
&peer_id,
certificate.id.clone().unwrap(),
&client_subnet_id
);
tx.send((peer_id, client_subnet_id, certificate.try_into().unwrap()))
.await
.unwrap();
incoming_certificates_number -= 1;
if incoming_certificates_number == 0 {
// We have received all expected certificates for this subnet, end client
break;
}
}
}
debug!("Finishing client for peer_id: {}", &peer_id);
});
client_tasks.push(client_task);
}
info!(
"Waiting for expected delivered certificates {:?}",
expected_certificates
);
// Delivery tasks collect certificates that clients of every TCE node
// are receiving to reduce them to one channel (delivery_rx)
let mut delivery_tasks = Vec::new();
// delivery_tx/delivery_rx Pass certificates from delivery tasks of every client to final collection of delivered certificates
let (delivery_tx, mut delivery_rx) = mpsc::channel::<(PeerId, SubnetId, Certificate)>(
peer_number * number_of_certificates_per_subnet * number_of_subnets,
);
for (index, mut client_delivered_certificates) in
clients_delivered_certificates.into_iter().enumerate()
{
let delivery_tx = delivery_tx.clone();
let delivery_task = tokio::spawn(async move {
// Read certificates that every client has received
info!("Delivery task for receiver {}", index);
loop {
let x = client_delivered_certificates.recv().await;
match x {
Some((peer_id, target_subnet_id, cert)) => {
info!(
"Delivered certificate on peer_Id: {} cert id: {} from source subnet \
id: {} to target subnet id {}",
&peer_id, cert.id, cert.source_subnet_id, target_subnet_id
);
// Send certificates from every peer to one delivery_rx receiver
delivery_tx
.send((peer_id, target_subnet_id, cert))
.await
.unwrap();
}
_ => break,
}
}
// We will end this loop when sending TCE client has dropped channel sender and there
// are not certificates in channel
info!("End delivery task for receiver {}", index);
});
delivery_tasks.push(delivery_task);
}
drop(delivery_tx);
// Broadcast multiple certificates from all subnets
info!("Broadcasting certificates...");
for (peer_id, client) in peers_context.iter_mut() {
// If there exist of connected subnets to particular TCE
if let Some(ref connected_subnets) = client.connected_subnets {
// Iterate all subnets connected to TCE (normally 1)
for subnet_id in connected_subnets {
if let Some(certificates) = subnet_certificates.get_mut(subnet_id) {
// Iterate all certificates meant to be sent to the particular network
for cert in certificates.iter() {
info!(
"Sending certificate id={} from subnet id: {} to peer id: {}",
&cert.id, &subnet_id, &peer_id
);
let _ = client
.api_grpc_client
.submit_certificate(SubmitCertificateRequest {
certificate: Some(cert.clone().into()),
})
.await
.expect("Can't send certificate");
}
// Remove sent certificate, every certificate is sent only once to TCE network
certificates.clear();
}
}
}
}
let assertion = async move {
info!("Waiting for all delivery tasks");
join_all(delivery_tasks).await;
info!("All expected clients delivered");
let mut delivered_certificates: HashMap<PeerId, HashMap<SubnetId, HashSet<Certificate>>> =
HashMap::new();
// Collect all certificates per peer_id and subnet_id
while let Some((peer_id, receiving_subnet_id, cert)) = delivery_rx.recv().await {
debug!("Counting delivered certificate cert id: {:?}", cert.id);
delivered_certificates
.entry(peer_id)
.or_default()
.entry(receiving_subnet_id)
.or_default()
.insert(cert);
}
info!("All incoming certificates received");
// Check received certificates for every peer and every subnet
for delivered_certificates_per_peer in delivered_certificates.values() {
for (subnet_id, delivered_certificates_per_subnet) in delivered_certificates_per_peer {
assert_eq!(
expected_certificates.get(subnet_id).unwrap().len(),
delivered_certificates_per_subnet.len()
);
assert_eq!(
expected_certificates.get(subnet_id).unwrap(),
delivered_certificates_per_subnet
);
}
}
};
// Set big timeout to prevent flaky fails. Instead fail/panic early in the test to indicate actual error
if tokio::time::timeout(std::time::Duration::from_secs(30), assertion)
.await
.is_err()
{
panic!("Timeout waiting for command");
}
}
// Picks a random peer and sends it a certificate. All other peers listen for broadcast certs.
// Three possible outcomes:
// 1. No errors, returns Ok
// 2. There were errors, returns a list of all errors encountered
// 3. timeout
async fn assert_certificate_full_delivery(
timeout_broadcast: Duration,
peers: Vec<Uri>,
) -> Result<(), Box<dyn std::error::Error>> {
use std::io::{Error, ErrorKind};
let random_peer: Uri = peers
.choose(&mut rand::thread_rng())
.ok_or_else(|| {
Error::new(
ErrorKind::Other,
"Unable to select a random peer from the list: {peers:?}",
)
})?
.try_into()?;
let pushed_certificate = Certificate::new_with_default_fields(
[0u8; CERTIFICATE_ID_LENGTH],
[1u8; SUBNET_ID_LENGTH].into(),
&[[2u8; SUBNET_ID_LENGTH].into()],
)?;
let certificate_id = pushed_certificate.id;
let mut join_handlers = Vec::new();
// check that all nodes delivered the certificate
for peer in peers {
join_handlers.push(tokio::spawn(async move {
let peer_string = peer.clone();
let mut client = ConsoleServiceClient::connect(peer_string.clone())
.await
.map_err(|_| (peer_string.clone(), "Unable to connect to the api console"))?;
let result = client.status(StatusRequest {}).await.map_err(|_| {
(
peer_string.clone(),
"Unable to get the status from the api console",
)
})?;
let status = result.into_inner();
if !status.has_active_sample {
return Err((peer_string, "failed to find active sample"));
}
let mut client = ApiServiceClient::connect(peer_string.clone())
.await
.map_err(|_| (peer_string.clone(), "Unable to connect to the TCE api"))?;
let in_stream = async_stream::stream! {
yield OpenStream {
target_checkpoint: Some(TargetCheckpoint {
target_subnet_ids: vec![[2u8; SUBNET_ID_LENGTH].into()],
positions: vec![]
}),
source_checkpoint: None
}.into()
};
let response = client.watch_certificates(in_stream).await.map_err(|_| {
(
peer_string.clone(),
"Unable to execute the watch_certificates on TCE api",
)
})?;
let mut resp_stream = response.into_inner();
async move {
while let Some(received) = resp_stream.next().await {
let received = received.unwrap();
if let Some(Event::CertificatePushed(CertificatePushed {
certificate: Some(certificate),
..
})) = received.event
{
// unwrap is safe because we are sure that the certificate is present
if certificate_id == certificate.id.unwrap() {
debug!("Received the certificate on {}", peer_string);
return Ok(());
}
}
}
Err((peer_string.clone(), "didn't receive any certificate"))
}
.await
}));
}
let mut client = ApiServiceClient::connect(random_peer.clone()).await?;
// submit a certificate to one node
_ = client
.submit_certificate(SubmitCertificateRequest {
certificate: Some(pushed_certificate.into()),
})
.await?;
tokio::time::sleep(timeout_broadcast).await;
join_all(join_handlers)
.await
.iter()
.for_each(|result| match result {
Err(e) => {
panic!("Join error: {e}");
}
Ok(Err((peer, error))) => {
panic!("Peer {peer} error: {error}");
}
_ => {}
});
Ok(())
}
async fn run_assert_certificate_full_delivery(
number_of_nodes: usize,
timeout_broadcast: Duration,
) -> Result<(), Box<dyn std::error::Error>> {
let mut peers_context = create_network(number_of_nodes, &[]).await;
for (_peer_id, client) in peers_context.iter_mut() {
let response = client
.console_grpc_client
.status(StatusRequest {})
.await
.expect("Can't get status");
assert!(response.into_inner().has_active_sample);
}
let nodes = peers_context
.iter()
.map(|peer| peer.1.api_entrypoint.clone())
.collect::<Vec<_>>();
debug!("Nodes used in test: {:?}", nodes);
let assertion = async move {
let peers: Vec<tonic::transport::Uri> = nodes
.into_iter()
.map(TryInto::try_into)
.collect::<Result<_, _>>()
.map_err(|e| format!("Unable to parse node list: {e}"))
.expect("Valid node list");
match assert_certificate_full_delivery(timeout_broadcast, peers).await {
Ok(()) => {
info!("Check certificate delivery passed for network of {number_of_nodes}!");
}
Err(e) => {
panic!("Test error: {e}");
}
}
};
assertion.await;
Ok(())
}
mod serial_integration {
use super::*;
#[rstest]
#[case(5usize)]
#[case(9usize)]
#[test_log::test(tokio::test)]
#[trace]
#[timeout(Duration::from_secs(30))]
async fn push_and_deliver_cert(
#[case] number_of_nodes: usize,
) -> Result<(), Box<dyn std::error::Error>> {
run_assert_certificate_full_delivery(number_of_nodes, Duration::from_secs(10)).await
}
}
================================================
FILE: crates/topos/tests/config.rs
================================================
use assert_cmd::prelude::*;
use regex::Regex;
use std::path::PathBuf;
use std::process::{Command, Stdio};
use tempfile::tempdir;
use tokio::fs::OpenOptions;
use tokio::io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt};
use toml::map::Map;
use toml::Value;
use topos_test_sdk::create_folder;
use crate::utils::setup_polygon_edge;
mod utils;
mod serial_integration {
use rstest::rstest;
use sysinfo::{Pid, PidExt, ProcessExt, Signal, System, SystemExt};
use super::*;
#[rstest]
#[tokio::test]
async fn handle_command_init(
#[from(create_folder)] home: PathBuf,
) -> Result<(), Box<dyn std::error::Error>> {
let path = setup_polygon_edge(home.to_str().unwrap()).await;
let mut cmd = Command::cargo_bin("topos")?;
cmd.arg("node")
.arg("--edge-path")
.arg(path)
.arg("init")
.arg("--home")
.arg(home.to_str().unwrap());
let output = cmd.assert().success();
let result: &str = std::str::from_utf8(&output.get_output().stdout)?;
assert!(result.contains("Created node config file"));
// Verification: check that the config file was created
let config_path = home.join("node").join("default").join("config.toml");
assert!(config_path.exists());
// Further verification might include checking the contents of the config file
let config_contents = std::fs::read_to_string(&config_path).unwrap();
assert!(config_contents.contains("[base]"));
assert!(config_contents.contains("name = \"default\""));
assert!(config_contents.contains("[edge]"));
assert!(config_contents.contains("[tce]"));
Ok(())
}
#[tokio::test]
async fn handle_command_init_without_polygon_edge() -> Result<(), Box<dyn std::error::Error>> {
let tmp_home_dir = tempdir()?;
let mut cmd = Command::cargo_bin("topos")?;
cmd.arg("node")
.arg("init")
.arg("--home")
.arg(tmp_home_dir.path().to_str().unwrap())
.arg("--no-edge-process");
let output = cmd.assert().success();
let result: &str = std::str::from_utf8(&output.get_output().stdout)?;
assert!(result.contains("Created node config file"));
let home = PathBuf::from(tmp_home_dir.path());
// Verification: check that the config file was created
let config_path = home.join("node").join("default").join("config.toml");
assert!(config_path.exists());
// Further verification might include checking the contents of the config file
let config_contents = std::fs::read_to_string(&config_path).unwrap();
assert!(config_contents.contains("[base]"));
assert!(config_contents.contains("name = \"default\""));
assert!(config_contents.contains("[tce]"));
Ok(())
}
#[test]
fn nothing_written_if_failure() -> Result<(), Box<dyn std::error::Error>> {
let tmp_home_dir = tempdir()?;
let mut cmd = Command::cargo_bin("topos")?;
cmd.arg("node")
.arg("--edge-path")
.arg("./inexistent/folder/") // Command will fail
.arg("init")
.arg("--home")
.arg(tmp_home_dir.path().to_str().unwrap());
// Should fail
cmd.assert().failure();
let home = PathBuf::from(tmp_home_dir.path().to_str().unwrap());
// Check that files were NOT created
let config_path = home.join("node").join("default");
assert!(!config_path.exists());
Ok(())
}
#[tokio::test]
async fn handle_command_init_with_custom_name() -> Result<(), Box<dyn std::error::Error>> {
let tmp_home_dir = tempdir()?;
let node_name = "TEST_NODE";
let path = setup_polygon_edge(tmp_home_dir.path().to_str().unwrap()).await;
let mut cmd = Command::cargo_bin("topos")?;
cmd.arg("node")
.arg("--edge-path")
.arg(path.clone())
.arg("init")
.arg("--home")
.arg(tmp_home_dir.path().to_str().unwrap())
.arg("--name")
.arg(node_name);
let output = cmd.assert().success();
let result: &str = std::str::from_utf8(&output.get_output().stdout)?;
assert!(result.contains("Created node config file"));
let home = PathBuf::from(path);
// Verification: check that the config file was created
let config_path = home.join("node").join(node_name).join("config.toml");
assert!(config_path.exists());
// Further verification might include checking the contents of the config file
let config_contents = std::fs::read_to_string(&config_path).unwrap();
assert!(config_contents.contains("[base]"));
assert!(config_contents.contains(node_name));
assert!(config_contents.contains("[tce]"));
Ok(())
}
/// Test node init env arguments
#[rstest]
#[tokio::test]
async fn command_init_precedence_env(
create_folder: PathBuf,
) -> Result<(), Box<dyn std::error::Error>> {
let tmp_home_directory = create_folder;
// Test node init with env variables
let node_init_home_env = tmp_home_directory
.to_str()
.expect("path names are valid utf-8");
let node_edge_path_env = setup_polygon_edge(node_init_home_env).await;
let node_init_name_env = "TEST_NODE_ENV";
let node_init_role_env = "full-node";
let node_init_subnet_env = "topos-env";
let mut cmd = Command::cargo_bin("topos")?;
cmd.arg("node")
.env("TOPOS_POLYGON_EDGE_BIN_PATH", &node_edge_path_env)
.env("TOPOS_HOME", node_init_home_env)
.env("TOPOS_NODE_NAME", node_init_name_env)
.env("TOPOS_NODE_ROLE", node_init_role_env)
.env("TOPOS_NODE_SUBNET", node_init_subnet_env)
.arg("init");
let output = cmd.assert().success();
let result: &str = std::str::from_utf8(&output.get_output().stdout)?;
// Test node init with cli flags
assert!(result.contains("Created node config file"));
let home = PathBuf::from(node_init_home_env);
// Verification: check that the config file was created
let config_path = home
.join("node")
.join(node_init_name_env)
.join("config.toml");
assert!(config_path.exists());
// Check if config file params are according to env params
let config_contents = std::fs::read_to_string(&config_path).unwrap();
assert!(config_contents.contains("name = \"TEST_NODE_ENV\""));
assert!(config_contents.contains("role = \"fullnode\""));
assert!(config_contents.contains("subnet = \"topos-env\""));
Ok(())
}
/// Test node cli arguments precedence over env arguments
#[tokio::test]
async fn command_init_precedence_cli_env() -> Result<(), Box<dyn std::error::Error>> {
let tmp_home_dir_env = create_folder("command_init_precedence_cli_env");
let tmp_home_dir_cli = create_folder("command_init_precedence_cli_env");
// Test node init with both cli and env flags
// Cli arguments should take precedence over env variables
let node_init_home_env = tmp_home_dir_env.to_str().unwrap();
let node_edge_path_env = setup_polygon_edge(node_init_home_env).await;
let node_init_name_env = "TEST_NODE_ENV";
let node_init_role_env = "full-node";
let node_init_subnet_env = "topos-env";
let node_init_home_cli = tmp_home_dir_cli.to_str().unwrap();
let node_edge_path_cli = node_edge_path_env.clone();
let node_init_name_cli = "TEST_NODE_CLI";
let node_init_role_cli = "sequencer";
let node_init_subnet_cli = "topos-cli";
let mut cmd = Command::cargo_bin("topos")?;
cmd.arg("node")
.env("TOPOS_POLYGON_EDGE_BIN_PATH", &node_edge_path_env)
.env("TOPOS_HOME", node_init_home_env)
.env("TOPOS_NODE_NAME", node_init_name_env)
.env("TOPOS_NODE_ROLE", node_init_role_env)
.env("TOPOS_NODE_SUBNET", node_init_subnet_env)
.arg("--edge-path")
.arg(node_edge_path_cli)
.arg("init")
.arg("--name")
.arg(node_init_name_cli)
.arg("--home")
.arg(node_init_home_cli)
.arg("--role")
.arg(node_init_role_cli)
.arg("--subnet")
.arg(node_init_subnet_cli);
let output = cmd.assert().success();
let result: &str = std::str::from_utf8(&output.get_output().stdout)?;
assert!(result.contains("Created node config file"));
let home = PathBuf::from(node_init_home_cli);
// Verification: check that the config file was created
let config_path = home
.join("node")
.join(node_init_name_cli)
.join("config.toml");
assert!(config_path.exists());
// Check if config file params are according to cli params
let config_contents = std::fs::read_to_string(&config_path).unwrap();
assert!(config_contents.contains("name = \"TEST_NODE_CLI\""));
assert!(config_contents.contains("role = \"sequencer\""));
assert!(config_contents.contains("subnet = \"topos-cli\""));
Ok(())
}
/// Test node up running from config file
#[rstest]
#[test_log::test(tokio::test)]
async fn command_node_up(
#[from(create_folder)] tmp_home_dir: PathBuf,
) -> Result<(), Box<dyn std::error::Error>> {
// Create config file
let node_up_home_env = tmp_home_dir.to_str().unwrap();
let node_edge_path_env = setup_polygon_edge(node_up_home_env).await;
let node_up_name_env = "TEST_NODE_UP";
let node_up_role_env = "full-node";
let node_up_subnet_env = "topos";
let mut cmd = Command::cargo_bin("topos")?;
cmd.arg("node")
.env("TOPOS_POLYGON_EDGE_BIN_PATH", &node_edge_path_env)
.env("TOPOS_HOME", node_up_home_env)
.env("TOPOS_NODE_NAME", node_up_name_env)
.env("TOPOS_NODE_ROLE", node_up_role_env)
.env("TOPOS_NODE_SUBNET", node_up_subnet_env)
.arg("init");
let output = cmd.assert().success();
let result: &str = std::str::from_utf8(&output.get_output().stdout)?;
assert!(result.contains("Created node config file"));
// Run node init with cli flags
let home = PathBuf::from(node_up_home_env);
// Verification: check that the config file was created
let config_path = home.join("node").join(node_up_name_env).join("config.toml");
assert!(config_path.exists());
// Generate polygon edge genesis file
let polygon_edge_bin = format!("{}/polygon-edge", node_edge_path_env);
utils::generate_polygon_edge_genesis_file(
&polygon_edge_bin,
node_up_home_env,
node_up_name_env,
node_up_subnet_env,
)
.await?;
let polygon_edge_genesis_path = home
.join("subnet")
.join(node_up_subnet_env)
.join("genesis.json");
assert!(polygon_edge_genesis_path.exists());
let mut cmd = Command::cargo_bin("topos")?;
cmd.arg("node")
.env("TOPOS_POLYGON_EDGE_BIN_PATH", &node_edge_path_env)
.env("TOPOS_HOME", node_up_home_env)
.env("TOPOS_NODE_NAME", node_up_name_env)
.env("RUST_LOG", "topos=debug")
.arg("up")
.stdout(Stdio::piped());
let cmd = tokio::process::Command::from(cmd).spawn().unwrap();
let pid = cmd.id().unwrap();
let _ = tokio::time::sleep(std::time::Duration::from_secs(10)).await;
let s = System::new_all();
if let Some(process) = s.process(Pid::from_u32(pid)) {
if process.kill_with(Signal::Term).is_none() {
eprintln!("This signal isn't supported on this platform");
}
}
if let Ok(output) = cmd.wait_with_output().await {
assert!(output.status.success());
let stdout = output.stdout;
let stdout = String::from_utf8_lossy(&stdout);
let reg =
Regex::new(r#"Local node is listening on "\/ip4\/.*\/tcp\/9090\/p2p\/"#).unwrap();
assert!(reg.is_match(&stdout));
} else {
panic!("Failed to shutdown gracefully");
}
// Cleanup
std::fs::remove_dir_all(node_up_home_env)?;
Ok(())
}
/// Test node up running from config file
#[rstest::rstest]
#[test_log::test(tokio::test)]
async fn command_node_up_with_old_config(
#[from(create_folder)] tmp_home_dir: PathBuf,
) -> Result<(), Box<dyn std::error::Error>> {
// Create config file
let node_up_home_env = tmp_home_dir.to_str().unwrap();
let node_edge_path_env = setup_polygon_edge(node_up_home_env).await;
let node_up_name_env = "test_node_up_old_config";
let node_up_subnet_env = "topos";
let mut cmd = Command::cargo_bin("topos")?;
cmd.arg("node")
.env("TOPOS_POLYGON_EDGE_BIN_PATH", &node_edge_path_env)
.env("TOPOS_HOME", node_up_home_env)
.env("TOPOS_NODE_NAME", node_up_name_env)
.env("TOPOS_NODE_SUBNET", node_up_subnet_env)
.arg("init");
let output = cmd.assert().success();
let result: &str = std::str::from_utf8(&output.get_output().stdout)?;
assert!(result.contains("Created node config file"));
// Run node init with cli flags
let home = PathBuf::from(node_up_home_env);
// Verification: check that the config file was created
let config_path = home.join("node").join(node_up_name_env).join("config.toml");
assert!(config_path.exists());
let mut file = OpenOptions::new()
.read(true)
.write(true)
.open(config_path.clone())
.await?;
let mut buf = String::new();
let _ = file.read_to_string(&mut buf).await?;
let mut current: Map<String, Value> = toml::from_str(&buf)?;
let tce = current.get_mut("tce").unwrap();
if let Value::Table(tce_table) = tce {
tce_table.insert(
"libp2p-api-addr".to_string(),
Value::String("0.0.0.0:9091".to_string()),
);
tce_table.insert("minimum-tce-cluster-size".to_string(), Value::Integer(0));
tce_table.insert("network-bootstrap-timeout".to_string(), Value::Integer(5));
tce_table.remove("p2p");
} else {
panic!("TCE configuration table malformed");
}
let _ = file.set_len(0).await;
let _ = file.seek(std::io::SeekFrom::Start(0)).await;
let _ = file.write_all(toml::to_string(¤t)?.as_bytes()).await;
drop(file);
// Generate polygon edge genesis file
let polygon_edge_bin = format!("{}/polygon-edge", node_edge_path_env);
utils::generate_polygon_edge_genesis_file(
&polygon_edge_bin,
node_up_home_env,
node_up_name_env,
node_up_subnet_env,
)
.await?;
let polygon_edge_genesis_path = home
.join("subnet")
.join(node_up_subnet_env)
.join("genesis.json");
assert!(polygon_edge_genesis_path.exists());
let mut cmd = Command::cargo_bin("topos")?;
cmd.arg("node")
.env("TOPOS_POLYGON_EDGE_BIN_PATH", &node_edge_path_env)
.env("TOPOS_NODE_NAME", node_up_name_env)
.env("TOPOS_HOME", node_up_home_env)
.env("RUST_LOG", "topos=info")
.arg("up")
.stdout(Stdio::piped());
let cmd = tokio::process::Command::from(cmd).spawn().unwrap();
let pid = cmd.id().unwrap();
let _ = tokio::time::sleep(std::time::Duration::from_secs(10)).await;
let s = System::new_all();
if let Some(process) = s.process(Pid::from_u32(pid)) {
if process.kill_with(Signal::Term).is_none() {
eprintln!("This signal isn't supported on this platform");
}
}
if let Ok(output) = cmd.wait_with_output().await {
assert!(output.status.success());
let stdout = output.stdout;
let stdout = String::from_utf8_lossy(&stdout);
let reg =
Regex::new(r#"Local node is listening on "\/ip4\/.*\/tcp\/9091\/p2p\/"#).unwrap();
assert!(reg.is_match(&stdout));
} else {
panic!("Failed to shutdown gracefully");
}
// Cleanup
std::fs::remove_dir_all(node_up_home_env)?;
Ok(())
}
}
================================================
FILE: crates/topos/tests/node.rs
================================================
mod utils;
use std::{path::PathBuf, process::Command};
use assert_cmd::prelude::*;
use sysinfo::{Pid, PidExt, ProcessExt, Signal, System, SystemExt};
use tempfile::tempdir;
use crate::utils::generate_polygon_edge_genesis_file;
#[test]
fn help_display() -> Result<(), Box<dyn std::error::Error>> {
let mut cmd = Command::cargo_bin("topos")?;
cmd.arg("node").arg("-h");
let output = cmd.assert().success();
let result: &str = std::str::from_utf8(&output.get_output().stdout)?;
insta::assert_snapshot!(utils::sanitize_config_folder_path(result));
Ok(())
}
mod serial_integration {
use super::*;
/// Test node up running from config file
#[test_log::test(tokio::test)]
async fn command_node_up_sigterm() -> Result<(), Box<dyn std::error::Error>> {
let tmp_home_dir = tempdir()?;
// Create config file
let node_up_home_env = tmp_home_dir.path().to_str().unwrap();
let node_edge_path_env = utils::setup_polygon_edge(node_up_home_env).await;
let node_up_name_env = "TEST_NODE_UP";
let node_up_role_env = "full-node";
let node_up_subnet_env = "topos-up-env-subnet";
let mut cmd = Command::cargo_bin("topos")?;
cmd.arg("node")
.env("TOPOS_POLYGON_EDGE_BIN_PATH", &node_edge_path_env)
.env("TOPOS_HOME", node_up_home_env)
.env("TOPOS_NODE_NAME", node_up_name_env)
.env("TOPOS_NODE_ROLE", node_up_role_env)
.env("TOPOS_NODE_SUBNET", node_up_subnet_env)
.arg("init");
let output = cmd.assert().success();
let result: &str = std::str::from_utf8(&output.get_output().stdout)?;
assert!(result.contains("Created node config file"));
// Run node init with cli flags
let home = PathBuf::from(node_up_home_env);
// Verification: check that the config file was created
let config_path = home.join("node").join(node_up_name_env).join("config.toml");
assert!(config_path.exists());
// Generate polygon edge genesis file
let polygon_edge_bin = format!("{}/polygon-edge", node_edge_path_env);
generate_polygon_edge_genesis_file(
&polygon_edge_bin,
node_up_home_env,
node_up_name_env,
node_up_subnet_env,
)
.await?;
let polygon_edge_genesis_path = home
.join("subnet")
.join(node_up_subnet_env)
.join("genesis.json");
assert!(polygon_edge_genesis_path.exists());
let mut cmd = Command::cargo_bin("topos")?;
cmd.arg("node")
.env("TOPOS_POLYGON_EDGE_BIN_PATH", &node_edge_path_env)
.env("TOPOS_HOME", node_up_home_env)
.env("TOPOS_NODE_NAME", node_up_name_env)
.arg("up");
let mut cmd = tokio::process::Command::from(cmd).spawn().unwrap();
let pid = cmd.id().unwrap();
let _ = tokio::time::sleep(std::time::Duration::from_secs(10)).await;
let s = System::new_all();
if let Some(process) = s.process(Pid::from_u32(pid)) {
if process.kill_with(Signal::Term).is_none() {
eprintln!("This signal isn't supported on this platform");
}
}
if let Ok(code) = cmd.wait().await {
assert!(code.success());
} else {
panic!("Failed to shutdown gracefully");
}
// Cleanup
std::fs::remove_dir_all(node_up_home_env)?;
Ok(())
}
#[test_log::test(tokio::test)]
async fn command_node_up_custom_polygon() -> Result<(), Box<dyn std::error::Error>> {
let tmp_home_dir = tempdir()?;
// Create config file
let node_up_home_env = tmp_home_dir.path().to_str().unwrap();
let custom_path = tmp_home_dir.path().join("custom_path");
let node_edge_path_env = utils::setup_polygon_edge(custom_path.to_str().unwrap()).await;
let node_up_name_env = "TEST_NODE_UP";
let node_up_role_env = "full-node";
let node_up_subnet_env = "topos-up-env-subnet";
let mut cmd = Command::cargo_bin("topos")?;
cmd.arg("node")
.env("TOPOS_POLYGON_EDGE_BIN_PATH", &node_edge_path_env)
.env("TOPOS_HOME", node_up_home_env)
.env("TOPOS_NODE_NAME", node_up_name_env)
.env("TOPOS_NODE_ROLE", node_up_role_env)
.env("TOPOS_NODE_SUBNET", node_up_subnet_env)
.arg("init");
let output = cmd.assert().success();
let result: &str = std::str::from_utf8(&output.get_output().stdout)?;
assert!(result.contains("Created node config file"));
// Run node init with cli flags
let home = PathBuf::from(node_up_home_env);
// Verification: check that the config file was created
let config_path = home.join("node").join(node_up_name_env).join("config.toml");
assert!(config_path.exists());
// Generate polygon edge genesis file
let polygon_edge_bin = format!("{}/polygon-edge", node_edge_path_env);
generate_polygon_edge_genesis_file(
&polygon_edge_bin,
node_up_home_env,
node_up_name_env,
node_up_subnet_env,
)
.await?;
let polygon_edge_genesis_path = home
.join("subnet")
.join(node_up_subnet_env)
.join("genesis.json");
assert!(polygon_edge_genesis_path.exists());
let mut cmd = Command::cargo_bin("topos")?;
cmd.arg("node")
.env("TOPOS_POLYGON_EDGE_BIN_PATH", &node_edge_path_env)
.env("TOPOS_HOME", node_up_home_env)
.env("TOPOS_NODE_NAME", node_up_name_env)
.arg("up");
let mut cmd = tokio::process::Command::from(cmd).spawn().unwrap();
let pid = cmd.id().unwrap();
let _ = tokio::time::sleep(std::time::Duration::from_secs(10)).await;
let s = System::new_all();
if let Some(process) = s.process(Pid::from_u32(pid)) {
if process.kill_with(Signal::Term).is_none() {
eprintln!("This signal isn't supported on this platform");
}
}
if let Ok(code) = cmd.wait().await {
assert!(code.success());
} else {
panic!("Failed to shutdown gracefully");
}
// Cleanup
std::fs::remove_dir_all(node_up_home_env)?;
Ok(())
}
}
================================================
FILE: crates/topos/tests/regtest.rs
================================================
mod utils;
use std::process::Command;
use assert_cmd::prelude::*;
#[test]
fn regtest_spam_help_display() -> Result<(), Box<dyn std::error::Error>> {
let mut cmd = Command::cargo_bin("topos")?;
cmd.arg("regtest").arg("spam").arg("-h");
let output = cmd.assert().success();
let result: &str = std::str::from_utf8(&output.get_output().stdout)?;
insta::assert_snapshot!(utils::sanitize_config_folder_path(result));
Ok(())
}
#[test]
fn regtest_spam_invalid_hosts() -> Result<(), Box<dyn std::error::Error>> {
let mut cmd = Command::cargo_bin("topos")?;
cmd.arg("regtest")
.arg("spam")
.arg("--benchmark")
.arg("--target-hosts")
.arg("asd")
.arg("--number")
.arg("1");
let output = cmd.assert().failure();
let result: &str = std::str::from_utf8(&output.get_output().stdout)?;
assert!(result.contains(
"Invalid target-hosts pattern. Has to be in the format of http://validator-1:9090"
));
Ok(())
}
#[test]
fn regtest_spam_invalid_number() -> Result<(), Box<dyn std::error::Error>> {
let mut cmd = Command::cargo_bin("topos")?;
cmd.arg("regtest")
.arg("spam")
.arg("--benchmark")
.arg("--target-hosts")
.arg(" http://validator-{N}:9090")
.arg("--number")
.arg("dasd");
cmd.assert().failure();
Ok(())
}
================================================
FILE: crates/topos/tests/setup.rs
================================================
mod utils;
use std::{fs, process::Command};
use assert_cmd::prelude::*;
use tempfile::tempdir;
#[test]
fn setup_subnet_install_edge() -> Result<(), Box<dyn std::error::Error>> {
let tmp_home_dir = tempdir()?;
let mut cmd = Command::cargo_bin("topos")?;
cmd.arg("setup")
.arg("subnet")
.arg("--path")
.arg(tmp_home_dir.path());
let output = cmd.assert().success();
let result: &str = std::str::from_utf8(&output.get_output().stdout)?;
assert!(result.contains("Polygon Edge installation successful"));
Ok(())
}
#[test]
fn setup_with_no_arguments() -> Result<(), Box<dyn std::error::Error>> {
let mut cmd = Command::cargo_bin("topos")?;
cmd.arg("setup");
let output = cmd.assert().failure();
let result: &str = std::str::from_utf8(&output.get_output().stderr)?;
assert!(result
.contains("No subcommand provided. You can use `--help` to see available subcommands."));
Ok(())
}
#[test]
fn setup_subnet_fail_to_install_release() -> Result<(), Box<dyn std::error::Error>> {
let tmp_home_dir = tempdir()?;
let mut cmd = Command::cargo_bin("topos")?;
cmd.arg("setup")
.arg("subnet")
.arg("--path")
.arg(tmp_home_dir.path())
.arg("--release")
.arg("invalid");
let output = cmd.assert().failure();
let result: &str = std::str::from_utf8(&output.get_output().stderr)?;
assert!(result.contains(
"Error installing Polygon Edge: There is no valid Polygon Edge release available"
));
Ok(())
}
#[test]
fn setup_subnet_install_edge_custom_path() -> Result<(), Box<dyn std::error::Error>> {
let tmp_home_dir = tempdir()?;
let custom_path = tmp_home_dir.path().join("custom_path");
fs::create_dir(&custom_path).unwrap();
let mut cmd = Command::cargo_bin("topos")?;
cmd.arg("setup")
.arg("subnet")
.arg("--path")
.arg(&custom_path);
let output = cmd.assert().success();
let result: &str = std::str::from_utf8(&output.get_output().stdout)?;
assert!(result.contains("Polygon Edge installation successful"));
let file = fs::read_dir(&custom_path)
.unwrap()
.filter_map(|x| match x.ok() {
Some(f) if f.path().ends_with("polygon-edge") => Some(f),
_ => None,
})
.last()
.unwrap();
assert!(file.path().starts_with(&custom_path));
Ok(())
}
#[test]
fn setup_subnet_install_edge_custom_path_env() -> Result<(), Box<dyn std::error::Error>> {
let tmp_home_dir = tempdir()?;
let custom_path = tmp_home_dir.path().join("custom_path");
fs::create_dir(&custom_path).unwrap();
let mut cmd = Command::cargo_bin("topos")?;
cmd.env("TOPOS_SETUP_POLYGON_EDGE_DIR", &custom_path)
.arg("setup")
.arg("subnet");
let output = cmd.assert().success();
let result: &str = std::str::from_utf8(&output.get_output().stdout)?;
assert!(result.contains("Polygon Edge installation successful"));
let file = fs::read_dir(&custom_path)
.unwrap()
.filter_map(|x| match x.ok() {
Some(f) if f.path().ends_with("polygon-edge") => Some(f),
_ => None,
})
.last()
.unwrap();
assert!(file.path().starts_with(&custom_path));
Ok(())
}
================================================
FILE: crates/topos/tests/snapshots/node__help_display.snap
================================================
---
source: crates/topos/tests/node.rs
expression: "utils::sanitize_config_folder_path(result)"
---
Utility to manage your nodes in the Topos network
Usage: topos node [OPTIONS] [COMMAND]
Commands:
up Spawn your node
init Setup your node
status Get node status
help Print this message or the help of the given subcommand(s)
Options:
--edge-path <EDGE_PATH> Installation directory path for Polygon Edge binary [env: TOPOS_POLYGON_EDGE_BIN_PATH=] [default: .]
-v, --verbose... Defines the verbosity level
--no-color Disable color in logs [env: TOPOS_LOG_NOCOLOR=]
--home <HOME> Home directory for the configuration [env: TOPOS_HOME=] [default: /home/runner/.config/topos]
-h, --help Print help
================================================
FILE: crates/topos/tests/snapshots/push_certificate__help_display.snap
================================================
---
source: crates/topos/tests/push-certificate.rs
expression: "utils::sanitize_config_folder_path(result)"
---
Push a certificate to a TCE process
Usage: topos regtest push-certificate [OPTIONS]
Options:
-f, --format <FORMAT>
[default: plain] [possible values: json, plain]
-v, --verbose...
Defines the verbosity level
--no-color
Disable color in logs [env: TOPOS_LOG_NOCOLOR=]
-t, --timeout <TIMEOUT>
Global timeout for the command [default: 60]
--home <HOME>
Home directory for the configuration [env: TOPOS_HOME=] [default: /home/runner/.config/topos]
--timeout-broadcast <TIMEOUT_BROADCAST>
Seconds to wait before asserting the broadcast [default: 30]
-n, --nodes <NODES>
The node list to be used, can be a file path or a comma separated list of Uri. If not provided, stdin is listened [env: TARGET_NODES_PATH=]
-h, --help
Print help
================================================
FILE: crates/topos/tests/snapshots/regtest__regtest_spam_help_display.snap
================================================
---
source: crates/topos/tests/regtest.rs
expression: "utils::sanitize_config_folder_path(result)"
---
Run a test topos certificate spammer to send test certificates to the network, generating randomly among the `nb_subnets` subnets the batch of `cert_per_batch` certificates at every `batch-interval`
Usage: topos regtest spam [OPTIONS]
Options:
--target-nodes <TARGET_NODES>
The target node api endpoint. Multiple nodes could be specified as comma separated list e.g. `--target-nodes=http://[::1]:1340,http://[::1]:1341` [env: TOPOS_NETWORK_SPAMMER_TARGET_NODES=]
-v, --verbose...
Defines the verbosity level
--no-color
Disable color in logs [env: TOPOS_LOG_NOCOLOR=]
--target-nodes-path <TARGET_NODES_PATH>
Path to json file with list of target nodes as alternative to `--target-nodes` [env: TOPOS_NETWORK_SPAMMER_TARGET_NODES_PATH=]
--home <HOME>
Home directory for the configuration [env: TOPOS_HOME=] [default: /home/runner/.config/topos]
--local-key-seed <LOCAL_KEY_SEED>
Seed for generation of local private signing keys and corresponding subnet ids [env: TOPOS_NETWORK_SPAMMER_LOCAL_KEY_SEED=] [default: 1]
--cert-per-batch <CERT_PER_BATCH>
Certificates generated in one batch. Batch is generated every `batch-interval` milliseconds [env: TOPOS_NETWORK_SPAMMER_CERT_PER_BATCH=] [default: 1]
--nb-subnets <NB_SUBNETS>
Number of subnets to use for certificate generation. For every certificate subnet id will be picked randomly [env: TOPOS_NETWORK_SPAMMER_NUMBER_OF_SUBNETS=] [default: 1]
--nb-batches <NB_BATCHES>
Number of batches to generate before finishing execution. If not specified, batches will be generated indefinitely [env: TOPOS_NETWORK_SPAMMER_NUMBER_OF_BATCHES=]
--batch-interval <BATCH_INTERVAL>
Time interval in milliseconds between generated batches of certificates [env: TOPOS_NETWORK_SPAMMER_BATCH_INTERVAL=] [default: 2000]
--target-subnets <TARGET_SUBNETS>
List of generated certificate target subnets. No target subnets by default. For example `--target-subnets=0x3bc19e36ff1673910575b6727a974a9abd80c9a875d41ab3e2648dbfb9e4b518,0xa00d60b2b408c2a14c5d70cdd2c205db8985ef737a7e55ad20ea32cc9e7c417c` [env: TOPOS_NETWORK_SPAMMER_TARGET_SUBNETS=]
--otlp-agent <OTLP_AGENT>
Socket of the opentelemetry agent endpoint. If not provided open telemetry will not be used [env: TOPOS_OTLP_AGENT=]
--otlp-service-name <OTLP_SERVICE_NAME>
Otlp service name. If not provided open telemetry will not be used [env: TOPOS_OTLP_SERVICE_NAME=]
--benchmark
Flag to indicate usage of Kubernetes [env: TOPOS_NETWORK_SPAMMER_BENCHMARK=]
--target-hosts <TARGET_HOSTS>
Template for generating target node entrypoints. e.g. `--hosts="http://validator-{N}:1340"` [env: TOPOS_NETWORK_SPAMMER_TARGET_HOSTS=]
--number <NUMBER>
Number of nodes to generate based on the DNS template [env: TOPOS_NETWORK_SPAMMER_NUMBER=]
-h, --help
Print help
================================================
FILE: crates/topos/tests/utils.rs
================================================
use assert_cmd::prelude::*;
use predicates::prelude::*;
use regex::Regex;
use std::path::PathBuf;
use std::process::Command;
use topos::install_polygon_edge;
// Have to allow dead_code because clippy doesn't recognize it is being used in the tests
#[cfg(test)]
#[allow(dead_code)]
pub fn sanitize_config_folder_path(cmd_out: &str) -> String {
// Sanitize the result here:
// When run locally, we get /Users/<username>/.config/topos
// When testing on the CI, we get /home/runner/.config/topos
let pattern = Regex::new(r"\[default: .+?/.config/topos\]").unwrap();
pattern
.replace(cmd_out, "[default: /home/runner/.config/topos]")
.to_string()
}
// Have to allow dead_code because clippy doesn't recognize it is being used in the tests
#[allow(dead_code)]
pub async fn setup_polygon_edge(path: &str) -> String {
let installation_path = std::env::current_dir().unwrap().join(path);
let binary_path = installation_path.join("polygon-edge");
if !binary_path.exists() {
std::fs::create_dir_all(installation_path.clone())
.expect("Cannot create test binary folder");
install_polygon_edge(
"topos-protocol/polygon-edge".to_string(),
None,
installation_path.clone().as_path(),
)
.await
.expect("Cannot install Polygon Edge binary");
}
installation_path.to_str().unwrap().to_string()
}
// Have to allow dead_code because clippy doesn't recognize it is being used in the tests
#[allow(dead_code)]
pub async fn generate_polygon_edge_genesis_file(
polygon_edge_bin: &str,
home_path: &str,
node_name: &str,
subnet: &str,
) -> Result<(), Box<dyn std::error::Error>> {
let genesis_folder_path: PathBuf = PathBuf::from(format!("{}/subnet/{}", home_path, subnet));
if !genesis_folder_path.exists() {
std::fs::create_dir_all(genesis_folder_path.clone())
.expect("Cannot create subnet genesis file folder");
}
let genesis_file_path = format!("{}/genesis.json", genesis_folder_path.display());
println!("Polygon edge path: {}", polygon_edge_bin);
let mut cmd = Command::new(polygon_edge_bin);
let val_prefix_path = format!("{}/node/{}/", home_path, node_name);
cmd.arg("genesis")
.arg("--dir")
.arg(&genesis_file_path)
.arg("--consensus")
.arg("ibft")
.arg("--ibft-validators-prefix-path")
.arg(val_prefix_path)
.arg("--bootnode") /* set dummy bootnode, we will not run edge to produce blocks */
.arg("/ip4/127.0.0.1/tcp/8545/p2p/16Uiu2HAmNYneHCbJ1Ntz1ojvTdiNGCMGWNT5MGMH28AzKNV66Paa");
cmd.assert()
.success()
.stdout(predicate::str::contains(format!(
"Genesis written to {}",
genesis_folder_path.display()
)));
Ok(())
}
================================================
FILE: crates/topos-certificate-spammer/Cargo.toml
================================================
[package]
name = "topos-certificate-spammer"
version = "0.1.0"
edition = "2021"
[lints]
workspace = true
[dependencies]
clap.workspace = true
tokio-stream.workspace = true
rand_distr.workspace = true
rand_core.workspace = true
rand.workspace = true
futures.workspace = true
tokio.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
hex.workspace = true
thiserror.workspace = true
tracing.workspace = true
tracing-opentelemetry.workspace = true
opentelemetry.workspace = true
tiny-keccak.workspace = true
uuid.workspace = true
lazy_static.workspace = true
http.workspace = true
toml = "0.5.9"
topos-core.workspace = true
topos-tce-proxy = { path = "../topos-tce-proxy"}
topos-crypto = {path = "../topos-crypto"}
================================================
FILE: crates/topos-certificate-spammer/README.md
================================================
# Topos Certificate Spammer
## How does it work?
The Topos Certificate Spammer generates test certificate chain and sends them to one or more target nodes, specified with parameter `--target-nodes`, e.g. `--target-nodes=http://[::1]:1340,http://[::1]:1341`.
Every `--batch-interval`, a batch of certificates is generated and sent following the `--certs-per-batch` argument.
Source subnet id and list of target subnets are randomly assigned to every certificate.
When argument `--nb-batches` is specified, program will send specified number of batches and the command will gracefully shut down connections and exit. When unspecified, it will continuously generate and send batches of certificates.
The time delay in milliseconds between two batches of two certificates is set with `--batch-interval`.
Certificates are signed with secp256k1 private key, and seed for generation of `nb-subnets` private keys is infuenced by `--local-key-seed`.
The dispatching of Certificate is done through the TCE service gRPC API.
## Commands
To compile from the root `topos` workspace directory:
```
cargo build --release
```
The extended list of commands:
```
topos network spam -h
```
## Example
Continuously spam local tce node `http://[::1]:1340` with batch of 1 certificate every 2 seconds. Certificate target subnet list is empty:
```
topos network spam
```
Spam two tce target nodes with 3 batches (every batch containing 5 certificate with 2 possible source subnet id),
also specifying two possible target subnets for every generated certificate:
```
topos network spam --nb-subnets=2 --cert-per-batch=5 --nb-batches=3 --target-nodes=http://[::1]:1340,http://[::1]:1341 --target-subnets=0x3bc19e36ff1673910575b6727a974a9abd80c9a875d41ab3e2648dbfb9e4b518,0xa00d60b2b408c2a14c5d70cdd2c205db8985ef737a7e55ad20ea32cc9e7c417c
```
Alternatively environment variables could be used instead of command line arguments to configure Topos Certificate Spammer:
```
TOPOS_NETWORK_SPAMMER_NUMBER_OF_CERTIFICATES
TOPOS_NETWORK_SPAMMER_TARGET_NODES
TOPOS_NETWORK_SPAMMER_SIGNING_KEY
TOPOS_NETWORK_SPAMMER_INTERVAL
TOPOS_NETWORK_SPAMMER_TARGET_SUBNETS
```
## Instrumentation
By specifying `--otlp-agent` and `--otlp-service-name` cli options, instrumentation event `NewTestCertificate` will be observable from Otlp/Jaeger.
================================================
FILE: crates/topos-certificate-spammer/config/target_nodes_example.json
================================================
{
"nodes": [
"http://[::1]:1340",
"http://[::1]:1341"
]
}
================================================
FILE: crates/topos-certificate-spammer/src/config.rs
================================================
#[derive(Clone, Debug)]
pub struct CertificateSpammerConfig {
pub target_nodes: Option<Vec<String>>,
pub target_nodes_path: Option<String>,
pub local_key_seed: u64,
pub cert_per_batch: u64,
pub nb_subnets: u8,
pub nb_batches: Option<u64>,
pub batch_interval: u64,
pub target_subnets: Option<Vec<String>>,
pub benchmark: bool,
pub target_hosts: Option<String>,
pub number: Option<u32>,
}
================================================
FILE: crates/topos-certificate-spammer/src/error.rs
================================================
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("target nodes are not specified")]
TargetNodesNotSpecified,
#[error("error reading target nodes json file:{0}")]
ReadingTargetNodesJsonFile(String),
#[error("error parsing target nodes json file:{0}")]
InvalidTargetNodesJsonFile(String),
#[error("invalid subnet id error: {0}")]
InvalidSubnetId(String),
#[error("hex conversion error {0}")]
HexConversion(hex::FromHexError),
#[error("invalid signing key: {0}")]
InvalidSigningKey(String),
#[error("Tce node connection error {0}")]
TCENodeConnection(topos_tce_proxy::Error),
#[error("Certificate signing error: {0}")]
CertificateSigning(topos_core::uci::Error),
#[error("BenchmkarkConfigError config error: {0}")]
BenchmarkConfig(String),
}
================================================
FILE: crates/topos-certificate-spammer/src/lib.rs
================================================
//! Utility to spam dummy certificates
use http::Uri;
use opentelemetry::trace::FutureExt;
use serde::Deserialize;
use std::collections::HashMap;
use std::fmt::Debug;
use std::sync::Arc;
use tokio::sync::{mpsc, oneshot, Mutex};
use tokio::time::{self, Duration};
use tokio_stream::StreamExt;
use topos_core::uci::*;
use topos_tce_proxy::client::{TceClient, TceClientBuilder};
use tracing::{debug, error, info, info_span, Instrument, Span};
use tracing_opentelemetry::OpenTelemetrySpanExt;
mod config;
pub mod error;
mod utils;
use error::Error;
use crate::utils::{generate_source_subnets, generate_test_certificate};
pub use config::CertificateSpammerConfig;
type NodeApiAddress = String;
#[derive(Deserialize)]
struct FileNodes {
nodes: Vec<String>,
}
/// Represents connection from one sequencer to a TCE node
/// Multiple different subnets could be connected to the same TCE node address (represented with TargetNodeConnection with different SubnetId and created client)
/// Multiple topos-sequencers from the same subnet could be connected to the same TCE node address (so they would have same SubnetID, but different client instances)
struct TargetNodeConnection {
address: NodeApiAddress,
client: Arc<Mutex<TceClient>>,
shutdown: mpsc::Sender<oneshot::Sender<()>>,
source_subnet: SourceSubnet,
}
#[derive(Debug, Clone)]
pub struct SourceSubnet {
signing_key: [u8; 32],
source_subnet_id: SubnetId,
last_certificate_id: CertificateId,
}
impl TargetNodeConnection {
pub async fn shutdown(&mut self) -> Result<(), Box<dyn std::error::Error>> {
let (sender, receiver) = oneshot::channel();
self.shutdown.send(sender).await?;
receiver.await?;
Ok(())
}
}
async fn open_target_node_connection(
nodes: &[String],
source_subnet: &SourceSubnet,
) -> Result<Vec<TargetNodeConnection>, Error> {
let mut target_node_connections: Vec<TargetNodeConnection> = Vec::new();
for tce_address in nodes {
info!(
"Opening client for tce service {}, source subnet id: {}",
&tce_address, &source_subnet.source_subnet_id
);
let (tce_client_shutdown_channel, shutdown_receiver) =
mpsc::channel::<oneshot::Sender<()>>(1);
let (tce_client, mut receiving_certificate_stream) = match TceClientBuilder::default()
.set_subnet_id(source_subnet.source_subnet_id)
.set_tce_endpoint(tce_address)
.build_and_launch(shutdown_receiver)
.await
{
Ok(value) => value,
Err(e) => {
error!(
"Unable to create TCE client for node {}: {}",
&tce_address, e
);
return Err(Error::TCENodeConnection(e));
}
};
match tce_client.open_stream(Vec::new()).await {
Ok(_) => {}
Err(e) => {
error!("Unable to connect to node {}: {}", &tce_address, e);
return Err(Error::TCENodeConnection(e));
}
}
let (shutdown_channel, mut shutdown_receiver) = mpsc::channel::<oneshot::Sender<()>>(1);
let client = Arc::new(Mutex::new(tce_client));
{
let source_subnet_id = source_subnet.source_subnet_id;
let tce_address = tce_address.clone();
tokio::spawn(async move {
loop {
// process certificates received from the TCE node
tokio::select! {
Some((cert, position)) = receiving_certificate_stream.next() => {
info!("Delivered certificate from tce address: {} for subnet id: {} cert id {}, position {:?}",
&tce_address, &source_subnet_id, &cert.id, position);
},
Some(sender) = shutdown_receiver.recv() => {
info!("Shutting down client for tce address: {} for subnet id: {}",
&tce_address, &source_subnet_id);
let (killer, waiter) = oneshot::channel::<()>();
tce_client_shutdown_channel.send(killer).await.unwrap();
waiter.await.unwrap();
info!("Finishing watch certificates task...");
_ = sender.send(());
// Finish this task listener
break;
}
}
}
});
}
target_node_connections.push(TargetNodeConnection {
address: tce_address.clone(),
client,
shutdown: shutdown_channel,
source_subnet: source_subnet.clone(),
});
}
Ok(target_node_connections)
}
async fn close_target_node_connections(
target_node_connections: HashMap<SubnetId, Vec<TargetNodeConnection>>,
) {
for mut target_node in target_node_connections
.into_iter()
.flat_map(|(_, connections)| connections)
.collect::<Vec<TargetNodeConnection>>()
{
info!("Closing connection to target node {}", target_node.address);
if let Err(e) = target_node.shutdown().await {
error!("Failed to close stream with {}: {e}", target_node.address);
}
}
}
/// Submit the certificate to the TCE node
async fn submit_cert_to_tce(node: &TargetNodeConnection, cert: Certificate) {
let client = node.client.clone();
let span = Span::current();
span.record("certificate_id", cert.id.to_string());
span.record("source_subnet_id", cert.source_subnet_id.to_string());
let mut tce_client = client.lock().await;
send_new_certificate(&mut tce_client, cert)
.with_context(span.context())
.instrument(span)
.await
}
async fn send_new_certificate(tce_client: &mut TceClient, cert: Certificate) {
if let Err(e) = tce_client
.send_certificate(cert)
.with_current_context()
.instrument(Span::current())
.await
{
error!("Failed to send the Certificate to the TCE client: {}", e);
}
}
async fn dispatch(cert: Certificate, target_node: &TargetNodeConnection) {
info!(
"Sending cert id={:?} prev_cert_id= {:?} subnet_id={:?} to tce node {}",
&cert.id, &cert.prev_id, &cert.source_subnet_id, target_node.address
);
submit_cert_to_tce(target_node, cert).await
}
pub async fn run(
args: CertificateSpammerConfig,
mut shutdown: mpsc::Receiver<oneshot::Sender<()>>,
) -> Result<(), Error> {
// Is list of nodes is specified in the command line use them otherwise use
// config file provided nodes
let target_nodes = if args.benchmark {
if let (Some(target_hosts), Some(number)) = (args.target_hosts, args.number) {
let uri = target_hosts
.replace("{N}", &0.to_string())
.parse::<Uri>()
.map_err(|e| Error::BenchmarkConfig(e.to_string()))?;
if uri.host().is_none() || uri.path().is_empty() || uri.port_u16().is_none() {
return Err(Error::BenchmarkConfig(
"Invalid target-hosts pattern. Has to be in the format of http://validator-1:9090"
.into(),
));
}
(0..number)
.map(|n| target_hosts.replace("{N}", &n.to_string()))
.collect::<Vec<String>>()
} else {
return Err(Error::BenchmarkConfig(
"The --benchmark flag needs the following two additional flags being passed to it:\n--target-hosts http://validator-{N}\n--number 10".into(),
));
}
} else if let Some(nodes) = args.target_nodes {
nodes
} else if let Some(target_nodes_path) = args.target_nodes_path {
let json_str = std::fs::read_to_string(target_nodes_path)
.map_err(|e| Error::ReadingTargetNodesJsonFile(e.to_string()))?;
let json: FileNodes = serde_json::from_str(&json_str)
.map_err(|e| Error::InvalidTargetNodesJsonFile(e.to_string()))?;
json.nodes
} else {
return Err(Error::TargetNodesNotSpecified);
};
// Generate keys for all required subnets (`nb_subnets`)
let mut source_subnets = generate_source_subnets(args.local_key_seed, args.nb_subnets)?;
info!("Generated source subnets: {source_subnets:#?}");
// Target subnets (randomly assigned to every generated certificate)
let target_subnet_ids: Vec<SubnetId> = args
.target_subnets
.iter()
.flat_map(|id| {
id.iter().map(|id| {
let id =
hex::decode(&id[2..]).map_err(|e| Error::InvalidSubnetId(e.to_string()))?;
TryInto::<[u8; 32]>::try_into(id.as_slice())
.map_err(|e| Error::InvalidSubnetId(e.to_string()))
})
})
.map(|id| id.map(SubnetId::from_array))
.collect::<Result<_, _>>()?;
let mut target_node_connections: HashMap<SubnetId, Vec<TargetNodeConnection>> = HashMap::new();
// For every source subnet, open connection to every target node, so we will have
// nb_subnets * len(target_nodes) connections
for source_subnet in &source_subnets {
let connections_for_source_subnet =
open_target_node_connection(target_nodes.as_slice(), source_subnet).await?;
target_node_connections.insert(
source_subnet.source_subnet_id,
connections_for_source_subnet,
);
}
target_node_connections
.iter()
.flat_map(|(_, connections)| connections)
.for_each(|connection| {
info!(
"Certificate spammer target nodes address: {}, source_subnet_id: {}, target \
subnet ids {:?}",
connection.address, connection.source_subnet.source_subnet_id, target_subnet_ids
);
});
let number_of_peer_nodes = target_nodes.len();
let mut batch_interval = time::interval(Duration::from_millis(args.batch_interval));
let mut batch_number: u64 = 0;
let shutdown_sender = loop {
let should_send_batch = tokio::select! {
_ = batch_interval.tick() => true,
Some(sender) = shutdown.recv() => {
info!("Received shutdown signal, stopping certificate spammer");
for (_, connections) in target_node_connections {
for mut connection in connections {
info!("Closing connection to target node {}", connection.address);
_ = connection.shutdown().await;
}
}
break Some(sender);
}
};
if should_send_batch {
// Starting batch, generate cert_per_batch certificates
batch_number += 1;
let batch_id = uuid::Uuid::new_v4().to_string();
// TODO: Need a better name for this span
let span = info_span!(
"Batch",
batch_id,
batch_number,
cert_per_batch = args.cert_per_batch,
number_of_peer_nodes
);
async {
info!("Starting batch {batch_number}");
let mut batch: Vec<Certificate> = Vec::new(); // Certificates for this batch
for b in 0..args.cert_per_batch {
// Randomize source subnet id
let source_subnet =
&mut source_subnets[rand::random::<usize>() % args.nb_subnets as usize];
// Randomize number of target subnets if target subnet list cli argument is provided
let target_subnets: Vec<SubnetId> = if target_subnet_ids.is_empty() {
// Empty list of target subnets in certificate
Vec::new()
} else {
// Generate random list in size of 0..len(target_subnet_ids) as target subnets
let number_of_target_subnets =
rand::random::<usize>() % (target_subnet_ids.len() + 1);
let mut target_subnets = Vec::new();
for _ in 0..number_of_target_subnets {
target_subnets.push(
target_subnet_ids
[rand::random::<usize>() % target_subnet_ids.len()],
);
}
target_subnets
};
let new_cert =
match generate_test_certificate(source_subnet, target_subnets.as_slice()) {
Ok(cert) => cert,
Err(e) => {
error!("Unable to generate certificate: {e}");
continue;
}
};
debug!("New cert number {b} in batch {batch_number} generated");
batch.push(new_cert);
}
// Dispatch certs in this batch
for cert in batch {
// Randomly choose target tce node for every certificate from related source_subnet_id connection list
let target_node_connection = &target_node_connections[&cert.source_subnet_id]
[rand::random::<usize>() % target_nodes.len()];
dispatch(cert, target_node_connection)
.instrument(Span::current())
.with_current_context()
.await;
}
}
.instrument(span)
.await;
if let Some(nb_batches) = args.nb_batches {
if batch_number >= nb_batches {
info!("Generated {nb_batches}, finishing certificate spammer...");
tokio::time::sleep(Duration::from_secs(5)).await;
close_target_node_connections(target_node_connections).await;
info!("Cert spammer finished");
break None;
}
}
}
};
info!("Certificate spammer finished");
if let Some(sender) = shutdown_sender {
sender
.send(())
.expect("Failed to send shutdown signal from certificate spammer");
}
Ok(())
}
================================================
FILE: crates/topos-certificate-spammer/src/utils.rs
================================================
use topos_core::uci::{Certificate, SubnetId};
use crate::{error::Error, SourceSubnet};
lazy_static::lazy_static! {
/// Size of the proof
static ref PROOF_SIZE_BYTES: usize =
std::env::var("TOPOS_PROOF_SIZE_BYTES")
.ok()
.and_then(|s| s.parse().ok())
.unwrap_or(1000);
/// Dummy proof with specified size
static ref STARK_BLOB: Vec<u8> =
(0..*PROOF_SIZE_BYTES)
.map(|_| rand::random::<u8>())
.collect::<Vec<u8>>();
}
pub fn generate_random_32b_array() -> [u8; 32] {
(0..32)
.map(|_| rand::random::<u8>())
.collect::<Vec<u8>>()
.try_into()
.expect("Valid 32 byte array")
}
/// Generate test certificate
pub fn generate_test_certificate(
source_subnet: &mut SourceSubnet,
target_subnet_ids: &[SubnetId],
) -> Result<Certificate, Box<dyn std::error::Error>> {
let mut new_cert = Certificate::new(
source_subnet.last_certificate_id,
source_subnet.source_subnet_id,
generate_random_32b_array(),
generate_random_32b_array(),
generate_random_32b_array(),
target_subnet_ids,
0,
STARK_BLOB.clone(),
)?;
new_cert
.update_signature(&source_subnet.signing_key)
.map_err(Error::CertificateSigning)?;
source_subnet.last_certificate_id = new_cert.id;
Ok(new_cert)
}
pub fn generate_source_subnets(
local_key_seed: u64,
number_of_subnets: u8,
) -> Result<Vec<SourceSubnet>, Error> {
let mut subnets = Vec::new();
let mut signing_key = [0u8; 32];
let (_, right) = signing_key.split_at_mut(24);
right.copy_from_slice(local_key_seed.to_be_bytes().as_slice());
for _ in 0..number_of_subnets {
signing_key = tiny_keccak::keccak256(&signing_key);
// Subnet id of the source subnet which will be used for every generated certificate
let source_subnet_id: SubnetId = topos_crypto::keys::derive_public_key(&signing_key)
.map_err(|e| Error::InvalidSigningKey(e.to_string()))?
.as_slice()[1..33]
.try_into()
.map_err(|_| Error::InvalidSubnetId("Unable to parse subnet id".to_string()))?;
subnets.push(SourceSubnet {
signing_key,
source_subnet_id,
last_certificate_id: Default::default(),
});
}
Ok(subnets)
}
================================================
FILE: crates/topos-clock/Cargo.toml
================================================
[package]
name = "topos-clock"
version = "0.1.0"
edition = "2021"
[lints]
workspace = true
[dependencies]
tokio.workspace = true
futures.workspace = true
thiserror.workspace = true
chrono = {version = "0.4", default-features = false, features = ["clock"]}
tracing.workspace = true
================================================
FILE: crates/topos-clock/src/lib.rs
================================================
//! This crate is responsible for managing the clock pace.
//!
//! The Clock is responsible of giving informations about Epoch and Delta timing by exposing
//! reference to the data but also by broadcasting `EpochChange` events.
use std::sync::{atomic::AtomicU64, Arc};
use tokio::sync::broadcast;
mod time;
pub use time::TimeClock;
const BROADCAST_CHANNEL_SIZE: usize = 100;
pub trait Clock {
/// Compute Epoch/Block numbers and spawn the clock task.
fn spawn(self) -> Result<broadcast::Receiver<Event>, Error>;
/// Return a reference to the current block number
fn block_ref(&self) -> Arc<AtomicU64>;
/// Return a reference to the current epoch number
fn epoch_ref(&self) -> Arc<AtomicU64>;
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Event {
/// Notify an Epoch change with the associated epoch_number
EpochChange(u64),
}
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("Unable to generate spawn date")]
SpawnDateFailure,
}
================================================
FILE: crates/topos-clock/src/time.rs
================================================
use std::{
sync::{
atomic::{AtomicU64, Ordering},
Arc,
},
time::Duration,
};
use chrono::{DateTime, Utc};
use tokio::{
spawn,
sync::broadcast,
time::{interval_at, Instant},
};
use crate::{Clock, Error, Event, BROADCAST_CHANNEL_SIZE};
/// Time based clock implementation.
///
/// Simulate blockchain block production by increasing block number by 1 every second.
/// Epoch duration can be configured when creating the clock.
pub struct TimeClock {
genesis: DateTime<Utc>,
current_block: Arc<AtomicU64>,
epoch_duration: u64,
current_epoch: Arc<AtomicU64>,
}
impl Clock for TimeClock {
fn spawn(mut self) -> Result<broadcast::Receiver<Event>, Error> {
let (sender, receiver) = broadcast::channel(BROADCAST_CHANNEL_SIZE);
self.compute_block();
self.compute_epoch();
spawn(async move {
self.run(sender).await;
});
Ok(receiver)
}
fn block_ref(&self) -> Arc<AtomicU64> {
self.current_block.clone()
}
fn epoch_ref(&self) -> Arc<AtomicU64> {
self.current_epoch.clone()
}
}
impl TimeClock {
/// Create a new TimeClock instance based on a genesis datatime and an epoch duration.
pub fn new(genesis: DateTime<Utc>, epoch_duration: u64) -> Result<Self, Error> {
let mut clock = Self {
genesis,
current_block: Arc::new(AtomicU64::new(0)),
epoch_duration,
current_epoch: Arc::new(AtomicU64::new(0)),
};
clock.compute_block();
clock.compute_epoch();
Ok(clock)
}
async fn run(&mut self, sender: broadcast::Sender<Event>) {
let mut interval = interval_at(Instant::now(), Duration::from_secs(1));
loop {
interval.tick().await;
let _previous_block = self.current_block.fetch_add(1, Ordering::Relaxed);
if self.current_block.load(Ordering::Relaxed) % self.epoch_duration == 0 {
self.compute_epoch();
_ = sender.send(Event::EpochChange(
self.current_epoch.load(Ordering::Relaxed),
));
}
}
}
fn compute_block(&mut self) {
let blocks = std::cmp::max(
Utc::now()
.naive_utc()
.signed_duration_since(self.genesis.naive_utc())
.num_seconds(),
0,
) as u64;
self.current_block.store(blocks, Ordering::Relaxed);
}
fn compute_epoch(&mut self) {
self.current_epoch.store(
self.current_block.load(Ordering::Relaxed) / self.epoch_duration,
Ordering::Relaxed,
);
}
}
#[cfg(test)]
mod tests {
use chrono::{Duration, Utc};
use crate::{Clock, Event, TimeClock};
#[tokio::test]
async fn test_time_clock() {
let genesis = Utc::now()
.checked_sub_signed(Duration::seconds(30))
.unwrap();
let clock = TimeClock::new(genesis, 5).unwrap();
let current_block = clock.block_ref();
let current_epoch = clock.epoch_ref();
let mut recv = clock.spawn().unwrap();
assert_eq!(recv.recv().await, Ok(Event::EpochChange(7)));
assert_eq!(current_epoch.load(std::sync::atomic::Ordering::Relaxed), 7);
assert!(current_block.load(std::sync::atomic::Ordering::Relaxed) >= 30);
}
#[tokio::test]
async fn test_time_clock_catchup() {
let genesis = Utc::now()
.checked_sub_signed(Duration::seconds(30))
.unwrap();
let clock = TimeClock::new(genesis, 2).unwrap();
let current_block = clock.block_ref();
let current_epoch = clock.epoch_ref();
let mut recv = clock.spawn().unwrap();
assert_eq!(recv.recv().await, Ok(Event::EpochChange(16)));
assert!(recv.try_recv().is_err());
assert_eq!(current_epoch.load(std::sync::atomic::Ordering::Relaxed), 16);
assert!(current_block.load(std::sync::atomic::Ordering::Relaxed) >= 30);
tokio::time::sleep(std::time::Duration::from_secs(5)).await;
assert_eq!(recv.recv().await, Ok(Event::EpochChange(17)));
assert_eq!(recv.recv().await, Ok(Event::EpochChange(18)));
assert_eq!(current_epoch.load(std::sync::atomic::Ordering::Relaxed), 18);
assert!(current_block.load(std::sync::atomic::Ordering::Relaxed) >= 35);
}
}
================================================
FILE: crates/topos-config/Cargo.toml
================================================
[package]
name = "topos-config"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
topos-p2p = { path = "../topos-p2p" }
topos-core = { path = "../topos-core" }
topos-wallet = { path = "../topos-wallet" }
async-stream.workspace = true
async-trait.workspace = true
clap.workspace = true
hex.workspace = true
futures.workspace = true
opentelemetry.workspace = true
serde.workspace = true
serde_json.workspace = true
tokio = { workspace = true, features = ["full"] }
tokio-util.workspace = true
tonic.workspace = true
tower.workspace = true
tracing = { workspace = true, features = ["log"] }
tracing-opentelemetry.workspace = true
tracing-subscriber = { workspace = true, features = ["env-filter", "json", "ansi", "fmt"] }
uuid.workspace = true
rand.workspace = true
reqwest.workspace = true
thiserror.workspace = true
opentelemetry-otlp = { workspace = true, features = ["grpc-tonic", "metrics", "tls-roots"] }
figment = { version = "0.10", features = ["yaml", "toml", "env"] }
dirs = "5.0"
tracing-log = { version = "0.1.3", features = ["env_logger"] }
tar = "0.4.38"
flate2 ="1.0.26"
url = "2.3.1"
once_cell = "1.17.1"
toml = "0.7.4"
regex = "1"
rlp = "0.5.1"
openssl = { version = "0.10.61", features = ["vendored"] }
[dev-dependencies]
topos-tce-broadcast = { path = "../topos-tce-broadcast" }
topos-tce-synchronizer = { path = "../topos-tce-synchronizer" }
topos-tce-gatekeeper = { path = "../topos-tce-gatekeeper" }
topos-tce-api = { path = "../topos-tce-api" }
topos-tce-storage = { path = "../topos-tce-storage" }
topos-test-sdk = { path = "../topos-test-sdk" }
serde.workspace = true
serde_json.workspace = true
test-log.workspace = true
env_logger.workspace = true
rand.workspace = true
futures.workspace = true
libp2p = { workspace = true, features = ["identify"] }
assert_cmd = "2.0.6"
insta = { version = "1.21", features = ["json", "redactions"] }
rstest = { workspace = true, features = ["async-timeout"] }
tempfile = "3.8.0"
predicates = "3.0.3"
sysinfo = "0.29.11"
serial_test = {version = "0.9.0"}
[lints]
workspace = true
================================================
FILE: crates/topos-config/assets/genesis-example.json
================================================
{
"name": "polygon-edge",
"genesis": {
"nonce": "0x0000000000000000",
"timestamp": "0x0",
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000f90129f90120f84694100d617e4392c02b31bdce650b26b6c0c3e04f95b0ae7711044926a23c1462754cbb0d1b43fb91fc8fd18bf5c81edb4de15124203157657bf7a8e86d9a3be5f32de725f3c4f8469492183cff18a1328e7d791d607589a15d9eee4bc4b0b45118f9e430d94f424019bb8702e004db5dad5725ab1a5346b0aaad556935189c47df5e401988527ce880bb1e2492cef84694b4973cdb10894d1d1547673bd758589034c2bba5b0b9833912ee2eab270a1204f3f9e58c5f2be603cc2ce32f5467e2a8246bb6b25a7908b39a8a0ed629a689da376b5cdd2df84694c16d83893cb61872206d4e271b813015d3242d94b0a468068169523df684362de6a5b729c8db400958bfd4f6d4e3646cc640f3d241253a21b00f05ff97545f535b36b31c7b80c28080c080",
"gasLimit": "0x500000",
"difficulty": "0x1",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"alloc": {
"0x100D617E4392C02B31bdCe650b26b6c0c3E04F95": {
"balance": "0x3b9aca00"
},
"0x92183Cff18A1328E7d791D607589A15d9EeE4bC4": {
"balance": "0x3b9aca00"
},
"0xB4973Cdb10894D1D1547673bD758589034C2BBa5": {
"balance": "0x3b9aca00"
},
"0xC16d83893cB61872206D4e271B813015D3242d94": {
"balance": "0x3b9aca00"
}
},
"number": "0x0",
"gasUsed": "0x70000",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"baseFee": "0x0",
"baseFeeEM": "0x0"
},
"params": {
"chainID": 100,
"engine": {
"ibft": {
"blockTime": 6000000000,
"epochSize": 30000,
"type": "PoA",
"validator_type": "bls"
}
},
"blockGasTarget": 0,
"burnContract": null,
"burnContractDestinationAddress": "0x0000000000000000000000000000000000000000"
},
"bootnodes": [
"/ip4/10.101.192.110/tcp/10001/p2p/16Uiu2HAkxKTnwPL3eZmFkiKYJiG3um9uraPh21XhsJEPNm8juhy3",
"/ip4/10.101.232.59/tcp/10001/p2p/16Uiu2HAmQfaE4bjJMVCwzigAUgp9eLcGQz8HZpURqEPNjtfDwge8",
"/ip4/10.101.208.7/tcp/10001/p2p/16Uiu2HAm5tS7AdBhhtQ2JuTtyy2U4uFqsiW57vof5fiyHPRpwboD",
"/ip4/10.101.210.76/tcp/10001/p2p/16Uiu2HAmFjGqEUYSnKkoqURRu8bZaWpuGdxBBqW15KFs4BsxFxdp"
]
}
================================================
FILE: crates/topos-config/src/base.rs
================================================
use std::path::Path;
use figment::{
providers::{Format, Toml},
Figment,
};
use serde::{Deserialize, Serialize};
use crate::node::NodeRole;
use crate::Config;
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "kebab-case")]
pub struct BaseConfig {
#[serde(default = "default_name")]
pub name: String,
#[serde(default = "default_role")]
pub role: NodeRole,
#[serde(default = "default_subnet")]
pub subnet: String,
#[serde(default = "default_secrets_config")]
pub secrets_config: Option<String>,
}
fn default_name() -> String {
"default".to_string()
}
fn default_role() -> NodeRole {
NodeRole::Validator
}
fn default_subnet() -> String {
"topos".to_string()
}
fn default_secrets_config() -> Option<String> {
None
}
impl BaseConfig {
pub fn need_tce(&self) -> bool {
self.subnet == "topos"
}
pub fn need_sequencer(&self) -> bool {
matches!(self.role, NodeRole::Sequencer)
}
pub fn need_edge(&self) -> bool {
true
}
}
impl Config for BaseConfig {
type Output = Self;
fn load_from_file(figment: Figment, home: &Path) -> Figment {
let home = home.join("config.toml");
let base = Figment::new()
.merge(Toml::file(home).nested())
.select("base");
figment.merge(base)
}
fn load_context(figment: Figment) -> Result<Self::Output, figment::Error> {
figment.extract()
}
fn profile() -> String {
"base".to_string()
}
}
================================================
FILE: crates/topos-config/src/edge/command.rs
================================================
use serde_json::Value;
use std::collections::HashMap;
use std::os::unix::prelude::ExitStatusExt;
use std::path::{Path, PathBuf};
use std::process::{ExitStatus, Stdio};
use tokio::{
io::{AsyncBufReadExt, BufReader},
process::Command,
};
use tracing::debug;
use tracing::{error, info, warn};
pub const BINARY_NAME: &str = "polygon-edge";
pub struct CommandConfig {
binary_path: PathBuf,
args: Vec<String>,
}
impl CommandConfig {
pub fn new(binary_path: PathBuf) -> Self {
let binary_path = if binary_path == PathBuf::from(".") {
std::env::current_dir()
.expect("Cannot get the current directory")
.join(BINARY_NAME)
} else {
binary_path
};
CommandConfig {
binary_path,
args: Vec::new(),
}
}
pub fn init(mut self, path: &Path) -> Self {
self.args.push("secrets".into());
self.args.push("init".into());
self.args.push("--insecure".into());
self.args.push("--data-dir".into());
self.args.push(format!("{}", path.display()));
self
}
pub fn server(
mut self,
data_dir: &Path,
genesis_path: &Path,
edge_args: HashMap<String, String>,
) -> Self {
self.args.push("server".into());
self.args.push("--data-dir".into());
self.args.push(format!("{}", data_dir.display()));
self.args.push("--chain".into());
self.args.push(format!("{}", genesis_path.display()));
self.args.push("--json".into());
for (k, v) in &edge_args {
self.args.push(format!("--{k}"));
self.args.push(v.to_string());
}
self
}
pub async fn spawn(self) -> Result<ExitStatus, std::io::Error> {
info!(
"Spawning Polygon Edge binary located at: {:?}, args: {:?}",
self.binary_path, self.args
);
let mut command = Command::new(self.binary_path);
command.kill_on_drop(true);
command.args(self.args);
let mut child = command
.stderr(Stdio::piped())
.stdout(Stdio::piped())
.stdin(Stdio::piped())
.spawn()?;
if let Some(pid) = child.id() {
info!("Polygon Edge child process with pid {pid} successfully started");
}
let stdout = child
.stderr
.take()
.expect("child did not have a handle to stdout");
let mut reader = BufReader::new(stdout).lines();
let running = async { child.wait().await };
let logging = async {
while let Ok(line) = reader.next_line().await {
match line {
Some(l) => match serde_json::from_str(&l) {
Ok(v) => EdgeLog::new(v).log(),
Err(_) => println!("{l}"),
},
None => break,
}
}
};
let (running_out, _) = tokio::join!(running, logging);
let exit_status = running_out?;
info!(
"The Edge process is terminated with exit status {:?}; exit code: {:?}, exit signal \
{:?}, success: {:?}, raw code: {}",
exit_status,
exit_status.code(),
exit_status.signal(),
exit_status.success(),
exit_status.into_raw(),
);
Ok(exit_status)
}
}
pub struct EdgeLog {
v: HashMap<String, Value>,
}
impl EdgeLog {
pub fn new(v: HashMap<String, Value>) -> Self {
Self { v }
}
pub fn log(&mut self) {
match self.v.get("@level") {
Some(level) => match level.as_str() {
Some(r#"info"#) => info!("{}", self.internal()),
Some(r#"warn"#) => warn!("{}", self.internal()),
Some(r#"debug"#) => debug!("{}", self.internal()),
Some(r#"error"#) => error!("{}", self.internal()),
_ => error!("log parse failure: {:?}", self.v),
},
None => error!("{:?}", self.v.get("error")),
}
}
fn internal(&mut self) -> String {
let module = self.v.remove("@module").unwrap();
let message = self.v.remove("@message").unwrap();
// FIXME: Figure out tracing features to make this nicer
self.v.remove("@timestamp");
self.v.remove("@level");
let mut message = format!("{module}: {message}");
for (k, s) in &self.v {
message = format!("{} {}:{}", message, k, s);
}
message
}
}
================================================
FILE: crates/topos-config/src/edge.rs
================================================
use crate::{edge::command::CommandConfig, Config};
use figment::{
providers::{Format, Toml},
Figment,
};
use serde::{Deserialize, Serialize};
use std::{
collections::HashMap,
path::{Path, PathBuf},
process::ExitStatus,
};
use tokio::{spawn, task::JoinHandle};
use tracing::{error, info};
use self::command::BINARY_NAME;
// TODO: Provides the default arguments here
// Serde `flatten` and `default` doesn't work together yet
// https://github.com/serde-rs/serde/issues/1626
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "kebab-case")]
pub struct EdgeConfig {
#[serde(flatten)]
pub args: HashMap<String, String>,
}
impl Config for EdgeConfig {
type Output = EdgeConfig;
fn load_from_file(figment: Figment, home: &Path) -> Figment {
let home = home.join("config.toml");
let edge = Figment::new()
.merge(Toml::file(home).nested())
.select("edge");
figment.merge(edge)
}
fn load_context(figment: Figment) -> Result<Self::Output, figment::Error> {
figment.extract()
}
fn profile() -> String {
"edge".to_string()
}
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "kebab-case")]
pub struct EdgeBinConfig {
pub edge_path: PathBuf,
}
impl EdgeBinConfig {
pub fn binary_path(&self) -> PathBuf {
self.edge_path.join(BINARY_NAME)
}
}
impl Config for EdgeBinConfig {
type Output = EdgeBinConfig;
fn load_from_file(figment: Figment, home: &Path) -> Figment {
let home = home.join("config.toml");
let edge = Figment::new()
.merge(Toml::file(home).nested())
.select("edge");
figment.merge(edge)
}
fn load_context(figment: Figment) -> Result<Self::Output, figment::Error> {
figment.extract()
}
fn profile() -> String {
"edge".to_string()
}
}
pub mod command;
pub fn generate_edge_config(
edge_path: PathBuf,
config_path: PathBuf,
) -> JoinHandle<Result<ExitStatus, std::io::Error>> {
// Create the Polygon Edge config
info!("Generating the configuration at {config_path:?}");
info!("Polygon-edge binary located at: {edge_path:?}");
spawn(async move {
CommandConfig::new(edge_path)
.init(&config_path)
.spawn()
.await
.map_err(|e| {
error!("Failed to generate the edge configuration: {e:?}");
e
})
})
}
================================================
FILE: crates/topos-config/src/genesis/mod.rs
================================================
use rlp::Rlp;
use std::collections::HashSet;
use std::str::FromStr;
use std::{fs, path::PathBuf};
use serde_json::Value;
use topos_core::types::ValidatorId;
use topos_p2p::{Multiaddr, PeerId};
use tracing::info;
use crate::node::NodeConfig;
#[cfg(test)]
pub(crate) mod tests;
/// From the Edge format
pub struct Genesis {
pub json: Value,
}
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("Failed to parse validators")]
ParseValidators,
#[error("Invalid genesis file on path {0}: {1}")]
InvalidGenesisFile(String, String),
}
impl Genesis {
pub fn new(path: &PathBuf) -> Result<Self, Error> {
info!("Reading subnet genesis file {}", path.display());
let genesis_file = fs::File::open(path)
gitextract_hgeg_lhv/
├── .cargo/
│ ├── audit.toml
│ └── config.toml
├── .config/
│ └── nextest.toml
├── .dockerignore
├── .github/
│ ├── CODEOWNERS
│ ├── ISSUE_TEMPLATE/
│ │ └── bug_report.md
│ ├── actions/
│ │ └── install-rust/
│ │ └── action.yml
│ └── workflows/
│ ├── coverage.yml
│ ├── doc.yml
│ ├── docker_build_push.yml
│ ├── docker_utils.yml
│ ├── pr-checking.yml
│ ├── quality.yml
│ ├── release.yml
│ ├── sequencer_topos_core_contract_test.yml
│ └── test.yml
├── .gitignore
├── CHANGELOG.md
├── Cargo.toml
├── Cross.toml
├── Dockerfile
├── LICENSE
├── README.md
├── cliff.toml
├── crates/
│ ├── topos/
│ │ ├── Cargo.toml
│ │ ├── build.rs
│ │ ├── src/
│ │ │ ├── components/
│ │ │ │ ├── mod.rs
│ │ │ │ ├── node/
│ │ │ │ │ ├── commands/
│ │ │ │ │ │ ├── init.rs
│ │ │ │ │ │ ├── status.rs
│ │ │ │ │ │ └── up.rs
│ │ │ │ │ ├── commands.rs
│ │ │ │ │ ├── mod.rs
│ │ │ │ │ ├── services/
│ │ │ │ │ │ └── status.rs
│ │ │ │ │ └── services.rs
│ │ │ │ ├── regtest/
│ │ │ │ │ ├── commands/
│ │ │ │ │ │ └── spam.rs
│ │ │ │ │ ├── commands.rs
│ │ │ │ │ └── mod.rs
│ │ │ │ └── setup/
│ │ │ │ ├── commands/
│ │ │ │ │ └── subnet.rs
│ │ │ │ ├── commands.rs
│ │ │ │ └── mod.rs
│ │ │ ├── lib.rs
│ │ │ ├── main.rs
│ │ │ ├── options/
│ │ │ │ └── input_format.rs
│ │ │ └── options.rs
│ │ └── tests/
│ │ ├── cert_delivery.rs
│ │ ├── config.rs
│ │ ├── node.rs
│ │ ├── regtest.rs
│ │ ├── setup.rs
│ │ ├── snapshots/
│ │ │ ├── node__help_display.snap
│ │ │ ├── push_certificate__help_display.snap
│ │ │ └── regtest__regtest_spam_help_display.snap
│ │ └── utils.rs
│ ├── topos-certificate-spammer/
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── config/
│ │ │ └── target_nodes_example.json
│ │ └── src/
│ │ ├── config.rs
│ │ ├── error.rs
│ │ ├── lib.rs
│ │ └── utils.rs
│ ├── topos-clock/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ ├── lib.rs
│ │ └── time.rs
│ ├── topos-config/
│ │ ├── Cargo.toml
│ │ ├── assets/
│ │ │ └── genesis-example.json
│ │ └── src/
│ │ ├── base.rs
│ │ ├── edge/
│ │ │ └── command.rs
│ │ ├── edge.rs
│ │ ├── genesis/
│ │ │ ├── mod.rs
│ │ │ └── tests.rs
│ │ ├── lib.rs
│ │ ├── node.rs
│ │ ├── sequencer.rs
│ │ ├── tce/
│ │ │ ├── broadcast.rs
│ │ │ ├── p2p.rs
│ │ │ └── synchronization.rs
│ │ └── tce.rs
│ ├── topos-core/
│ │ ├── .rustfmt.toml
│ │ ├── Cargo.toml
│ │ ├── build.rs
│ │ ├── proto/
│ │ │ ├── buf.yaml
│ │ │ └── topos/
│ │ │ ├── p2p/
│ │ │ │ └── info.proto
│ │ │ ├── shared/
│ │ │ │ └── v1/
│ │ │ │ ├── certificate.proto
│ │ │ │ ├── checkpoints.proto
│ │ │ │ ├── frost.proto
│ │ │ │ ├── signature.proto
│ │ │ │ ├── stark_proof.proto
│ │ │ │ ├── subnet.proto
│ │ │ │ ├── uuid.proto
│ │ │ │ └── validator_id.proto
│ │ │ ├── tce/
│ │ │ │ └── v1/
│ │ │ │ ├── api.proto
│ │ │ │ ├── console.proto
│ │ │ │ ├── double_echo.proto
│ │ │ │ ├── gossipsub.proto
│ │ │ │ └── synchronization.proto
│ │ │ └── uci/
│ │ │ └── v1/
│ │ │ └── certification.proto
│ │ ├── src/
│ │ │ ├── api/
│ │ │ │ ├── graphql/
│ │ │ │ │ ├── certificate.rs
│ │ │ │ │ ├── checkpoint.rs
│ │ │ │ │ ├── errors.rs
│ │ │ │ │ ├── filter.rs
│ │ │ │ │ ├── mod.rs
│ │ │ │ │ ├── query.rs
│ │ │ │ │ └── subnet.rs
│ │ │ │ ├── grpc/
│ │ │ │ │ ├── checkpoints/
│ │ │ │ │ │ ├── errors.rs
│ │ │ │ │ │ ├── mod.rs
│ │ │ │ │ │ └── positions.rs
│ │ │ │ │ ├── conversions/
│ │ │ │ │ │ ├── shared/
│ │ │ │ │ │ │ └── v1/
│ │ │ │ │ │ │ ├── certificate.rs
│ │ │ │ │ │ │ ├── signature.rs
│ │ │ │ │ │ │ ├── subnet.rs
│ │ │ │ │ │ │ ├── uuid.rs
│ │ │ │ │ │ │ └── validator_id.rs
│ │ │ │ │ │ ├── tce/
│ │ │ │ │ │ │ └── v1/
│ │ │ │ │ │ │ ├── api.rs
│ │ │ │ │ │ │ ├── mod.rs
│ │ │ │ │ │ │ └── synchronization.rs
│ │ │ │ │ │ └── uci/
│ │ │ │ │ │ └── v1/
│ │ │ │ │ │ └── uci.rs
│ │ │ │ │ ├── generated/
│ │ │ │ │ │ ├── topos.p2p.rs
│ │ │ │ │ │ ├── topos.shared.v1.rs
│ │ │ │ │ │ ├── topos.tce.v1.rs
│ │ │ │ │ │ └── topos.uci.v1.rs
│ │ │ │ │ └── mod.rs
│ │ │ │ └── mod.rs
│ │ │ ├── errors.rs
│ │ │ ├── lib.rs
│ │ │ ├── test.rs
│ │ │ ├── types/
│ │ │ │ └── stream.rs
│ │ │ ├── types.rs
│ │ │ └── uci/
│ │ │ ├── certificate.rs
│ │ │ ├── certificate_id.rs
│ │ │ ├── mod.rs
│ │ │ └── subnet_id.rs
│ │ └── tests/
│ │ └── tce_layer.rs
│ ├── topos-crypto/
│ │ ├── Cargo.toml
│ │ ├── src/
│ │ │ ├── hash.rs
│ │ │ ├── keys.rs
│ │ │ ├── keystore.rs
│ │ │ ├── lib.rs
│ │ │ ├── messages.rs
│ │ │ ├── signatures.rs
│ │ │ └── validator_id.rs
│ │ └── tests/
│ │ └── messages.rs
│ ├── topos-metrics/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ ├── api.rs
│ │ ├── double_echo.rs
│ │ ├── lib.rs
│ │ ├── p2p.rs
│ │ ├── storage.rs
│ │ └── tests.rs
│ ├── topos-node/
│ │ ├── Cargo.toml
│ │ ├── build.rs
│ │ └── src/
│ │ ├── lib.rs
│ │ ├── main.rs
│ │ └── process.rs
│ ├── topos-p2p/
│ │ ├── Cargo.toml
│ │ ├── src/
│ │ │ ├── behaviour/
│ │ │ │ ├── discovery.rs
│ │ │ │ ├── gossip.rs
│ │ │ │ ├── grpc/
│ │ │ │ │ ├── connection.rs
│ │ │ │ │ ├── error.rs
│ │ │ │ │ ├── event.rs
│ │ │ │ │ ├── handler/
│ │ │ │ │ │ ├── event.rs
│ │ │ │ │ │ └── protocol.rs
│ │ │ │ │ ├── handler.rs
│ │ │ │ │ ├── proxy.rs
│ │ │ │ │ └── stream.rs
│ │ │ │ ├── grpc.rs
│ │ │ │ ├── peer_info.rs
│ │ │ │ └── topos.rs
│ │ │ ├── behaviour.rs
│ │ │ ├── client.rs
│ │ │ ├── command.rs
│ │ │ ├── config.rs
│ │ │ ├── constants.rs
│ │ │ ├── error.rs
│ │ │ ├── event.rs
│ │ │ ├── lib.rs
│ │ │ ├── network.rs
│ │ │ ├── runtime/
│ │ │ │ ├── handle_command.rs
│ │ │ │ ├── handle_event/
│ │ │ │ │ ├── discovery.rs
│ │ │ │ │ ├── gossipsub.rs
│ │ │ │ │ ├── grpc.rs
│ │ │ │ │ └── peer_info.rs
│ │ │ │ ├── handle_event.rs
│ │ │ │ └── mod.rs
│ │ │ └── tests/
│ │ │ ├── behaviour/
│ │ │ │ ├── grpc.rs
│ │ │ │ └── mod.rs
│ │ │ ├── bootstrap.rs
│ │ │ ├── command/
│ │ │ │ ├── mod.rs
│ │ │ │ └── random_peer.rs
│ │ │ ├── mod.rs
│ │ │ └── support/
│ │ │ ├── macros.rs
│ │ │ └── mod.rs
│ │ └── tests/
│ │ └── support/
│ │ └── network.rs
│ ├── topos-sequencer/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ ├── app_context.rs
│ │ └── lib.rs
│ ├── topos-sequencer-subnet-client/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ ├── lib.rs
│ │ └── subnet_contract.rs
│ ├── topos-sequencer-subnet-runtime/
│ │ ├── Cargo.toml
│ │ ├── src/
│ │ │ ├── certification.rs
│ │ │ ├── lib.rs
│ │ │ └── proxy.rs
│ │ └── tests/
│ │ ├── common/
│ │ │ ├── abi.rs
│ │ │ ├── mod.rs
│ │ │ └── subnet_test_data.rs
│ │ └── subnet_contract.rs
│ ├── topos-tce/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ ├── app_context/
│ │ │ ├── api.rs
│ │ │ ├── network.rs
│ │ │ └── protocol.rs
│ │ ├── app_context.rs
│ │ ├── events.rs
│ │ ├── lib.rs
│ │ └── tests/
│ │ ├── api.rs
│ │ ├── mod.rs
│ │ └── network.rs
│ ├── topos-tce-api/
│ │ ├── Cargo.toml
│ │ ├── src/
│ │ │ ├── graphql/
│ │ │ │ ├── builder.rs
│ │ │ │ ├── filter.rs
│ │ │ │ ├── mod.rs
│ │ │ │ ├── query.rs
│ │ │ │ ├── routes.rs
│ │ │ │ └── tests.rs
│ │ │ ├── grpc/
│ │ │ │ ├── builder.rs
│ │ │ │ ├── console.rs
│ │ │ │ ├── messaging.rs
│ │ │ │ ├── mod.rs
│ │ │ │ └── tests.rs
│ │ │ ├── lib.rs
│ │ │ ├── metrics/
│ │ │ │ ├── builder.rs
│ │ │ │ └── mod.rs
│ │ │ ├── runtime/
│ │ │ │ ├── builder.rs
│ │ │ │ ├── client.rs
│ │ │ │ ├── commands.rs
│ │ │ │ ├── error.rs
│ │ │ │ ├── events.rs
│ │ │ │ ├── mod.rs
│ │ │ │ ├── sync_task.rs
│ │ │ │ └── tests.rs
│ │ │ ├── stream/
│ │ │ │ ├── commands.rs
│ │ │ │ ├── errors.rs
│ │ │ │ ├── mod.rs
│ │ │ │ ├── tests/
│ │ │ │ │ └── utils.rs
│ │ │ │ └── tests.rs
│ │ │ └── tests.rs
│ │ └── tests/
│ │ ├── grpc/
│ │ │ ├── certificate_precedence.rs
│ │ │ └── mod.rs
│ │ └── runtime.rs
│ ├── topos-tce-broadcast/
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ ├── benches/
│ │ │ ├── double_echo.rs
│ │ │ └── task_manager.rs
│ │ └── src/
│ │ ├── constant.rs
│ │ ├── double_echo/
│ │ │ ├── broadcast_state/
│ │ │ │ └── status.rs
│ │ │ ├── broadcast_state.rs
│ │ │ └── mod.rs
│ │ ├── event.rs
│ │ ├── lib.rs
│ │ ├── sampler/
│ │ │ └── mod.rs
│ │ ├── task_manager/
│ │ │ ├── mod.rs
│ │ │ └── task.rs
│ │ └── tests/
│ │ ├── mod.rs
│ │ ├── task.rs
│ │ └── task_manager.rs
│ ├── topos-tce-gatekeeper/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ ├── builder.rs
│ │ ├── client.rs
│ │ ├── lib.rs
│ │ └── tests.rs
│ ├── topos-tce-proxy/
│ │ ├── Cargo.toml
│ │ ├── src/
│ │ │ ├── client.rs
│ │ │ ├── lib.rs
│ │ │ └── worker.rs
│ │ └── tests/
│ │ └── tce_tests.rs
│ ├── topos-tce-storage/
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ └── src/
│ │ ├── client.rs
│ │ ├── constant.rs
│ │ ├── epoch/
│ │ │ ├── mod.rs
│ │ │ └── tables.rs
│ │ ├── errors.rs
│ │ ├── fullnode/
│ │ │ ├── locking.rs
│ │ │ └── mod.rs
│ │ ├── index/
│ │ │ └── mod.rs
│ │ ├── lib.rs
│ │ ├── rocks/
│ │ │ ├── constants.rs
│ │ │ ├── db.rs
│ │ │ ├── db_column.rs
│ │ │ ├── iterator.rs
│ │ │ ├── map.rs
│ │ │ └── types.rs
│ │ ├── rocks.rs
│ │ ├── store.rs
│ │ ├── tests/
│ │ │ ├── checkpoints.rs
│ │ │ ├── db_columns.rs
│ │ │ ├── mod.rs
│ │ │ ├── pending_certificates.rs
│ │ │ ├── position.rs
│ │ │ ├── rocks.rs
│ │ │ └── support/
│ │ │ ├── columns.rs
│ │ │ ├── folder.rs
│ │ │ └── mod.rs
│ │ ├── types.rs
│ │ └── validator/
│ │ ├── mod.rs
│ │ └── tables.rs
│ ├── topos-tce-synchronizer/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ ├── builder.rs
│ │ ├── checkpoints_collector/
│ │ │ ├── error.rs
│ │ │ ├── mod.rs
│ │ │ ├── tests/
│ │ │ │ └── integration.rs
│ │ │ └── tests.rs
│ │ └── lib.rs
│ ├── topos-telemetry/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ ├── lib.rs
│ │ └── tracing.rs
│ ├── topos-test-sdk/
│ │ ├── Cargo.toml
│ │ ├── build.rs
│ │ ├── proc_macro_sdk/
│ │ │ ├── Cargo.toml
│ │ │ └── src/
│ │ │ └── lib.rs
│ │ ├── proto/
│ │ │ └── behaviour/
│ │ │ ├── helloworld.proto
│ │ │ └── noop.proto
│ │ └── src/
│ │ ├── certificates/
│ │ │ └── mod.rs
│ │ ├── crypto.rs
│ │ ├── grpc/
│ │ │ ├── behaviour/
│ │ │ │ ├── helloworld.rs
│ │ │ │ └── noop.rs
│ │ │ └── mod.rs
│ │ ├── lib.rs
│ │ ├── networking/
│ │ │ └── mod.rs
│ │ ├── p2p/
│ │ │ └── mod.rs
│ │ ├── sequencer/
│ │ │ └── mod.rs
│ │ ├── storage/
│ │ │ └── mod.rs
│ │ └── tce/
│ │ ├── gatekeeper.rs
│ │ ├── mod.rs
│ │ ├── p2p.rs
│ │ ├── protocol.rs
│ │ ├── public_api.rs
│ │ └── synchronizer.rs
│ └── topos-wallet/
│ ├── Cargo.toml
│ └── src/
│ ├── error.rs
│ └── lib.rs
├── docs/
│ ├── .gitignore
│ ├── README.md
│ ├── architecture/
│ │ ├── certificates_collector.md
│ │ ├── checkpoints_collector.md
│ │ ├── gatekeeper.md
│ │ └── synchronizer.md
│ ├── book.toml
│ └── src/
│ ├── README.md
│ ├── SUMMARY.md
│ ├── glossary.md
│ ├── test.md
│ └── topos-node.md
├── grafana/
│ └── benchmarks-dashboard.json
├── rust-toolchain
├── rustfmt.toml
└── scripts/
└── check_readme.sh
SYMBOL INDEX (1649 symbols across 242 files)
FILE: crates/topos-certificate-spammer/src/config.rs
type CertificateSpammerConfig (line 2) | pub struct CertificateSpammerConfig {
FILE: crates/topos-certificate-spammer/src/error.rs
type Error (line 2) | pub enum Error {
FILE: crates/topos-certificate-spammer/src/lib.rs
type NodeApiAddress (line 26) | type NodeApiAddress = String;
type FileNodes (line 29) | struct FileNodes {
type TargetNodeConnection (line 36) | struct TargetNodeConnection {
method shutdown (line 51) | pub async fn shutdown(&mut self) -> Result<(), Box<dyn std::error::Err...
type SourceSubnet (line 44) | pub struct SourceSubnet {
function open_target_node_connection (line 60) | async fn open_target_node_connection(
function close_target_node_connections (line 140) | async fn close_target_node_connections(
function submit_cert_to_tce (line 156) | async fn submit_cert_to_tce(node: &TargetNodeConnection, cert: Certifica...
function send_new_certificate (line 169) | async fn send_new_certificate(tce_client: &mut TceClient, cert: Certific...
function dispatch (line 180) | async fn dispatch(cert: Certificate, target_node: &TargetNodeConnection) {
function run (line 188) | pub async fn run(
FILE: crates/topos-certificate-spammer/src/utils.rs
function generate_random_32b_array (line 20) | pub fn generate_random_32b_array() -> [u8; 32] {
function generate_test_certificate (line 29) | pub fn generate_test_certificate(
function generate_source_subnets (line 51) | pub fn generate_source_subnets(
FILE: crates/topos-clock/src/lib.rs
constant BROADCAST_CHANNEL_SIZE (line 14) | const BROADCAST_CHANNEL_SIZE: usize = 100;
type Clock (line 16) | pub trait Clock {
method spawn (line 18) | fn spawn(self) -> Result<broadcast::Receiver<Event>, Error>;
method block_ref (line 20) | fn block_ref(&self) -> Arc<AtomicU64>;
method epoch_ref (line 22) | fn epoch_ref(&self) -> Arc<AtomicU64>;
type Event (line 26) | pub enum Event {
type Error (line 32) | pub enum Error {
FILE: crates/topos-clock/src/time.rs
type TimeClock (line 22) | pub struct TimeClock {
method new (line 53) | pub fn new(genesis: DateTime<Utc>, epoch_duration: u64) -> Result<Self...
method run (line 67) | async fn run(&mut self, sender: broadcast::Sender<Event>) {
method compute_block (line 83) | fn compute_block(&mut self) {
method compute_epoch (line 95) | fn compute_epoch(&mut self) {
method spawn (line 30) | fn spawn(mut self) -> Result<broadcast::Receiver<Event>, Error> {
method block_ref (line 43) | fn block_ref(&self) -> Arc<AtomicU64> {
method epoch_ref (line 46) | fn epoch_ref(&self) -> Arc<AtomicU64> {
function test_time_clock (line 110) | async fn test_time_clock() {
function test_time_clock_catchup (line 127) | async fn test_time_clock_catchup() {
FILE: crates/topos-config/src/base.rs
type BaseConfig (line 14) | pub struct BaseConfig {
method need_tce (line 45) | pub fn need_tce(&self) -> bool {
method need_sequencer (line 49) | pub fn need_sequencer(&self) -> bool {
method need_edge (line 53) | pub fn need_edge(&self) -> bool {
function default_name (line 28) | fn default_name() -> String {
function default_role (line 32) | fn default_role() -> NodeRole {
function default_subnet (line 36) | fn default_subnet() -> String {
function default_secrets_config (line 40) | fn default_secrets_config() -> Option<String> {
type Output (line 59) | type Output = Self;
method load_from_file (line 61) | fn load_from_file(figment: Figment, home: &Path) -> Figment {
method load_context (line 71) | fn load_context(figment: Figment) -> Result<Self::Output, figment::Error> {
method profile (line 75) | fn profile() -> String {
FILE: crates/topos-config/src/edge.rs
type EdgeConfig (line 22) | pub struct EdgeConfig {
type Output (line 28) | type Output = EdgeConfig;
method load_from_file (line 30) | fn load_from_file(figment: Figment, home: &Path) -> Figment {
method load_context (line 40) | fn load_context(figment: Figment) -> Result<Self::Output, figment::Error> {
method profile (line 44) | fn profile() -> String {
type EdgeBinConfig (line 51) | pub struct EdgeBinConfig {
method binary_path (line 56) | pub fn binary_path(&self) -> PathBuf {
type Output (line 62) | type Output = EdgeBinConfig;
method load_from_file (line 64) | fn load_from_file(figment: Figment, home: &Path) -> Figment {
method load_context (line 74) | fn load_context(figment: Figment) -> Result<Self::Output, figment::Error> {
method profile (line 78) | fn profile() -> String {
function generate_edge_config (line 84) | pub fn generate_edge_config(
FILE: crates/topos-config/src/edge/command.rs
constant BINARY_NAME (line 13) | pub const BINARY_NAME: &str = "polygon-edge";
type CommandConfig (line 15) | pub struct CommandConfig {
method new (line 21) | pub fn new(binary_path: PathBuf) -> Self {
method init (line 36) | pub fn init(mut self, path: &Path) -> Self {
method server (line 45) | pub fn server(
method spawn (line 66) | pub async fn spawn(self) -> Result<ExitStatus, std::io::Error> {
type EdgeLog (line 122) | pub struct EdgeLog {
method new (line 127) | pub fn new(v: HashMap<String, Value>) -> Self {
method log (line 131) | pub fn log(&mut self) {
method internal (line 144) | fn internal(&mut self) -> String {
FILE: crates/topos-config/src/genesis/mod.rs
type Genesis (line 17) | pub struct Genesis {
method new (line 31) | pub fn new(path: &PathBuf) -> Result<Self, Error> {
method boot_peers (line 42) | pub fn boot_peers(&self, port: Option<u16>) -> Vec<(PeerId, Multiaddr)> {
method validators (line 67) | pub fn validators(&self) -> Result<HashSet<ValidatorId>, Error> {
type Error (line 110) | type Error = Error;
method try_from (line 112) | fn try_from(config: &NodeConfig) -> Result<Self, Self::Error> {
type Error (line 22) | pub enum Error {
FILE: crates/topos-config/src/genesis/tests.rs
function genesis (line 16) | pub fn genesis() -> Genesis {
function test_correct_validator_count (line 22) | pub fn test_correct_validator_count(genesis: &Genesis) {
function test_parse_bootnodes (line 28) | pub fn test_parse_bootnodes(genesis: &Genesis) {
function test_extract_validators (line 35) | pub fn test_extract_validators(genesis: &Genesis) {
FILE: crates/topos-config/src/lib.rs
type Config (line 14) | pub trait Config: Serialize {
method load_from_file (line 21) | fn load_from_file(figment: Figment, home: &Path) -> Figment;
method load_context (line 25) | fn load_context(figment: Figment) -> Result<Self::Output, figment::Err...
method profile (line 29) | fn profile() -> String;
method to_toml (line 32) | fn to_toml(&self) -> Result<toml::Table, toml::ser::Error> {
method load (line 49) | fn load<S: Serialize>(home: &Path, config: Option<&S>) -> Result<Self:...
function load_config (line 62) | pub(crate) fn load_config<T: Config, S: Serialize>(
FILE: crates/topos-config/src/node.rs
type NodeRole (line 23) | pub enum NodeRole {
type NodeConfig (line 30) | pub struct NodeConfig {
method try_from (line 54) | pub fn try_from<S: Serialize>(
method create (line 78) | pub fn create<S: Serialize>(home_path: &Path, node_name: &str, config:...
method build_config (line 85) | fn build_config<S: Serialize>(
type Output (line 132) | type Output = NodeConfig;
method load_from_file (line 134) | fn load_from_file(figment: Figment, home: &Path) -> Figment {
method load_context (line 140) | fn load_context(figment: Figment) -> Result<Self::Output, figment::Error> {
method profile (line 144) | fn profile() -> String {
method from (line 150) | fn from(val: &NodeConfig) -> Self {
FILE: crates/topos-config/src/sequencer.rs
type SequencerConfig (line 12) | pub struct SequencerConfig {
function default_subnet_jsonrpc_endpoint (line 45) | fn default_subnet_jsonrpc_endpoint() -> String {
function default_subnet_contract_address (line 49) | fn default_subnet_contract_address() -> String {
function default_tce_grpc_endpoint (line 53) | fn default_tce_grpc_endpoint() -> String {
type Output (line 58) | type Output = Self;
method load_from_file (line 60) | fn load_from_file(figment: Figment, home: &Path) -> Figment {
method load_context (line 70) | fn load_context(figment: Figment) -> Result<Self::Output, figment::Error> {
method profile (line 74) | fn profile() -> String {
FILE: crates/topos-config/src/tce.rs
constant DEFAULT_IP (line 24) | const DEFAULT_IP: std::net::Ipv4Addr = std::net::Ipv4Addr::new(0, 0, 0, 0);
type AuthKey (line 27) | pub enum AuthKey {
type StorageConfiguration (line 32) | pub enum StorageConfiguration {
type TceConfig (line 40) | pub struct TceConfig {
method parse_boot_peers (line 121) | pub fn parse_boot_peers(&self) -> Vec<(PeerId, Multiaddr)> {
function default_network_bootstrap_timeout (line 97) | const fn default_network_bootstrap_timeout() -> u64 {
function default_db_path (line 101) | fn default_db_path() -> PathBuf {
function default_minimum_tce_cluster_size (line 104) | const fn default_minimum_tce_cluster_size() -> usize {
function default_grpc_api_addr (line 108) | const fn default_grpc_api_addr() -> SocketAddr {
function default_graphql_api_addr (line 112) | const fn default_graphql_api_addr() -> SocketAddr {
function default_metrics_api_addr (line 116) | const fn default_metrics_api_addr() -> SocketAddr {
type Output (line 144) | type Output = TceConfig;
method load_from_file (line 146) | fn load_from_file(figment: Figment, home: &Path) -> Figment {
method load_context (line 156) | fn load_context(figment: Figment) -> Result<Self::Output, figment::Error> {
method profile (line 160) | fn profile() -> String {
FILE: crates/topos-config/src/tce/broadcast.rs
type ReliableBroadcastParams (line 5) | pub struct ReliableBroadcastParams {
method new (line 15) | pub const fn new(n: usize) -> Self {
FILE: crates/topos-config/src/tce/p2p.rs
type P2PConfig (line 10) | pub struct P2PConfig {
method default (line 23) | fn default() -> Self {
function default_libp2p_api_addr (line 32) | const fn default_libp2p_api_addr() -> SocketAddr {
function default_listen_addresses (line 36) | fn default_listen_addresses() -> Vec<Multiaddr> {
function default_public_addresses (line 51) | fn default_public_addresses() -> Vec<Multiaddr> {
FILE: crates/topos-config/src/tce/synchronization.rs
type SynchronizationConfig (line 6) | pub struct SynchronizationConfig {
constant INTERVAL_SECONDS (line 26) | pub const INTERVAL_SECONDS: u64 = 10;
constant LIMIT_PER_SUBNET (line 27) | pub const LIMIT_PER_SUBNET: usize = 100;
method default_interval_seconds (line 29) | const fn default_interval_seconds() -> u64 {
method default_limit_per_subnet (line 33) | const fn default_limit_per_subnet() -> usize {
method default (line 17) | fn default() -> Self {
FILE: crates/topos-core/build.rs
function main (line 3) | fn main() -> Result<(), Box<dyn std::error::Error>> {
FILE: crates/topos-core/src/api/graphql/certificate.rs
type CertificateId (line 9) | pub struct CertificateId(String);
method from (line 12) | fn from(value: uci::CertificateId) -> Self {
type CertificatePositions (line 19) | pub struct CertificatePositions {
type Certificate (line 26) | pub struct Certificate {
method from (line 80) | fn from(value: &CertificateDelivered) -> Self {
type UndeliveredCertificate (line 43) | pub struct UndeliveredCertificate {
method from (line 57) | fn from(value: &crate::uci::Certificate) -> Self {
type Ready (line 74) | pub struct Ready {
type Error (line 102) | type Error = uci::Error;
function try_from (line 104) | fn try_from(value: CertificateId) -> Result<Self, Self::Error> {
FILE: crates/topos-core/src/api/graphql/checkpoint.rs
type SourceStreamPositionInput (line 9) | pub struct SourceStreamPositionInput {
type SourceStreamPosition (line 17) | pub struct SourceStreamPosition {
method from (line 24) | fn from(value: &ProofOfDelivery) -> Self {
type SourceCheckpointInput (line 34) | pub struct SourceCheckpointInput {
FILE: crates/topos-core/src/api/graphql/errors.rs
type GraphQLServerError (line 2) | pub enum GraphQLServerError {
FILE: crates/topos-core/src/api/graphql/filter.rs
type SubnetFilter (line 4) | pub enum SubnetFilter {
FILE: crates/topos-core/src/api/graphql/query.rs
type CertificateQuery (line 9) | pub trait CertificateQuery {
method certificates_per_subnet (line 10) | async fn certificates_per_subnet(
method certificate_by_id (line 16) | async fn certificate_by_id(
FILE: crates/topos-core/src/api/graphql/subnet.rs
type SubnetId (line 9) | pub struct SubnetId(pub(crate) String);
method from (line 23) | fn from(uci_id: &crate::uci::SubnetId) -> Self {
method eq (line 29) | fn eq(&self, other: &crate::uci::SubnetId) -> bool {
type Error (line 12) | type Error = GraphQLServerError;
function try_from (line 14) | fn try_from(value: &SubnetId) -> Result<Self, Self::Error> {
FILE: crates/topos-core/src/api/grpc/checkpoints/errors.rs
type TargetCheckpointError (line 4) | pub enum TargetCheckpointError {
type StreamPositionError (line 14) | pub enum StreamPositionError {
FILE: crates/topos-core/src/api/grpc/checkpoints/mod.rs
type TargetCheckpoint (line 11) | pub struct TargetCheckpoint {
type Error (line 17) | type Error = TargetCheckpointError;
method try_from (line 19) | fn try_from(value: shared_v1::checkpoints::TargetCheckpoint) -> Result...
function from (line 38) | fn from(value: TargetCheckpoint) -> Self {
FILE: crates/topos-core/src/api/grpc/checkpoints/positions.rs
type TargetStreamPosition (line 6) | pub struct TargetStreamPosition {
type Error (line 14) | type Error = StreamPositionError;
method try_from (line 16) | fn try_from(value: shared_v1::positions::TargetStreamPosition) -> Resu...
function from (line 39) | fn from(value: TargetStreamPosition) -> Self {
type SourceStreamPosition (line 50) | pub struct SourceStreamPosition {
type Error (line 57) | type Error = StreamPositionError;
method try_from (line 59) | fn try_from(value: shared_v1::positions::SourceStreamPosition) -> Resu...
function from (line 78) | fn from(value: SourceStreamPosition) -> Self {
FILE: crates/topos-core/src/api/grpc/conversions/shared/v1/certificate.rs
method fmt (line 6) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
type Error (line 12) | pub enum Error {
method from (line 18) | fn from(value: [u8; CERTIFICATE_ID_LENGTH]) -> Self {
method from (line 26) | fn from(value: crate::uci::CertificateId) -> Self {
type Error (line 34) | type Error = Error;
function try_from (line 36) | fn try_from(value: CertificateId) -> Result<Self, Self::Error> {
function eq (line 49) | fn eq(&self, other: &CertificateId) -> bool {
FILE: crates/topos-core/src/api/grpc/conversions/shared/v1/signature.rs
function from (line 5) | fn from(proto: EcdsaSignature) -> Self {
method from (line 15) | fn from(other: topos_crypto::messages::Signature) -> Self {
FILE: crates/topos-core/src/api/grpc/conversions/shared/v1/subnet.rs
method fmt (line 7) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
type Error (line 13) | pub enum Error {
method from (line 34) | fn from(value: [u8; SUBNET_ID_LENGTH]) -> Self {
type Error (line 42) | type Error = Error;
function try_from (line 44) | fn try_from(value: SubnetId) -> Result<Self, Self::Error> {
method from (line 57) | fn from(value: crate::uci::SubnetId) -> Self {
type Error (line 65) | type Error = Error;
function try_from (line 67) | fn try_from(value: SubnetId) -> Result<Self, Self::Error> {
FILE: crates/topos-core/src/api/grpc/conversions/shared/v1/uuid.rs
method from (line 4) | fn from((most_significant_bits, least_significant_bits): (u64, u64)) -> ...
function from (line 13) | fn from(proto: Uuid) -> Self {
method from (line 19) | fn from(uuid: uuid::Uuid) -> Self {
FILE: crates/topos-core/src/api/grpc/conversions/shared/v1/validator_id.rs
method fmt (line 6) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
method from (line 12) | fn from(other: topos_crypto::validator_id::ValidatorId) -> Self {
type Error (line 20) | type Error = Error;
function try_from (line 22) | fn try_from(other: ValidatorId) -> Result<Self, Self::Error> {
function eq (line 33) | fn eq(&self, other: &ValidatorId) -> bool {
FILE: crates/topos-core/src/api/grpc/conversions/uci/v1/uci.rs
type Error (line 8) | type Error = Error;
function try_from (line 10) | fn try_from(certificate: proto_v1::Certificate) -> Result<Self, Self::Er...
function from (line 55) | fn from(certificate: crate::uci::Certificate) -> Self {
function test_proto_uci_certificate_conversion_id_random_0x (line 86) | fn test_proto_uci_certificate_conversion_id_random_0x() {
function test_proto_uci_certificate_conversion_id_starts_with_0x (line 137) | fn test_proto_uci_certificate_conversion_id_starts_with_0x() {
FILE: crates/topos-core/src/api/grpc/generated/topos.p2p.rs
type InfoServiceClient (line 7) | pub struct InfoServiceClient<T> {
function connect (line 12) | pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
function new (line 28) | pub fn new(inner: T) -> Self {
function with_origin (line 32) | pub fn with_origin(inner: T, origin: Uri) -> Self {
function with_interceptor (line 36) | pub fn with_interceptor<F>(
function send_compressed (line 60) | pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
function accept_compressed (line 66) | pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
function max_decoding_message_size (line 74) | pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
function max_encoding_message_size (line 82) | pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
type InfoService (line 94) | pub trait InfoService: Send + Sync + 'static {}
type InfoServiceServer (line 96) | pub struct InfoServiceServer<T: InfoService> {
type _Inner (line 103) | struct _Inner<T>(Arc<T>);
function new (line 105) | pub fn new(inner: T) -> Self {
function from_arc (line 108) | pub fn from_arc(inner: Arc<T>) -> Self {
function with_interceptor (line 118) | pub fn with_interceptor<F>(
function accept_compressed (line 129) | pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
function send_compressed (line 135) | pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
function max_decoding_message_size (line 143) | pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
function max_encoding_message_size (line 151) | pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
type Response (line 162) | type Response = http::Response<tonic::body::BoxBody>;
type Error (line 163) | type Error = std::convert::Infallible;
type Future (line 164) | type Future = BoxFuture<Self::Response, Self::Error>;
function poll_ready (line 165) | fn poll_ready(
function call (line 171) | fn call(&mut self, req: http::Request<B>) -> Self::Future {
method clone (line 190) | fn clone(&self) -> Self {
method clone (line 202) | fn clone(&self) -> Self {
function fmt (line 207) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
constant NAME (line 212) | const NAME: &'static str = "topos.p2p.InfoService";
FILE: crates/topos-core/src/api/grpc/generated/topos.shared.v1.rs
type Uuid (line 4) | pub struct Uuid {
type SubnetId (line 13) | pub struct SubnetId {
type ValidatorId (line 22) | pub struct ValidatorId {
type CertificateId (line 30) | pub struct CertificateId {
type Checkpoints (line 37) | pub struct Checkpoints {}
type SourceCheckpoint (line 44) | pub struct SourceCheckpoint {
type TargetCheckpoint (line 54) | pub struct TargetCheckpoint {
type Positions (line 63) | pub struct Positions {}
type SourceStreamPosition (line 71) | pub struct SourceStreamPosition {
type TargetStreamPosition (line 84) | pub struct TargetStreamPosition {
type Frost (line 100) | pub struct Frost {
type StarkProof (line 107) | pub struct StarkProof {
type EcdsaSignature (line 116) | pub struct EcdsaSignature {
FILE: crates/topos-core/src/api/grpc/generated/topos.tce.v1.rs
type CheckpointRequest (line 4) | pub struct CheckpointRequest {
type CheckpointResponse (line 16) | pub struct CheckpointResponse {
type CheckpointMapFieldEntry (line 26) | pub struct CheckpointMapFieldEntry {
type FetchCertificatesRequest (line 34) | pub struct FetchCertificatesRequest {
type FetchCertificatesResponse (line 43) | pub struct FetchCertificatesResponse {
type ProofOfDelivery (line 53) | pub struct ProofOfDelivery {
type SignedReady (line 66) | pub struct SignedReady {
type SynchronizerServiceClient (line 78) | pub struct SynchronizerServiceClient<T> {
function connect (line 83) | pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
function new (line 99) | pub fn new(inner: T) -> Self {
function with_origin (line 103) | pub fn with_origin(inner: T, origin: Uri) -> Self {
function with_interceptor (line 107) | pub fn with_interceptor<F>(
function send_compressed (line 131) | pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
function accept_compressed (line 137) | pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
function max_decoding_message_size (line 145) | pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
function max_encoding_message_size (line 153) | pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
function fetch_checkpoint (line 157) | pub async fn fetch_checkpoint(
function fetch_certificates (line 187) | pub async fn fetch_certificates(
type SynchronizerService (line 225) | pub trait SynchronizerService: Send + Sync + 'static {
method fetch_checkpoint (line 226) | async fn fetch_checkpoint(
method fetch_certificates (line 233) | async fn fetch_certificates(
type SynchronizerServiceServer (line 242) | pub struct SynchronizerServiceServer<T: SynchronizerService> {
type _Inner (line 249) | struct _Inner<T>(Arc<T>);
function new (line 251) | pub fn new(inner: T) -> Self {
function from_arc (line 254) | pub fn from_arc(inner: Arc<T>) -> Self {
function with_interceptor (line 264) | pub fn with_interceptor<F>(
function accept_compressed (line 275) | pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
function send_compressed (line 281) | pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
function max_decoding_message_size (line 289) | pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
function max_encoding_message_size (line 297) | pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
type Response (line 308) | type Response = http::Response<tonic::body::BoxBody>;
type Error (line 309) | type Error = std::convert::Infallible;
type Future (line 310) | type Future = BoxFuture<Self::Response, Self::Error>;
function poll_ready (line 311) | fn poll_ready(
function call (line 317) | fn call(&mut self, req: http::Request<B>) -> Self::Future {
method clone (line 436) | fn clone(&self) -> Self {
method clone (line 448) | fn clone(&self) -> Self {
function fmt (line 453) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
constant NAME (line 459) | const NAME: &'static str = "topos.tce.v1.SynchronizerService";
type SubmitCertificateRequest (line 464) | pub struct SubmitCertificateRequest {
type SubmitCertificateResponse (line 470) | pub struct SubmitCertificateResponse {}
type GetSourceHeadRequest (line 473) | pub struct GetSourceHeadRequest {
type GetSourceHeadResponse (line 479) | pub struct GetSourceHeadResponse {
type GetLastPendingCertificatesRequest (line 489) | pub struct GetLastPendingCertificatesRequest {
type LastPendingCertificate (line 495) | pub struct LastPendingCertificate {
type GetLastPendingCertificatesResponse (line 504) | pub struct GetLastPendingCertificatesResponse {
type WatchCertificatesRequest (line 515) | pub struct WatchCertificatesRequest {
type OpenStream (line 528) | pub struct OpenStream {
type Command (line 541) | pub enum Command {
type WatchCertificatesResponse (line 548) | pub struct WatchCertificatesResponse {
type StreamOpened (line 561) | pub struct StreamOpened {
type CertificatePushed (line 570) | pub struct CertificatePushed {
type Event (line 582) | pub enum Event {
type ApiServiceClient (line 595) | pub struct ApiServiceClient<T> {
function connect (line 600) | pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
function new (line 616) | pub fn new(inner: T) -> Self {
function with_origin (line 620) | pub fn with_origin(inner: T, origin: Uri) -> Self {
function with_interceptor (line 624) | pub fn with_interceptor<F>(
function send_compressed (line 648) | pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
function accept_compressed (line 654) | pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
function max_decoding_message_size (line 662) | pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
function max_encoding_message_size (line 670) | pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
function submit_certificate (line 674) | pub async fn submit_certificate(
function get_source_head (line 699) | pub async fn get_source_head(
function get_last_pending_certificates (line 729) | pub async fn get_last_pending_certificates(
function watch_certificates (line 760) | pub async fn watch_certificates(
type ApiService (line 795) | pub trait ApiService: Send + Sync + 'static {
method submit_certificate (line 796) | async fn submit_certificate(
method get_source_head (line 803) | async fn get_source_head(
method get_last_pending_certificates (line 815) | async fn get_last_pending_certificates(
method watch_certificates (line 832) | async fn watch_certificates(
type ApiServiceServer (line 841) | pub struct ApiServiceServer<T: ApiService> {
type _Inner (line 848) | struct _Inner<T>(Arc<T>);
function new (line 850) | pub fn new(inner: T) -> Self {
function from_arc (line 853) | pub fn from_arc(inner: Arc<T>) -> Self {
function with_interceptor (line 863) | pub fn with_interceptor<F>(
function accept_compressed (line 874) | pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
function send_compressed (line 880) | pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
function max_decoding_message_size (line 888) | pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
function max_encoding_message_size (line 896) | pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
type Response (line 907) | type Response = http::Response<tonic::body::BoxBody>;
type Error (line 908) | type Error = std::convert::Infallible;
type Future (line 909) | type Future = BoxFuture<Self::Response, Self::Error>;
function poll_ready (line 910) | fn poll_ready(
function call (line 916) | fn call(&mut self, req: http::Request<B>) -> Self::Future {
method clone (line 1129) | fn clone(&self) -> Self {
method clone (line 1141) | fn clone(&self) -> Self {
function fmt (line 1146) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
constant NAME (line 1151) | const NAME: &'static str = "topos.tce.v1.APIService";
type StatusRequest (line 1156) | pub struct StatusRequest {}
type StatusResponse (line 1159) | pub struct StatusResponse {
type ConsoleServiceClient (line 1169) | pub struct ConsoleServiceClient<T> {
function connect (line 1174) | pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
function new (line 1190) | pub fn new(inner: T) -> Self {
function with_origin (line 1194) | pub fn with_origin(inner: T, origin: Uri) -> Self {
function with_interceptor (line 1198) | pub fn with_interceptor<F>(
function send_compressed (line 1222) | pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
function accept_compressed (line 1228) | pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
function max_decoding_message_size (line 1236) | pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
function max_encoding_message_size (line 1244) | pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
function status (line 1248) | pub async fn status(
type ConsoleService (line 1278) | pub trait ConsoleService: Send + Sync + 'static {
method status (line 1279) | async fn status(
type ConsoleServiceServer (line 1285) | pub struct ConsoleServiceServer<T: ConsoleService> {
type _Inner (line 1292) | struct _Inner<T>(Arc<T>);
function new (line 1294) | pub fn new(inner: T) -> Self {
function from_arc (line 1297) | pub fn from_arc(inner: Arc<T>) -> Self {
function with_interceptor (line 1307) | pub fn with_interceptor<F>(
function accept_compressed (line 1318) | pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
function send_compressed (line 1324) | pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
function max_decoding_message_size (line 1332) | pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
function max_encoding_message_size (line 1340) | pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
type Response (line 1351) | type Response = http::Response<tonic::body::BoxBody>;
type Error (line 1352) | type Error = std::convert::Infallible;
type Future (line 1353) | type Future = BoxFuture<Self::Response, Self::Error>;
function poll_ready (line 1354) | fn poll_ready(
function call (line 1360) | fn call(&mut self, req: http::Request<B>) -> Self::Future {
method clone (line 1425) | fn clone(&self) -> Self {
method clone (line 1437) | fn clone(&self) -> Self {
function fmt (line 1442) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
constant NAME (line 1447) | const NAME: &'static str = "topos.tce.v1.ConsoleService";
type Gossip (line 1453) | pub struct Gossip {
type Echo (line 1460) | pub struct Echo {
type Ready (line 1471) | pub struct Ready {
type DoubleEchoRequest (line 1482) | pub struct DoubleEchoRequest {
type Request (line 1491) | pub enum Request {
type Batch (line 1503) | pub struct Batch {
FILE: crates/topos-core/src/api/grpc/generated/topos.uci.v1.rs
type Certificate (line 5) | pub struct Certificate {
type OptionalCertificate (line 29) | pub struct OptionalCertificate {
FILE: crates/topos-core/src/api/grpc/mod.rs
constant FILE_DESCRIPTOR_SET (line 7) | pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!("generated/topos.b...
type GrpcClient (line 11) | pub trait GrpcClient {
method init (line 14) | fn init(destination: Channel) -> Self::Output;
type Output (line 18) | type Output = Self;
method init (line 20) | fn init(channel: Channel) -> Self::Output {
type ConversionError (line 26) | pub enum ConversionError {
FILE: crates/topos-core/src/errors.rs
type GrpcParsingError (line 4) | pub enum GrpcParsingError {
FILE: crates/topos-core/src/test.rs
function test_position (line 4) | fn test_position() {
function position_from_integer (line 23) | fn position_from_integer() {
FILE: crates/topos-core/src/types.rs
type Ready (line 14) | pub type Ready = String;
type Signature (line 15) | pub type Signature = String;
type CertificateDelivered (line 21) | pub struct CertificateDelivered {
method as_ref (line 27) | fn as_ref(&self) -> &Self {
type ProofOfDelivery (line 47) | pub struct ProofOfDelivery {
type Error (line 68) | type Error = GrpcParsingError;
method try_from (line 69) | fn try_from(value: GrpcProofOfDelivery) -> Result<Self, Self::Error> {
method from (line 59) | fn from(value: SourceStreamPosition) -> Self {
method from (line 93) | fn from(value: ProofOfDelivery) -> Self {
FILE: crates/topos-core/src/types/stream.rs
type CertificateSourceStreamPosition (line 17) | pub struct CertificateSourceStreamPosition {
method fmt (line 25) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
method new (line 31) | pub fn new<P: Into<Position>>(subnet_id: SubnetId, position: P) -> Self {
type CertificateTargetStreamPosition (line 49) | pub struct CertificateTargetStreamPosition {
method new (line 56) | pub fn new<P: Into<Position>>(
type Position (line 71) | pub struct Position(u64);
type Error (line 85) | type Error = PositionError;
method try_from (line 87) | fn try_from(value: usize) -> Result<Self, Self::Error> {
method from (line 95) | fn from(value: u64) -> Self {
method fmt (line 121) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
constant ZERO (line 127) | pub const ZERO: Self = Self(0);
method increment (line 129) | pub fn increment(self) -> Result<Self, PositionError> {
type Error (line 74) | type Error = PositionError;
function try_from (line 76) | fn try_from(position: Position) -> Result<usize, Self::Error> {
type Target (line 101) | type Target = u64;
method deref (line 103) | fn deref(&self) -> &Self::Target {
function eq (line 109) | fn eq(&self, other: &Position) -> bool {
method partial_cmp (line 115) | fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
type PositionError (line 141) | pub enum PositionError {
FILE: crates/topos-core/src/uci/certificate.rs
type Certificate (line 12) | pub struct Certificate {
method as_ref (line 26) | fn as_ref(&self) -> &Self {
method new (line 69) | pub fn new<P: Into<CertificateId>>(
method new_with_default_fields (line 96) | pub fn new_with_default_fields<P: Into<CertificateId>>(
method check_signature (line 118) | pub fn check_signature(&self) -> Result<(), Error> {
method check_proof (line 123) | pub fn check_proof(&self) -> Result<(), Error> {
method update_signature (line 129) | pub fn update_signature(&mut self, private_key: &[u8]) -> Result<(), E...
method get_payload (line 137) | pub fn get_payload(&self) -> Vec<u8> {
method calculate_cert_id (line 155) | fn calculate_cert_id(certificate: &Certificate) -> Result<[u8; CERTIFI...
method fmt (line 32) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
constant PREV_CERTIFICATE_ID (line 177) | const PREV_CERTIFICATE_ID: CertificateId =
constant TARGET_SUBNET_ID (line 179) | const TARGET_SUBNET_ID: SubnetId = SubnetId::from_array([3u8; SUBNET_ID_...
constant STATE_ROOT (line 180) | const STATE_ROOT: StateRoot = [4u8; 32];
constant TX_ROOT_HASH (line 181) | const TX_ROOT_HASH: TxRootHash = [5u8; 32];
constant RECEIPTS_ROOT_HASH (line 182) | const RECEIPTS_ROOT_HASH: ReceiptsRootHash = [6u8; 32];
constant PRIVATE_TEST_KEY (line 183) | const PRIVATE_TEST_KEY: &str =
function generate_dummy_cert (line 186) | fn generate_dummy_cert(signing_key: &[u8]) -> Certificate {
function certificate_signatures (line 205) | fn certificate_signatures() {
function signature_verification_failed_corrupt_data (line 223) | fn signature_verification_failed_corrupt_data() {
function signature_verification_failed_invalid_public_key (line 246) | fn signature_verification_failed_invalid_public_key() {
FILE: crates/topos-core/src/uci/certificate_id.rs
constant INITIAL_CERTIFICATE_ID (line 7) | pub const INITIAL_CERTIFICATE_ID: CertificateId =
type CertificateId (line 11) | pub struct CertificateId {
method from (line 40) | fn from(value: [u8; CERTIFICATE_ID_LENGTH]) -> Self {
type Error (line 52) | type Error = Error;
method try_from (line 54) | fn try_from(value: &[u8]) -> Result<Self, Self::Error> {
method from_array (line 92) | pub const fn from_array(id: [u8; CERTIFICATE_ID_LENGTH]) -> Self {
method as_array (line 96) | pub const fn as_array(&self) -> &[u8; CERTIFICATE_ID_LENGTH] {
method fmt (line 16) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
method fmt (line 22) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
method cmp (line 28) | fn cmp(&self, other: &Self) -> std::cmp::Ordering {
method partial_cmp (line 34) | fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
function from (line 46) | fn from(value: CertificateId) -> Vec<u8> {
constant CERTIFICATE_ID_WITH_PREFIX (line 105) | const CERTIFICATE_ID_WITH_PREFIX: &str =
constant CERTIFICATE_ID_WITHOUT_PREFIX (line 107) | const CERTIFICATE_ID_WITHOUT_PREFIX: &str =
constant MALFORMATTED_CERTIFICATE_ID (line 109) | const MALFORMATTED_CERTIFICATE_ID: &str = "invalid_hex_string";
function convert_cert_id_string_with_prefix (line 112) | fn convert_cert_id_string_with_prefix() {
function convert_cert_id_string_without_prefix (line 128) | fn convert_cert_id_string_without_prefix() {
function malformatted_cert_id (line 146) | fn malformatted_cert_id() {
FILE: crates/topos-core/src/uci/mod.rs
constant CERTIFICATE_ID_LENGTH (line 17) | pub const CERTIFICATE_ID_LENGTH: usize = 32;
constant HEX_CERTIFICATE_ID_LENGTH (line 18) | pub const HEX_CERTIFICATE_ID_LENGTH: usize = 64;
constant SUBNET_ID_LENGTH (line 19) | pub const SUBNET_ID_LENGTH: usize = 32;
type StarkProof (line 22) | pub type StarkProof = Vec<u8>;
type Frost (line 23) | pub type Frost = Vec<u8>;
type Address (line 24) | pub type Address = [u8; 20];
type Amount (line 25) | pub type Amount = ethereum_types::U256;
type StateRoot (line 26) | pub type StateRoot = [u8; 32];
type TxRootHash (line 27) | pub type TxRootHash = [u8; 32];
type ReceiptsRootHash (line 28) | pub type ReceiptsRootHash = [u8; 32];
constant DUMMY_FROST_VERIF_DELAY (line 31) | const DUMMY_FROST_VERIF_DELAY: time::Duration = time::Duration::from_mil...
constant DUMMY_STARK_DELAY (line 34) | const DUMMY_STARK_DELAY: time::Duration = time::Duration::from_millis(0);
type Error (line 37) | pub enum Error {
FILE: crates/topos-core/src/uci/subnet_id.rs
type SubnetId (line 9) | pub struct SubnetId {
method from (line 38) | fn from(value: [u8; SUBNET_ID_LENGTH]) -> Self {
type Error (line 56) | type Error = Error;
method try_from (line 58) | fn try_from(value: &[u8]) -> Result<Self, Self::Error> {
method eq (line 92) | fn eq(&self, other: &[u8]) -> bool {
method from_array (line 102) | pub const fn from_array(id: [u8; SUBNET_ID_LENGTH]) -> Self {
method as_array (line 106) | pub const fn as_array(&self) -> &[u8; SUBNET_ID_LENGTH] {
method to_secp256k1_public_key (line 110) | pub fn to_secp256k1_public_key(&self) -> [u8; 33] {
method fmt (line 14) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
method fmt (line 20) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
method cmp (line 26) | fn cmp(&self, other: &Self) -> std::cmp::Ordering {
method partial_cmp (line 32) | fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
function from (line 44) | fn from(value: SubnetId) -> Self {
function from (line 50) | fn from(value: SubnetId) -> Vec<u8> {
type Err (line 74) | type Err = Error;
method from_str (line 76) | fn from_str(s: &str) -> Result<Self, Self::Err> {
FILE: crates/topos-core/tests/tce_layer.rs
function create_tce_layer (line 30) | async fn create_tce_layer() {
function create_grpc_client (line 264) | async fn create_grpc_client() {
FILE: crates/topos-crypto/src/hash.rs
function calculate_hash (line 3) | pub fn calculate_hash(data: &[u8]) -> [u8; 32] {
FILE: crates/topos-crypto/src/keys.rs
function derive_public_key (line 4) | pub fn derive_public_key(private_key: &[u8]) -> Result<Vec<u8>, Error> {
FILE: crates/topos-crypto/src/keystore.rs
constant SUBNET_NODE_VALIDATOR_KEY_FILE_PATH (line 5) | pub const SUBNET_NODE_VALIDATOR_KEY_FILE_PATH: &str = "/consensus/valida...
function read_private_key_from_file (line 7) | pub fn read_private_key_from_file(
function get_keystore_path (line 23) | pub fn get_keystore_path(subnet_data_dir: &str) -> std::path::PathBuf {
FILE: crates/topos-crypto/src/lib.rs
type Error (line 11) | pub enum Error {
FILE: crates/topos-crypto/src/messages.rs
type MessageSignerError (line 11) | pub enum MessageSignerError {
type MessageSigner (line 17) | pub struct MessageSigner {
method new (line 33) | pub fn new(private_key: &[u8]) -> Result<Self, MessageSignerError> {
method sign_message (line 43) | pub fn sign_message(&self, payload: &[u8]) -> Result<Signature, Wallet...
method verify_signature (line 49) | pub fn verify_signature(
type Err (line 23) | type Err = MessageSignerError;
method from_str (line 25) | fn from_str(s: &str) -> Result<Self, Self::Err> {
FILE: crates/topos-crypto/src/signatures.rs
function sign (line 4) | pub fn sign(private_key: &[u8], data: &[u8]) -> Result<Vec<u8>, crate::E...
function verify (line 15) | pub fn verify(public_key: &[u8], data: &[u8], signature: &[u8]) -> Resul...
FILE: crates/topos-crypto/src/validator_id.rs
constant VALIDATOR_ID_LENGTH (line 6) | pub const VALIDATOR_ID_LENGTH: usize = 20;
type Error (line 9) | pub enum Error {
type ValidatorId (line 17) | pub struct ValidatorId(H160);
method as_bytes (line 20) | pub fn as_bytes(&self) -> &[u8] {
method address (line 24) | pub fn address(&self) -> Address {
method from (line 30) | fn from(address: H160) -> Self {
method fmt (line 46) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
type Err (line 36) | type Err = Error;
method from_str (line 38) | fn from_str(address: &str) -> Result<Self, Self::Err> {
FILE: crates/topos-crypto/tests/messages.rs
function test_signing_messages (line 9) | pub fn test_signing_messages() {
function fails_to_verify_with_own_public_address (line 38) | pub fn fails_to_verify_with_own_public_address() {
FILE: crates/topos-metrics/src/lib.rs
function gather_metrics (line 76) | pub fn gather_metrics() -> String {
function init_metrics (line 91) | pub fn init_metrics() {
FILE: crates/topos-metrics/src/tests.rs
function increment_echo_failure_ser (line 4) | fn increment_echo_failure_ser() {
function increment_echo_failure_des (line 14) | fn increment_echo_failure_des() {
FILE: crates/topos-node/build.rs
constant DEFAULT_VERSION (line 3) | const DEFAULT_VERSION: &str = "detached";
function main (line 5) | fn main() {
FILE: crates/topos-node/src/lib.rs
type Error (line 26) | pub enum Error {
function start (line 48) | pub async fn start(
function spawn_processes (line 146) | fn spawn_processes(
function shutdown (line 216) | async fn shutdown(trigger: CancellationToken, mut termination: mpsc::Rec...
FILE: crates/topos-node/src/main.rs
function main (line 2) | async fn main() -> Result<(), Box<dyn std::error::Error>> {
FILE: crates/topos-node/src/process.rs
type Errors (line 19) | pub enum Errors {
function spawn_sequencer_process (line 28) | pub(crate) fn spawn_sequencer_process(
function spawn_tce_process (line 54) | pub(crate) fn spawn_tce_process(
function spawn_edge_process (line 107) | pub fn spawn_edge_process(
FILE: crates/topos-p2p/src/behaviour.rs
type HealthStatus (line 13) | pub(crate) enum HealthStatus {
type Behaviour (line 25) | pub(crate) struct Behaviour {
FILE: crates/topos-p2p/src/behaviour/discovery.rs
type PendingRecordRequest (line 24) | pub type PendingRecordRequest = oneshot::Sender<Result<Vec<Multiaddr>, C...
type DiscoveryBehaviour (line 27) | pub(crate) struct DiscoveryBehaviour {
method create (line 40) | pub fn create(
method bootstrap (line 100) | pub fn bootstrap(&mut self) -> Result<(), P2PError> {
method change_interval (line 111) | pub async fn change_interval(&mut self, duration: Duration) -> Result<...
type ConnectionHandler (line 126) | type ConnectionHandler = <Behaviour<MemoryStore> as NetworkBehaviour>::C...
type ToSwarm (line 128) | type ToSwarm = KademliaEvent;
method handle_established_inbound_connection (line 130) | fn handle_established_inbound_connection(
method handle_established_outbound_connection (line 145) | fn handle_established_outbound_connection(
method on_swarm_event (line 156) | fn on_swarm_event(&mut self, event: libp2p::swarm::FromSwarm) {
method on_connection_handler_event (line 160) | fn on_connection_handler_event(
method poll (line 170) | fn poll(
method handle_pending_inbound_connection (line 222) | fn handle_pending_inbound_connection(
method handle_pending_outbound_connection (line 232) | fn handle_pending_outbound_connection(
FILE: crates/topos-p2p/src/behaviour/gossip.rs
constant MAX_BATCH_SIZE (line 28) | const MAX_BATCH_SIZE: usize = 10;
type Behaviour (line 30) | pub struct Behaviour {
method publish (line 42) | pub fn publish(
method subscribe (line 60) | pub fn subscribe(&mut self) -> Result<(), P2PError> {
method new (line 73) | pub async fn new(peer_key: Keypair) -> Self {
type ConnectionHandler (line 124) | type ConnectionHandler = <gossipsub::Behaviour as NetworkBehaviour>::Con...
type ToSwarm (line 126) | type ToSwarm = ComposedEvent;
method handle_established_inbound_connection (line 128) | fn handle_established_inbound_connection(
method handle_established_outbound_connection (line 143) | fn handle_established_outbound_connection(
method on_swarm_event (line 158) | fn on_swarm_event(&mut self, event: libp2p::swarm::FromSwarm) {
method on_connection_handler_event (line 180) | fn on_connection_handler_event(
method poll (line 190) | fn poll(
FILE: crates/topos-p2p/src/behaviour/grpc.rs
type GrpcContext (line 45) | pub struct GrpcContext {
method into_parts (line 51) | pub(crate) fn into_parts(mut self) -> (Option<Router>, (HashSet<String...
method with_router (line 64) | pub fn with_router(mut self, router: GrpcRouter) -> Self {
method add_client_protocol (line 70) | pub fn add_client_protocol<S: ToString>(mut self, protocol: S) -> Self {
method with_client_protocols (line 76) | pub fn with_client_protocols(mut self, protocols: HashSet<String>) -> ...
type RequestId (line 85) | pub struct RequestId(pub(crate) u64);
method fmt (line 88) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
type ChannelNegotiationFuture (line 93) | type ChannelNegotiationFuture =
type Behaviour (line 103) | pub(crate) struct Behaviour {
method new (line 128) | pub fn new(service: GrpcContext) -> Self {
method add_address (line 151) | pub fn add_address(&mut self, peer: &PeerId, address: Multiaddr) {
method remove_address (line 158) | pub fn remove_address(&mut self, peer: &PeerId, address: &Multiaddr) {
method open_outbound_connection (line 176) | pub fn open_outbound_connection(
method next_request_id (line 228) | fn next_request_id(&mut self) -> RequestId {
method open_connection (line 236) | fn open_connection(&mut self, peer_id: &PeerId, protocol: String) -> O...
method on_connection_established (line 262) | fn on_connection_established(
method on_new_listener (line 294) | fn on_new_listener(&mut self, listener_id: ListenerId) {
method on_connection_closed (line 310) | fn on_connection_closed(
method on_dial_failure (line 329) | fn on_dial_failure(
method try_connect (line 366) | fn try_connect(&mut self, peer_id: &PeerId) {
type ConnectionHandler (line 392) | type ConnectionHandler = Handler;
type ToSwarm (line 394) | type ToSwarm = Event;
method handle_established_inbound_connection (line 396) | fn handle_established_inbound_connection(
method handle_established_outbound_connection (line 409) | fn handle_established_outbound_connection(
method handle_pending_outbound_connection (line 422) | fn handle_pending_outbound_connection(
method on_connection_handler_event (line 446) | fn on_connection_handler_event(
method on_swarm_event (line 516) | fn on_swarm_event(&mut self, event: FromSwarm) {
method poll (line 541) | fn poll(
FILE: crates/topos-p2p/src/behaviour/grpc/connection.rs
type Connection (line 17) | pub(crate) struct Connection {
type OutboundConnectionRequest (line 32) | pub(crate) struct OutboundConnectionRequest {
type OutboundConnectedConnection (line 40) | pub struct OutboundConnectedConnection {
type OutboundConnection (line 50) | pub enum OutboundConnection {
type Output (line 62) | type Output = Result<OutboundConnectedConnection, OutboundConnectionError>;
type IntoFuture (line 64) | type IntoFuture = BoxFuture<'static, Self::Output>;
method into_future (line 66) | fn into_future(self) -> Self::IntoFuture {
FILE: crates/topos-p2p/src/behaviour/grpc/error.rs
type OutboundError (line 6) | pub enum OutboundError {
type OutboundConnectionError (line 18) | pub enum OutboundConnectionError {
FILE: crates/topos-p2p/src/behaviour/grpc/event.rs
type Event (line 7) | pub enum Event {
FILE: crates/topos-p2p/src/behaviour/grpc/handler.rs
type ProtocolRequest (line 25) | pub struct ProtocolRequest {
type Handler (line 31) | pub struct Handler {
method new (line 43) | pub(crate) fn new(inbound_request_id: Arc<AtomicU64>, protocols: HashS...
type FromBehaviour (line 55) | type FromBehaviour = ProtocolRequest;
type ToBehaviour (line 57) | type ToBehaviour = event::Event;
type InboundProtocol (line 59) | type InboundProtocol = GrpcUpgradeProtocol;
type OutboundProtocol (line 61) | type OutboundProtocol = GrpcUpgradeProtocol;
type InboundOpenInfo (line 63) | type InboundOpenInfo = RequestId;
type OutboundOpenInfo (line 65) | type OutboundOpenInfo = ProtocolRequest;
method listen_protocol (line 67) | fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, Se...
method connection_keep_alive (line 78) | fn connection_keep_alive(&self) -> bool {
method on_behaviour_event (line 82) | fn on_behaviour_event(&mut self, request: Self::FromBehaviour) {
method on_connection_event (line 93) | fn on_connection_event(
method poll (line 149) | fn poll(
FILE: crates/topos-p2p/src/behaviour/grpc/handler/event.rs
type Event (line 6) | pub enum Event {
FILE: crates/topos-p2p/src/behaviour/grpc/handler/protocol.rs
type GrpcUpgradeProtocol (line 17) | pub struct GrpcUpgradeProtocol {
type Output (line 32) | type Output = Stream;
type Error (line 34) | type Error = std::io::Error;
type Future (line 36) | type Future = futures::future::Ready<Result<Self::Output, Self::Error>>;
method upgrade_outbound (line 38) | fn upgrade_outbound(self, socket: Stream, _info: Self::Info) -> Self::...
type Output (line 44) | type Output = Stream;
type Error (line 46) | type Error = std::io::Error;
type Future (line 48) | type Future = futures::future::Ready<Result<Self::Output, Self::Error>>;
method upgrade_inbound (line 50) | fn upgrade_inbound(self, socket: Stream, info: Self::Info) -> Self::Fu...
type Info (line 22) | type Info = String;
type InfoIter (line 24) | type InfoIter = std::collections::hash_set::IntoIter<Self::Info>;
method protocol_info (line 26) | fn protocol_info(&self) -> Self::InfoIter {
FILE: crates/topos-p2p/src/behaviour/grpc/proxy.rs
type GrpcProxy (line 15) | pub(crate) struct GrpcProxy {
method new (line 21) | pub(crate) fn new(rx: mpsc::UnboundedReceiver<io::Result<GrpcStream>>)...
type Item (line 27) | type Item = io::Result<GrpcStream>;
method poll_next (line 29) | fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<...
FILE: crates/topos-p2p/src/behaviour/grpc/stream.rs
type GrpcStream (line 21) | pub(crate) struct GrpcStream {
method new (line 75) | pub fn new(stream: libp2p::Stream, peer_id: PeerId, connection_id: Con...
method into_channel (line 84) | pub async fn into_channel(self) -> Result<Channel, tonic::transport::E...
type InitializedGrpcOutboundStream (line 30) | struct InitializedGrpcOutboundStream {
type Response (line 57) | type Response = GrpcStream;
type Error (line 59) | type Error = BoxError;
type Future (line 61) | type Future = NegotiatedGrpcOutboundStream;
method poll_ready (line 63) | fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self...
method call (line 67) | fn call(&mut self, req: Uri) -> Self::Future {
type NegotiatedGrpcOutboundStream (line 37) | struct NegotiatedGrpcOutboundStream {
type Output (line 43) | type Output = Result<GrpcStream, BoxError>;
method poll (line 45) | fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
type ConnectInfo (line 105) | type ConnectInfo = ();
method connect_info (line 107) | fn connect_info(&self) -> Self::ConnectInfo {}
method poll_read (line 111) | fn poll_read(
method poll_write (line 126) | fn poll_write(
method poll_flush (line 134) | fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result...
method poll_shutdown (line 138) | fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Res...
FILE: crates/topos-p2p/src/behaviour/peer_info.rs
type PeerInfoBehaviour (line 8) | pub struct PeerInfoBehaviour {
method new (line 13) | pub(crate) fn new(identify_protocol: &'static str, peer_key: &Keypair)...
FILE: crates/topos-p2p/src/client.rs
type NetworkClient (line 17) | pub struct NetworkClient {
method connected_peers (line 26) | pub async fn connected_peers(&self) -> Result<Vec<PeerId>, P2PError> {
method random_known_peer (line 32) | pub async fn random_known_peer(&self) -> Result<PeerId, P2PError> {
method publish (line 42) | pub fn publish<T: std::fmt::Debug + prost::Message + 'static>(
method send_command_with_receiver (line 59) | async fn send_command_with_receiver<
method shutdown (line 74) | pub async fn shutdown(&self) -> Result<(), P2PError> {
method new_grpc_client (line 85) | pub async fn new_grpc_client<C, S>(&self, peer: PeerId) -> Result<C, P...
type RetryPolicy (line 94) | pub enum RetryPolicy {
FILE: crates/topos-p2p/src/command.rs
type Command (line 9) | pub enum Command {
method fmt (line 38) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
FILE: crates/topos-p2p/src/config.rs
type NetworkConfig (line 3) | pub struct NetworkConfig {
constant MINIMUM_CLUSTER_SIZE (line 26) | pub const MINIMUM_CLUSTER_SIZE: usize = 5;
constant CLIENT_RETRY_TTL (line 27) | pub const CLIENT_RETRY_TTL: u64 = 200;
method default (line 13) | fn default() -> Self {
type DiscoveryConfig (line 30) | pub struct DiscoveryConfig {
constant BOOTSTRAP_INTERVAL (line 61) | pub const BOOTSTRAP_INTERVAL: Duration = Duration::from_secs(60);
constant FAST_BOOTSTRAP_INTERVAL (line 63) | pub const FAST_BOOTSTRAP_INTERVAL: Duration = Duration::from_secs(5);
method with_replication_factor (line 65) | pub fn with_replication_factor(mut self, replication_factor: NonZeroUs...
method default (line 47) | fn default() -> Self {
FILE: crates/topos-p2p/src/constants.rs
constant DISCOVERY_PROTOCOL (line 29) | pub const DISCOVERY_PROTOCOL: &str = "/tce-disco/1";
constant PEER_INFO_PROTOCOL (line 30) | pub const PEER_INFO_PROTOCOL: &str = "/tce-peer-info/1";
constant GRPC_P2P_TOPOS_PROTOCOL (line 31) | pub const GRPC_P2P_TOPOS_PROTOCOL: &str = "/topos-grpc-p2p/1.0";
constant TCE_BOOTNODE_PORT (line 34) | pub const TCE_BOOTNODE_PORT: u16 = 9090;
constant IDLE_CONNECTION_TIMEOUT (line 37) | pub const IDLE_CONNECTION_TIMEOUT: Duration = Duration::from_secs(30);
FILE: crates/topos-p2p/src/error.rs
type P2PError (line 13) | pub enum P2PError {
type CommandExecutionError (line 55) | pub enum CommandExecutionError {
FILE: crates/topos-p2p/src/event.rs
type GossipEvent (line 7) | pub enum GossipEvent {
type ComposedEvent (line 17) | pub enum ComposedEvent {
method from (line 26) | fn from(event: grpc::Event) -> Self {
method from (line 32) | fn from(event: kad::Event) -> Self {
method from (line 38) | fn from(event: identify::Event) -> Self {
method from (line 44) | fn from(_: void::Void) -> Self {
type Event (line 51) | pub enum Event {
method from (line 63) | fn from(value: &HealthStatus) -> Self {
FILE: crates/topos-p2p/src/lib.rs
constant TOPOS_GOSSIP (line 37) | pub const TOPOS_GOSSIP: &str = "topos_gossip";
constant TOPOS_ECHO (line 38) | pub const TOPOS_ECHO: &str = "topos_echo";
constant TOPOS_READY (line 39) | pub const TOPOS_READY: &str = "topos_ready";
type GrpcP2pInfo (line 49) | pub(crate) struct GrpcP2pInfo {}
type GrpcRouter (line 55) | pub struct GrpcRouter {
method new (line 61) | pub fn new(mut server: tonic::transport::Server) -> Self {
method add_service (line 71) | pub fn add_service<S>(mut self, service: S) -> Self
type GrpcOverP2P (line 100) | pub struct GrpcOverP2P {
method new (line 105) | pub fn new(proxy_sender: mpsc::Sender<Command>) -> Self {
method create (line 109) | pub async fn create<C, S>(&self, peer: PeerId) -> Result<C::Output, P2...
function local_key_pair (line 137) | pub fn local_key_pair(secret_key_seed: Option<u8>) -> identity::Keypair {
function local_key_pair_from_slice (line 149) | pub fn local_key_pair_from_slice(slice: &[u8]) -> identity::Keypair {
function keypair_from_protobuf_encoding (line 161) | pub fn keypair_from_protobuf_encoding(priv_key: &[u8]) -> identity::Keyp...
function generate_from_secp256k1 (line 167) | pub fn generate_from_secp256k1() {
FILE: crates/topos-p2p/src/network.rs
function builder (line 35) | pub fn builder<'a>() -> NetworkBuilder<'a> {
constant TWO_HOURS (line 39) | const TWO_HOURS: Duration = Duration::from_secs(60 * 60 * 2);
type NetworkBuilder (line 42) | pub struct NetworkBuilder<'a> {
function memory (line 57) | pub(crate) fn memory(mut self) -> Self {
function grpc_context (line 62) | pub fn grpc_context(mut self, grpc_context: GrpcContext) -> Self {
function discovery_config (line 68) | pub fn discovery_config(mut self, config: DiscoveryConfig) -> Self {
function minimum_cluster_size (line 74) | pub fn minimum_cluster_size(mut self, size: usize) -> Self {
function peer_key (line 80) | pub fn peer_key(mut self, peer_key: Keypair) -> Self {
function public_addresses (line 86) | pub fn public_addresses<M: Into<Vec<Multiaddr>>>(mut self, addresses: M)...
function listen_addresses (line 92) | pub fn listen_addresses<M: Into<Vec<Multiaddr>>>(mut self, addresses: M)...
function allow_private_ip (line 99) | pub fn allow_private_ip(mut self, allow_private_ip: bool) -> Self {
function store (line 105) | pub fn store(mut self, store: MemoryStore) -> Self {
function known_peers (line 111) | pub fn known_peers(mut self, known_peers: &'a [(PeerId, Multiaddr)]) -> ...
function local_port (line 117) | pub fn local_port(mut self, port: u8) -> Self {
function discovery_protocol (line 123) | pub fn discovery_protocol(mut self, protocol: &'static str) -> Self {
function build (line 129) | pub async fn build(
FILE: crates/topos-p2p/src/runtime/handle_command.rs
method handle_command (line 11) | pub(crate) async fn handle_command(&mut self, command: Command) {
FILE: crates/topos-p2p/src/runtime/handle_event.rs
type EventResult (line 11) | pub type EventResult = Result<(), P2PError>;
type EventHandler (line 14) | pub(crate) trait EventHandler<T> {
method handle (line 15) | async fn handle(&mut self, event: T) -> EventResult;
method handle (line 20) | async fn handle(&mut self, event: Event) -> EventResult {
method handle (line 31) | async fn handle(&mut self, event: ComposedEvent) -> EventResult {
method handle (line 44) | async fn handle(&mut self, event: SwarmEvent<ComposedEvent>) -> EventRes...
FILE: crates/topos-p2p/src/runtime/handle_event/discovery.rs
method handle (line 10) | async fn handle(&mut self, event: Box<Event>) -> EventResult {
FILE: crates/topos-p2p/src/runtime/handle_event/gossipsub.rs
method handle (line 16) | async fn handle(&mut self, event: GossipEvent) -> EventResult {
FILE: crates/topos-p2p/src/runtime/handle_event/grpc.rs
method handle (line 9) | async fn handle(&mut self, event: grpc::Event) -> EventResult {
FILE: crates/topos-p2p/src/runtime/handle_event/peer_info.rs
method handle (line 15) | async fn handle(&mut self, event: Box<IdentifyEvent>) -> EventResult {
function is_global_addr (line 49) | pub fn is_global_addr(addr: &Multiaddr) -> bool {
FILE: crates/topos-p2p/src/runtime/mod.rs
type Runtime (line 21) | pub struct Runtime {
method bootstrap (line 77) | pub async fn bootstrap<S: Stream<Item = Event> + Unpin + Send>(
method run (line 130) | pub async fn run(mut self) -> Result<(), P2PError> {
method healthy_status_changed (line 151) | pub(crate) fn healthy_status_changed(&mut self) -> Option<Event> {
type HealthState (line 59) | pub(crate) struct HealthState {
FILE: crates/topos-p2p/src/tests/behaviour/grpc.rs
function instantiate_grpc (line 33) | async fn instantiate_grpc() {
function opening_outbound_stream (line 102) | async fn opening_outbound_stream() {}
function opening_outbound_stream_half_close (line 105) | async fn opening_outbound_stream_half_close() {}
function closing_stream (line 109) | async fn closing_stream() {
function execute_query (line 167) | async fn execute_query() {
function create_context_with_only_router (line 222) | fn create_context_with_only_router() {
function create_context_with_only_client (line 232) | fn create_context_with_only_client() {
function create_context_with_only_client_custom_protocol (line 242) | fn create_context_with_only_client_custom_protocol() {
function incompatible_protocol (line 257) | async fn incompatible_protocol() {
FILE: crates/topos-p2p/src/tests/bootstrap.rs
function two_bootnode_communicating (line 12) | async fn two_bootnode_communicating() {
FILE: crates/topos-p2p/src/tests/command/random_peer.rs
function no_random_peer (line 13) | async fn no_random_peer() {
function return_a_peer (line 43) | async fn return_a_peer() {
function return_a_random_peer_among_100 (line 72) | async fn return_a_random_peer_among_100() {
FILE: crates/topos-p2p/src/tests/support/mod.rs
type PeerAddr (line 13) | pub type PeerAddr = (PeerId, Multiaddr);
function dummy_peer (line 16) | pub async fn dummy_peer() -> (NetworkClient, PeerAddr) {
function keypair_from_byte (line 32) | pub fn keypair_from_byte(seed: u8) -> Keypair {
function local_peer (line 39) | pub fn local_peer(peer_index: u8) -> (Keypair, Multiaddr) {
FILE: crates/topos-p2p/tests/support/network.rs
function start_node (line 8) | pub async fn start_node(
type TestNodeContext (line 34) | pub struct TestNodeContext {
method next_event (line 41) | pub(crate) async fn next_event(&mut self) -> Option<topos_p2p::Event> {
FILE: crates/topos-sequencer-subnet-client/src/lib.rs
constant PUSH_CERTIFICATE_GAS_LIMIT (line 26) | const PUSH_CERTIFICATE_GAS_LIMIT: u64 = 1000000;
constant SUBNET_CONNECT_BACKOFF_TIMEOUT (line 28) | const SUBNET_CONNECT_BACKOFF_TIMEOUT: Duration = Duration::from_secs(12 ...
constant SUBNET_GET_CHECKPOINTS_BACKOFF_TIMEOUT (line 29) | const SUBNET_GET_CHECKPOINTS_BACKOFF_TIMEOUT: Duration = Duration::from_...
constant SUBNET_GET_SUBNET_ID_BACKOFF_TIMEOUT (line 30) | const SUBNET_GET_SUBNET_ID_BACKOFF_TIMEOUT: Duration = Duration::from_se...
type BlockData (line 32) | pub type BlockData = Vec<u8>;
type BlockNumber (line 33) | pub type BlockNumber = u64;
type Hash (line 34) | pub type Hash = String;
type SubnetEvent (line 38) | pub enum SubnetEvent {
type BlockInfo (line 47) | pub struct BlockInfo {
type Error (line 65) | pub enum Error {
type SubnetClientListener (line 117) | pub struct SubnetClientListener {
method new (line 124) | pub async fn new(ws_subnet_endpoint: &str, contract_address: &str) -> ...
method new_block_subscription_stream (line 140) | pub async fn new_block_subscription_stream(
method get_finalized_block (line 150) | pub async fn get_finalized_block(
method get_subnet_block_number (line 213) | pub async fn get_subnet_block_number(&mut self) -> Result<u64, Error> {
method wait_for_new_block (line 221) | pub async fn wait_for_new_block(
function connect_to_subnet_listener_with_retry (line 263) | pub async fn connect_to_subnet_listener_with_retry(
type SubnetClient (line 291) | pub struct SubnetClient {
constant NODE_POLLING_INTERVAL (line 298) | pub const NODE_POLLING_INTERVAL: Duration = Duration::from_millis(2000...
method new (line 301) | pub async fn new(
method push_certificate (line 356) | pub async fn push_certificate(
method get_checkpoints (line 411) | pub async fn get_checkpoints(
method get_subnet_id (line 450) | pub async fn get_subnet_id(&self) -> Result<SubnetId, Error> {
function new_subnet_client_proxy_backoff_err (line 472) | pub(crate) fn new_subnet_client_proxy_backoff_err<E: std::fmt::Display>(
function connect_to_subnet_with_retry (line 484) | pub async fn connect_to_subnet_with_retry(
FILE: crates/topos-sequencer-subnet-client/src/subnet_contract.rs
function create_topos_core_contract_from_json (line 19) | pub(crate) fn create_topos_core_contract_from_json<T: Middleware>(
function get_block_events (line 29) | pub(crate) async fn get_block_events(
function derive_eth_address (line 74) | pub fn derive_eth_address(secret_key: &[u8]) -> Result<H160, crate::Erro...
FILE: crates/topos-sequencer-subnet-runtime/src/certification.rs
type Certification (line 10) | pub struct Certification {
constant BLOCK_HISTORY_LENGTH (line 34) | pub const BLOCK_HISTORY_LENGTH: usize = 256;
method new (line 36) | pub fn new(
method generate_certificates (line 54) | pub(crate) async fn generate_certificates(&mut self) -> Result<Vec<Cer...
method get_signing_key (line 158) | pub fn get_signing_key(&self) -> &[u8] {
method append_blocks (line 163) | pub fn append_blocks(&mut self, blocks: Vec<BlockInfo>) {
method fmt (line 28) | fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
FILE: crates/topos-sequencer-subnet-runtime/src/lib.rs
type Peer (line 14) | pub type Peer = String;
constant EVENT_SUBSCRIBER_CHANNEL_SIZE (line 22) | const EVENT_SUBSCRIBER_CHANNEL_SIZE: usize = 64;
type Error (line 25) | pub enum Error {
type SubnetRuntimeProxyConfig (line 82) | pub struct SubnetRuntimeProxyConfig {
type SubnetRuntimeProxyWorker (line 94) | pub struct SubnetRuntimeProxyWorker {
method new (line 104) | pub async fn new(
method eval (line 126) | pub async fn eval(&self, cmd: SubnetRuntimeProxyCommand) -> Result<(),...
method next_event (line 134) | pub async fn next_event(&mut self) -> Result<SubnetRuntimeProxyEvent, ...
method shutdown (line 140) | pub async fn shutdown(&mut self) -> Result<(), Error> {
method get_checkpoints (line 145) | pub async fn get_checkpoints(&self) -> Result<Vec<TargetStreamPosition...
method get_subnet_id (line 150) | pub async fn get_subnet_id(
method set_source_head_certificate_id (line 157) | pub async fn set_source_head_certificate_id(
function derive_endpoints (line 170) | pub fn derive_endpoints(endpoint: &str) -> Result<(String, String), Erro...
function get_runtime (line 194) | pub fn get_runtime(
function test_derive_endpoints (line 204) | fn test_derive_endpoints() {
FILE: crates/topos-sequencer-subnet-runtime/src/proxy.rs
type Authorities (line 19) | pub struct Authorities {
type SubnetRuntimeProxyEvent (line 24) | pub enum SubnetRuntimeProxyEvent {
type SubnetRuntimeProxyCommand (line 36) | pub enum SubnetRuntimeProxyCommand {
type SubnetRuntimeProxy (line 45) | pub struct SubnetRuntimeProxy {
method spawn_new (line 62) | pub fn spawn_new(
method retrieve_and_process_block (line 329) | async fn retrieve_and_process_block(
method process_block (line 378) | async fn process_block(
method send_new_certificate (line 402) | async fn send_new_certificate(
method push_certificate (line 423) | async fn push_certificate(
method on_command (line 440) | async fn on_command(
method send_out_event (line 522) | async fn send_out_event(&mut self, evt: SubnetRuntimeProxyEvent) {
method shutdown (line 531) | pub async fn shutdown(&self) -> Result<(), Error> {
method set_source_head_certificate_id (line 552) | pub async fn set_source_head_certificate_id(
method get_checkpoints (line 567) | pub async fn get_checkpoints(&self) -> Result<Vec<TargetStreamPosition...
method get_subnet_id (line 608) | pub async fn get_subnet_id(
method fmt (line 56) | fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
FILE: crates/topos-sequencer-subnet-runtime/tests/common/abi.rs
type IToposCoreClient (line 61) | pub type IToposCoreClient = IToposCore<SignerMiddleware<Provider<Http>, ...
type IToposMessagingClient (line 62) | pub type IToposMessagingClient =
type IERC20Client (line 64) | pub type IERC20Client = IERC20<SignerMiddleware<Provider<Http>, Wallet<S...
type IERC20MessagingClient (line 65) | pub type IERC20MessagingClient =
FILE: crates/topos-sequencer-subnet-runtime/tests/common/subnet_test_data.rs
constant TEST_VALIDATOR_KEY_FILE_DATA (line 3) | pub const TEST_VALIDATOR_KEY_FILE_DATA: &str =
function generate_test_subnet_data_dir (line 7) | pub fn generate_test_subnet_data_dir() -> Result<std::path::PathBuf, Box...
function generate_test_private_key (line 23) | pub fn generate_test_private_key() -> Vec<u8> {
FILE: crates/topos-sequencer-subnet-runtime/tests/subnet_contract.rs
constant STANDALONE_SUBNET_BLOCK_TIME (line 31) | const STANDALONE_SUBNET_BLOCK_TIME: u64 = 2;
constant STANDALONE_SUBNET_WITH_LONG_BLOCKS_BLOCK_TIME (line 33) | const STANDALONE_SUBNET_WITH_LONG_BLOCKS_BLOCK_TIME: u64 = 12;
constant SUBNET_RPC_PORT (line 35) | const SUBNET_RPC_PORT: u32 = 8545;
constant TEST_SECRET_ETHEREUM_KEY (line 37) | const TEST_SECRET_ETHEREUM_KEY: &str =
constant TEST_ETHEREUM_ACCOUNT (line 39) | const TEST_ETHEREUM_ACCOUNT: &str = "0xf39Fd6e51aad88F6F4ce6aB8827279cff...
constant TEST_SUBNET_ID (line 40) | const TEST_SUBNET_ID: &str = "646464646464646464646464646464646464646464...
constant TOKEN_SYMBOL (line 41) | const TOKEN_SYMBOL: &str = "TKX";
constant TEST_ACCOUNT_ALITH_KEY (line 44) | const TEST_ACCOUNT_ALITH_KEY: &str =
constant TEST_ACCOUNT_ALITH_ACCOUNT (line 46) | const TEST_ACCOUNT_ALITH_ACCOUNT: &str = "0x70997970C51812dc3A010C7d01b5...
constant TEST_ACCOUNT_BALATHAR_KEY (line 47) | const TEST_ACCOUNT_BALATHAR_KEY: &str =
constant TEST_ACCOUNT_BALATHAR_ACCOUNT (line 49) | const TEST_ACCOUNT_BALATHAR_ACCOUNT: &str = "0x3C44CdDdB6a900fa2b585dd29...
constant TEST_ACCOUNT_CEZAR_KEY (line 50) | const TEST_ACCOUNT_CEZAR_KEY: &str =
constant TEST_ACCOUNT_CEZAR_ACCOUNT (line 52) | const TEST_ACCOUNT_CEZAR_ACCOUNT: &str = "0x90F79bf6EB2c4f870365E785982E...
constant PREV_CERTIFICATE_ID_1 (line 54) | const PREV_CERTIFICATE_ID_1: CertificateId = CERTIFICATE_ID_4;
constant PREV_CERTIFICATE_ID_2 (line 55) | const PREV_CERTIFICATE_ID_2: CertificateId = CERTIFICATE_ID_5;
constant CERTIFICATE_ID_1 (line 56) | const CERTIFICATE_ID_1: CertificateId = CERTIFICATE_ID_6;
constant CERTIFICATE_ID_2 (line 57) | const CERTIFICATE_ID_2: CertificateId = CERTIFICATE_ID_7;
constant CERTIFICATE_ID_3 (line 58) | const CERTIFICATE_ID_3: CertificateId = CERTIFICATE_ID_8;
constant DEFAULT_GAS (line 59) | const DEFAULT_GAS: u64 = 5_000_000;
function spawn_subnet_node (line 61) | fn spawn_subnet_node(
type Context (line 80) | struct Context {
method shutdown (line 89) | pub async fn shutdown(mut self) -> Result<(), Box<dyn std::error::Erro...
method jsonrpc (line 99) | pub fn jsonrpc(&self) -> String {
method jsonrpc_ws (line 103) | pub fn jsonrpc_ws(&self) -> String {
method drop (line 109) | fn drop(&mut self) {
function create_new_erc20msg_client (line 116) | async fn create_new_erc20msg_client(
function create_new_erc20_client (line 135) | async fn create_new_erc20_client(
function deploy_contracts (line 152) | async fn deploy_contracts(
function deploy_test_token (line 288) | async fn deploy_test_token(
function check_received_certificate (line 363) | async fn check_received_certificate(
function context_running_subnet_node (line 428) | async fn context_running_subnet_node(
function test_subnet_node_contract_deployment (line 478) | async fn test_subnet_node_contract_deployment(
function test_subnet_node_get_block_info (line 494) | async fn test_subnet_node_get_block_info(
function test_create_runtime (line 533) | async fn test_create_runtime() -> Result<(), Box<dyn std::error::Error>> {
function test_subnet_certificate_push_call (line 559) | async fn test_subnet_certificate_push_call(
function test_subnet_certificate_get_checkpoints_call (line 679) | async fn test_subnet_certificate_get_checkpoints_call(
function test_subnet_id_call (line 798) | async fn test_subnet_id_call(
function test_subnet_send_token_processing (line 845) | async fn test_subnet_send_token_processing(
function test_sync_from_genesis_and_particular_source_head (line 963) | async fn test_sync_from_genesis_and_particular_source_head(
function test_sync_from_start_block (line 1126) | async fn test_sync_from_start_block(
function test_subnet_multiple_send_token_in_a_block (line 1223) | async fn test_subnet_multiple_send_token_in_a_block(
FILE: crates/topos-sequencer/src/app_context.rs
type AppContext (line 22) | pub struct AppContext {
method new (line 35) | pub fn new(
method run (line 48) | pub(crate) async fn run(
method on_subnet_runtime_proxy_event (line 95) | async fn on_subnet_runtime_proxy_event(&mut self, evt: SubnetRuntimePr...
method on_tce_proxy_event (line 124) | async fn on_tce_proxy_event(&mut self, evt: TceProxyEvent) {
method shutdown (line 148) | async fn shutdown(&mut self) -> Result<(), Box<dyn std::error::Error>> {
type AppContextStatus (line 28) | pub enum AppContextStatus {
FILE: crates/topos-sequencer/src/lib.rs
type SequencerConfiguration (line 21) | pub struct SequencerConfiguration {
function launch_workers (line 33) | async fn launch_workers(
function launch (line 129) | pub async fn launch(
function run (line 178) | pub async fn run(
FILE: crates/topos-tce-api/src/graphql/builder.rs
type ServerBuilder (line 22) | pub struct ServerBuilder {
method runtime (line 32) | pub(crate) fn runtime(mut self, runtime: mpsc::Sender<InternalRuntimeC...
method store (line 37) | pub(crate) fn store(mut self, store: Arc<ValidatorStore>) -> Self {
method serve_addr (line 43) | pub(crate) fn serve_addr(mut self, addr: Option<SocketAddr>) -> Self {
method build (line 49) | pub async fn build(
FILE: crates/topos-tce-api/src/graphql/filter.rs
type FilterIs (line 1) | pub(crate) enum FilterIs {
FILE: crates/topos-tce-api/src/graphql/query.rs
type QueryRoot (line 30) | pub struct QueryRoot;
method certificates (line 104) | async fn certificates(
method certificate (line 113) | async fn certificate(
method get_storage_pool_stats (line 124) | async fn get_storage_pool_stats(
method get_checkpoint (line 184) | async fn get_checkpoint(
method get_pending_pool (line 210) | async fn get_pending_pool(
method check_precedence (line 228) | async fn check_precedence(
type ServiceSchema (line 31) | pub(crate) type ServiceSchema = Schema<QueryRoot, EmptyMutation, Subscri...
method certificates_per_subnet (line 35) | async fn certificates_per_subnet(
method certificate_by_id (line 77) | async fn certificate_by_id(
type SubscriptionRoot (line 250) | pub struct SubscriptionRoot;
method new_transient_stream (line 254) | pub(crate) async fn new_transient_stream(
method watch_delivered_certificates (line 305) | async fn watch_delivered_certificates(
FILE: crates/topos-tce-api/src/graphql/routes.rs
type Health (line 10) | struct Health {
function health (line 14) | pub(crate) async fn health() -> impl IntoResponse {
function graphql_playground (line 20) | pub async fn graphql_playground() -> impl IntoResponse {
FILE: crates/topos-tce-api/src/graphql/tests.rs
function requesting_transient_stream_from_graphql (line 26) | async fn requesting_transient_stream_from_graphql() {
function open_watch_certificate_delivered (line 56) | async fn open_watch_certificate_delivered() {
FILE: crates/topos-tce-api/src/grpc/builder.rs
type ServerBuilder (line 17) | pub struct ServerBuilder {
method with_store (line 25) | pub(crate) fn with_store(mut self, store: Arc<ValidatorStore>) -> Self {
method with_peer_id (line 31) | pub(crate) fn with_peer_id(mut self, local_peer_id: String) -> Self {
method command_sender (line 37) | pub(crate) fn command_sender(mut self, sender: Sender<InternalRuntimeC...
method serve_addr (line 43) | pub(crate) fn serve_addr(mut self, addr: Option<SocketAddr>) -> Self {
method build (line 49) | pub async fn build(
FILE: crates/topos-tce-api/src/grpc/console.rs
type TceConsoleService (line 11) | pub(crate) struct TceConsoleService {
method status (line 22) | async fn status(
FILE: crates/topos-tce-api/src/grpc/messaging.rs
type InboundMessage (line 11) | pub enum InboundMessage {
type Error (line 37) | type Error = Status;
method try_from (line 39) | fn try_from(command: Command) -> Result<Self, Self::Error> {
method from (line 60) | fn from(value: OpenStream) -> Self {
type OpenStream (line 15) | pub struct OpenStream {
type Error (line 47) | type Error = Status;
method try_from (line 49) | fn try_from(value: GrpcOpenStream) -> Result<Self, Self::Error> {
type CertificatePushed (line 20) | pub struct CertificatePushed {
type OutboundMessage (line 26) | pub enum OutboundMessage {
type StreamOpened (line 32) | pub struct StreamOpened {
method from (line 66) | fn from(value: OutboundMessage) -> Self {
FILE: crates/topos-tce-api/src/grpc/mod.rs
constant DEFAULT_CHANNEL_STREAM_CAPACITY (line 32) | const DEFAULT_CHANNEL_STREAM_CAPACITY: usize = 100;
type TceGrpcService (line 37) | pub(crate) struct TceGrpcService {
method create_stream (line 43) | pub fn create_stream(
method parse_stream (line 56) | pub fn parse_stream(
method submit_certificate (line 81) | async fn submit_certificate(
method get_source_head (line 140) | async fn get_source_head(
method get_last_pending_certificates (line 214) | async fn get_last_pending_certificates(
type WatchCertificatesStream (line 254) | type WatchCertificatesStream = Pin<
method watch_certificates (line 259) | async fn watch_certificates(
FILE: crates/topos-tce-api/src/grpc/tests.rs
function respond_to_valid_certificate_submission (line 5) | async fn respond_to_valid_certificate_submission() {}
function respond_to_invalid_certificate_submission (line 9) | async fn respond_to_invalid_certificate_submission() {}
FILE: crates/topos-tce-api/src/lib.rs
constant CHANNEL_SIZE (line 12) | pub(crate) const CHANNEL_SIZE: usize = 2048;
constant TRANSIENT_STREAM_CHANNEL_SIZE (line 15) | pub(crate) const TRANSIENT_STREAM_CHANNEL_SIZE: usize = 1024;
FILE: crates/topos-tce-api/src/metrics/builder.rs
type ServerBuilder (line 9) | pub struct ServerBuilder {
method serve_addr (line 14) | pub fn serve_addr(mut self, addr: Option<SocketAddr>) -> Self {
method build (line 20) | pub async fn build(
FILE: crates/topos-tce-api/src/runtime/builder.rs
type RuntimeBuilder (line 21) | pub struct RuntimeBuilder {
method with_broadcast_stream (line 33) | pub fn with_broadcast_stream(
method with_peer_id (line 42) | pub fn with_peer_id(mut self, local_peer_id: String) -> Self {
method serve_grpc_addr (line 48) | pub fn serve_grpc_addr(mut self, addr: SocketAddr) -> Self {
method serve_graphql_addr (line 54) | pub fn serve_graphql_addr(mut self, addr: SocketAddr) -> Self {
method serve_metrics_addr (line 60) | pub fn serve_metrics_addr(mut self, addr: SocketAddr) -> Self {
method tce_status (line 66) | pub fn tce_status(mut self, status: RwLock<StatusResponse>) -> Self {
method store (line 72) | pub fn store(mut self, store: Arc<ValidatorStore>) -> Self {
method storage (line 78) | pub fn storage(mut self, storage: StorageClient) -> Self {
method build_and_launch (line 84) | pub async fn build_and_launch(
method set_grpc_socket_addr (line 189) | pub fn set_grpc_socket_addr(mut self, socket: Option<SocketAddr>) -> S...
type RuntimeContext (line 197) | pub struct RuntimeContext {
method drop (line 205) | fn drop(&mut self) {
FILE: crates/topos-tce-api/src/runtime/client.rs
type RuntimeClient (line 14) | pub struct RuntimeClient {
method dispatch_certificate (line 21) | pub fn dispatch_certificate(
method has_active_sample (line 41) | pub async fn has_active_sample(&self) -> bool {
method set_active_sample (line 45) | pub async fn set_active_sample(&self, value: bool) {
method shutdown (line 51) | pub async fn shutdown(&self) -> Result<(), Box<dyn std::error::Error>> {
FILE: crates/topos-tce-api/src/runtime/commands.rs
type RuntimeCommand (line 14) | pub enum RuntimeCommand {
type InternalRuntimeCommand (line 23) | pub(crate) enum InternalRuntimeCommand {
FILE: crates/topos-tce-api/src/runtime/error.rs
type RuntimeError (line 7) | pub enum RuntimeError {
FILE: crates/topos-tce-api/src/runtime/events.rs
type RuntimeEvent (line 9) | pub enum RuntimeEvent {
FILE: crates/topos-tce-api/src/runtime/mod.rs
type Streams (line 51) | pub(crate) type Streams =
type Runtime (line 54) | pub struct Runtime {
method builder (line 86) | pub fn builder() -> RuntimeBuilder {
method launch (line 90) | pub async fn launch(mut self) {
method handle_stream_termination (line 154) | async fn handle_stream_termination(&mut self, stream_result: Result<Uu...
method handle_runtime_command (line 179) | async fn handle_runtime_command(&mut self, command: RuntimeCommand) {
method handle_internal_command (line 247) | async fn handle_internal_command(&mut self, command: InternalRuntimeCo...
FILE: crates/topos-tce-api/src/runtime/sync_task.rs
type TargetSubnetStreamPositions (line 18) | type TargetSubnetStreamPositions = HashMap<SubnetId, HashMap<SubnetId, T...
type RunningTasks (line 19) | pub(crate) type RunningTasks =
type SyncTaskStatus (line 24) | pub(crate) enum SyncTaskStatus {
type SyncTaskError (line 37) | pub(crate) enum SyncTaskError {
type SyncTask (line 54) | pub(crate) struct SyncTask {
method new (line 72) | pub(crate) fn new(
type Output (line 91) | type Output = (Uuid, SyncTaskStatus);
type IntoFuture (line 93) | type IntoFuture = Pin<Box<dyn Future<Output = Self::Output> + Send + 'st...
method into_future (line 95) | fn into_future(mut self) -> Self::IntoFuture {
FILE: crates/topos-tce-api/src/runtime/tests.rs
function handling_new_stream (line 5) | async fn handling_new_stream() {}
function stream_collision (line 9) | async fn stream_collision() {}
function handle_stream_timedout (line 13) | async fn handle_stream_timedout() {}
function handle_stream_handshaked (line 17) | async fn handle_stream_handshaked() {}
function handle_stream_registration (line 21) | async fn handle_stream_registration() {}
function handle_certificate_submission (line 25) | async fn handle_certificate_submission() {}
function handle_stream_error (line 29) | async fn handle_stream_error() {}
function handle_stream_closing (line 33) | async fn handle_stream_closing() {}
function forcing_a_stream_to_close (line 37) | async fn forcing_a_stream_to_close() {}
FILE: crates/topos-tce-api/src/stream/commands.rs
type StreamCommand (line 5) | pub enum StreamCommand {
FILE: crates/topos-tce-api/src/stream/errors.rs
type StreamErrorKind (line 8) | pub(crate) enum StreamErrorKind {
type StreamError (line 26) | pub struct StreamError {
method new (line 32) | pub(crate) fn new(stream_id: Uuid, kind: StreamErrorKind) -> Self {
type HandshakeError (line 38) | pub(crate) enum HandshakeError {
function handshake_error_expected (line 57) | async fn handshake_error_expected() {
FILE: crates/topos-tce-api/src/stream/mod.rs
type TransientStream (line 43) | pub struct TransientStream {
type Item (line 50) | type Item = Arc<CertificateDelivered>;
method poll_next (line 52) | fn poll_next(
method drop (line 61) | fn drop(&mut self) {
type Stream (line 72) | pub struct Stream {
method new (line 98) | pub(crate) fn new(
method run (line 115) | pub async fn run(mut self) -> Result<Uuid, StreamError> {
method handle_command (line 190) | async fn handle_command(&mut self, command: StreamCommand) -> Result<b...
method pre_start (line 226) | async fn pre_start(&mut self) -> Result<(Option<Uuid>, TargetCheckpoin...
method handshake (line 272) | async fn handshake(&mut self, checkpoint: TargetCheckpoint) -> Result<...
method handle_checkpoint (line 297) | fn handle_checkpoint(&mut self, checkpoint: TargetCheckpoint) -> Resul...
method fmt (line 89) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
FILE: crates/topos-tce-api/src/stream/tests.rs
function sending_no_message (line 28) | pub async fn sending_no_message() -> Result<(), Box<dyn std::error::Erro...
function sending_open_stream_message (line 51) | pub async fn sending_open_stream_message() -> Result<(), Box<dyn std::er...
function subscribing_to_one_target_with_position (line 81) | async fn subscribing_to_one_target_with_position() -> Result<(), Box<dyn...
function receive_expected_certificate_from_zero (line 117) | async fn receive_expected_certificate_from_zero() -> Result<(), Box<dyn ...
function pausing_all_subscription (line 189) | async fn pausing_all_subscription() {}
function pausing_one_subscription (line 193) | async fn pausing_one_subscription() {}
function resuming_one_subscription (line 197) | async fn resuming_one_subscription() {}
function resuming_all_subscription (line 201) | async fn resuming_all_subscription() {}
function closing_client_stream (line 205) | async fn closing_client_stream() -> Result<(), Box<dyn std::error::Error...
function closing_server_stream (line 254) | async fn closing_server_stream() {}
function opening_transient_stream (line 257) | async fn opening_transient_stream() {
function opening_transient_stream_drop_sender (line 278) | async fn opening_transient_stream_drop_sender() {
FILE: crates/topos-tce-api/src/stream/tests/utils.rs
type CreateStreamResult (line 23) | type CreateStreamResult = (
function create_stream (line 28) | pub fn create_stream(stream_id: Uuid) -> CreateStreamResult {
type StreamBuilder (line 38) | pub struct StreamBuilder {
method outbound_stream_channel_size (line 58) | pub fn outbound_stream_channel_size(mut self, value: usize) -> Self {
method runtime_channel_size (line 65) | pub fn runtime_channel_size(mut self, value: usize) -> Self {
method stream_channel_size (line 72) | pub fn stream_channel_size(mut self, value: usize) -> Self {
method stream_id (line 79) | pub fn stream_id(mut self, value: Uuid) -> Self {
method build (line 85) | pub fn build(self) -> (Sender, Stream, StreamContext) {
method default (line 46) | fn default() -> Self {
type StreamContext (line 115) | pub struct StreamContext {
FILE: crates/topos-tce-api/src/tests.rs
function encode (line 27) | pub fn encode<T: Message>(proto: &T) -> Result<Bytes, Box<dyn std::error...
FILE: crates/topos-tce-api/tests/grpc/certificate_precedence.rs
function fetch_latest_pending_certificates (line 18) | async fn fetch_latest_pending_certificates() {
function fetch_latest_pending_certificates_with_conflicts (line 66) | async fn fetch_latest_pending_certificates_with_conflicts() {
FILE: crates/topos-tce-api/tests/runtime.rs
function runtime_can_dispatch_a_cert (line 45) | async fn runtime_can_dispatch_a_cert(
function can_catchup_with_old_certs (line 122) | async fn can_catchup_with_old_certs(
function can_catchup_with_old_certs_with_position (line 207) | async fn can_catchup_with_old_certs_with_position(
function can_listen_for_multiple_subnet_id (line 327) | async fn can_listen_for_multiple_subnet_id() {}
function boots_healthy_graphql_server (line 332) | async fn boots_healthy_graphql_server(
function graphql_server_enables_cors (line 375) | async fn graphql_server_enables_cors(
function can_query_graphql_endpoint_for_certificates (line 442) | async fn can_query_graphql_endpoint_for_certificates(
function check_storage_pool_stats (line 634) | async fn check_storage_pool_stats(
function get_pending_pool (line 709) | async fn get_pending_pool(
function check_precedence (line 789) | async fn check_precedence(
FILE: crates/topos-tce-broadcast/benches/double_echo.rs
function criterion_benchmark (line 6) | pub fn criterion_benchmark(c: &mut Criterion) {
FILE: crates/topos-tce-broadcast/benches/task_manager.rs
constant CHANNEL_SIZE (line 13) | const CHANNEL_SIZE: usize = 256_000;
constant PRIVATE_KEY (line 14) | const PRIVATE_KEY: &str = "d6f8d1fe6d0f3606ccb15ef383910f10d83ca77bf3d73...
type TceParams (line 16) | struct TceParams {
function processing_double_echo (line 21) | pub async fn processing_double_echo(n: u64, validator_store: Arc<Validat...
FILE: crates/topos-tce-broadcast/src/double_echo/broadcast_state.rs
type BroadcastState (line 21) | pub struct BroadcastState {
method new (line 38) | pub fn new(
method into_delivered (line 83) | pub fn into_delivered(&self) -> CertificateDelivered {
method apply_echo (line 106) | pub fn apply_echo(&mut self, validator_id: ValidatorId) -> Option<Stat...
method apply_ready (line 114) | pub fn apply_ready(&mut self, validator_id: ValidatorId) -> Option<Sta...
method update_status (line 123) | fn update_status(&mut self) -> Option<Status> {
method reached_ready_threshold (line 204) | fn reached_ready_threshold(&self) -> bool {
method reached_delivery_threshold (line 234) | fn reached_delivery_threshold(&self) -> bool {
FILE: crates/topos-tce-broadcast/src/double_echo/broadcast_state/status.rs
type Status (line 4) | pub enum Status {
method is_ready_sent (line 25) | pub(crate) fn is_ready_sent(&self) -> bool {
method is_delivered (line 29) | pub(crate) fn is_delivered(&self) -> bool {
method ready_sent (line 33) | pub(crate) fn ready_sent(self) -> Self {
method delivered (line 41) | pub(crate) fn delivered(self) -> Self {
method fmt (line 13) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
FILE: crates/topos-tce-broadcast/src/double_echo/mod.rs
type DoubleEcho (line 32) | pub struct DoubleEcho {
constant MAX_BUFFER_SIZE (line 58) | pub const MAX_BUFFER_SIZE: usize = 2048;
method new (line 61) | pub fn new(
method spawn_task_manager (line 93) | pub fn spawn_task_manager(
method run (line 118) | pub(crate) async fn run(
method handle_echo (line 208) | pub async fn handle_echo(
method handle_ready (line 236) | pub async fn handle_ready(
FILE: crates/topos-tce-broadcast/src/event.rs
type ProtocolEvents (line 9) | pub enum ProtocolEvents {
FILE: crates/topos-tce-broadcast/src/lib.rs
type Peer (line 55) | pub type Peer = String;
type TaskStatus (line 70) | pub enum TaskStatus {
type ReliableBroadcastConfig (line 78) | pub struct ReliableBroadcastConfig {
type DoubleEchoCommand (line 86) | pub enum DoubleEchoCommand {
type ReliableBroadcastClient (line 111) | pub struct ReliableBroadcastClient {
method new (line 121) | pub async fn new(
method get_double_echo_channel (line 162) | pub fn get_double_echo_channel(&self) -> Sender<DoubleEchoCommand> {
method shutdown (line 166) | pub async fn shutdown(&self) -> Result<(), Errors> {
type Errors (line 181) | pub enum Errors {
FILE: crates/topos-tce-broadcast/src/sampler/mod.rs
type SubscriptionsView (line 7) | pub struct SubscriptionsView {
method is_some (line 17) | pub fn is_some(&self) -> bool {
method is_none (line 21) | pub fn is_none(&self) -> bool {
FILE: crates/topos-tce-broadcast/src/task_manager/mod.rs
type RunningTasks (line 37) | type RunningTasks =
type TaskManager (line 43) | pub struct TaskManager {
method new (line 61) | pub fn new(
method next_pending_certificate (line 90) | fn next_pending_certificate(&mut self) {
method run (line 109) | pub async fn run(mut self, shutdown_receiver: CancellationToken) {
method start_task (line 171) | fn start_task(
method create_task (line 201) | fn create_task(&mut self, cert: &Certificate, need_gossip: bool, pendi...
FILE: crates/topos-tce-broadcast/src/task_manager/task.rs
type TaskContext (line 18) | pub struct TaskContext {
type Task (line 23) | pub struct Task {
method new (line 33) | pub fn new(
method persist (line 59) | pub async fn persist(&self) -> Result<CertificateDeliveredWithPosition...
type Output (line 75) | type Output = (CertificateId, TaskStatus);
type IntoFuture (line 77) | type IntoFuture = Pin<Box<dyn Future<Output = Self::Output> + Send + 'st...
method into_future (line 79) | fn into_future(mut self) -> Self::IntoFuture {
FILE: crates/topos-tce-broadcast/src/tests/mod.rs
constant CHANNEL_SIZE (line 22) | const CHANNEL_SIZE: usize = 10;
constant PRIVATE_KEY (line 23) | const PRIVATE_KEY: &str = "d6f8d1fe6d0f3606ccb15ef383910f10d83ca77bf3d73...
function small_config (line 26) | fn small_config() -> TceParams {
function medium_config (line 38) | fn medium_config() -> TceParams {
type TceParams (line 50) | struct TceParams {
type Context (line 55) | struct Context {
function create_context (line 61) | async fn create_context(params: TceParams) -> (DoubleEcho, Context) {
function reach_echo_threshold (line 107) | async fn reach_echo_threshold(double_echo: &mut DoubleEcho, cert: &Certi...
function reach_ready_threshold (line 130) | async fn reach_ready_threshold(double_echo: &mut DoubleEcho, cert: &Cert...
function reach_delivery_threshold (line 154) | async fn reach_delivery_threshold(double_echo: &mut DoubleEcho, cert: &C...
function trigger_success_path_upon_reaching_threshold (line 183) | async fn trigger_success_path_upon_reaching_threshold(#[case] params: Tc...
function trigger_ready_when_reached_enough_ready (line 238) | async fn trigger_ready_when_reached_enough_ready(#[case] params: TcePara...
FILE: crates/topos-tce-broadcast/src/tests/task.rs
function start_with_ungossiped_cert (line 26) | async fn start_with_ungossiped_cert(
FILE: crates/topos-tce-broadcast/src/tests/task_manager.rs
function can_start (line 23) | async fn can_start(
FILE: crates/topos-tce-gatekeeper/src/builder.rs
type GatekeeperBuilder (line 9) | pub struct GatekeeperBuilder {}
type Output (line 12) | type Output = Result<(GatekeeperClient, Gatekeeper), GatekeeperError>;
type IntoFuture (line 14) | type IntoFuture = BoxFuture<'static, Self::Output>;
method into_future (line 16) | fn into_future(self) -> Self::IntoFuture {
FILE: crates/topos-tce-gatekeeper/src/client.rs
type GatekeeperClient (line 5) | pub struct GatekeeperClient {
method shutdown (line 10) | pub async fn shutdown(&self) -> Result<(), GatekeeperError> {
FILE: crates/topos-tce-gatekeeper/src/lib.rs
type Gatekeeper (line 20) | pub struct Gatekeeper {
constant DEFAULT_TICK_DURATION (line 69) | pub(crate) const DEFAULT_TICK_DURATION: u64 = 10;
method builder (line 71) | pub fn builder() -> GatekeeperBuilder {
method default (line 26) | fn default() -> Self {
type Output (line 38) | type Output = Result<(), GatekeeperError>;
type IntoFuture (line 40) | type IntoFuture = BoxFuture<'static, Self::Output>;
method into_future (line 42) | fn into_future(mut self) -> Self::IntoFuture {
type GatekeeperError (line 77) | pub enum GatekeeperError {
FILE: crates/topos-tce-gatekeeper/src/tests.rs
function can_start_and_stop (line 11) | async fn can_start_and_stop() -> Result<(), Box<dyn std::error::Error>> {
function gatekeeper (line 24) | async fn gatekeeper() -> GatekeeperClient {
function peer_list (line 33) | fn peer_list(#[default(10)] number: usize) -> Vec<PeerId> {
FILE: crates/topos-tce-proxy/src/client.rs
constant CERTIFICATE_OUTBOUND_CHANNEL_SIZE (line 25) | const CERTIFICATE_OUTBOUND_CHANNEL_SIZE: usize = 100;
constant CERTIFICATE_INBOUND_CHANNEL_SIZE (line 26) | const CERTIFICATE_INBOUND_CHANNEL_SIZE: usize = 100;
constant TCE_PROXY_COMMAND_CHANNEL_SIZE (line 27) | const TCE_PROXY_COMMAND_CHANNEL_SIZE: usize = 100;
constant TCE_SUBMIT_CERTIFICATE_BACKOFF_TIMEOUT (line 30) | const TCE_SUBMIT_CERTIFICATE_BACKOFF_TIMEOUT: Duration = Duration::from_...
type TceClientCommand (line 32) | pub(crate) enum TceClientCommand {
function new_tce_proxy_backoff_err (line 58) | pub(crate) fn new_tce_proxy_backoff_err<E: std::fmt::Display>(err: E) ->...
type TceClient (line 66) | pub struct TceClient {
method open_stream (line 73) | pub async fn open_stream(&self, positions: Vec<TargetStreamPosition>) ...
method send_certificate (line 85) | pub async fn send_certificate(&mut self, cert: Certificate) -> Result<...
method close (line 97) | pub async fn close(&mut self) -> Result<(), Error> {
method get_source_head (line 106) | pub async fn get_source_head(&mut self) -> Result<(Certificate, u64), ...
method get_last_pending_certificates (line 123) | pub async fn get_last_pending_certificates(
method get_subnet_id (line 137) | pub fn get_subnet_id(&self) -> SubnetId {
method get_tce_endpoint (line 141) | pub fn get_tce_endpoint(&self) -> &str {
type TceClientBuilder (line 147) | pub struct TceClientBuilder {
method set_tce_endpoint (line 154) | pub fn set_tce_endpoint<T: ToString>(mut self, endpoint: T) -> Self {
method set_subnet_id (line 159) | pub fn set_subnet_id(mut self, subnet_id: SubnetId) -> Self {
method set_proxy_event_sender (line 164) | pub fn set_proxy_event_sender(
method build_and_launch (line 172) | pub async fn build_and_launch(
FILE: crates/topos-tce-proxy/src/lib.rs
constant TCE_CONNECT_BACKOFF_TIMEOUT (line 18) | const TCE_CONNECT_BACKOFF_TIMEOUT: Duration = Duration::from_secs(12 * 3...
type Error (line 21) | pub enum Error {
type TceProxyCommand (line 61) | pub enum TceProxyCommand {
type TceProxyEvent (line 74) | pub enum TceProxyEvent {
type TceProxyConfig (line 87) | pub struct TceProxyConfig {
function connect_to_tce_service_with_retry (line 96) | async fn connect_to_tce_service_with_retry(
FILE: crates/topos-tce-proxy/src/worker.rs
type TceProxyWorker (line 14) | pub struct TceProxyWorker {
method new (line 24) | pub async fn new(config: TceProxyConfig) -> Result<(Self, Option<(Cert...
method send_command (line 160) | pub async fn send_command(&self, cmd: TceProxyCommand) -> Result<(), S...
method next_event (line 168) | pub async fn next_event(&mut self) -> Result<TceProxyEvent, String> {
method shutdown (line 174) | pub async fn shutdown(&self) -> Result<(), String> {
FILE: crates/topos-tce-proxy/tests/tce_tests.rs
constant SOURCE_SUBNET_ID_1_NUMBER_OF_PREFILLED_CERTIFICATES (line 31) | pub const SOURCE_SUBNET_ID_1_NUMBER_OF_PREFILLED_CERTIFICATES: usize = 15;
constant SOURCE_SUBNET_ID_2_NUMBER_OF_PREFILLED_CERTIFICATES (line 32) | pub const SOURCE_SUBNET_ID_2_NUMBER_OF_PREFILLED_CERTIFICATES: usize = 10;
function test_tce_submit_certificate (line 35) | async fn test_tce_submit_certificate() -> Result<(), Box<dyn std::error:...
function test_tce_watch_certificates (line 75) | async fn test_tce_watch_certificates() -> Result<(), Box<dyn std::error:...
function test_tce_get_source_head_certificate (line 138) | async fn test_tce_get_source_head_certificate() -> Result<(), Box<dyn st...
function test_tce_get_last_pending_certificates (line 238) | async fn test_tce_get_last_pending_certificates() -> Result<(), Box<dyn ...
function test_tce_open_stream_with_checkpoint (line 331) | async fn test_tce_open_stream_with_checkpoint(
function input_certificates (line 506) | fn input_certificates() -> Vec<CertificateDelivered> {
function test_tce_proxy_submit_certificate (line 524) | async fn test_tce_proxy_submit_certificate() -> Result<(), Box<dyn std::...
function create_tce_client (line 615) | async fn create_tce_client(
function test_tce_client_submit_and_get_last_pending_certificate (line 646) | async fn test_tce_client_submit_and_get_last_pending_certificate(
function test_tce_client_get_empty_history_source_head (line 702) | async fn test_tce_client_get_empty_history_source_head() -> Result<(), B...
function test_tce_client_get_source_head (line 730) | async fn test_tce_client_get_source_head(
function test_tce_client_submit_and_get_certificate_delivered (line 790) | async fn test_tce_client_submit_and_get_certificate_delivered(
FILE: crates/topos-tce-storage/src/client.rs
type StorageClient (line 14) | pub struct StorageClient {
method new (line 20) | pub fn new(store: Arc<ValidatorStore>) -> Self {
method get_target_source_subnet_list (line 25) | pub async fn get_target_source_subnet_list(
method get_pending_certificates (line 35) | pub async fn get_pending_certificates(
method fetch_certificates (line 41) | pub async fn fetch_certificates(
method get_source_head (line 74) | pub async fn get_source_head(
FILE: crates/topos-tce-storage/src/constant.rs
constant CERTIFICATES (line 2) | pub(crate) const CERTIFICATES: &str = "certificates";
constant STREAMS (line 3) | pub(crate) const STREAMS: &str = "streams";
constant EPOCH_CHAIN (line 4) | pub(crate) const EPOCH_CHAIN: &str = "epoch_chain";
constant UNVERIFIED (line 5) | pub(crate) const UNVERIFIED: &str = "unverified";
constant PENDING_POOL (line 7) | pub(crate) const PENDING_POOL: &str = "pending_pool";
constant PENDING_POOL_INDEX (line 8) | pub(crate) const PENDING_POOL_INDEX: &str = "pending_pool_index";
constant PRECEDENCE_POOL (line 9) | pub(crate) const PRECEDENCE_POOL: &str = "precedence_pool";
constant TARGET_STREAMS (line 11) | pub(crate) const TARGET_STREAMS: &str = "target_streams";
constant TARGET_SOURCE_LIST (line 12) | pub(crate) const TARGET_SOURCE_LIST: &str = "target_source_list";
constant SOURCE_LIST (line 13) | pub(crate) const SOURCE_LIST: &str = "source_list";
constant DELIVERED_CERTIFICATES_PER_SOURCE_FOR_TARGET (line 14) | pub(crate) const DELIVERED_CERTIFICATES_PER_SOURCE_FOR_TARGET: &str =
constant VALIDATORS (line 17) | pub(crate) const VALIDATORS: &str = "validators";
constant EPOCH_SUMMARY (line 19) | pub(crate) const EPOCH_SUMMARY: &str = "epoch_summary";
constant BROADCAST_STATES (line 20) | pub(crate) const BROADCAST_STATES: &str = "broadcast_states";
FILE: crates/topos-tce-storage/src/epoch/mod.rs
type ValidatorPerEpochStore (line 16) | pub struct ValidatorPerEpochStore {
method new (line 26) | pub fn new(epoch_id: EpochId, path: &Path) -> Result<ArcSwap<Self>, St...
type EpochValidatorsStore (line 37) | pub struct EpochValidatorsStore {
method new (line 45) | pub fn new(path: &Path) -> Result<Arc<Self>, StorageError> {
FILE: crates/topos-tce-storage/src/epoch/tables.rs
type EpochValidatorsTables (line 16) | pub struct EpochValidatorsTables {
method open (line 22) | pub(crate) fn open(path: &Path) -> Self {
type ValidatorPerEpochTables (line 35) | pub struct ValidatorPerEpochTables {
method open (line 45) | pub(crate) fn open(epoch_id: EpochId, path: &Path) -> Self {
type EpochSummaryKey (line 68) | enum EpochSummaryKey {
type EpochSummaryValue (line 75) | enum EpochSummaryValue {
FILE: crates/topos-tce-storage/src/errors.rs
type InternalStorageError (line 9) | pub enum InternalStorageError {
type StorageError (line 59) | pub enum StorageError {
FILE: crates/topos-tce-storage/src/fullnode/locking.rs
constant LOCK_SHARDING (line 9) | const LOCK_SHARDING: usize = 2048;
type LocksVec (line 11) | type LocksVec<T> = Vec<RwLock<HashMap<T, Arc<Mutex<()>>>>>;
type LockGuards (line 13) | pub(crate) struct LockGuards<T: Hash + Eq + PartialEq> {
function new (line 19) | pub fn new() -> Self {
function get_lock (line 30) | pub async fn get_lock(&self, key: T) -> Arc<Mutex<()>> {
FILE: crates/topos-tce-storage/src/fullnode/mod.rs
type FullNodeStore (line 43) | pub struct FullNodeStore {
method new (line 56) | pub fn new(path: &Path) -> Result<Arc<Self>, StorageError> {
method open (line 71) | pub fn open(
method certificate_lock_guard (line 88) | pub(crate) async fn certificate_lock_guard(
method subnet_lock_guard (line 100) | pub(crate) async fn subnet_lock_guard(&self, subnet_id: SubnetId) -> O...
method insert_certificate_delivered (line 111) | async fn insert_certificate_delivered(
method insert_certificates_delivered (line 259) | async fn insert_certificates_delivered(
method count_certificates_delivered (line 271) | fn count_certificates_delivered(&self) -> Result<u64, StorageError> {
method get_source_head (line 278) | fn get_source_head(&self, subnet_id: &SubnetId) -> Result<Option<SourceH...
method get_certificate (line 290) | fn get_certificate(
method get_certificates (line 297) | fn get_certificates(
method last_delivered_position_for_subnet (line 307) | fn last_delivered_position_for_subnet(
method get_checkpoint (line 319) | fn get_checkpoint(&self) -> Result<HashMap<SubnetId, SourceHead>, Storag...
method get_source_stream_certificates_from_position (line 337) | fn get_source_stream_certificates_from_position(
method get_target_stream_certificates_from_position (line 373) | fn get_target_stream_certificates_from_position(
method get_target_source_subnet_list (line 416) | fn get_target_source_subnet_list(
FILE: crates/topos-tce-storage/src/index/mod.rs
type IndexStore (line 20) | pub struct IndexStore {}
type IndexTables (line 22) | pub struct IndexTables {
method open (line 30) | pub fn open(path: &Path) -> Self {
FILE: crates/topos-tce-storage/src/lib.rs
type PendingCertificateId (line 110) | pub type PendingCertificateId = u64;
type FetchCertificatesFilter (line 113) | pub enum FetchCertificatesFilter {
type FetchCertificatesPosition (line 126) | pub enum FetchCertificatesPosition {
type CertificatePositions (line 132) | pub struct CertificatePositions {
type SourceHead (line 141) | pub struct SourceHead {
FILE: crates/topos-tce-storage/src/rocks/constants.rs
constant PENDING_CERTIFICATES (line 3) | pub(crate) const PENDING_CERTIFICATES: &str = "PENDING_CERTIFICATES";
constant CERTIFICATES (line 4) | pub(crate) const CERTIFICATES: &str = "CERTIFICATES";
constant SOURCE_STREAMS (line 6) | pub(crate) const SOURCE_STREAMS: &str = "SOURCE_STREAMS";
constant TARGET_STREAMS (line 7) | pub(crate) const TARGET_STREAMS: &str = "TARGET_STREAMS";
constant TARGET_SOURCES (line 8) | pub(crate) const TARGET_SOURCES: &str = "TARGET_SOURCES";
constant TARGET_STREAMS_PREFIX_SIZE (line 10) | pub(crate) const TARGET_STREAMS_PREFIX_SIZE: usize = 32 * 2;
constant SOURCE_STREAMS_PREFIX_SIZE (line 11) | pub(crate) const SOURCE_STREAMS_PREFIX_SIZE: usize = 32;
FILE: crates/topos-tce-storage/src/rocks/db.rs
type RocksDB (line 10) | pub(crate) type RocksDB = Arc<rocksdb::DBWithThreadMode<MultiThreaded>>;
function init_with_cfs (line 12) | pub(crate) fn init_with_cfs(
function default_options (line 23) | pub(crate) fn default_options() -> rocksdb::Options {
function init_db (line 30) | pub(crate) fn init_db(
FILE: crates/topos-tce-storage/src/rocks/db_column.rs
type DBColumn (line 22) | pub struct DBColumn<K, V> {
function open (line 31) | pub fn open<P: AsRef<Path>>(
function reopen (line 60) | pub fn reopen(db: &RocksDB, column: &'static str) -> Self {
function cf (line 69) | pub(crate) fn cf(&self) -> Result<Arc<BoundColumnFamily<'_>>, InternalSt...
function property_int_value (line 81) | pub(crate) fn property_int_value(
function insert (line 95) | pub(crate) fn insert(&self, key: &K, value: &V) -> Result<(), InternalSt...
function delete (line 110) | pub(crate) fn delete(&self, key: &K) -> Result<(), InternalStorageError> {
function get (line 121) | pub(crate) fn get(&self, key: &K) -> Result<Option<V>, InternalStorageEr...
function multi_insert (line 133) | pub(crate) fn multi_insert(
function multi_get (line 142) | pub(crate) fn multi_get(&self, keys: &[K]) -> Result<Vec<Option<V>>, Int...
function merge (line 165) | pub(crate) fn merge(&self, key: &K, value: V) -> Result<(), InternalStor...
function batch (line 172) | pub(crate) fn batch(&self) -> DBBatch {
type DBBatch (line 177) | pub(crate) struct DBBatch {
method new (line 183) | fn new(rocksdb: &Arc<DBWithThreadMode<MultiThreaded>>) -> Self {
method insert_batch (line 190) | pub(crate) fn insert_batch<K, V, Key, Value>(
method write (line 215) | pub(crate) fn write(self) -> Result<(), InternalStorageError> {
type Iterator (line 227) | type Iterator = ColumnIterator<'a, K, V>;
function iter (line 229) | fn iter(&'a self) -> Result<Self::Iterator, InternalStorageError> {
function iter_at (line 236) | fn iter_at<I: Serialize>(&'a self, index: &I) -> Result<Self::Iterator, ...
function iter_with_mode (line 243) | fn iter_with_mode(
function prefix_iter (line 264) | fn prefix_iter<P: Serialize>(
function prefix_iter_at (line 276) | fn prefix_iter_at<P: Serialize, I: Serialize>(
function be_fix_int_ser (line 292) | pub(crate) fn be_fix_int_ser<S>(t: &S) -> Result<Vec<u8>, InternalStorag...
function check_cross_batch (line 302) | fn check_cross_batch(base: &RocksDB, current: &RocksDB) -> Result<(), In...
FILE: crates/topos-tce-storage/src/rocks/iterator.rs
type ColumnIterator (line 7) | pub struct ColumnIterator<'a, K, V> {
function new (line 15) | pub fn new(iterator: DBRawIteratorWithThreadMode<'a, DBWithThreadMode<Mu...
function new_with_direction (line 19) | pub fn new_with_direction(
type Item (line 36) | type Item = (K, V);
method next (line 38) | fn next(&mut self) -> Option<Self::Item> {
FILE: crates/topos-tce-storage/src/rocks/map.rs
type Map (line 6) | pub trait Map<'a, K, V>
method iter (line 14) | fn iter(&'a self) -> Result<Self::Iterator, InternalStorageError>;
method iter_at (line 17) | fn iter_at<I: Serialize>(&'a self, index: &I) -> Result<Self::Iterator...
method iter_with_mode (line 21) | fn iter_with_mode(
method prefix_iter (line 27) | fn prefix_iter<P: Serialize>(
method prefix_iter_at (line 34) | fn prefix_iter_at<P: Serialize, I: Serialize>(
FILE: crates/topos-tce-storage/src/rocks/types.rs
type TargetSourceListKey (line 6) | pub(crate) struct TargetSourceListKey(
FILE: crates/topos-tce-storage/src/store.rs
type WriteStore (line 19) | pub trait WriteStore: Send {
method insert_certificate_delivered (line 26) | async fn insert_certificate_delivered(
method insert_certificates_delivered (line 35) | async fn insert_certificates_delivered(
type ReadStore (line 44) | pub trait ReadStore: Send {
method count_certificates_delivered (line 46) | fn count_certificates_delivered(&self) -> Result<u64, StorageError>;
method get_source_head (line 52) | fn get_source_head(&self, subnet_id: &SubnetId) -> Result<Option<Sourc...
method get_certificate (line 58) | fn get_certificate(
method get_certificates (line 66) | fn get_certificates(
method last_delivered_position_for_subnet (line 72) | fn last_delivered_position_for_subnet(
method get_checkpoint (line 81) | fn get_checkpoint(&self) -> Result<HashMap<SubnetId, SourceHead>, Stor...
method get_source_stream_certificates_from_position (line 84) | fn get_source_stream_certificates_from_position(
method get_target_stream_certificates_from_position (line 91) | fn get_target_stream_certificates_from_position(
method get_target_source_subnet_list (line 98) | fn get_target_source_subnet_list(
FILE: crates/topos-tce-storage/src/tests/checkpoints.rs
function get_checkpoint_for_two_subnets (line 18) | async fn get_checkpoint_for_two_subnets(store: Arc<ValidatorStore>) {
function get_checkpoint_diff_with_no_input (line 44) | async fn get_checkpoint_diff_with_no_input(store: Arc<ValidatorStore>) {
function get_checkpoint_diff_with_input (line 84) | async fn get_checkpoint_diff_with_input(store: Arc<ValidatorStore>) {
FILE: crates/topos-tce-storage/src/tests/db_columns.rs
function can_persist_a_pending_certificate (line 17) | async fn can_persist_a_pending_certificate(pending_column: PendingCertif...
function can_persist_a_delivered_certificate (line 27) | async fn can_persist_a_delivered_certificate(certificates_column: Certif...
function delivered_certificate_position_are_incremented (line 46) | async fn delivered_certificate_position_are_incremented(
function position_can_be_fetch_for_one_subnet (line 67) | async fn position_can_be_fetch_for_one_subnet(source_streams_column: Str...
function position_can_be_fetch_for_multiple_subnets (line 121) | async fn position_can_be_fetch_for_multiple_subnets() {}
function position_can_be_fetch_for_all_subnets (line 125) | async fn position_can_be_fetch_for_all_subnets() {}
FILE: crates/topos-tce-storage/src/tests/mod.rs
constant SOURCE_STORAGE_SUBNET_ID (line 31) | const SOURCE_STORAGE_SUBNET_ID: SubnetId = SOURCE_SUBNET_ID_1;
constant TARGET_STORAGE_SUBNET_ID_1 (line 32) | const TARGET_STORAGE_SUBNET_ID_1: SubnetId = TARGET_SUBNET_ID_1;
constant TARGET_STORAGE_SUBNET_ID_2 (line 33) | const TARGET_STORAGE_SUBNET_ID_2: SubnetId = TARGET_SUBNET_ID_2;
function can_persist_a_pending_certificate (line 37) | async fn can_persist_a_pending_certificate(store: Arc<ValidatorStore>) {
function can_persist_a_delivered_certificate (line 46) | async fn can_persist_a_delivered_certificate(store: Arc<ValidatorStore>) {
function cannot_persist_a_delivered_certificate_twice (line 101) | async fn cannot_persist_a_delivered_certificate_twice(store: Arc<Validat...
function cannot_persist_a_delivered_certificate_at_same_position (line 141) | async fn cannot_persist_a_delivered_certificate_at_same_position(store: ...
function delivered_certificate_are_added_to_target_stream (line 205) | async fn delivered_certificate_are_added_to_target_stream(store: Arc<Val...
function pending_certificate_are_removed_during_persist_action (line 275) | async fn pending_certificate_are_removed_during_persist_action(store: Ar...
function fetch_certificates_for_subnets (line 315) | async fn fetch_certificates_for_subnets(store: Arc<ValidatorStore>) {
function pending_certificate_can_be_removed (line 444) | async fn pending_certificate_can_be_removed(store: Arc<ValidatorStore>) {
function get_source_head_for_subnet (line 486) | async fn get_source_head_for_subnet(store: Arc<ValidatorStore>) {
function get_pending_certificates (line 592) | async fn get_pending_certificates(store: Arc<ValidatorStore>) {
function fetch_source_subnet_certificates_in_order (line 670) | async fn fetch_source_subnet_certificates_in_order(store: Arc<ValidatorS...
FILE: crates/topos-tce-storage/src/tests/pending_certificates.rs
function adding_genesis_pending_certificate (line 15) | async fn adding_genesis_pending_certificate(store: Arc<ValidatorStore>) {
function adding_pending_certificate_with_precedence_check_fail (line 42) | async fn adding_pending_certificate_with_precedence_check_fail(store: Ar...
function adding_pending_certificate_already_delivered (line 80) | async fn adding_pending_certificate_already_delivered(store: Arc<Validat...
function adding_pending_certificate_but_prev_fail (line 116) | async fn adding_pending_certificate_but_prev_fail(store: Arc<ValidatorSt...
function certificate_in_delivery (line 143) | async fn certificate_in_delivery(store: Arc<ValidatorStore>) {
function prev_certificate_in_delivery (line 181) | async fn prev_certificate_in_delivery(store: Arc<ValidatorStore>) {
FILE: crates/topos-tce-storage/src/tests/position.rs
function position_can_be_fetch_for_multiple_subnets (line 5) | async fn position_can_be_fetch_for_multiple_subnets() {}
function position_can_be_fetch_for_all_subnets (line 9) | async fn position_can_be_fetch_for_all_subnets() {}
FILE: crates/topos-tce-storage/src/tests/rocks.rs
function create_batch_multithread (line 14) | async fn create_batch_multithread(database_name: &'static str) {
FILE: crates/topos-tce-storage/src/tests/support/columns.rs
function pending_column (line 13) | pub(crate) fn pending_column(database_name: &'static str) -> PendingCert...
function certificates_column (line 18) | pub(crate) fn certificates_column(database_name: &'static str) -> Certif...
function source_streams_column (line 23) | pub(crate) fn source_streams_column(database_name: &'static str) -> Stre...
function target_streams_column (line 28) | pub(crate) fn target_streams_column(database_name: &'static str) -> Targ...
function target_source_list_column (line 33) | pub(crate) fn target_source_list_column(database_name: &'static str) -> ...
FILE: crates/topos-tce-storage/src/tests/support/folder.rs
function random_path (line 10) | pub(crate) fn random_path() -> Box<PathBuf> {
function created_folder (line 15) | pub(crate) fn created_folder(random_path: &Path) {
FILE: crates/topos-tce-storage/src/tests/support/mod.rs
function database_name (line 31) | pub(crate) fn database_name() -> &'static str {
function store (line 41) | pub(crate) fn store() -> Arc<ValidatorStore> {
function rocks_db (line 64) | pub(crate) fn rocks_db(database_name: &'static str) -> Arc<RocksDB> {
FILE: crates/topos-tce-storage/src/types.rs
type Echo (line 15) | pub type Echo = String;
type CertificateSequenceNumber (line 17) | pub type CertificateSequenceNumber = u64;
type EpochId (line 18) | pub type EpochId = u64;
type Validators (line 19) | pub type Validators = Vec<String>;
type PendingCertificatesColumn (line 22) | pub(crate) type PendingCertificatesColumn = DBColumn<u64, Certificate>;
type CertificatesColumn (line 24) | pub(crate) type CertificatesColumn = DBColumn<CertificateId, Certificate...
type StreamsColumn (line 27) | pub(crate) type StreamsColumn = DBColumn<CertificateSourceStreamPosition...
type TargetStreamsColumn (line 31) | pub(crate) type TargetStreamsColumn = DBColumn<CertificateTargetStreamPo...
type TargetSourceListColumn (line 33) | pub(crate) type TargetSourceListColumn = DBColumn<TargetSourceListKey, P...
type PendingResult (line 36) | pub enum PendingResult {
type CertificateDeliveredWithPositions (line 44) | pub struct CertificateDeliveredWithPositions(pub CertificateDelivered, p...
type EpochSummary (line 47) | pub struct EpochSummary {
type CheckpointSummary (line 54) | pub struct CheckpointSummary {
type VerifiedCheckpointSummary (line 60) | pub struct VerifiedCheckpointSummary(CheckpointSummary, ValidatorQuorumS...
type ValidatorQuorumSignatureInfo (line 63) | pub struct ValidatorQuorumSignatureInfo {
type BroadcastState (line 69) | pub struct BroadcastState {
FILE: crates/topos-tce-storage/src/validator/mod.rs
type ValidatorStore (line 61) | pub struct ValidatorStore {
method new (line 68) | pub fn new(path: &Path) -> Result<Arc<Self>, StorageError> {
method open (line 75) | pub fn open(
method fullnode_store (line 122) | pub fn fullnode_store(&self) -> Arc<FullNodeStore> {
method pending_pool_size (line 127) | pub fn pending_pool_size(&self) -> Result<u64, StorageError> {
method precedence_pool_size (line 135) | pub fn precedence_pool_size(&self) -> Result<u64, StorageError> {
method get_pending_id (line 145) | pub fn get_pending_id(
method get_pending_certificate (line 155) | pub fn get_pending_certificate(
method iter_pending_pool (line 166) | pub fn iter_pending_pool(
method iter_pending_pool_at (line 176) | pub fn iter_pending_pool_at(
method iter_precedence_pool (line 187) | pub fn iter_precedence_pool(
method get_next_pending_certificates (line 193) | pub fn get_next_pending_certificates(
method check_precedence (line 211) | pub fn check_precedence(
method get_pending_certificates_for_subnets (line 220) | pub fn get_pending_certificates_for_subnets(
method insert_pending_certificates (line 255) | pub(crate) fn insert_pending_certificates(
method insert_pending_certificate (line 289) | pub async fn insert_pending_certificate(
method insert_unverified_proofs (line 368) | pub fn insert_unverified_proofs(
method synchronize_certificate (line 394) | pub async fn synchronize_certificate(
method get_unverified_proof (line 428) | pub fn get_unverified_proof(
method get_checkpoint_diff (line 445) | pub fn get_checkpoint_diff(
method delete_pending_certificate (line 519) | pub(crate) fn delete_pending_certificate(
method count_certificates_delivered (line 541) | fn count_certificates_delivered(&self) -> Result<u64, StorageError> {
method get_source_head (line 545) | fn get_source_head(&self, subnet_id: &SubnetId) -> Result<Option<SourceH...
method get_certificate (line 549) | fn get_certificate(
method get_certificates (line 556) | fn get_certificates(
method last_delivered_position_for_subnet (line 563) | fn last_delivered_position_for_subnet(
method get_checkpoint (line 578) | fn get_checkpoint(&self) -> Result<HashMap<SubnetId, SourceHead>, Storag...
method get_source_stream_certificates_from_position (line 582) | fn get_source_stream_certificates_from_position(
method get_target_stream_certificates_from_position (line 591) | fn get_target_stream_certificates_from_position(
method get_target_source_subnet_list (line 600) | fn get_target_source_subnet_list(
method insert_certificate_delivered (line 611) | async fn insert_certificate_delivered(
method insert_certificates_delivered (line 655) | async fn insert_certificates_delivered(
FILE: crates/topos-tce-storage/src/validator/tables.rs
type ValidatorPendingTables (line 56) | pub struct ValidatorPendingTables {
method open (line 65) | pub fn open(path: &Path) -> Self {
type ValidatorPerpetualTables (line 119) | pub struct ValidatorPerpetualTables {
method open (line 128) | pub fn open(path: &Path) -> Self {
FILE: crates/topos-tce-synchronizer/src/builder.rs
type SynchronizerBuilder (line 16) | pub struct SynchronizerBuilder {
method build (line 39) | pub fn build(
method with_store (line 92) | pub fn with_store(mut self, store: Arc<ValidatorStore>) -> Self {
method with_network_client (line 98) | pub fn with_network_client(mut self, network_client: NetworkClient) ->...
method with_config (line 104) | pub fn with_config(mut self, config: SynchronizationConfig) -> Self {
method with_shutdown (line 110) | pub fn with_shutdown(mut self, shutdown: CancellationToken) -> Self {
method default (line 27) | fn default() -> Self {
FILE: crates/topos-tce-synchronizer/src/checkpoints_collector/error.rs
type CheckpointsCollectorError (line 5) | pub enum CheckpointsCollectorError {
FILE: crates/topos-tce-synchronizer/src/checkpoints_collector/mod.rs
type CheckpointSynchronizer (line 41) | pub struct CheckpointSynchronizer {
method ask_for_checkpoint (line 126) | async fn ask_for_checkpoint(
method insert_unverified_proofs (line 191) | fn insert_unverified_proofs(
method fetch_certificates (line 219) | async fn fetch_certificates(
method initiate_request (line 258) | async fn initiate_request(&mut self) -> Result<(), SyncError> {
type Output (line 57) | type Output = Result<(), CheckpointsCollectorError>;
type IntoFuture (line 59) | type IntoFuture = BoxFuture<'static, Self::Output>;
method into_future (line 61) | fn into_future(mut self) -> Self::IntoFuture {
type SyncError (line 97) | enum SyncError {
type CheckpointsCollectorEvent (line 293) | pub enum CheckpointsCollectorEvent {}
FILE: crates/topos-tce-synchronizer/src/checkpoints_collector/tests.rs
function encode (line 27) | fn encode() {
function check_fetch_certificates (line 62) | async fn check_fetch_certificates() {
function sync_unordered_certificates (line 126) | fn sync_unordered_certificates() {}
function sync_conflicting_certificate (line 129) | fn sync_conflicting_certificate() {}
function fetch_certificate_failure (line 132) | fn fetch_certificate_failure() {}
function missing_certificate_for_pod (line 135) | fn missing_certificate_for_pod() {}
FILE: crates/topos-tce-synchronizer/src/checkpoints_collector/tests/integration.rs
function network_test (line 24) | async fn network_test() {
FILE: crates/topos-tce-synchronizer/src/lib.rs
type Synchronizer (line 35) | pub struct Synchronizer {
method builder (line 73) | pub fn builder() -> SynchronizerBuilder {
type Output (line 44) | type Output = Result<(), SynchronizerError>;
type IntoFuture (line 46) | type IntoFuture = BoxFuture<'static, Self::Output>;
method into_future (line 48) | fn into_future(mut self) -> Self::IntoFuture {
type SynchronizerError (line 79) | pub enum SynchronizerError {
type SynchronizerEvent (line 102) | pub enum SynchronizerEvent {}
type SynchronizerService (line 105) | pub struct SynchronizerService {
method fetch_certificates (line 111) | async fn fetch_certificates(
method fetch_checkpoint (line 143) | async fn fetch_checkpoint(
FILE: crates/topos-tce/src/app_context.rs
type AppContext (line 39) | pub struct AppContext {
constant DUMMY_INITIAL_CERTIFICATE_ID (line 57) | const DUMMY_INITIAL_CERTIFICATE_ID: CertificateId =
method new (line 62) | pub fn new(
method run (line 92) | pub async fn run(
method shutdown (line 149) | pub async fn shutdown(&mut self) -> Result<(), Box<dyn std::error::Err...
FILE: crates/topos-tce/src/app_context/api.rs
method on_api_event (line 14) | pub async fn on_api_event(&mut self, event: ApiEvent) {
FILE: crates/topos-tce/src/app_context/network.rs
method on_net_event (line 18) | pub async fn on_net_event(&mut self, evt: NetEvent) {
FILE: crates/topos-tce/src/app_context/protocol.rs
method on_protocol_event (line 8) | pub async fn on_protocol_event(&mut self, evt: ProtocolEvents) {
FILE: crates/topos-tce/src/events.rs
type Events (line 2) | pub enum Events {
FILE: crates/topos-tce/src/lib.rs
constant BROADCAST_CHANNEL_SIZE (line 33) | const BROADCAST_CHANNEL_SIZE: usize = 10_000;
function launch (line 35) | pub async fn launch(
function run (line 60) | pub async fn run(
FILE: crates/topos-tce/src/tests/api.rs
function handle_new_certificate (line 19) | async fn handle_new_certificate(
function handle_certificate_in_precedence_pool (line 46) | async fn handle_certificate_in_precedence_pool(
function handle_certificate_already_delivered (line 73) | async fn handle_certificate_already_delivered(
FILE: crates/topos-tce/src/tests/mod.rs
function non_validator_publish_gossip (line 28) | async fn non_validator_publish_gossip(
function non_validator_do_not_publish_echo (line 51) | async fn non_validator_do_not_publish_echo(
function non_validator_do_not_publish_ready (line 72) | async fn non_validator_do_not_publish_ready(
function setup_test (line 92) | pub async fn setup_test(
FILE: crates/topos-tce/src/tests/network.rs
function handle_gossip (line 22) | async fn handle_gossip(
function handle_echo (line 48) | async fn handle_echo(
function handle_ready (line 77) | async fn handle_ready(
function handle_already_delivered (line 106) | async fn handle_already_delivered(
FILE: crates/topos-telemetry/src/lib.rs
type TonicMetaInjector (line 15) | pub struct TonicMetaInjector<'a>(pub &'a mut tonic::metadata::MetadataMap);
type TonicMetaExtractor (line 16) | pub struct TonicMetaExtractor<'a>(pub &'a tonic::metadata::MetadataMap);
function extract (line 19) | pub fn extract(&self) -> opentelemetry::Context {
function inject (line 25) | pub fn inject(&mut self, context: &Context) {
method set (line 34) | fn set(&mut self, key: &str, value: String) {
method get (line 48) | fn get(&self, key: &str) -> Option<&str> {
method keys (line 52) | fn keys(&self) -> Vec<&str> {
type PropagationContext (line 64) | pub struct PropagationContext {
method inject (line 69) | pub fn inject(context: &Context) -> Self {
method extract (line 77) | pub fn extract(&self) -> opentelemetry::Context {
method set (line 83) | fn set(&mut self, key: &str, value: String) {
method get (line 89) | fn get(&self, key: &str) -> Option<&str> {
method keys (line 93) | fn keys(&self) -> Vec<&str> {
FILE: crates/topos-telemetry/src/tracing.rs
function verbose_to_level (line 13) | fn verbose_to_level(verbose: u8) -> Level {
function build_resources (line 23) | fn build_resources(otlp_service_name: String, version: &'static str) -> ...
function create_filter (line 53) | fn create_filter(verbose: u8) -> EnvFilter {
function setup_tracing (line 63) | pub fn setup_tracing(
FILE: crates/topos-test-sdk/build.rs
function main (line 3) | fn main() {
FILE: crates/topos-test-sdk/proc_macro_sdk/src/lib.rs
function generate_certificate_ids (line 11) | pub fn generate_certificate_ids(input: TokenStream) -> TokenStream {
function generate_source_subnet_ids (line 28) | pub fn generate_source_subnet_ids(input: TokenStream) -> TokenStream {
function generate_target_subnet_ids (line 33) | pub fn generate_target_subnet_ids(input: TokenStream) -> TokenStream {
function generate_subnet_ids (line 37) | fn generate_subnet_ids(subnet_type: &str, input: TokenStream) -> TokenSt...
function parse_range (line 53) | fn parse_range(range: ExprRange) -> std::ops::Range<u8> {
FILE: crates/topos-test-sdk/src/certificates/mod.rs
function create_certificate (line 17) | pub fn create_certificate(
function create_certificate_at_position (line 31) | pub fn create_certificate_at_position(
function create_certificate_chain (line 53) | pub fn create_certificate_chain(
function create_certificate_chains (line 89) | pub fn create_certificate_chains(
FILE: crates/topos-test-sdk/src/crypto.rs
function message_signer (line 7) | pub fn message_signer(key: &str) -> Arc<MessageSigner> {
FILE: crates/topos-test-sdk/src/grpc/behaviour/helloworld.rs
type HelloRequest (line 4) | pub struct HelloRequest {
type HelloWithDelayRequest (line 11) | pub struct HelloWithDelayRequest {
type HelloReply (line 20) | pub struct HelloReply {
type GreeterClient (line 31) | pub struct GreeterClient<T> {
function connect (line 36) | pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
function new (line 52) | pub fn new(inner: T) -> Self {
function with_origin (line 56) | pub fn with_origin(inner: T, origin: Uri) -> Self {
function with_interceptor (line 60) | pub fn with_interceptor<F>(
function send_compressed (line 84) | pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
function accept_compressed (line 90) | pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
function max_decoding_message_size (line 98) | pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
function max_encoding_message_size (line 106) | pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
function say_hello (line 111) | pub async fn say_hello(
function say_hello_with_delay (line 134) | pub async fn say_hello_with_delay(
type Greeter (line 164) | pub trait Greeter: Send + Sync + 'static {
method say_hello (line 166) | async fn say_hello(
method say_hello_with_delay (line 171) | async fn say_hello_with_delay(
type GreeterServer (line 178) | pub struct GreeterServer<T: Greeter> {
type _Inner (line 185) | struct _Inner<T>(Arc<T>);
function new (line 187) | pub fn new(inner: T) -> Self {
function from_arc (line 190) | pub fn from_arc(inner: Arc<T>) -> Self {
function with_interceptor (line 200) | pub fn with_interceptor<F>(
function accept_compressed (line 211) | pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
function send_compressed (line 217) | pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
function max_decoding_message_size (line 225) | pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
function max_encoding_message_size (line 233) | pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
type Response (line 244) | type Response = http::Response<tonic::body::BoxBody>;
type Error (line 245) | type Error = std::convert::Infallible;
type Future (line 246) | type Future = BoxFuture<Self::Response, Self::Error>;
function poll_ready (line 247) | fn poll_ready(
function call (line 253) | fn call(&mut self, req: http::Request<B>) -> Self::Future {
method clone (line 362) | fn clone(&self) -> Self {
method clone (line 374) | fn clone(&self) -> Self {
function fmt (line 379) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
constant NAME (line 384) | const NAME: &'static str = "helloworld.Greeter";
FILE: crates/topos-test-sdk/src/grpc/behaviour/noop.rs
type NoopRequest (line 3) | pub struct NoopRequest {}
type NoopResponse (line 6) | pub struct NoopResponse {}
type NoopClient (line 14) | pub struct NoopClient<T> {
function connect (line 19) | pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
function new (line 35) | pub fn new(inner: T) -> Self {
function with_origin (line 39) | pub fn with_origin(inner: T, origin: Uri) -> Self {
function with_interceptor (line 43) | pub fn with_interceptor<F>(
function send_compressed (line 67) | pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
function accept_compressed (line 73) | pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
function max_decoding_message_size (line 81) | pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
function max_encoding_message_size (line 89) | pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
function do_nothing (line 94) | pub async fn do_nothing(
type Noop (line 121) | pub trait Noop: Send + Sync + 'static {
method do_nothing (line 123) | async fn do_nothing(
type NoopServer (line 130) | pub struct NoopServer<T: Noop> {
type _Inner (line 137) | struct _Inner<T>(Arc<T>);
function new (line 139) | pub fn new(inner: T) -> Self {
function from_arc (line 142) | pub fn from_arc(inner: Arc<T>) -> Self {
function with_interceptor (line 152) | pub fn with_interceptor<F>(
function accept_compressed (line 163) | pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
function send_compressed (line 169) | pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
function max_decoding_message_size (line 177) | pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
function max_encoding_message_size (line 185) | pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
type Response (line 196) | type Response = http::Response<tonic::body::BoxBody>;
type Error (line 197) | type Error = std::convert::Infallible;
type Future (line 198) | type Future = BoxFuture<Self::Response, Self::Error>;
function poll_ready (line 199) | fn poll_ready(
function call (line 205) | fn call(&mut self, req: http::Request<B>) -> Self::Future {
method clone (line 268) | fn clone(&self) -> Self {
method clone (line 280) | fn clone(&self) -> Self {
function fmt (line 285) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
constant NAME (line 290) | const NAME: &'static str = "noop.Noop";
FILE: crates/topos-test-sdk/src/grpc/mod.rs
type DummyServer (line 21) | pub struct DummyServer {}
method say_hello (line 25) | async fn say_hello(
method say_hello_with_delay (line 34) | async fn say_hello_with_delay(
type NoopServer (line 48) | pub struct NoopServer {}
method do_nothing (line 52) | async fn do_nothing(
FILE: crates/topos-test-sdk/src/lib.rs
constant PREV_CERTIFICATE_ID (line 41) | pub const PREV_CERTIFICATE_ID: CertificateId =
function get_available_port (line 68) | pub fn get_available_port() -> u16 {
function get_available_addr (line 71) | pub fn get_available_addr() -> SocketAddr {
function next_available_port (line 87) | fn next_available_port() -> SocketAddr {
function folder_name (line 108) | fn folder_name() -> &'static str {
function create_folder (line 115) | pub fn create_folder(folder_name: &str) -> PathBuf {
FILE: crates/topos-test-sdk/src/networking/mod.rs
function get_available_port (line 4) | pub fn get_available_port() -> u16 {
function get_available_addr (line 8) | pub fn get_available_addr() -> SocketAddr {
FILE: crates/topos-test-sdk/src/p2p/mod.rs
function local_peer (line 10) | pub fn local_peer(peer_index: u8, memory_transport: bool) -> (Keypair, M...
function keypair_from_seed (line 28) | pub fn keypair_from_seed(seed: u8) -> Keypair {
FILE: crates/topos-test-sdk/src/sequencer/mod.rs
constant TEST_VALIDATOR_KEY (line 1) | pub const TEST_VALIDATOR_KEY: &str =
FILE: crates/topos-test-sdk/src/storage/mod.rs
function storage_client (line 15) | pub async fn storage_client(certificates: &[CertificateDelivered]) -> St...
function create_folder (line 22) | pub fn create_folder(folder_name: &str) -> PathBuf {
function create_validator_store (line 31) | pub async fn create_validator_store(
function create_validator_store_with_fullnode (line 49) | pub async fn create_validator_store_with_fullnode(
function create_fullnode_store (line 57) | pub async fn create_fullnode_store(certificates: &[CertificateDelivered]...
FILE: crates/topos-test-sdk/src/tce/gatekeeper.rs
function create_gatekeeper (line 10) | pub async fn create_gatekeeper(
FILE: crates/topos-test-sdk/src/tce/mod.rs
type TceContext (line 59) | pub struct TceContext {
method shutdown (line 84) | pub async fn shutdown(&mut self) -> Result<(), Box<dyn std::error::Err...
method drop (line 75) | fn drop(&mut self) {
type NodeConfig (line 97) | pub struct NodeConfig {
method standalone (line 112) | pub fn standalone() -> Self {
method memory (line 119) | pub fn memory(seed: u8) -> Self {
method from_seed (line 131) | pub fn from_seed(seed: u8) -> Self {
method peer_id (line 143) | pub fn peer_id(&self) -> PeerId {
method bootstrap (line 147) | pub async fn bootstrap(
method create (line 170) | pub async fn create(
method default (line 106) | fn default() -> Self {
type DummyService (line 187) | struct DummyService {}
method fetch_certificates (line 191) | async fn fetch_certificates(
method fetch_checkpoint (line 198) | async fn fetch_checkpoint(
function create_dummy_router (line 206) | pub fn create_dummy_router() -> Router {
function start_node (line 217) | pub async fn start_node(
function build_peer_config_pool (line 328) | fn build_peer_config_pool(peer_number: u8) -> Vec<NodeConfig> {
function start_pool (line 338) | pub async fn start_pool(
function create_network (line 399) | pub async fn create_network(
FILE: crates/topos-test-sdk/src/tce/p2p.rs
function create_network_worker (line 13) | pub async fn create_network_worker(
function bootstrap_network (line 63) | pub async fn bootstrap_network(
FILE: crates/topos-test-sdk/src/tce/protocol.rs
function create_reliable_broadcast_client (line 14) | pub async fn create_reliable_broadcast_client(
function create_reliable_broadcast_params (line 37) | pub fn create_reliable_broadcast_params(number_of_nodes: usize) -> Relia...
FILE: crates/topos-test-sdk/src/tce/public_api.rs
type PublicApiContext (line 26) | pub struct PublicApiContext {
function broadcast_stream (line 35) | pub fn broadcast_stream() -> broadcast::Receiver<CertificateDeliveredWit...
function create_public_api (line 42) | pub async fn create_public_api(
FILE: crates/topos-test-sdk/src/tce/synchronizer.rs
function create_synchronizer (line 14) | pub async fn create_synchronizer(
FILE: crates/topos-wallet/src/error.rs
type Error (line 4) | pub enum Error {
FILE: crates/topos-wallet/src/lib.rs
constant NETWORK_KEY (line 9) | pub const NETWORK_KEY: &str = "libp2p/libp2p.key";
constant VALIDATOR_KEY (line 11) | pub const VALIDATOR_KEY: &str = "consensus/validator.key";
constant VALIDATOR_BLS_KEY (line 13) | pub const VALIDATOR_BLS_KEY: &str = "consensus/validator-bls.key";
function load_fs_secret (line 16) | pub fn load_fs_secret(file: PathBuf) -> Option<SecretKey> {
function load_aws_secrets (line 25) | pub fn load_aws_secrets(secrets_config: &str) {
type SecretKey (line 29) | pub type SecretKey = Vec<u8>;
type PublicKey (line 30) | pub type PublicKey = Vec<u8>;
type SecretManager (line 33) | pub struct SecretManager {
method from_fs (line 40) | pub fn from_fs(home_path: PathBuf) -> Self {
method from_aws (line 48) | pub fn from_aws(_secrets_config: &str) -> Self {
method validator_pubkey (line 53) | pub fn validator_pubkey(&self) -> Option<PublicKey> {
FILE: crates/topos/build.rs
constant DEFAULT_VERSION (line 3) | const DEFAULT_VERSION: &str = "detached";
function main (line 5) | fn main() {
FILE: crates/topos/src/components/node/commands.rs
type NodeArgument (line 15) | pub(crate) struct NodeArgument {
type NodeCommand (line 22) | pub(crate) struct NodeCommand {
type NodeCommands (line 46) | pub(crate) enum NodeCommands {
function test_run (line 57) | fn test_run() {
FILE: crates/topos/src/components/node/commands/init.rs
type Init (line 10) | pub struct Init {
FILE: crates/topos/src/components/node/commands/status.rs
type Status (line 7) | pub(crate) struct Status {
FILE: crates/topos/src/components/node/commands/up.rs
type Up (line 9) | pub struct Up {
FILE: crates/topos/src/components/node/mod.rs
type NodeService (line 20) | pub(crate) struct NodeService {
method with_grpc_endpoint (line 25) | pub(crate) fn with_grpc_endpoint(endpoint: &str) -> Self {
function handle_command (line 32) | pub(crate) async fn handle_command(
function setup_console_tce_grpc (line 161) | fn setup_console_tce_grpc(endpoint: &str) -> Arc<Mutex<ConsoleServiceCli...
FILE: crates/topos/src/components/node/services/status.rs
type Response (line 16) | type Response = bool;
type Error (line 18) | type Error = std::io::Error;
type Future (line 20) | type Future =
method poll_ready (line 23) | fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self:...
method call (line 27) | fn call(&mut self, _: Status) -> Self::Future {
FILE: crates/topos/src/components/regtest/commands.rs
type RegtestCommand (line 9) | pub(crate) struct RegtestCommand {
type RegtestCommands (line 18) | pub(crate) enum RegtestCommands {
function test_run (line 27) | fn test_run() {
FILE: crates/topos/src/components/regtest/commands/spam.rs
type Spam (line 9) | pub struct Spam {
FILE: crates/topos/src/components/regtest/mod.rs
function handle_command (line 14) | pub(crate) async fn handle_command(
FILE: crates/topos/src/components/setup/commands.rs
type SetupCommand (line 9) | pub(crate) struct SetupCommand {
type SetupCommands (line 15) | pub(crate) enum SetupCommands {
function test_run (line 24) | fn test_run() {
FILE: crates/topos/src/components/setup/commands/subnet.rs
type Subnet (line 7) | pub struct Subnet {
FILE: crates/topos/src/components/setup/mod.rs
function handle_command (line 9) | pub(crate) async fn handle_command(
FILE: crates/topos/src/lib.rs
constant GITHUB_REPO_API (line 10) | const GITHUB_REPO_API: &str = "https://api.github.com/repos/";
type Error (line 13) | pub enum Error {
function map_arch (line 30) | fn map_arch(arch: &str) -> &str {
function map_os (line 39) | fn map_os(arch: &str) -> &str {
function determine_binary_release_name (line 50) | fn determine_binary_release_name(release: &PolygonEdgeRelease) -> String {
function download_binary (line 62) | async fn download_binary(file_name: &str, uri: &str, target_directory: &...
type PolygonEdgeRelease (line 97) | struct PolygonEdgeRelease {
function get_available_releases (line 103) | async fn get_available_releases(repository: &str) -> Result<Vec<PolygonE...
function get_release (line 169) | async fn get_release(
function install_polygon_edge (line 188) | pub async fn install_polygon_edge(
function list_polygon_edge_releases (line 210) | pub async fn list_polygon_edge_releases(repository: String) -> Result<()...
FILE: crates/topos/src/main.rs
function main (line 10) | async fn main() -> Result<(), Box<dyn std::error::Error>> {
FILE: crates/topos/src/options.rs
type Opt (line 12) | pub(crate) struct Opt {
function get_default_home (line 41) | fn get_default_home() -> OsString {
type ToposCommand (line 49) | pub(crate) enum ToposCommand {
FILE: crates/topos/src/options/input_format.rs
type InputFormat (line 5) | pub(crate) enum InputFormat {
FILE: crates/topos/tests/cert_delivery.rs
constant NUMBER_OF_SUBNETS_PER_CLIENT (line 28) | const NUMBER_OF_SUBNETS_PER_CLIENT: usize = 1;
function get_subset_of_subnets (line 30) | fn get_subset_of_subnets(subnets: &[SubnetId], subset_size: usize) -> Ve...
function start_a_cluster (line 44) | async fn start_a_cluster() {
function cert_delivery (line 67) | async fn cert_delivery() {
function assert_certificate_full_delivery (line 324) | async fn assert_certificate_full_delivery(
function run_assert_certificate_full_delivery (line 437) | async fn run_assert_certificate_full_delivery(
function push_and_deliver_cert (line 491) | async fn push_and_deliver_cert(
FILE: crates/topos/tests/config.rs
function handle_command_init (line 24) | async fn handle_command_init(
function handle_command_init_without_polygon_edge (line 58) | async fn handle_command_init_without_polygon_edge() -> Result<(), Box<dy...
function nothing_written_if_failure (line 90) | fn nothing_written_if_failure() -> Result<(), Box<dyn std::error::Error>> {
function handle_command_init_with_custom_name (line 114) | async fn handle_command_init_with_custom_name() -> Result<(), Box<dyn st...
function command_init_precedence_env (line 152) | async fn command_init_precedence_env(
function command_init_precedence_cli_env (line 198) | async fn command_init_precedence_cli_env() -> Result<(), Box<dyn std::er...
function command_node_up (line 256) | async fn command_node_up(
function command_node_up_with_old_config (line 340) | async fn command_node_up_with_old_config(
FILE: crates/topos/tests/node.rs
function help_display (line 12) | fn help_display() -> Result<(), Box<dyn std::error::Error>> {
function command_node_up_sigterm (line 29) | async fn command_node_up_sigterm() -> Result<(), Box<dyn std::error::Err...
function command_node_up_custom_polygon (line 104) | async fn command_node_up_custom_polygon() -> Result<(), Box<dyn std::err...
FILE: crates/topos/tests/regtest.rs
function regtest_spam_help_display (line 8) | fn regtest_spam_help_display() -> Result<(), Box<dyn std::error::Error>> {
function regtest_spam_invalid_hosts (line 22) | fn regtest_spam_invalid_hosts() -> Result<(), Box<dyn std::error::Error>> {
function regtest_spam_invalid_number (line 44) | fn regtest_spam_invalid_number() -> Result<(), Box<dyn std::error::Error...
FILE: crates/topos/tests/setup.rs
function setup_subnet_install_edge (line 9) | fn setup_subnet_install_edge() -> Result<(), Box<dyn std::error::Error>> {
function setup_with_no_arguments (line 28) | fn setup_with_no_arguments() -> Result<(), Box<dyn std::error::Error>> {
function setup_subnet_fail_to_install_release (line 43) | fn setup_subnet_fail_to_install_release() -> Result<(), Box<dyn std::err...
function setup_subnet_install_edge_custom_path (line 66) | fn setup_subnet_install_edge_custom_path() -> Result<(), Box<dyn std::er...
function setup_subnet_install_edge_custom_path_env (line 99) | fn setup_subnet_install_edge_custom_path_env() -> Result<(), Box<dyn std...
FILE: crates/topos/tests/utils.rs
function sanitize_config_folder_path (line 11) | pub fn sanitize_config_folder_path(cmd_out: &str) -> String {
function setup_polygon_edge (line 23) | pub async fn setup_polygon_edge(path: &str) -> String {
function generate_polygon_edge_genesis_file (line 45) | pub async fn generate_polygon_edge_genesis_file(
Condensed preview — 355 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,427K chars).
[
{
"path": ".cargo/audit.toml",
"chars": 25,
"preview": "[advisories]\nignore = []\n"
},
{
"path": ".cargo/config.toml",
"chars": 160,
"preview": "[alias]\nxclippy = [\n \"clippy\", \"--workspace\", \"--tests\", \"--all-targets\", \"--all-features\", \"--\",\n \"-Wclippy::all\""
},
{
"path": ".config/nextest.toml",
"chars": 253,
"preview": "[profile.default]\nslow-timeout = { period = \"60s\", terminate-after = 1 }\nleak-timeout = \"10s\"\n\n[test-groups]\nserial-inte"
},
{
"path": ".dockerignore",
"chars": 198,
"preview": "# Ignore everything\n**\n\n# Allow Rust source code\n!src\n!crates\n!tests\n!Cargo.*\n!tools/init.sh\n!tools/node_config\n!tools/n"
},
{
"path": ".github/CODEOWNERS",
"chars": 128,
"preview": "* @topos-protocol/protocol\n\n# Crypto Internals\n\n/crates/topos-crypto/ @topos-protocol/protocol @topos-protocol/crypto @N"
},
{
"path": ".github/ISSUE_TEMPLATE/bug_report.md",
"chars": 764,
"preview": "---\nname: Bug Report\nabout: Create a report to help us solve bugs!\nlabels: bug\n---\n\n<!--\n ✰ Thanks for opening a"
},
{
"path": ".github/actions/install-rust/action.yml",
"chars": 4409,
"preview": "\nname: 'Install Rust toolchain'\ndescription: 'Install a rust toolchain and cache the crates index'\n\ninputs:\n toolchain:"
},
{
"path": ".github/workflows/coverage.yml",
"chars": 1735,
"preview": "name: Coverage\n\non:\n push:\n branches:\n - main\n - \"!release/**\"\n paths: crates/**\n pull_request:\n ty"
},
{
"path": ".github/workflows/doc.yml",
"chars": 1205,
"preview": "name: Build and host documentation on GH pages\non:\n push:\n branches:\n - main\n\njobs:\n build:\n name: Build do"
},
{
"path": ".github/workflows/docker_build_push.yml",
"chars": 1967,
"preview": "name: Docker build and push\n\non:\n push:\n branches: [main, debug/**]\n pull_request:\n types: [opened, synchronize,"
},
{
"path": ".github/workflows/docker_utils.yml",
"chars": 3389,
"preview": "name: template - docker\n\nenv:\n REGISTRY: ghcr.io\n IMAGE_NAME: ${{ github.repository }}\n AWS_SHARED_CREDENTIALS_FILE: "
},
{
"path": ".github/workflows/pr-checking.yml",
"chars": 578,
"preview": "name: Checking PR semantic\n\non:\n pull_request_target:\n types:\n - opened\n - edited\n - synchronize\n\njob"
},
{
"path": ".github/workflows/quality.yml",
"chars": 3348,
"preview": "name: Quality\n\non:\n push:\n branches:\n - main\n pull_request:\n types: [opened, synchronize, reopened, ready_f"
},
{
"path": ".github/workflows/release.yml",
"chars": 3525,
"preview": "name: Release\n\non:\n release:\n types: [published]\n\nenv:\n CARGO_TERM_COLOR: always\n CARGO_INCREMENTAL: 0\n CARGO_NET"
},
{
"path": ".github/workflows/sequencer_topos_core_contract_test.yml",
"chars": 646,
"preview": "name: Sequencer Topos Core Contract interaction test\n\non:\n push:\n branches: [main]\n pull_request:\n types: [opene"
},
{
"path": ".github/workflows/test.yml",
"chars": 2377,
"preview": "name: Test\n\non:\n push:\n branches:\n - main\n pull_request:\n types: [opened, synchronize, reopened, ready_for_"
},
{
"path": ".gitignore",
"chars": 1442,
"preview": "# Generated by Cargo\n# will have compiled files and executables\n/target/\n*~\n\n# testing database\n/default_db/\n/db*/\n\n# Th"
},
{
"path": "CHANGELOG.md",
"chars": 16906,
"preview": "\n## [0.1.0](https://github.com/topos-protocol/topos/compare/v0.0.11..0.1.0"
},
{
"path": "Cargo.toml",
"chars": 3233,
"preview": "[workspace]\nresolver = \"2\"\ndefault-members = [\"crates/topos\", \"crates/topos-node\"]\nmembers = [\n \"crates/*\"\n]\n\n[worksp"
},
{
"path": "Cross.toml",
"chars": 440,
"preview": "[build]\npre-build = [\n \"apt update && apt install -y unzip\",\n \"curl -LO https://github.com/protocolbuffers/protobu"
},
{
"path": "Dockerfile",
"chars": 1033,
"preview": "ARG RUSTUP_TOOLCHAIN=stable\nFROM --platform=${BUILDPLATFORM:-linux/amd64} ghcr.io/topos-protocol/rust_builder:bullseye-$"
},
{
"path": "LICENSE",
"chars": 5124,
"preview": "The Transmission Control Engine (TCE) and Sequencer are licensed under BSL-1.1.\n\n---------------------------------------"
},
{
"path": "README.md",
"chars": 2692,
"preview": "<div id=\"top\"></div>\n<!-- PROJECT LOGO -->\n<br />\n<div align=\"center\">\n\n <img src=\"./.github/assets/topos_logo.png#gh-l"
},
{
"path": "cliff.toml",
"chars": 4104,
"preview": "# git-cliff ~ configuration file\n# https://git-cliff.org/docs/configuration\n#\n# Lines starting with \"#\" are comments.\n# "
},
{
"path": "crates/topos/Cargo.toml",
"chars": 2402,
"preview": "[package]\nname = \"topos\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[lints]\nworkspace = true\n\n[dependencies]\ntopos-node = { pat"
},
{
"path": "crates/topos/build.rs",
"chars": 655,
"preview": "use std::process::Command;\n\nconst DEFAULT_VERSION: &str = \"detached\";\n\nfn main() {\n // Set TOPOS_VERSION to HEAD shor"
},
{
"path": "crates/topos/src/components/mod.rs",
"chars": 67,
"preview": "pub(crate) mod node;\npub(crate) mod regtest;\npub(crate) mod setup;\n"
},
{
"path": "crates/topos/src/components/node/commands/init.rs",
"chars": 1296,
"preview": "use std::path::PathBuf;\n\nuse clap::Args;\nuse serde::Serialize;\nuse topos_config::node::NodeRole;\n\n#[derive(Args, Debug, "
},
{
"path": "crates/topos/src/components/node/commands/status.rs",
"chars": 276,
"preview": "use super::NodeArgument;\nuse clap::Args;\nuse serde::Serialize;\n\n#[derive(Args, Debug, Serialize)]\n#[command(about = \"Get"
},
{
"path": "crates/topos/src/components/node/commands/up.rs",
"chars": 1332,
"preview": "use std::path::PathBuf;\n\nuse clap::Args;\nuse serde::Serialize;\n\n#[derive(Args, Clone, Debug, Serialize)]\n#[command(about"
},
{
"path": "crates/topos/src/components/node/commands.rs",
"chars": 1253,
"preview": "use std::path::PathBuf;\n\nuse clap::{Args, Subcommand};\nuse serde::Serialize;\n\nmod init;\nmod status;\nmod up;\n\npub(crate) "
},
{
"path": "crates/topos/src/components/node/mod.rs",
"chars": 6038,
"preview": "use std::{\n fs::{create_dir_all, remove_dir_all, OpenOptions},\n io::Write,\n};\nuse std::{path::Path, sync::Arc};\nus"
},
{
"path": "crates/topos/src/components/node/services/status.rs",
"chars": 1368,
"preview": "use std::{\n future::Future,\n io::Error,\n pin::Pin,\n task::{Context, Poll},\n};\n\nuse futures::FutureExt;\nuse t"
},
{
"path": "crates/topos/src/components/node/services.rs",
"chars": 23,
"preview": "pub(crate) mod status;\n"
},
{
"path": "crates/topos/src/components/regtest/commands/spam.rs",
"chars": 3475,
"preview": "use clap::Args;\n\n#[derive(Args, Debug)]\n#[command(\n about = \"Run a test topos certificate spammer to send test certif"
},
{
"path": "crates/topos/src/components/regtest/commands.rs",
"chars": 560,
"preview": "use clap::{Args, Subcommand};\n\nmod spam;\n\npub(crate) use spam::Spam;\n\n/// Run test commands (e.g., pushing a certificate"
},
{
"path": "crates/topos/src/components/regtest/mod.rs",
"chars": 3162,
"preview": "use self::commands::{RegtestCommand, RegtestCommands};\n\nuse opentelemetry::global;\nuse tokio::{\n spawn,\n sync::{mp"
},
{
"path": "crates/topos/src/components/setup/commands/subnet.rs",
"chars": 921,
"preview": "use clap::Args;\n\nuse std::path::PathBuf;\n\n#[derive(Args, Debug)]\n#[command(about = \"Install Polygon Edge node binary\")]\n"
},
{
"path": "crates/topos/src/components/setup/commands.rs",
"chars": 560,
"preview": "use clap::{Args, Subcommand};\n\nmod subnet;\n\npub(crate) use subnet::Subnet;\n\n/// Topos CLI subcommand for the setup of va"
},
{
"path": "crates/topos/src/components/setup/mod.rs",
"chars": 2386,
"preview": "use self::commands::{SetupCommand, SetupCommands};\nuse tokio::{signal, spawn};\nuse tracing::{error, info};\n\nuse topos::{"
},
{
"path": "crates/topos/src/lib.rs",
"chars": 6703,
"preview": "use flate2::read::GzDecoder;\nuse serde_json::Value;\nuse std::collections::HashSet;\nuse std::fs::File;\nuse std::io::Write"
},
{
"path": "crates/topos/src/main.rs",
"chars": 555,
"preview": "use clap::Parser;\n\npub(crate) mod components;\npub(crate) mod options;\n\nuse crate::options::ToposCommand;\nuse tracing_log"
},
{
"path": "crates/topos/src/options/input_format.rs",
"chars": 149,
"preview": "use clap::ValueEnum;\nuse serde::Serialize;\n\n#[derive(ValueEnum, Copy, Clone, Debug, Serialize)]\npub(crate) enum InputFor"
},
{
"path": "crates/topos/src/options.rs",
"chars": 1338,
"preview": "use clap::{Parser, Subcommand};\nuse std::{ffi::OsString, path::PathBuf};\n\nuse crate::components::node::commands::NodeCom"
},
{
"path": "crates/topos/tests/cert_delivery.rs",
"chars": 19033,
"preview": "use futures::{future::join_all, StreamExt};\nuse libp2p::PeerId;\nuse rand::seq::{IteratorRandom, SliceRandom};\nuse rstest"
},
{
"path": "crates/topos/tests/config.rs",
"chars": 16972,
"preview": "use assert_cmd::prelude::*;\nuse regex::Regex;\nuse std::path::PathBuf;\nuse std::process::{Command, Stdio};\nuse tempfile::"
},
{
"path": "crates/topos/tests/node.rs",
"chars": 6451,
"preview": "mod utils;\n\nuse std::{path::PathBuf, process::Command};\n\nuse assert_cmd::prelude::*;\nuse sysinfo::{Pid, PidExt, ProcessE"
},
{
"path": "crates/topos/tests/regtest.rs",
"chars": 1381,
"preview": "mod utils;\n\nuse std::process::Command;\n\nuse assert_cmd::prelude::*;\n\n#[test]\nfn regtest_spam_help_display() -> Result<()"
},
{
"path": "crates/topos/tests/setup.rs",
"chars": 3326,
"preview": "mod utils;\n\nuse std::{fs, process::Command};\n\nuse assert_cmd::prelude::*;\nuse tempfile::tempdir;\n\n#[test]\nfn setup_subne"
},
{
"path": "crates/topos/tests/snapshots/node__help_display.snap",
"chars": 794,
"preview": "---\nsource: crates/topos/tests/node.rs\nexpression: \"utils::sanitize_config_folder_path(result)\"\n---\nUtility to manage yo"
},
{
"path": "crates/topos/tests/snapshots/push_certificate__help_display.snap",
"chars": 950,
"preview": "---\nsource: crates/topos/tests/push-certificate.rs\nexpression: \"utils::sanitize_config_folder_path(result)\"\n---\nPush a c"
},
{
"path": "crates/topos/tests/snapshots/regtest__regtest_spam_help_display.snap",
"chars": 3106,
"preview": "---\nsource: crates/topos/tests/regtest.rs\nexpression: \"utils::sanitize_config_folder_path(result)\"\n---\nRun a test topos "
},
{
"path": "crates/topos/tests/utils.rs",
"chars": 2840,
"preview": "use assert_cmd::prelude::*;\nuse predicates::prelude::*;\nuse regex::Regex;\nuse std::path::PathBuf;\nuse std::process::Comm"
},
{
"path": "crates/topos-certificate-spammer/Cargo.toml",
"chars": 760,
"preview": "[package]\nname = \"topos-certificate-spammer\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[lints]\nworkspace = true\n\n[dependencies"
},
{
"path": "crates/topos-certificate-spammer/README.md",
"chars": 2321,
"preview": "# Topos Certificate Spammer\n\n## How does it work?\n\nThe Topos Certificate Spammer generates test certificate chain and se"
},
{
"path": "crates/topos-certificate-spammer/config/target_nodes_example.json",
"chars": 70,
"preview": "{\n \"nodes\": [\n \"http://[::1]:1340\",\n \"http://[::1]:1341\"\n ]\n}\n"
},
{
"path": "crates/topos-certificate-spammer/src/config.rs",
"chars": 431,
"preview": "#[derive(Clone, Debug)]\npub struct CertificateSpammerConfig {\n pub target_nodes: Option<Vec<String>>,\n pub target_"
},
{
"path": "crates/topos-certificate-spammer/src/error.rs",
"chars": 822,
"preview": "#[derive(Debug, thiserror::Error)]\npub enum Error {\n #[error(\"target nodes are not specified\")]\n TargetNodesNotSpe"
},
{
"path": "crates/topos-certificate-spammer/src/lib.rs",
"chars": 14638,
"preview": "//! Utility to spam dummy certificates\n\nuse http::Uri;\nuse opentelemetry::trace::FutureExt;\nuse serde::Deserialize;\nuse "
},
{
"path": "crates/topos-certificate-spammer/src/utils.rs",
"chars": 2385,
"preview": "use topos_core::uci::{Certificate, SubnetId};\n\nuse crate::{error::Error, SourceSubnet};\n\nlazy_static::lazy_static! {\n "
},
{
"path": "crates/topos-clock/Cargo.toml",
"chars": 283,
"preview": "[package]\nname = \"topos-clock\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[lints]\nworkspace = true\n\n[dependencies]\ntokio.worksp"
},
{
"path": "crates/topos-clock/src/lib.rs",
"chars": 993,
"preview": "//! This crate is responsible for managing the clock pace.\n//!\n//! The Clock is responsible of giving informations about"
},
{
"path": "crates/topos-clock/src/time.rs",
"chars": 4428,
"preview": "use std::{\n sync::{\n atomic::{AtomicU64, Ordering},\n Arc,\n },\n time::Duration,\n};\n\nuse chrono::{D"
},
{
"path": "crates/topos-config/Cargo.toml",
"chars": 2142,
"preview": "[package]\nname = \"topos-config\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n# See more keys and their definitions at https://doc"
},
{
"path": "crates/topos-config/assets/genesis-example.json",
"chars": 2544,
"preview": "{\n \"name\": \"polygon-edge\",\n \"genesis\": {\n \"nonce\": \"0x0000000000000000\",\n \"timestamp\": \"0x0\",\n "
},
{
"path": "crates/topos-config/src/base.rs",
"chars": 1538,
"preview": "use std::path::Path;\n\nuse figment::{\n providers::{Format, Toml},\n Figment,\n};\nuse serde::{Deserialize, Serialize};"
},
{
"path": "crates/topos-config/src/edge/command.rs",
"chars": 4625,
"preview": "use serde_json::Value;\nuse std::collections::HashMap;\nuse std::os::unix::prelude::ExitStatusExt;\nuse std::path::{Path, P"
},
{
"path": "crates/topos-config/src/edge.rs",
"chars": 2507,
"preview": "use crate::{edge::command::CommandConfig, Config};\nuse figment::{\n providers::{Format, Toml},\n Figment,\n};\nuse ser"
},
{
"path": "crates/topos-config/src/genesis/mod.rs",
"chars": 4009,
"preview": "use rlp::Rlp;\nuse std::collections::HashSet;\nuse std::str::FromStr;\nuse std::{fs, path::PathBuf};\n\nuse serde_json::Value"
},
{
"path": "crates/topos-config/src/genesis/tests.rs",
"chars": 1429,
"preview": "use rstest::fixture;\nuse rstest::rstest;\nuse std::str::FromStr;\nuse topos_core::types::ValidatorId;\n\nuse super::Genesis;"
},
{
"path": "crates/topos-config/src/lib.rs",
"chars": 2513,
"preview": "pub(crate) mod base;\npub mod edge;\npub mod genesis;\npub mod node;\npub mod sequencer;\npub mod tce;\n\nuse std::path::Path;\n"
},
{
"path": "crates/topos-config/src/node.rs",
"chars": 4633,
"preview": "use std::path::{Path, PathBuf};\n\nuse figment::{\n providers::{Format, Toml},\n Figment,\n};\n\nuse serde::{Deserialize,"
},
{
"path": "crates/topos-config/src/sequencer.rs",
"chars": 2357,
"preview": "use std::path::Path;\n\nuse crate::Config;\nuse figment::{\n providers::{Format, Toml},\n Figment,\n};\nuse serde::{Deser"
},
{
"path": "crates/topos-config/src/tce/broadcast.rs",
"chars": 606,
"preview": "use serde::{Deserialize, Serialize};\n\n/// Broadcast threshold configurations\n#[derive(Clone, Debug, Default, Deserialize"
},
{
"path": "crates/topos-config/src/tce/p2p.rs",
"chars": 1726,
"preview": "use std::net::SocketAddr;\n\nuse serde::{Deserialize, Serialize};\nuse topos_p2p::Multiaddr;\n\nuse super::DEFAULT_IP;\n\n#[der"
},
{
"path": "crates/topos-config/src/tce/synchronization.rs",
"chars": 1073,
"preview": "use serde::{Deserialize, Serialize};\n\n/// Configuration for the TCE synchronization\n#[derive(Serialize, Deserialize, Deb"
},
{
"path": "crates/topos-config/src/tce.rs",
"chars": 4358,
"preview": "use std::collections::HashSet;\nuse std::path::Path;\nuse std::{net::SocketAddr, path::PathBuf};\n\nuse figment::{\n provi"
},
{
"path": "crates/topos-core/.rustfmt.toml",
"chars": 59,
"preview": "unstable_features = true\nignore = [\n \"src/generated\",\n]\n"
},
{
"path": "crates/topos-core/Cargo.toml",
"chars": 1235,
"preview": "[package]\nname = \"topos-core\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[lints]\nworkspace = true\n\n[dependencies]\ntopos-crypto "
},
{
"path": "crates/topos-core/build.rs",
"chars": 3684,
"preview": "use std::path::PathBuf;\n\nfn main() -> Result<(), Box<dyn std::error::Error>> {\n let descriptor_path = PathBuf::from(\""
},
{
"path": "crates/topos-core/proto/buf.yaml",
"chars": 67,
"preview": "version: v1\nbreaking:\n use:\n - FILE\nlint:\n use:\n - DEFAULT\n"
},
{
"path": "crates/topos-core/proto/topos/p2p/info.proto",
"chars": 64,
"preview": "syntax = \"proto3\";\n\npackage topos.p2p;\n\nservice InfoService {\n}\n"
},
{
"path": "crates/topos-core/proto/topos/shared/v1/certificate.proto",
"chars": 91,
"preview": "syntax = \"proto3\";\n\npackage topos.shared.v1;\n\nmessage CertificateId {\n bytes value = 1;\n}\n"
},
{
"path": "crates/topos-core/proto/topos/shared/v1/checkpoints.proto",
"chars": 1646,
"preview": "syntax = \"proto3\";\n\npackage topos.shared.v1;\n\nimport \"topos/shared/v1/certificate.proto\";\nimport \"topos/shared/v1/subnet"
},
{
"path": "crates/topos-core/proto/topos/shared/v1/frost.proto",
"chars": 83,
"preview": "syntax = \"proto3\";\n\npackage topos.shared.v1;\n\nmessage Frost {\n bytes value = 1;\n}\n"
},
{
"path": "crates/topos-core/proto/topos/shared/v1/signature.proto",
"chars": 208,
"preview": "syntax = \"proto3\";\n\npackage topos.shared.v1;\n\n// A signature using the ECDSA algorithm.\n// Used to sign double echo prot"
},
{
"path": "crates/topos-core/proto/topos/shared/v1/stark_proof.proto",
"chars": 88,
"preview": "syntax = \"proto3\";\n\npackage topos.shared.v1;\n\nmessage StarkProof {\n bytes value = 1;\n}\n"
},
{
"path": "crates/topos-core/proto/topos/shared/v1/subnet.proto",
"chars": 86,
"preview": "syntax = \"proto3\";\n\npackage topos.shared.v1;\n\nmessage SubnetId {\n bytes value = 1;\n}\n"
},
{
"path": "crates/topos-core/proto/topos/shared/v1/uuid.proto",
"chars": 136,
"preview": "syntax = \"proto3\";\n\npackage topos.shared.v1;\n\nmessage UUID {\n uint64 most_significant_bits = 1;\n uint64 least_signific"
},
{
"path": "crates/topos-core/proto/topos/shared/v1/validator_id.proto",
"chars": 263,
"preview": "syntax = \"proto3\";\n\npackage topos.shared.v1;\n\n// Id of the validator in the Topos protocol network\n// This is the same a"
},
{
"path": "crates/topos-core/proto/topos/tce/v1/api.proto",
"chars": 3080,
"preview": "syntax = \"proto3\";\n\npackage topos.tce.v1;\n\nimport \"topos/shared/v1/checkpoints.proto\";\nimport \"topos/shared/v1/subnet.pr"
},
{
"path": "crates/topos-core/proto/topos/tce/v1/console.proto",
"chars": 245,
"preview": "syntax = \"proto3\";\n\npackage topos.tce.v1;\n\nimport \"topos/shared/v1/uuid.proto\";\n\nservice ConsoleService {\n rpc Status(S"
},
{
"path": "crates/topos-core/proto/topos/tce/v1/double_echo.proto",
"chars": 730,
"preview": "syntax = \"proto3\";\n\npackage topos.tce.v1;\n\nimport \"topos/shared/v1/certificate.proto\";\nimport \"topos/shared/v1/signature"
},
{
"path": "crates/topos-core/proto/topos/tce/v1/gossipsub.proto",
"chars": 134,
"preview": "syntax = \"proto3\";\n\npackage topos.tce.v1;\n\nimport \"topos/tce/v1/double_echo.proto\";\n\nmessage Batch {\n repeated bytes me"
},
{
"path": "crates/topos-core/proto/topos/tce/v1/synchronization.proto",
"chars": 1532,
"preview": "syntax = \"proto3\";\n\npackage topos.tce.v1;\n\nimport \"topos/shared/v1/checkpoints.proto\";\nimport \"topos/shared/v1/certifica"
},
{
"path": "crates/topos-core/proto/topos/uci/v1/certification.proto",
"chars": 703,
"preview": "syntax = \"proto3\";\n\npackage topos.uci.v1;\n\nimport \"topos/shared/v1/certificate.proto\";\nimport \"topos/shared/v1/frost.pro"
},
{
"path": "crates/topos-core/src/api/graphql/certificate.rs",
"chars": 3600,
"preview": "use async_graphql::{NewType, SimpleObject};\nuse serde::{Deserialize, Serialize};\n\nuse crate::{types::CertificateDelivere"
},
{
"path": "crates/topos-core/src/api/graphql/checkpoint.rs",
"chars": 1056,
"preview": "use async_graphql::{InputObject, SimpleObject};\nuse serde::{Deserialize, Serialize};\n\nuse crate::types::ProofOfDelivery;"
},
{
"path": "crates/topos-core/src/api/graphql/errors.rs",
"chars": 602,
"preview": "#[derive(Debug, thiserror::Error)]\npub enum GraphQLServerError {\n #[error(\"The provided data layer is invalid\")]\n "
},
{
"path": "crates/topos-core/src/api/graphql/filter.rs",
"chars": 197,
"preview": "use crate::api::graphql::subnet::SubnetId;\n\n#[derive(Debug, serde::Serialize, serde::Deserialize, async_graphql::OneofOb"
},
{
"path": "crates/topos-core/src/api/graphql/mod.rs",
"chars": 104,
"preview": "pub mod certificate;\npub mod checkpoint;\npub mod errors;\npub mod filter;\npub mod query;\npub mod subnet;\n"
},
{
"path": "crates/topos-core/src/api/graphql/query.rs",
"chars": 633,
"preview": "use crate::api::graphql::certificate::{Certificate, CertificateId};\nuse crate::api::graphql::checkpoint::SourceCheckpoin"
},
{
"path": "crates/topos-core/src/api/graphql/subnet.rs",
"chars": 1127,
"preview": "use async_graphql::NewType;\nuse serde::{Deserialize, Serialize};\nuse std::str::FromStr;\nuse tracing::error;\n\nuse super::"
},
{
"path": "crates/topos-core/src/api/grpc/checkpoints/errors.rs",
"chars": 727,
"preview": "use crate::api::grpc::shared::v1_conversions_subnet::Error;\n\n#[derive(Debug, thiserror::Error)]\npub enum TargetCheckpoin"
},
{
"path": "crates/topos-core/src/api/grpc/checkpoints/mod.rs",
"chars": 1512,
"preview": "use crate::api::grpc::shared::v1 as shared_v1;\nuse crate::uci::SubnetId;\n\nmod errors;\nmod positions;\n\npub use errors::*;"
},
{
"path": "crates/topos-core/src/api/grpc/checkpoints/positions.rs",
"chars": 3003,
"preview": "use crate::api::grpc::checkpoints::StreamPositionError;\nuse crate::api::grpc::shared::v1 as shared_v1;\nuse crate::uci::{"
},
{
"path": "crates/topos-core/src/api/grpc/conversions/shared/v1/certificate.rs",
"chars": 1474,
"preview": "use crate::uci::CERTIFICATE_ID_LENGTH;\n\nuse super::v1::CertificateId;\n\nimpl std::fmt::Display for CertificateId {\n fn"
},
{
"path": "crates/topos-core/src/api/grpc/conversions/shared/v1/signature.rs",
"chars": 806,
"preview": "use super::v1::EcdsaSignature;\nuse topos_crypto::messages::U256;\n\nimpl From<EcdsaSignature> for topos_crypto::messages::"
},
{
"path": "crates/topos-core/src/api/grpc/conversions/shared/v1/subnet.rs",
"chars": 1916,
"preview": "use crate::uci::SUBNET_ID_LENGTH;\n\nuse super::v1::SubnetId;\nuse base64ct::{Base64, Encoding};\n\nimpl std::fmt::Display fo"
},
{
"path": "crates/topos-core/src/api/grpc/conversions/shared/v1/uuid.rs",
"chars": 522,
"preview": "use super::v1::Uuid;\n\nimpl From<(u64, u64)> for Uuid {\n fn from((most_significant_bits, least_significant_bits): (u64"
},
{
"path": "crates/topos-core/src/api/grpc/conversions/shared/v1/validator_id.rs",
"chars": 1271,
"preview": "use super::v1::ValidatorId;\nuse topos_crypto::messages::H160;\nuse topos_crypto::validator_id::{Error, VALIDATOR_ID_LENGT"
},
{
"path": "crates/topos-core/src/api/grpc/conversions/tce/v1/api.rs",
"chars": 1054,
"preview": "use crate::api::grpc::tce::v1::{\n watch_certificates_request::{Command, OpenStream},\n watch_certificates_response:"
},
{
"path": "crates/topos-core/src/api/grpc/conversions/tce/v1/mod.rs",
"chars": 38,
"preview": "pub mod api;\npub mod synchronization;\n"
},
{
"path": "crates/topos-core/src/api/grpc/conversions/tce/v1/synchronization.rs",
"chars": 1141,
"preview": "use prost::{bytes::Bytes, Message};\n\nuse crate::api::grpc::tce::v1::{\n CheckpointRequest, CheckpointResponse, FetchCe"
},
{
"path": "crates/topos-core/src/api/grpc/conversions/uci/v1/uci.rs",
"chars": 7911,
"preview": "//!\n//! Protobuf generated/native Rust structures related conversions for GRPC API\n//!\nuse crate::api::grpc::shared::v1_"
},
{
"path": "crates/topos-core/src/api/grpc/generated/topos.p2p.rs",
"chars": 8138,
"preview": "/// Generated client implementations.\npub mod info_service_client {\n #![allow(unused_variables, dead_code, missing_do"
},
{
"path": "crates/topos-core/src/api/grpc/generated/topos.shared.v1.rs",
"chars": 5437,
"preview": "#[derive(Copy, serde::Deserialize, serde::Serialize)]\n#[allow(clippy::derive_partial_eq_without_eq)]\n#[derive(Clone, Par"
},
{
"path": "crates/topos-core/src/api/grpc/generated/topos.tce.v1.rs",
"chars": 64309,
"preview": "#[derive(serde::Deserialize, serde::Serialize)]\n#[allow(clippy::derive_partial_eq_without_eq)]\n#[derive(Clone, PartialEq"
},
{
"path": "crates/topos-core/src/api/grpc/generated/topos.uci.v1.rs",
"chars": 1513,
"preview": "/// Certificate - main exchange item\n#[derive(Eq, Hash, serde::Deserialize, serde::Serialize)]\n#[allow(clippy::derive_pa"
},
{
"path": "crates/topos-core/src/api/grpc/mod.rs",
"chars": 1899,
"preview": "use self::checkpoints::StreamPositionError;\n\nuse tonic::transport::Channel;\n\nuse self::tce::v1::synchronizer_service_cli"
},
{
"path": "crates/topos-core/src/api/mod.rs",
"chars": 31,
"preview": "pub mod graphql;\npub mod grpc;\n"
},
{
"path": "crates/topos-core/src/errors.rs",
"chars": 278,
"preview": "use crate::api::grpc::checkpoints::StreamPositionError;\n\n#[derive(Debug, thiserror::Error)]\npub enum GrpcParsingError {\n"
},
{
"path": "crates/topos-core/src/lib.rs",
"chars": 177,
"preview": "#[cfg_attr(docsrs, doc(cfg(feature = \"uci\")))]\npub mod uci;\n\n#[cfg_attr(docsrs, doc(cfg(feature = \"api\")))]\npub mod api;"
},
{
"path": "crates/topos-core/src/test.rs",
"chars": 581,
"preview": "use crate::types::stream::Position;\n\n#[test]\nfn test_position() {\n let zero = Position::ZERO;\n\n let serialized = b"
},
{
"path": "crates/topos-core/src/types/stream.rs",
"chars": 4092,
"preview": "use std::{fmt, ops::Deref};\n\nuse serde::{Deserialize, Serialize};\nuse thiserror::Error;\n\nuse crate::uci::SubnetId;\n\n/// "
},
{
"path": "crates/topos-core/src/types.rs",
"chars": 3977,
"preview": "use crate::uci::{Certificate, CertificateId};\nuse serde::{Deserialize, Serialize};\n\nuse crate::errors::GrpcParsingError;"
},
{
"path": "crates/topos-core/src/uci/certificate.rs",
"chars": 9381,
"preview": "use serde::{Deserialize, Serialize};\nuse std::borrow::Borrow;\nuse std::fmt::Debug;\n\nuse super::{\n CertificateId, Erro"
},
{
"path": "crates/topos-core/src/uci/certificate_id.rs",
"chars": 4579,
"preview": "use serde::{Deserialize, Serialize};\nuse std::fmt::{Debug, Display};\nuse std::hash::Hash;\n\nuse super::{Error, CERTIFICAT"
},
{
"path": "crates/topos-core/src/uci/mod.rs",
"chars": 1208,
"preview": "//! Universal Certificate Interface\n//!\n//! Data structures to support Certificates' exchange\n\npub use certificate::Cert"
},
{
"path": "crates/topos-core/src/uci/subnet_id.rs",
"chars": 2846,
"preview": "use serde::{Deserialize, Serialize};\nuse std::fmt::{Debug, Display};\nuse std::hash::Hash;\nuse std::str::FromStr;\n\nuse su"
},
{
"path": "crates/topos-core/tests/tce_layer.rs",
"chars": 9533,
"preview": "use async_stream::stream;\nuse futures::{channel::oneshot, FutureExt};\nuse futures::{Stream, StreamExt};\nuse rstest::rste"
},
{
"path": "crates/topos-crypto/Cargo.toml",
"chars": 515,
"preview": "[package]\nname = \"topos-crypto\"\ndescription = \"Implementation of the Topos cryptography utility functions\"\nversion = \"0."
},
{
"path": "crates/topos-crypto/src/hash.rs",
"chars": 163,
"preview": "use keccak_hash::keccak_256;\n\npub fn calculate_hash(data: &[u8]) -> [u8; 32] {\n let mut hash: [u8; 32] = [0u8; 32];\n "
},
{
"path": "crates/topos-crypto/src/keys.rs",
"chars": 367,
"preview": "use crate::Error;\nuse secp256k1::{PublicKey, Secp256k1, SecretKey};\n\npub fn derive_public_key(private_key: &[u8]) -> Res"
},
{
"path": "crates/topos-crypto/src/keystore.rs",
"chars": 877,
"preview": "use crate::Error;\n/// Module for handling local topos node keystore\nuse std::path::Path;\n\npub const SUBNET_NODE_VALIDATO"
},
{
"path": "crates/topos-crypto/src/lib.rs",
"chars": 585,
"preview": "use thiserror::Error;\n\npub mod hash;\npub mod keys;\npub mod keystore;\npub mod messages;\npub mod signatures;\npub mod valid"
},
{
"path": "crates/topos-crypto/src/messages.rs",
"chars": 1546,
"preview": "use ethers::signers::Signer;\nuse ethers::signers::{LocalWallet, WalletError};\nuse ethers::types::{RecoveryMessage, Signa"
},
{
"path": "crates/topos-crypto/src/signatures.rs",
"chars": 1175,
"preview": "use crate::Error;\nuse secp256k1::{Message, PublicKey, Secp256k1, SecretKey};\n\npub fn sign(private_key: &[u8], data: &[u8"
},
{
"path": "crates/topos-crypto/src/validator_id.rs",
"chars": 1146,
"preview": "use crate::messages::{Address, H160};\nuse serde::{Deserialize, Serialize};\nuse std::str::FromStr;\nuse thiserror::Error;\n"
},
{
"path": "crates/topos-crypto/tests/messages.rs",
"chars": 2180,
"preview": "use std::str::FromStr;\n\nuse rstest::*;\nuse topos_core::types::ValidatorId;\nuse topos_core::uci::CertificateId;\nuse topos"
},
{
"path": "crates/topos-metrics/Cargo.toml",
"chars": 167,
"preview": "[package]\nname = \"topos-metrics\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[lints]\nworkspace = true\n\n[dependencies]\nlazy_stati"
},
{
"path": "crates/topos-metrics/src/api.rs",
"chars": 444,
"preview": "use prometheus::{register_int_counter_with_registry, IntCounter};\n\nuse lazy_static::lazy_static;\n\nuse crate::TOPOS_METRI"
},
{
"path": "crates/topos-metrics/src/double_echo.rs",
"chars": 2141,
"preview": "use prometheus::{\n register_int_counter_with_registry, register_int_gauge_with_registry, IntCounter, IntGauge,\n};\n\nus"
},
{
"path": "crates/topos-metrics/src/lib.rs",
"chars": 3620,
"preview": "use prometheus::{\n register_histogram_with_registry, register_int_counter_with_registry, Encoder, Histogram,\n IntC"
},
{
"path": "crates/topos-metrics/src/p2p.rs",
"chars": 2871,
"preview": "use prometheus::{\n register_histogram_with_registry, register_int_counter_vec_with_registry,\n register_int_counter"
},
{
"path": "crates/topos-metrics/src/storage.rs",
"chars": 1819,
"preview": "use prometheus::{\n register_histogram_with_registry, register_int_counter_with_registry,\n register_int_gauge_with_"
},
{
"path": "crates/topos-metrics/src/tests.rs",
"chars": 616,
"preview": "use crate::p2p;\n\n#[test]\nfn increment_echo_failure_ser() {\n let m = &p2p::P2P_MESSAGE_SERIALIZE_FAILURE_TOTAL;\n\n m"
},
{
"path": "crates/topos-node/Cargo.toml",
"chars": 2413,
"preview": "[package]\nname = \"topos-node\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\ndescription = \"Runtime crate of a topos-node\"\n\n[lints]"
},
{
"path": "crates/topos-node/build.rs",
"chars": 671,
"preview": "use std::process::Command;\n\nconst DEFAULT_VERSION: &str = \"detached\";\n\nfn main() {\n // Set TOPOS_VERSION to HEAD shor"
},
{
"path": "crates/topos-node/src/lib.rs",
"chars": 6544,
"preview": "//! Temporary lib exposition for backward topos CLI compatibility\nuse std::process::ExitStatus;\n\nuse futures::stream::Fu"
},
{
"path": "crates/topos-node/src/main.rs",
"chars": 88,
"preview": "#[tokio::main]\nasync fn main() -> Result<(), Box<dyn std::error::Error>> {\n Ok(())\n}\n"
},
{
"path": "crates/topos-node/src/process.rs",
"chars": 4087,
"preview": "use std::collections::HashMap;\nuse std::path::PathBuf;\nuse std::process::ExitStatus;\nuse thiserror::Error;\nuse tokio::{s"
},
{
"path": "crates/topos-p2p/Cargo.toml",
"chars": 1374,
"preview": "[package]\nname = \"topos-p2p\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[lints]\nworkspace = true\n\n[dependencies]\nasync-trait.wo"
},
{
"path": "crates/topos-p2p/src/behaviour/discovery.rs",
"chars": 9060,
"preview": "use std::borrow::Cow;\nuse std::pin::Pin;\nuse std::task::Poll;\nuse std::time::Duration;\n\nuse crate::error::P2PError;\nuse "
},
{
"path": "crates/topos-p2p/src/behaviour/gossip.rs",
"chars": 11257,
"preview": "use std::collections::hash_map::DefaultHasher;\nuse std::collections::HashSet;\nuse std::hash::{Hash, Hasher};\nuse std::{\n"
},
{
"path": "crates/topos-p2p/src/behaviour/grpc/connection.rs",
"chars": 2899,
"preview": "use std::future::IntoFuture;\n\nuse futures::{future::BoxFuture, FutureExt};\nuse libp2p::{swarm::ConnectionId, Multiaddr};"
},
{
"path": "crates/topos-p2p/src/behaviour/grpc/error.rs",
"chars": 704,
"preview": "use std::sync::Arc;\n\nuse tokio::sync::oneshot;\n\n#[derive(Debug, thiserror::Error)]\npub enum OutboundError {\n #[error("
},
{
"path": "crates/topos-p2p/src/behaviour/grpc/event.rs",
"chars": 612,
"preview": "use libp2p::{swarm::ConnectionId, PeerId};\nuse tonic::transport::Channel;\n\nuse super::{OutboundError, RequestId};\n\n#[der"
},
{
"path": "crates/topos-p2p/src/behaviour/grpc/handler/event.rs",
"chars": 388,
"preview": "use crate::behaviour::grpc::RequestId;\n\nuse super::ProtocolRequest;\n\n#[derive(Debug)]\npub enum Event {\n InboundNegoti"
},
{
"path": "crates/topos-p2p/src/behaviour/grpc/handler/protocol.rs",
"chars": 1678,
"preview": "use std::collections::HashSet;\n\nuse libp2p::{core::UpgradeInfo, InboundUpgrade, OutboundUpgrade, Stream};\n\n/// UpgradePr"
},
{
"path": "crates/topos-p2p/src/behaviour/grpc/handler.rs",
"chars": 5524,
"preview": "use std::{\n collections::{HashSet, VecDeque},\n sync::{\n atomic::{AtomicU64, Ordering},\n Arc,\n },\n"
},
{
"path": "crates/topos-p2p/src/behaviour/grpc/proxy.rs",
"chars": 689,
"preview": "use std::{\n io,\n pin::Pin,\n task::{Context, Poll},\n};\n\nuse futures::Stream;\nuse pin_project::pin_project;\nuse t"
},
{
"path": "crates/topos-p2p/src/behaviour/grpc/stream.rs",
"chars": 3722,
"preview": "use std::{\n io,\n pin::Pin,\n sync::{Arc, Mutex},\n task::{Context, Poll},\n};\n\nuse futures::{AsyncRead as Futur"
},
{
"path": "crates/topos-p2p/src/behaviour/grpc.rs",
"chars": 22044,
"preview": "use std::{\n collections::{HashMap, HashSet, VecDeque},\n io,\n sync::{atomic::AtomicU64, Arc},\n task::{Context"
},
{
"path": "crates/topos-p2p/src/behaviour/peer_info.rs",
"chars": 609,
"preview": "use libp2p::{\n identify::Behaviour as Identify, identify::Config as IdentifyConfig,\n identify::Event as IdentifyEv"
},
{
"path": "crates/topos-p2p/src/behaviour/topos.rs",
"chars": 125,
"preview": "// #[derive(NetworkBehaviour)]\n// #[behaviour(out_event = \"ToposOut\", event_process = true)]\n// pub struct ToposBehaviou"
},
{
"path": "crates/topos-p2p/src/behaviour.rs",
"chars": 1125,
"preview": "use self::{discovery::DiscoveryBehaviour, peer_info::PeerInfoBehaviour};\nuse crate::event::ComposedEvent;\nuse libp2p::sw"
},
{
"path": "crates/topos-p2p/src/client.rs",
"chars": 2689,
"preview": "use futures::future::BoxFuture;\nuse libp2p::PeerId;\nuse tokio::sync::{\n mpsc::{self, error::SendError},\n oneshot,\n"
},
{
"path": "crates/topos-p2p/src/command.rs",
"chars": 1466,
"preview": "use std::fmt::Display;\n\nuse libp2p::PeerId;\nuse tokio::sync::oneshot;\n\nuse crate::{behaviour::grpc::connection::Outbound"
},
{
"path": "crates/topos-p2p/src/config.rs",
"chars": 2387,
"preview": "use std::{num::NonZeroUsize, time::Duration};\n\npub struct NetworkConfig {\n pub minimum_cluster_size: usize,\n pub c"
},
{
"path": "crates/topos-p2p/src/constants.rs",
"chars": 1483,
"preview": "use std::{env, time::Duration};\n\nuse lazy_static::lazy_static;\nuse prometheus_client::registry::Registry;\nuse tokio::syn"
},
{
"path": "crates/topos-p2p/src/error.rs",
"chars": 2410,
"preview": "use std::io;\n\nuse libp2p::{\n gossipsub::SubscriptionError, kad::NoKnownPeers, noise::Error as NoiseError,\n request"
},
{
"path": "crates/topos-p2p/src/event.rs",
"chars": 1755,
"preview": "use libp2p::{identify, kad, PeerId};\n\nuse crate::behaviour::{grpc, HealthStatus};\n\n/// Represents the events that the Go"
},
{
"path": "crates/topos-p2p/src/lib.rs",
"chars": 5132,
"preview": "#![allow(unused_variables)]\nmod behaviour;\nmod client;\nmod command;\npub mod config;\npub mod constants;\npub mod error;\nmo"
},
{
"path": "crates/topos-p2p/src/network.rs",
"chars": 7493,
"preview": "use super::{Behaviour, Event, NetworkClient, Runtime};\nuse crate::{\n behaviour::{\n discovery::DiscoveryBehavio"
},
{
"path": "crates/topos-p2p/src/runtime/handle_command.rs",
"chars": 2555,
"preview": "use crate::{\n error::{CommandExecutionError, P2PError},\n protocol_name, Command, Runtime,\n};\n\nuse rand::{thread_rn"
},
{
"path": "crates/topos-p2p/src/runtime/handle_event/discovery.rs",
"chars": 5642,
"preview": "use libp2p::kad::{BootstrapOk, BootstrapResult, Event, QueryResult};\nuse tracing::{debug, error, info, warn};\n\nuse crate"
},
{
"path": "crates/topos-p2p/src/runtime/handle_event/gossipsub.rs",
"chars": 2818,
"preview": "use topos_metrics::{\n P2P_EVENT_STREAM_CAPACITY_TOTAL, P2P_MESSAGE_DESERIALIZE_FAILURE_TOTAL,\n P2P_MESSAGE_RECEIVE"
},
{
"path": "crates/topos-p2p/src/runtime/handle_event/grpc.rs",
"chars": 1557,
"preview": "use tracing::debug;\n\nuse crate::{behaviour::grpc, Runtime};\n\nuse super::{EventHandler, EventResult};\n\n#[async_trait::asy"
},
{
"path": "crates/topos-p2p/src/runtime/handle_event/peer_info.rs",
"chars": 1821,
"preview": "use ip_network::IpNetwork;\nuse libp2p::{\n identify::{Event as IdentifyEvent, Info as IdentifyInfo},\n multiaddr::Pr"
},
{
"path": "crates/topos-p2p/src/runtime/handle_event.rs",
"chars": 8088,
"preview": "use libp2p::{core::Endpoint, multiaddr::Protocol, swarm::SwarmEvent};\nuse tracing::{debug, error, info, warn};\n\nuse crat"
},
{
"path": "crates/topos-p2p/src/runtime/mod.rs",
"chars": 6329,
"preview": "use std::collections::{HashMap, HashSet};\n\nuse crate::{\n behaviour::{discovery::PendingRecordRequest, HealthStatus},\n"
},
{
"path": "crates/topos-p2p/src/tests/behaviour/grpc.rs",
"chars": 8988,
"preview": "use std::{collections::HashSet, future::IntoFuture, time::Duration};\n\nuse libp2p::Swarm;\nuse libp2p_swarm_test::SwarmExt"
},
{
"path": "crates/topos-p2p/src/tests/behaviour/mod.rs",
"chars": 10,
"preview": "mod grpc;\n"
},
{
"path": "crates/topos-p2p/src/tests/bootstrap.rs",
"chars": 1969,
"preview": "use std::time::Duration;\n\nuse futures::{future::join_all, FutureExt};\nuse rstest::rstest;\nuse test_log::test;\nuse topos_"
},
{
"path": "crates/topos-p2p/src/tests/command/mod.rs",
"chars": 17,
"preview": "mod random_peer;\n"
},
{
"path": "crates/topos-p2p/src/tests/command/random_peer.rs",
"chars": 2722,
"preview": "use std::time::Duration;\n\nuse rstest::rstest;\nuse test_log::test;\nuse tokio::spawn;\nuse topos_test_sdk::tce::NodeConfig;"
},
{
"path": "crates/topos-p2p/src/tests/mod.rs",
"chars": 56,
"preview": "mod behaviour;\nmod bootstrap;\nmod command;\nmod support;\n"
},
{
"path": "crates/topos-p2p/src/tests/support/macros.rs",
"chars": 548,
"preview": "#[macro_export]\nmacro_rules! wait_for_event {\n ($node:ident, matches: $(|)? $( $pattern:pat_param )|+ $( if $guard: e"
},
{
"path": "crates/topos-p2p/src/tests/support/mod.rs",
"chars": 1235,
"preview": "use libp2p::{\n identity::{self, Keypair},\n Multiaddr, PeerId,\n};\nuse rstest::fixture;\nuse tokio::spawn;\nuse topos_"
},
{
"path": "crates/topos-p2p/tests/support/network.rs",
"chars": 1145,
"preview": "use futures::{Stream, StreamExt};\nuse libp2p::{identity::Keypair, Multiaddr, PeerId};\nuse tokio::spawn;\nuse topos_p2p::{"
},
{
"path": "crates/topos-sequencer/Cargo.toml",
"chars": 826,
"preview": "[package]\nname = \"topos-sequencer\"\ndescription = \"Implementation of the Topos protocol\"\nversion = \"0.1.0\"\nedition = \"202"
},
{
"path": "crates/topos-sequencer/src/app_context.rs",
"chars": 5791,
"preview": "//!\n//! Application logic glue\n//!\nuse crate::SequencerConfiguration;\nuse opentelemetry::trace::FutureExt;\nuse tokio::sy"
},
{
"path": "crates/topos-sequencer/src/lib.rs",
"chars": 8514,
"preview": "use crate::app_context::{AppContext, AppContextStatus};\nuse std::io::ErrorKind::InvalidInput;\nuse std::process::ExitStat"
},
{
"path": "crates/topos-sequencer-subnet-client/Cargo.toml",
"chars": 568,
"preview": "[package]\nname = \"topos-sequencer-subnet-client\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[lints]\nworkspace = true\n\n[dependen"
},
{
"path": "crates/topos-sequencer-subnet-client/src/lib.rs",
"chars": 18432,
"preview": "pub mod subnet_contract;\n\nuse crate::subnet_contract::{create_topos_core_contract_from_json, get_block_events};\nuse ethe"
},
{
"path": "crates/topos-sequencer-subnet-client/src/subnet_contract.rs",
"chars": 2567,
"preview": "use crate::{Error, SubnetEvent};\nuse ethers::abi::ethabi::ethereum_types::{H160, U64};\nuse ethers::contract::ContractErr"
},
{
"path": "crates/topos-sequencer-subnet-runtime/Cargo.toml",
"chars": 1242,
"preview": "[package]\nname = \"topos-sequencer-subnet-runtime\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[lints]\nworkspace = true\n\n[depende"
},
{
"path": "crates/topos-sequencer-subnet-runtime/src/certification.rs",
"chars": 6370,
"preview": "use crate::Error;\nuse std::collections::{HashSet, LinkedList};\nuse std::fmt::{Debug, Formatter};\nuse std::sync::Arc;\nuse"
},
{
"path": "crates/topos-sequencer-subnet-runtime/src/lib.rs",
"chars": 7326,
"preview": "//! implementation of Topos Reliable Broadcast to be used in the Transmission Control Engine (TCE)\n//!\n//! Abstracted fr"
}
]
// ... and 155 more files (download for full content)
About this extraction
This page contains the full source code of the topos-protocol/topos GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 355 files (1.3 MB), approximately 312.1k tokens, and a symbol index with 1649 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.