Skip to content

Commit 6cb4b21

Browse files
JonathanOppenheimeralarso16michaelkaplan13
authored
sync: coreth PR #1392: chore: Add lint link check job (#1870)
Signed-off-by: Jonathan Oppenheimer <147infiniti@gmail.com> Co-authored-by: Austin Larson <78000745+alarso16@users.noreply.github.com> Co-authored-by: Michael Kaplan <55204436+michaelkaplan13@users.noreply.github.com>
1 parent 8934633 commit 6cb4b21

File tree

19 files changed

+161
-116
lines changed

19 files changed

+161
-116
lines changed

.github/CONTRIBUTING.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,44 @@
11
# Contributing
22

3-
Thank you for considering to help out with the source code! We welcome
4-
contributions from anyone on the internet, and are grateful for even the
5-
smallest of fixes!
6-
7-
If you'd like to contribute to subnet-evm, please fork, fix, commit and send a
8-
pull request for the maintainers to review and merge into the main code base. If
9-
you wish to submit more complex changes though, please check up with the core
10-
devs first on [Discord](https://chat.avalabs.org) to
11-
ensure those changes are in line with the general philosophy of the project
12-
and/or get some early feedback which can make both your efforts much lighter as
13-
well as our review and merge procedures quick and simple.
3+
Thank you for considering to help out with the source code! We welcome contributions from anyone on the internet, and are grateful for even the smallest of fixes!
4+
5+
If you'd like to contribute to subnet-evm, please fork, fix, commit and send a pull request for the maintainers to review and merge into the main code base. If you wish to submit more complex changes though, please check up with the core devs first on [Discord](https://chat.avalabs.org) to ensure those changes are in line with the general philosophy of the project and/or get some early feedback which can make both your efforts much lighter as well as our review and merge procedures quick and simple.
146

157
## Coding guidelines
168

17-
Please make sure your contributions adhere to our coding and documentation
18-
guidelines:
9+
Please make sure your contributions adhere to our coding guidelines:
1910

2011
- Code must adhere to the official Go
2112
[formatting](https://go.dev/doc/effective_go#formatting) guidelines
2213
(i.e. uses [gofmt](https://pkg.go.dev/cmd/gofmt)).
14+
- Code must be documented adhering to the official Go
15+
[commentary](https://go.dev/doc/effective_go#commentary) guidelines.
2316
- Pull requests need to be based on and opened against the `master` branch.
2417
- Pull reuqests should include a detailed description
25-
- Commits are required to be signed. See [here](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits)
18+
- Commits are required to be signed. See the [commit signature verification documentation](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits)
2619
for information on signing commits.
2720
- Commit messages should be prefixed with the package(s) they modify.
2821
- E.g. "eth, rpc: make trace configs optional"
2922

30-
### Mocks
23+
## Can I have feature X
24+
25+
Before you submit a feature request, please check and make sure that it isn't possible through some other means.
26+
27+
## Mocks
3128

3229
Mocks are auto-generated using [mockgen](https://pkg.go.dev/go.uber.org/mock/mockgen) and `//go:generate` commands in the code.
3330

34-
- To **re-generate all mocks**, use the command below from the root of the project:
31+
- To **re-generate all mocks**, use the task below from the root of the project:
3532

36-
```sh
37-
go generate -run mockgen ./...
38-
```
33+
```sh
34+
task generate-mocks
35+
```
3936

40-
* To **add** an interface that needs a corresponding mock generated:
41-
* if the file `mocks_generate_test.go` exists in the package where the interface is located, either:
42-
* modify its `//go:generate go tool -modfile=tools/go.mod mockgen` to generate a mock for your interface (preferred); or
43-
* add another `//go:generate go tool -modfile=tools/go.mod mockgen` to generate a mock for your interface according to specific mock generation settings
44-
* if the file `mocks_generate_test.go` does not exist in the package where the interface is located, create it with content (adapt as needed):
37+
- To **add** an interface that needs a corresponding mock generated:
38+
- if the file `mocks_generate_test.go` exists in the package where the interface is located, either:
39+
- modify its `//go:generate go tool -modfile=tools/go.mod mockgen` to generate a mock for your interface (preferred); or
40+
- add another `//go:generate go tool -modfile=tools/go.mod mockgen` to generate a mock for your interface according to specific mock generation settings
41+
- if the file `mocks_generate_test.go` does not exist in the package where the interface is located, create it with content (adapt as needed):
4542

4643
```go
4744
// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved.
@@ -58,26 +55,29 @@ Mocks are auto-generated using [mockgen](https://pkg.go.dev/go.uber.org/mock/moc
5855
- To **remove** an interface from having a corresponding mock generated:
5956
1. Edit the `mocks_generate_test.go` file in the directory where the interface is defined
6057
1. If the `//go:generate` mockgen command line:
61-
* generates a mock file for multiple interfaces, remove your interface from the line
62-
* generates a mock file only for the interface, remove the entire line. If the file is empty, remove `mocks_generate_test.go` as well.
58+
- generates a mock file for multiple interfaces, remove your interface from the line
59+
- generates a mock file only for the interface, remove the entire line. If the file is empty, remove `mocks_generate_test.go` as well.
6360

6461
## Tool Dependencies
6562

6663
This project uses `go tool` to manage development tool dependencies in `tools/go.mod`. This isolates tool dependencies from the main application dependencies and provides consistent, version-locked tools across the team.
6764

6865
### Managing Tools
6966

70-
* To **add a new tool**:
67+
- To **add a new tool**:
68+
7169
```sh
7270
go get -tool -modfile=tools/go.mod example.com/tool/cmd/toolname@version
7371
```
7472

75-
* To **upgrade a tool**:
73+
- To **upgrade a tool**:
74+
7675
```sh
7776
go get -tool -modfile=tools/go.mod example.com/tool/cmd/toolname@newversion
7877
```
7978

80-
* To **run a tool manually**:
79+
- To **run a tool manually**:
80+
8181
```sh
8282
go tool -modfile=tools/go.mod toolname [args...]
8383
```

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ Which OS you used to reveal the bug.
3131
**Additional context**
3232
Add any other context about the problem here.
3333

34-
Avalanche Bug Bounty program can be found [here](https://immunefi.com/bug-bounty/avalanche/information/).
34+
You can submit a bug on the [Avalanche Bug Bounty program page](https://immunefi.com/bug-bounty/avalanche/information/).

.github/ISSUE_TEMPLATE/feature_spec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ Include a description of the changes to be made to the code along with alternati
1616
that were considered, including pro/con analysis where relevant.
1717

1818
**Open questions**
19-
Questions that are still being discussed.
19+
Questions that are still being discussed

.github/pull_request_template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- markdownlint-disable MD041 -->
12
## Why this should be merged
23

34
## How this works

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ jobs:
3535
env:
3636
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3737
run: ./scripts/run_task.sh check-avalanchego-version
38+
links-lint:
39+
name: Markdown Links Lint
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@v4
43+
- uses: umbrelladocs/action-linkspector@de84085e0f51452a470558693d7d308fbb2fa261 #v1.2.5
44+
with:
45+
fail_level: any
3846

3947
unit_test:
4048
name: Golang Unit Tests (${{ matrix.os }})

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
[![CodeQL](https://github.com/ava-labs/subnet-evm/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/ava-labs/subnet-evm/actions/workflows/codeql-analysis.yml)
66
[![License](https://img.shields.io/github/license/ava-labs/subnet-evm)](https://github.com/ava-labs/subnet-evm/blob/master/LICENSE)
77

8-
[Avalanche](https://docs.avax.network/avalanche-l1s) is a network composed of multiple blockchains.
8+
[Avalanche](https://build.avax.network/docs/avalanche-l1s) is a network composed of multiple blockchains.
99
Each blockchain is an instance of a Virtual Machine (VM), much like an object in an object-oriented language is an instance of a class.
1010
That is, the VM defines the behavior of the blockchain.
1111

12-
Subnet EVM is the [Virtual Machine (VM)](https://docs.avax.network/learn/virtual-machines) that defines the Subnet Contract Chains. Subnet EVM is a simplified version of [Coreth VM (C-Chain)](https://github.com/ava-labs/coreth).
12+
Subnet EVM is the [Virtual Machine (VM)](https://build.avax.network/docs/quick-start/virtual-machines) that defines the Subnet Contract Chains. Subnet EVM is a simplified version of [Coreth VM (C-Chain)](https://github.com/ava-labs/coreth).
1313

1414
This chain implements the Ethereum Virtual Machine and supports Solidity smart contracts as well as most other Ethereum client functionality.
1515

@@ -44,11 +44,11 @@ The Subnet EVM supports the following API namespaces:
4444

4545
Only the `eth` namespace is enabled by default.
4646
Subnet EVM is a simplified version of [Coreth VM (C-Chain)](https://github.com/ava-labs/coreth).
47-
Full documentation for the C-Chain's API can be found [here](https://build.avax.network/docs/api-reference/c-chain/api).
47+
Full documentation for the C-Chain's API can be found in the [builder docs](https://build.avax.network/docs/rpcs/c-chain).
4848

4949
## Compatibility
5050

51-
The Subnet EVM is compatible with almost all Ethereum tooling, including [Remix](https://docs.avax.network/build/dapp/smart-contracts/remix-deploy), [Metamask](https://docs.avax.network/build/dapp/chain-settings), and [Foundry](https://docs.avax.network/build/dapp/smart-contracts/toolchains/foundry).
51+
Subnet-EVM is compatible with almost all Ethereum tooling, including [Foundry](https://build.avax.network/academy/blockchain/solidity-foundry/03-smart-contracts/03-foundry-quickstart) and [Remix](https://build.avax.network/docs/avalanche-l1s/add-utility/deploy-smart-contract#using-remix).
5252

5353
**Note:** Subnet-EVM and Avalanche C-Chain currently implement the Ethereum Cancun fork and do not yet support newer hardforks (such as Pectra). Since Solidity v0.8.30 switched its default target EVM version to Pectra, contracts compiled with default settings may emit bytecode using instructions/features that Avalanche does not support.
5454
To avoid this mismatch, explicitly set the Solidity compiler’s `evmVersion` to `cancun` when deploying to Subnet-EVM or the C-Chain.
@@ -73,7 +73,7 @@ To support these changes, there have been a number of changes to the SubnetEVM b
7373

7474
### Clone Subnet-evm
7575

76-
First install Go 1.24.9 or later. Follow the instructions [here](https://go.dev/doc/install). You can verify by running `go version`.
76+
First install Go 1.24.9 or later. Follow the instructions on the [go docs](https://go.dev/doc/install). You can verify by running `go version`.
7777

7878
Set `$GOPATH` environment variable properly for Go to look for Go Workspaces. Please read [this](https://go.dev/doc/code) for details. You can verify by running `echo $GOPATH`.
7979

@@ -97,8 +97,8 @@ To run a local network, it is recommended to use the [avalanche-cli](https://git
9797

9898
There are two options when using the Avalanche-CLI:
9999

100-
1. Use an official Subnet-EVM release: <https://docs.avax.network/subnets/build-first-subnet>
101-
2. Build and deploy a locally built (and optionally modified) version of Subnet-EVM: <https://docs.avax.network/subnets/create-custom-subnet>
100+
1. Use an official Subnet-EVM release: <https://build.avax.network/docs/tooling/avalanche-cli/create-avalanche-l1>
101+
1. Build and deploy a locally built (and optionally modified) version of Subnet-EVM: <https://build.avax.network/docs/tooling/avalanche-cli/create-deploy-avalanche-l1s/deploy-with-custom-vm>
102102

103103
## Releasing
104104

RELEASES.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<!-- markdownlint-disable MD024 -->
2+
13
# Release Notes
24

35
## [v0.8.1](https://github.com/ava-labs/subnet-evm/releases/tag/v0.8.1)
@@ -201,7 +203,7 @@ The plugin version is unchanged at 37 and is compatible with AvalancheGo version
201203
- Added following new database options:
202204
- `"use-standalone-database"` (`bool`): If true it enables creation of standalone database. If false it uses the GRPC Database provided by AvalancheGo. Default is nil and creates the standalone database only if there is no accepted block in the AvalancheGo database (node has not accepted any blocks for this chain)
203205
- `"database-type"` (`string`): Specifies the type of database to use. Must be one of `pebbledb`, `leveldb` or `memdb`. memdb is an in-memory, non-persisted database. Default is `pebbledb`
204-
- `"database-config-file"` (`string`): Path to the database config file. Config file is changed for every database type. See [docs](https://docs.avax.network/api-reference/avalanche-go-configs-flags#database-config) for available configs per database type. Ignored if --config-file-content is specified
206+
- `"database-config-file"` (`string`): Path to the database config file. Config file is changed for every database type. See [docs](https://build.avax.network/docs/nodes/configure/configs-flags#database-config) for available configs per database type. Ignored if --config-file-content is specified
205207
- `"database-config-file-content"` (`string`): As an alternative to `database-config-file`, it allows specifying base64 encoded database config content
206208
- `"database-path"` (`string`): Specifies the directory to which the standalone database is persisted. Defaults to "`$HOME/.avalanchego/chainData/{chainID}`"
207209
- `"database-read-only"` (`bool`) : Specifies if the standalone database should be a read-only type. Defaults to false

cmd/precompilegen/template-readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ There are some must-be-done changes waiting in the generated file. Each area req
22
Additionally there are other files you need to edit to activate your precompile.
33
These areas are highlighted with comments "ADD YOUR PRECOMPILE HERE".
44
For testing take a look at other precompile tests in contract_test.go and config_test.go in other precompile folders.
5-
See the tutorial in <https://docs.avax.network/subnets/hello-world-precompile-tutorial> for more information about precompile development.
5+
See the tutorial in <https://build.avax.network/academy/blockchain/solidity-foundry/04-hello-world-part-1/01-intro> for more information about precompile development.
66

77
General guidelines for precompile development:
88

cmd/simulator/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ To confirm that you built successfully, run the simulator and print the version:
2424

2525
This should give the following output:
2626

27-
```
27+
```bash
2828
v0.1.0
2929
```
3030

31-
To run the load simulator, you must first start an EVM based network. The load simulator works on both the C-Chain and Subnet-EVM, so we will start a single node network and run the load simulator on the C-Chain.
31+
To run the load simulator, you must first start an EVM based network. The load simulator works on both the C-Chain and Subnet-EVM, so we will start a single node network and run the load simulator on a Subnet-EVM blockchain.
3232

3333
To start a single node network, follow the instructions from the AvalancheGo [README](https://github.com/ava-labs/avalanchego#building-avalanchego) to build from source.
3434

@@ -45,9 +45,9 @@ The `--sybil-protection-enabled=false` flag is only suitable for local testing.
4545
1. Ignore stake weight on the P-Chain and count each connected peer as having a stake weight of 1
4646
2. Automatically opts in to validate every Subnet
4747

48-
Once you have AvalancheGo running locally, it will be running an HTTP Server on the default port `9650`. This means that the RPC Endpoint for the C-Chain will be http://127.0.0.1:9650/ext/bc/C/rpc and ws://127.0.0.1:9650/ext/bc/C/ws for WebSocket connections.
48+
Once you have AvalancheGo running locally, it will be running an HTTP Server on the default port `9650`. This means that the RPC Endpoint for your Subnet-EVM blockchain will be `http://127.0.0.1:9650/ext/bc/BLOCKCHAIN_ID/rpc` and `ws://127.0.0.1:9650/ext/bc/BLOCKCHAIN_ID/ws` for WebSocket connections, where `BLOCKCHAIN_ID` is the blockchain ID of your deployed Subnet-EVM instance.
4949

50-
Now, we can run the simulator command to simulate some load on the local C-Chain for 30s:
50+
Now, we can run the simulator command to simulate some load on the local Subnet-EVM blockchain:
5151

5252
```bash
5353
./simulator --timeout=1m --workers=1 --max-fee-cap=300 --max-tip-cap=10 --txs-per-worker=50

consensus/dummy/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Consensus
22

3-
Disclaimer: the consensus package in subnet-evm is a complete misnomer.
3+
Disclaimer: the consensus package in Subnet-EVM is a complete misnomer.
44

55
The consensus package in go-ethereum handles block validation and specifically handles validating the PoW portion of consensus - thus the name.
66

@@ -12,7 +12,7 @@ The dummy consensus engine is responsible for performing verification on the hea
1212

1313
## Dynamic Fees
1414

15-
Subnet-EVM includes a dynamic fee algorithm based off of (EIP-1559)[https://eips.ethereum.org/EIPS/eip-1559]. This introduces a field to the block type called `BaseFee`. The Base Fee sets a minimum gas price for any transaction to be included in the block. For example, a transaction with a gas price of 49 gwei, will be invalid to include in a block with a base fee of 50 gwei.
15+
Subnet-EVM includes a dynamic fee algorithm based off of [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559). This introduces a field to the block type called `BaseFee`. The Base Fee sets a minimum gas price for any transaction to be included in the block. For example, a transaction with a gas price of 49 gwei, will be invalid to include in a block with a base fee of 50 gwei.
1616

1717
The dynamic fee algorithm aims to adjust the base fee to handle network congestion. Subnet-EVM sets a target utilization on the network, and the dynamic fee algorithm adjusts the base fee accordingly. If the network operates above the target utilization, the dynamic fee algorithm will increase the base fee to make utilizing the network more expensive and bring overall utilization down. If the network operates below the target utilization, the dynamic fee algorithm will decrease the base fee to make it cheaper to use the network.
1818

@@ -30,4 +30,4 @@ The FinalizeAndAssemble callback is used as the final step in building a block w
3030

3131
### Finalize
3232

33-
Finalize is called as the final step in processing a block [here](../../core/state_processor.go). Since either Finalize or FinalizeAndAssemble are called, but not both, when building or verifying/processing a block they need to perform the exact same processing/verification step to ensure that a block produced by the miner where FinalizeAndAssemble is called will be processed and verified in the same way when Finalize gets called.
33+
Finalize is called as the final step in processing a block in [state_processor.go](../../core/state_processor.go). Since either Finalize or FinalizeAndAssemble are called, but not both, when building or verifying/processing a block they need to perform the exact same processing/verification step to ensure that a block produced by the miner where FinalizeAndAssemble is called will be processed and verified in the same way when Finalize gets called.

0 commit comments

Comments
 (0)