Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/protect-main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Protect main

on:
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
- edited

jobs:
require-development:
name: Require development source branch
runs-on: ubuntu-latest
steps:
- name: Check source branch
env:
HEAD_REF: ${{ github.head_ref }}
run: |
if [ "$HEAD_REF" != "development" ]; then
echo "::error::PRs targeting main must come from the development branch (got '$HEAD_REF'). Open this PR against development instead, then promote development to main."
exit 1
fi
echo "PR is from development → main. OK."
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ discuss your intended approach for solving the problem in the comments for an ex
- **Update the CHANGELOG** for all enhancements and bug fixes. Include the corresponding date, issue
number if one exists and current version if any. Check the format of the [CHANGELOG](.docs/CHANGELOG.md).

- **Use the repo's default main branch.** Branch from and
- **Target the `development` branch.** The repo's default branch is still `main`, but do **not**
open pull requests against `main`. Branch from and
[submit your pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork)
to the repo's default branch `main`.
to `development`.

-
**[Resolve any merge conflicts](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/resolving-a-merge-conflict-on-github)**
Expand Down
6 changes: 3 additions & 3 deletions controller/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,8 @@ func (c *Controller) CommitCertificate(qc *lib.QuorumCertificate, block *lib.Blo
// reset mempool FSM
c.Mempool.FSM.Reset()
}
// update telemetry (using proper defer to ensure time.Since is evaluated at defer execution)
defer c.UpdateTelemetry(qc, block, time.Since(start))
// update telemetry at return time so the duration includes all commit work
defer func() { c.UpdateTelemetry(qc, block, time.Since(start)) }()
if !syncing {
// publish root chain information to all nested chain subscribers
for _, id := range c.RCManager.ChainIds() {
Expand Down Expand Up @@ -819,4 +819,4 @@ func (c *Controller) debugDumpHeaderDiff(candidate, compare *lib.BlockHeader) {
c.log.Errorf("Candidate:\n:%s", cand)
c.log.Errorf("Compare:\n:%s", comp)
c.log.Errorf("State:\n:%s", state)
}
}