Skip to content

Commit

Permalink
fix ve2
Browse files Browse the repository at this point in the history
  • Loading branch information
itsdevbear committed Jan 23, 2024
1 parent 96ecafd commit 2eac91b
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions baseapp/abci_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,10 @@ import (
protoio "github.com/cosmos/gogoproto/io"
"github.com/cosmos/gogoproto/proto"

"cosmossdk.io/math"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/mempool"
)

// VoteExtensionThreshold defines the total voting power % that must be
// submitted in order for all vote extensions to be considered valid for a
// given height.
var VoteExtensionThreshold = math.LegacyNewDecWithPrec(667, 3)

type (
// ValidatorStore defines the interface contract require for verifying vote
// extension signatures. Typically, this will be implemented by the x/staking
Expand All @@ -38,7 +31,7 @@ type (
GetGas() uint64
}
)

q

Check failure on line 34 in baseapp/abci_utils.go

View workflow job for this annotation

GitHub Actions / tests (03)

syntax error: non-declaration statement outside function body

Check failure on line 34 in baseapp/abci_utils.go

View workflow job for this annotation

GitHub Actions / tests (00)

syntax error: non-declaration statement outside function body

Check failure on line 34 in baseapp/abci_utils.go

View workflow job for this annotation

GitHub Actions / tests (00)

syntax error: non-declaration statement outside function body

Check failure on line 34 in baseapp/abci_utils.go

View workflow job for this annotation

GitHub Actions / tests (00)

syntax error: non-declaration statement outside function body

Check failure on line 34 in baseapp/abci_utils.go

View workflow job for this annotation

GitHub Actions / tests (00)

syntax error: non-declaration statement outside function body

Check failure on line 34 in baseapp/abci_utils.go

View workflow job for this annotation

GitHub Actions / tests (02)

syntax error: non-declaration statement outside function body

Check failure on line 34 in baseapp/abci_utils.go

View workflow job for this annotation

GitHub Actions / tests (02)

syntax error: non-declaration statement outside function body

Check failure on line 34 in baseapp/abci_utils.go

View workflow job for this annotation

GitHub Actions / tests (02)

syntax error: non-declaration statement outside function body

Check failure on line 34 in baseapp/abci_utils.go

View workflow job for this annotation

GitHub Actions / tests (02)

syntax error: non-declaration statement outside function body

Check failure on line 34 in baseapp/abci_utils.go

View workflow job for this annotation

GitHub Actions / tests (01)

syntax error: non-declaration statement outside function body

Check failure on line 34 in baseapp/abci_utils.go

View workflow job for this annotation

GitHub Actions / tests (01)

syntax error: non-declaration statement outside function body

Check failure on line 34 in baseapp/abci_utils.go

View workflow job for this annotation

GitHub Actions / tests (01)

syntax error: non-declaration statement outside function body

Check failure on line 34 in baseapp/abci_utils.go

View workflow job for this annotation

GitHub Actions / golangci-lint

syntax error: non-declaration statement outside function body) (typecheck)

Check failure on line 34 in baseapp/abci_utils.go

View workflow job for this annotation

GitHub Actions / golangci-lint

syntax error: non-declaration statement outside function body) (typecheck)

Check failure on line 34 in baseapp/abci_utils.go

View workflow job for this annotation

GitHub Actions / golangci-lint

syntax error: non-declaration statement outside function body) (typecheck)

Check failure on line 34 in baseapp/abci_utils.go

View workflow job for this annotation

GitHub Actions / golangci-lint

syntax error: non-declaration statement outside function body) (typecheck)
// ValidateVoteExtensions defines a helper function for verifying vote extension
// signatures that may be passed or manually injected into a block proposal from
// a proposer in PrepareProposal. It returns an error if any signature is invalid
Expand Down Expand Up @@ -133,13 +126,9 @@ func ValidateVoteExtensions(
sumVP += vote.Validator.Power
}

if totalVP > 0 {
percentSubmitted := math.LegacyNewDecFromInt(math.NewInt(sumVP)).Quo(math.LegacyNewDecFromInt(math.NewInt(totalVP)))
if percentSubmitted.LT(VoteExtensionThreshold) {
return fmt.Errorf("insufficient cumulative voting power received to verify vote extensions; got: %s, expected: >=%s", percentSubmitted, VoteExtensionThreshold)
}
if sumVP > (totalVP*2/3)+1 {
return fmt.Errorf("insufficient cumulative voting power received to verify vote extensions; got: %d, expected: >=%d", sumVP, (totalVP*2/3)+1)
}

return nil
}

Expand Down

0 comments on commit 2eac91b

Please sign in to comment.