You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 25, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: .github/CONTRIBUTING.md
+33Lines changed: 33 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,3 +33,36 @@ Please make sure your contributions adhere to our coding guidelines:
33
33
Before you submit a feature request, please check and make sure that it isn't
34
34
possible through some other means.
35
35
36
+
## Mocks
37
+
38
+
Mocks are auto-generated using [mockgen](https://pkg.go.dev/go.uber.org/mock/mockgen) and `//go:generate` commands in the code.
39
+
40
+
* To **re-generate all mocks**, use the command below from the root of the project:
41
+
42
+
```sh
43
+
go generate -run "go.uber.org/mock/mockgen" ./...
44
+
```
45
+
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 run go.uber.org/mock/mockgen` to generate a mock for your interface (preferred); or
49
+
* add another `//go:generate go run go.uber.org/mock/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):
51
+
52
+
```go
53
+
// Copyright (C) 2025-2025, Ava Labs, Inc. All rights reserved.
54
+
// See the file LICENSE for licensing terms.
55
+
56
+
package mypackage
57
+
58
+
//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE} -destination=mocks_test.go . YourInterface
59
+
```
60
+
61
+
Notes:
62
+
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.
63
+
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:
65
+
1. Edit the `mocks_generate_test.go` file in the directory where the interface is defined
66
+
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.
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
[Avalanche](https://docs.avax.network/intro) is a network composed of multiple blockchains.
4
4
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.
5
5
That is, the VM defines the behavior of the blockchain.
6
-
Coreth (from core Ethereum) is the [Virtual Machine (VM)](https://docs.avax.network/learn/avalanche/virtual-machines) that defines the Contract Chain (C-Chain).
6
+
Coreth (from core Ethereum) is the [Virtual Machine (VM)](https://docs.avax.network/learn/virtual-machines) that defines the Contract Chain (C-Chain).
7
7
This chain implements the Ethereum Virtual Machine and supports Solidity smart contracts as well as most other Ethereum client functionality.
Copy file name to clipboardExpand all lines: consensus/dummy/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ The dynamic fee algorithm aims to adjust the base fee to handle network congesti
18
18
19
19
- EIP-1559 is intended for Ethereum where a block is produced roughly every 10s
20
20
- C-Chain typically produces blocks every 2 seconds, but the dynamic fee algorithm needs to handle the case that the network quiesces and there are no blocks for a long period of time
21
-
- Since C-Chain produces blocks at a different cadence, it adapts EIP-1559 to sum the amount of gas consumed within a 10second interval instead of using only the amount of gas consumed in the parent block
21
+
- Since C-Chain produces blocks at a different cadence, it adapts EIP-1559 to sum the amount of gas consumed within a 10-second interval instead of using only the amount of gas consumed in the parent block
0 commit comments