forked from maticnetwork/bor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merged in the current develop branch
- Loading branch information
Showing
80 changed files
with
2,941 additions
and
493 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: SonarQube CI | ||
on: | ||
push: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
sonarqube: | ||
name: SonarQube | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
# Disabling shallow clone is recommended for improving relevancy of reporting. | ||
fetch-depth: 0 | ||
|
||
# Triggering SonarQube analysis as results of it are required by Quality Gate check. | ||
- name: SonarQube Scan | ||
uses: sonarsource/sonarqube-scan-action@master | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | ||
|
||
# Check the Quality Gate status. | ||
- name: SonarQube Quality Gate check | ||
id: sonarqube-quality-gate-check | ||
uses: sonarsource/sonarqube-quality-gate-action@master | ||
# Force to fail step after specific time. | ||
timeout-minutes: 5 | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package heimdallapp | ||
|
||
import ( | ||
"context" | ||
"math/big" | ||
|
||
"github.com/cosmos/cosmos-sdk/types" | ||
|
||
"github.com/ethereum/go-ethereum/consensus/bor/heimdall/checkpoint" | ||
"github.com/ethereum/go-ethereum/log" | ||
|
||
hmTypes "github.com/maticnetwork/heimdall/types" | ||
abci "github.com/tendermint/tendermint/abci/types" | ||
) | ||
|
||
func (h *HeimdallAppClient) FetchCheckpointCount(_ context.Context) (int64, error) { | ||
log.Info("Fetching checkpoint count") | ||
|
||
res := h.hApp.CheckpointKeeper.GetACKCount(h.NewContext()) | ||
|
||
log.Info("Fetched checkpoint count") | ||
|
||
return int64(res), nil | ||
} | ||
|
||
func (h *HeimdallAppClient) FetchCheckpoint(_ context.Context, number int64) (*checkpoint.Checkpoint, error) { | ||
log.Info("Fetching checkpoint", "number", number) | ||
|
||
res, err := h.hApp.CheckpointKeeper.GetCheckpointByNumber(h.NewContext(), uint64(number)) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
log.Info("Fetched checkpoint", "number", number) | ||
|
||
return toBorCheckpoint(res), nil | ||
} | ||
|
||
func (h *HeimdallAppClient) NewContext() types.Context { | ||
return h.hApp.NewContext(true, abci.Header{Height: h.hApp.LastBlockHeight()}) | ||
} | ||
|
||
func toBorCheckpoint(hdCheckpoint hmTypes.Checkpoint) *checkpoint.Checkpoint { | ||
return &checkpoint.Checkpoint{ | ||
Proposer: hdCheckpoint.Proposer.EthAddress(), | ||
StartBlock: big.NewInt(int64(hdCheckpoint.StartBlock)), | ||
EndBlock: big.NewInt(int64(hdCheckpoint.EndBlock)), | ||
RootHash: hdCheckpoint.RootHash.EthHash(), | ||
BorChainID: hdCheckpoint.BorChainID, | ||
Timestamp: hdCheckpoint.TimeStamp, | ||
} | ||
} |
Oops, something went wrong.