Skip to content

Commit c06f5df

Browse files
chore: Add lint link check job (#1392)
Signed-off-by: Jonathan Oppenheimer <[email protected]> Co-authored-by: Austin Larson <[email protected]>
1 parent 7e583fa commit c06f5df

File tree

16 files changed

+130
-113
lines changed

16 files changed

+130
-113
lines changed

.github/CONTRIBUTING.md

Lines changed: 33 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +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 coreth, 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 coreth, 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

179
Please make sure your contributions adhere to our coding guidelines:
1810

19-
* Code must adhere to the official Go
20-
[formatting](https://go.dev/doc/effective_go#formatting) guidelines
21-
(i.e. uses [gofmt](https://pkg.go.dev/cmd/gofmt)).
22-
* Code must be documented adhering to the official Go
23-
[commentary](https://go.dev/doc/effective_go#commentary) guidelines.
24-
* Pull requests need to be based on and opened against the `master` branch.
25-
* Pull reuqests should include a detailed description
26-
* Commits are required to be signed. See [here](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits)
27-
for information on signing commits.
28-
* Commit messages should be prefixed with the package(s) they modify.
29-
* E.g. "eth, rpc: make trace configs optional"
11+
- Code must adhere to the official Go
12+
[formatting](https://go.dev/doc/effective_go#formatting) guidelines
13+
(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.
16+
- Pull requests need to be based on and opened against the `master` branch.
17+
- Pull reuqests should include a detailed description
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)
19+
for information on signing commits.
20+
- Commit messages should be prefixed with the package(s) they modify.
21+
- E.g. "eth, rpc: make trace configs optional"
3022

3123
## Can I have feature X
3224

33-
Before you submit a feature request, please check and make sure that it isn't
34-
possible through some other means.
25+
Before you submit a feature request, please check and make sure that it isn't possible through some other means.
3526

3627
## Mocks
3728

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

40-
* 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:
4132

42-
```sh
43-
go generate -run mockgen ./...
44-
```
33+
```sh
34+
task generate-mocks
35+
```
4536

46-
* To **add** an interface that needs a corresponding mock generated:
47-
* if the file `mocks_generate_test.go` exists in the package where the interface is located, either:
48-
* modify its `//go:generate go tool -modfile=tools/go.mod mockgen` to generate a mock for your interface (preferred); or
49-
* add another `//go:generate go tool -modfile=tools/go.mod mockgen` to generate a mock for your interface according to specific mock generation settings
50-
* 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):
5142

5243
```go
5344
// Copyright (C) 2025-2025, Ava Labs, Inc. All rights reserved.
@@ -61,29 +52,32 @@ Mocks are auto-generated using [mockgen](https://pkg.go.dev/go.uber.org/mock/moc
6152
Notes:
6253
1. Ideally generate all mocks to `mocks_test.go` for the package you need to use the mocks for and do not export mocks to other packages. This reduces package dependencies, reduces production code pollution and forces to have locally defined narrow interfaces.
6354
1. Prefer using reflect mode to generate mocks than source mode, unless you need a mock for an unexported interface, which should be rare.
64-
* To **remove** an interface from having a corresponding mock generated:
55+
- To **remove** an interface from having a corresponding mock generated:
6556
1. Edit the `mocks_generate_test.go` file in the directory where the interface is defined
6657
1. If the `//go:generate` mockgen command line:
67-
* generates a mock file for multiple interfaces, remove your interface from the line
68-
* 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.
6960

7061
## Tool Dependencies
7162

7263
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.
7364

7465
### Managing Tools
7566

76-
* To **add a new tool**:
67+
- To **add a new tool**:
68+
7769
```sh
7870
go get -tool -modfile=tools/go.mod example.com/tool/cmd/toolname@version
7971
```
8072

81-
* To **upgrade a tool**:
73+
- To **upgrade a tool**:
74+
8275
```sh
8376
go get -tool -modfile=tools/go.mod example.com/tool/cmd/toolname@newversion
8477
```
8578

86-
* To **run a tool manually**:
79+
- To **run a tool manually**:
80+
8781
```sh
8882
go tool -modfile=tools/go.mod toolname [args...]
8983
```

.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://hackenproof.com/avalanche/avalanche-protocol).
34+
You can submit a bug on the [Avalanche Bug Bounty program page](https://hackenproof.com/avalanche/avalanche-protocol).

.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
@@ -50,6 +50,14 @@ jobs:
5050
env:
5151
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5252
run: ./scripts/run_task.sh check-avalanchego-version
53+
links-lint:
54+
name: Markdown Links Lint
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v4
58+
- uses: umbrelladocs/action-linkspector@de84085e0f51452a470558693d7d308fbb2fa261 #v1.2.5
59+
with:
60+
fail_level: any
5361

5462
unit_test:
5563
name: Golang Unit Tests (${{ matrix.os }})

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ test run, require binary dependencies. One way of making these dependencies avai
3131
to use a nix shell which will give access to the dependencies expected by the test
3232
tooling:
3333

34-
- Install [nix](https://nixos.org/). The [determinate systems
35-
installer](https://github.com/DeterminateSystems/nix-installer?tab=readme-ov-file#install-nix)
36-
is recommended.
37-
- Use `./scripts/dev_shell.sh` to start a nix shell
38-
- Execute the dependency-requiring command (e.g. `./scripts/tests.e2e.sh --start-collectors`)
34+
- Install [nix](https://nixos.org/). The [determinate systems
35+
installer](https://github.com/DeterminateSystems/nix-installer?tab=readme-ov-file#install-nix)
36+
is recommended.
37+
- Use `./scripts/dev_shell.sh` to start a nix shell
38+
- Execute the dependency-requiring command (e.g. `./scripts/tests.e2e.sh --start-collectors`)
3939

4040
This repo also defines a `.envrc` file to configure [devenv](https://direnv.net/). With
4141
`devenv` and `nix` installed, a shell at the root of the repo will automatically start a nix
@@ -50,13 +50,13 @@ The C-Chain supports the following API namespaces:
5050
- `txpool`
5151
- `debug`
5252

53-
Only the `eth` namespace is enabled by default.
54-
To enable the other namespaces see the instructions for passing the C-Chain config to AvalancheGo [here.](https://docs.avax.network/nodes/configure/chain-config-flags#enabling-evm-apis)
55-
Full documentation for the C-Chain's API can be found [here.](https://docs.avax.network/reference/avalanchego/c-chain/api)
53+
Only the `eth` namespace is enabled by default.
54+
To enable the other namespaces see the instructions for passing the C-Chain config to AvalancheGo in the [chain-config-flags documentation](https://build.avax.network/docs/nodes/chain-configs/c-chain#api-configuration).
55+
Full documentation for the C-Chain's API can be found in the [C-Chain API documentation](https://build.avax.network/docs/nodes/chain-configs/c-chain).
5656

5757
## Compatibility
5858

59-
The C-Chain is compatible with almost all Ethereum tooling, including [Core,](https://docs.avax.network/build/dapp/launch-dapp#through-core) [Metamask,](https://docs.avax.network/build/dapp/launch-dapp#through-metamask) [Remix](https://docs.avax.network/dapps/smart-contract-dev/deploy-with-remix-ide) and [Truffle.](https://docs.avax.network/build/tutorials/smart-contracts/using-truffle-with-the-avalanche-c-chain)
59+
The C-Chain is compatible with almost all Ethereum tooling, including [Core,](https://docs.avax.network/build/dapp/launch-dapp#through-core) [Metamask,](https://docs.avax.network/build/dapp/launch-dapp#through-metamask) and [Remix](https://docs.avax.network/dapps/smart-contract-dev/deploy-with-remix-ide).
6060

6161
## Differences Between Avalanche C-Chain and Ethereum
6262

@@ -82,15 +82,15 @@ To support these changes, there have been a number of changes to the C-Chain blo
8282

8383
### Block Body
8484

85-
* `Version`: provides version of the `ExtData` in the block. Currently, this field is always 0.
86-
* `ExtData`: extra data field within the block body to store atomic transaction bytes.
85+
- `Version`: provides version of the `ExtData` in the block. Currently, this field is always 0.
86+
- `ExtData`: extra data field within the block body to store atomic transaction bytes.
8787

8888
### Block Header
8989

90-
* `ExtDataHash`: the hash of the bytes in the `ExtDataHash` field
91-
* `BaseFee`: Added by EIP-1559 to represent the base fee of the block (present in Ethereum as of EIP-1559)
92-
* `ExtDataGasUsed`: amount of gas consumed by the atomic transactions in the block
93-
* `BlockGasCost`: surcharge for producing a block faster than the target rate
90+
- `ExtDataHash`: the hash of the bytes in the `ExtDataHash` field
91+
- `BaseFee`: Added by EIP-1559 to represent the base fee of the block (present in Ethereum as of EIP-1559)
92+
- `ExtDataGasUsed`: amount of gas consumed by the atomic transactions in the block
93+
- `BlockGasCost`: surcharge for producing a block faster than the target rate
9494

9595
## Releasing
9696

RELEASES.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
- Changed default percentile from 60 to 40
1717
- This impacts `eth_suggestGasPrice` and `eth_suggestGasTipCap` , `eth_suggestPriceOptions`, `eth_maxPriorityFeePerGas`, `eth_gasPrice` APIs
1818

19-
2019
## [v0.15.3](https://github.com/ava-labs/coreth/releases/tag/v0.15.3)
2120

2221
- Removed legacy warp message handlers in favor of ACP-118 SDK handlers.

SECURITY.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@ responsible disclosures. Valid reports will be eligible for a reward (terms and
55

66
## Reporting a Vulnerability
77

8-
**Please do not file a public ticket** mentioning the vulnerability. To disclose a vulnerability submit it through our [Bug Bounty Program](https://hackenproof.com/avalanche).
8+
**Please do not file a public ticket** mentioning the vulnerability. To disclose a vulnerability submit it through our [Bug Bounty Program](https://immunefi.com/bug-bounty/avalabs/information/).
99

1010
Vulnerabilities must be disclosed to us privately with reasonable time to respond, and avoid compromise of other users and accounts, or loss of funds that are not your own. We do not reward spam or
1111
social engineering vulnerabilities.
1212

1313
Do not test for or validate any security issues in the live Avalanche networks (Mainnet and Fuji testnet), confirm all exploits in a local private testnet.
1414

15-
Please refer to the [Bug Bounty Page](https://hackenproof.com/avalanche) for the most up-to-date program rules and scope.
15+
Please refer to the [Bug Bounty Page](https://immunefi.com/bug-bounty/avalabs/information/) for the most up-to-date program rules and scope.
1616

1717
## Supported Versions
1818

1919
Please use the [most recently released version](https://github.com/ava-labs/coreth/releases/latest) to perform testing and to validate security issues.
20-

cmd/simulator/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ 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

@@ -45,7 +45,7 @@ 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 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.
4949

5050
Now, we can run the simulator command to simulate some load on the local C-Chain for 30s:
5151

consensus/dummy/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The dummy consensus engine is responsible for performing verification on the hea
1212

1313
## Dynamic Fees
1414

15-
As of Apricot Phase 3, the C-Chain 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+
As of Apricot Phase 3, the C-Chain 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. Coreth 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). Finalize adds a callback function in order to process atomic transactions as well. 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). Finalize adds a callback function in order to process atomic transactions as well. 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.

core/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The core package maintains the backend for the blockchain, transaction pool, and
66

77
The [BlockChain](./blockchain.go) struct handles the insertion of blocks into the maintained chain. It maintains a "canonical chain", which is essentially the preferred chain (the chain that ends with the block preferred by the AvalancheGo consensus engine).
88

9-
When the consensus engine verifies blocks as they are ready to be issued into consensus, it calls `Verify()` on the ChainVM Block interface implemented [here](../plugin/evm/block.go). This calls `InsertBlockManual` on the BlockChain struct implemented in this package, which is the first entrypoint of a block into the blockchain.
9+
When the consensus engine verifies blocks as they are ready to be issued into consensus, it calls `Verify()` on the ChainVM Block interface implemented in [wrapped_block.go](../plugin/evm/wrapped_block.go). This calls `InsertBlockManual` on the BlockChain struct implemented in this package, which is the first entrypoint of a block into the blockchain.
1010

1111
InsertBlockManual verifies the block, inserts it into the state manager to track the merkle trie for the block, and adds it to the canonical chain if it extends the currently preferred chain.
1212

@@ -20,7 +20,7 @@ The transaction pool maintains the set of transactions that need to be issued in
2020

2121
## State Manager
2222

23-
The State Manager manages the [TrieDB](../trie/database.go). The TrieDB tracks a merkle forest of all of the merkle tries for the last accepted block and processing blocks. When a block is processed, the state transition results in a new merkle trie added to the merkle forest. The State Manager can operate in either archival or pruning mode.
23+
The State Manager manages references to state roots in the TrieDB implementations (see [`triedb`](../triedb/) for hashdb, pathdb, and firewood implementations). The TrieDB stores trie nodes (the individual components of state tries) in memory and on disk. When a block is processed, the state transition results in a new state root, and the TrieDB updates or inserts the trie nodes that compose this state. The State Manager tracks which state roots are referenced by processing blocks and manages when to commit trie nodes to disk or dereference them. The State Manager can operate in either archival or pruning mode.
2424

2525
### Archival Mode
2626

0 commit comments

Comments
 (0)