Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

[Feature] Double-signing slashing #1808

Merged
merged 100 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
5763ae3
Add governance parameters to genesis an polybft config
goran-ethernal May 17, 2023
498c886
Add Governance as fork (#1700)
goran-ethernal Jul 5, 2023
c092b91
[RFC-191] Add `governorAdmin` flag (#1728)
goran-ethernal Jul 17, 2023
1a7b487
[RFC-191]: Add governance `proposal-quorum` flag (#1730)
goran-ethernal Jul 18, 2023
3207a46
[RFC-191]: EVM-740 - Move distribute rewards to first block in epoch …
goran-ethernal Jul 20, 2023
b1bad54
Rebase fix
goran-ethernal Jul 20, 2023
ebf11e3
[RFC-191]: EVM-556 - Deploy governance contracts (#1733)
goran-ethernal Jul 21, 2023
ddcdc6a
[RFC-191]: EVM-558 - Update client configuration based on governance …
goran-ethernal Jul 31, 2023
9e79dd8
Rebase fix
goran-ethernal Jul 31, 2023
b573fff
[RFC-191]: EVM-750 - Governance e2e tests (#1761)
goran-ethernal Aug 7, 2023
bb15c51
[RFC-191]: EVM-760 - Utilize `ForkParams` contract (#1788)
goran-ethernal Aug 8, 2023
c5b2e81
Don't use hardcoded addresses for governance contracts (#1790)
goran-ethernal Aug 9, 2023
bf78f03
Rebase fix
goran-ethernal Aug 9, 2023
3da4858
Minor optimization (#1798)
Stefan-Ethernal Aug 9, 2023
39e9266
Rebase fix
goran-ethernal Aug 9, 2023
418530e
Small fixes
goran-ethernal Aug 9, 2023
796e358
Small fix
goran-ethernal Aug 10, 2023
b0b127e
Comments fix
goran-ethernal Aug 10, 2023
2b10f76
Slashing double signing tracker (#1756)
Stefan-Ethernal Aug 15, 2023
c0dcc0e
Double sign evidence struct modifications
dusan-maksimovic Aug 15, 2023
49bc267
Simplify double signer evidence (#1812)
Stefan-Ethernal Aug 15, 2023
ff08050
Rename checkpoint store to exit event store (#1814)
Stefan-Ethernal Aug 15, 2023
230361c
Sort rounds and senders in double signing tracker storage (#1806)
Stefan-Ethernal Aug 16, 2023
07368ed
slashing state transaction creation and validation (#1815)
dusan-maksimovic Aug 16, 2023
5ec165f
Byzantine node testing (#1813)
jelacamarko Aug 16, 2023
cdfb17a
Invoke PruneMsgsUntil when block is finalized (#1820)
Stefan-Ethernal Aug 16, 2023
ba15d1e
generated new bindings & artifacts for ValidatorSet and CustomSuperne…
dusan-maksimovic Aug 17, 2023
727ceaa
Merge branch 'develop' into feat/on-chain-governance
Stefan-Ethernal Aug 17, 2023
242f323
Run byzantine node as a validator (#1824)
jelacamarko Aug 17, 2023
b58795d
Expose JSON RPC function for slash exit events retrieval (#1823)
Stefan-Ethernal Aug 17, 2023
020485a
Merge branch 'feat/on-chain-governance' into feat/slashing
Stefan-Ethernal Aug 17, 2023
c5c2e9d
Merge fix (move polybft_config to common package)
Stefan-Ethernal Aug 17, 2023
577d0f9
Generate SC artifacts and bindings
Stefan-Ethernal Aug 17, 2023
99c3023
Build fix
Stefan-Ethernal Aug 17, 2023
a866797
Lint fix
Stefan-Ethernal Aug 17, 2023
8e0d564
SC artifacts regenerate
Stefan-Ethernal Aug 17, 2023
a3db6e3
Merge fix (provide isFirstBlockOfEpoch indicator)
Stefan-Ethernal Aug 18, 2023
a11cc5e
Increase timeout for e2e tests
Stefan-Ethernal Aug 18, 2023
8e22988
Update byzantine binary (#1829)
jelacamarko Aug 18, 2023
39050bb
GenerateSlashExitProofs UT (#1827)
Stefan-Ethernal Aug 18, 2023
ef9e653
Update contracts
Stefan-Ethernal Aug 18, 2023
e72ab8f
Remove executed slashing exit events from storage (#1832)
Stefan-Ethernal Aug 21, 2023
9820dea
Double sign slashing E2E test (#1833)
dusan-maksimovic Aug 23, 2023
b87e21c
e2e helper methods for byzantine validators (#1844)
jelacamarko Aug 24, 2023
4ee3b12
Add governance parameters to genesis an polybft config
goran-ethernal May 17, 2023
ab85339
Add Governance as fork (#1700)
goran-ethernal Jul 5, 2023
98e4b22
[RFC-191] Add `governorAdmin` flag (#1728)
goran-ethernal Jul 17, 2023
b316317
[RFC-191]: Add governance `proposal-quorum` flag (#1730)
goran-ethernal Jul 18, 2023
86976ea
[RFC-191]: EVM-740 - Move distribute rewards to first block in epoch …
goran-ethernal Jul 20, 2023
a140cf9
Rebase fix
goran-ethernal Jul 20, 2023
2b5094c
[RFC-191]: EVM-556 - Deploy governance contracts (#1733)
goran-ethernal Jul 21, 2023
b5501ac
[RFC-191]: EVM-558 - Update client configuration based on governance …
goran-ethernal Jul 31, 2023
6770ae2
Rebase fix
goran-ethernal Jul 31, 2023
f3009f3
[RFC-191]: EVM-750 - Governance e2e tests (#1761)
goran-ethernal Aug 7, 2023
bcf3215
[RFC-191]: EVM-760 - Utilize `ForkParams` contract (#1788)
goran-ethernal Aug 8, 2023
b2a85f9
Don't use hardcoded addresses for governance contracts (#1790)
goran-ethernal Aug 9, 2023
fef8f8b
Rebase fix
goran-ethernal Aug 9, 2023
6aa49bc
Minor optimization (#1798)
Stefan-Ethernal Aug 9, 2023
1df1e98
Rebase fix
goran-ethernal Aug 9, 2023
51af1bb
Small fixes
goran-ethernal Aug 9, 2023
b6157b1
Small fix
goran-ethernal Aug 10, 2023
145b62b
Comments fix
goran-ethernal Aug 10, 2023
219f557
Fix cluster script (provide governor-admin only for polybft consensus)
Stefan-Ethernal Aug 18, 2023
20fe110
Update contracts
Stefan-Ethernal Aug 29, 2023
dff9a38
Merge branch 'feat/on-chain-governance' into feat/slashing
Stefan-Ethernal Aug 29, 2023
815fcbd
Merge fix (update contracts)
Stefan-Ethernal Aug 29, 2023
f32d363
Add governance parameters to genesis an polybft config
goran-ethernal May 17, 2023
748150e
Add Governance as fork (#1700)
goran-ethernal Jul 5, 2023
a632a45
[RFC-191] Add `governorAdmin` flag (#1728)
goran-ethernal Jul 17, 2023
dbfd414
[RFC-191]: Add governance `proposal-quorum` flag (#1730)
goran-ethernal Jul 18, 2023
44bf5e7
[RFC-191]: EVM-740 - Move distribute rewards to first block in epoch …
goran-ethernal Jul 20, 2023
ba604d9
Rebase fix
goran-ethernal Jul 20, 2023
0650e53
[RFC-191]: EVM-556 - Deploy governance contracts (#1733)
goran-ethernal Jul 21, 2023
20a110f
[RFC-191]: EVM-558 - Update client configuration based on governance …
goran-ethernal Jul 31, 2023
8360a66
Rebase fix
goran-ethernal Jul 31, 2023
a9d3180
[RFC-191]: EVM-750 - Governance e2e tests (#1761)
goran-ethernal Aug 7, 2023
e96f482
[RFC-191]: EVM-760 - Utilize `ForkParams` contract (#1788)
goran-ethernal Aug 8, 2023
4178f18
Don't use hardcoded addresses for governance contracts (#1790)
goran-ethernal Aug 9, 2023
d865599
Rebase fix
goran-ethernal Aug 9, 2023
882220b
Minor optimization (#1798)
Stefan-Ethernal Aug 9, 2023
6cce28c
Rebase fix
goran-ethernal Aug 9, 2023
43bca09
Small fixes
goran-ethernal Aug 9, 2023
d229835
Small fix
goran-ethernal Aug 10, 2023
d46a312
Comments fix
goran-ethernal Aug 10, 2023
db38600
Fix cluster script (provide governor-admin only for polybft consensus)
Stefan-Ethernal Aug 18, 2023
e0d37b0
Increase E2E tests timeout
Stefan-Ethernal Sep 5, 2023
4a92ab0
Comments fix
goran-ethernal Sep 5, 2023
bb28c7a
Comments fix
goran-ethernal Sep 5, 2023
a1caa92
Merge branch 'feat/on-chain-governance' into feat/slashing
Stefan-Ethernal Sep 5, 2023
8507bab
Generate SC artifacts
Stefan-Ethernal Sep 5, 2023
437e008
Address comments (part 1)
Stefan-Ethernal Sep 5, 2023
14b5cfb
Address comment (part 2)
Stefan-Ethernal Sep 5, 2023
afdec38
Propagate error
Stefan-Ethernal Sep 5, 2023
decfafb
forks as a field
igorcrevar Sep 5, 2023
cfa96af
Formatting
Stefan-Ethernal Sep 5, 2023
de56a7c
Merge branch 'develop' into feat/slashing
Stefan-Ethernal Sep 5, 2023
a0e79f2
Fix bridge e2e tests
Stefan-Ethernal Sep 5, 2023
9a75e4c
Fix UTs
Stefan-Ethernal Sep 5, 2023
487ebe2
Update byzantine binary
Stefan-Ethernal Sep 5, 2023
b31de65
Update byzantine binary
Stefan-Ethernal Sep 6, 2023
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ test-e2e: check-go
.PHONY: test-e2e-polybft
test-e2e-polybft: check-go
go build -o artifacts/polygon-edge .
env EDGE_BINARY=${PWD}/artifacts/polygon-edge E2E_TESTS=true E2E_LOGS=true \
env EDGE_BINARY=${PWD}/artifacts/polygon-edge E2E_TESTS=true E2E_LOGS=true BYZANTINE_BINARY=${PWD}/e2e-polybft/e2e/polygon-edge-byzantine \
go test -v -timeout=1h30m ./e2e-polybft/e2e/...

.PHONY: test-property-polybft
Expand Down
6 changes: 5 additions & 1 deletion chain/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const (
TxHashWithType = "txHashWithType"
LondonFix = "londonfix"
Governance = "governance"
DoubleSignSlashing = "doubleSignSlashing"
)

// Forks is map which contains all forks and their starting blocks from genesis
Expand Down Expand Up @@ -129,6 +130,7 @@ func (f *Forks) At(block uint64) ForksInTime {
TxHashWithType: f.IsActive(TxHashWithType, block),
LondonFix: f.IsActive(LondonFix, block),
Governance: f.IsActive(Governance, block),
DoubleSignSlashing: f.IsActive(DoubleSignSlashing, block),
}
}

Expand Down Expand Up @@ -159,7 +161,8 @@ type ForksInTime struct {
QuorumCalcAlignment,
TxHashWithType,
LondonFix,
Governance bool
Governance,
DoubleSignSlashing bool
}

// AllForksEnabled should contain all supported forks by current edge version
Expand All @@ -177,4 +180,5 @@ var AllForksEnabled = &Forks{
TxHashWithType: NewFork(0),
LondonFix: NewFork(0),
Governance: NewFork(0),
DoubleSignSlashing: NewFork(0),
}
8 changes: 4 additions & 4 deletions command/genesis/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/0xPolygon/polygon-edge/consensus/ibft"
"github.com/0xPolygon/polygon-edge/consensus/ibft/fork"
"github.com/0xPolygon/polygon-edge/consensus/ibft/signer"
"github.com/0xPolygon/polygon-edge/consensus/polybft"
"github.com/0xPolygon/polygon-edge/consensus/polybft/common"
"github.com/0xPolygon/polygon-edge/contracts/staking"
stakingHelper "github.com/0xPolygon/polygon-edge/helper/staking"
"github.com/0xPolygon/polygon-edge/server"
Expand Down Expand Up @@ -133,7 +133,7 @@ type genesisParams struct {
accessListsOwner string

nativeTokenConfigRaw string
nativeTokenConfig *polybft.TokenConfig
nativeTokenConfig *common.TokenConfig

premineInfos []*premineInfo

Expand Down Expand Up @@ -576,7 +576,7 @@ func (p *genesisParams) isBurnContractEnabled() bool {
// extractNativeTokenMetadata parses provided native token metadata (such as name, symbol and decimals count)
func (p *genesisParams) extractNativeTokenMetadata() error {
if p.nativeTokenConfigRaw == "" {
p.nativeTokenConfig = &polybft.TokenConfig{
p.nativeTokenConfig = &common.TokenConfig{
Name: defaultNativeTokenName,
Symbol: defaultNativeTokenSymbol,
Decimals: defaultNativeTokenDecimals,
Expand Down Expand Up @@ -627,7 +627,7 @@ func (p *genesisParams) extractNativeTokenMetadata() error {
owner = types.StringToAddress(strings.TrimSpace(params[4]))
}

p.nativeTokenConfig = &polybft.TokenConfig{
p.nativeTokenConfig = &common.TokenConfig{
Name: name,
Symbol: symbol,
Decimals: uint8(decimals),
Expand Down
12 changes: 6 additions & 6 deletions command/genesis/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/umbracle/ethgo"

"github.com/0xPolygon/polygon-edge/command"
"github.com/0xPolygon/polygon-edge/consensus/polybft"
"github.com/0xPolygon/polygon-edge/consensus/polybft/common"
"github.com/0xPolygon/polygon-edge/types"
)

Expand All @@ -18,13 +18,13 @@ func Test_extractNativeTokenMetadata(t *testing.T) {
cases := []struct {
name string
rawConfig string
expectedCfg *polybft.TokenConfig
expectedCfg *common.TokenConfig
expectErr bool
}{
{
name: "default token config",
rawConfig: "",
expectedCfg: &polybft.TokenConfig{
expectedCfg: &common.TokenConfig{
Name: defaultNativeTokenName,
Symbol: defaultNativeTokenSymbol,
Decimals: defaultNativeTokenDecimals,
Expand Down Expand Up @@ -66,7 +66,7 @@ func Test_extractNativeTokenMetadata(t *testing.T) {
{
name: "non-mintable valid config",
rawConfig: "MyToken:MTK:9:false",
expectedCfg: &polybft.TokenConfig{
expectedCfg: &common.TokenConfig{
Name: "MyToken",
Symbol: "MTK",
Decimals: 9,
Expand All @@ -78,7 +78,7 @@ func Test_extractNativeTokenMetadata(t *testing.T) {
{
name: "non-mintable token config, owner provided but ignored",
rawConfig: "MyToken:MTK:9:false:0x123456789",
expectedCfg: &polybft.TokenConfig{
expectedCfg: &common.TokenConfig{
Name: "MyToken",
Symbol: "MTK",
Decimals: 9,
Expand All @@ -90,7 +90,7 @@ func Test_extractNativeTokenMetadata(t *testing.T) {
{
name: "mintable token valid config",
rawConfig: "MyMintToken:MMTK:9:true:0x123456789",
expectedCfg: &polybft.TokenConfig{
expectedCfg: &common.TokenConfig{
Name: "MyMintToken",
Symbol: "MMTK",
Decimals: 9,
Expand Down
9 changes: 5 additions & 4 deletions command/genesis/polybft_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/0xPolygon/polygon-edge/command"
"github.com/0xPolygon/polygon-edge/command/helper"
"github.com/0xPolygon/polygon-edge/consensus/polybft"
polyCommon "github.com/0xPolygon/polygon-edge/consensus/polybft/common"
"github.com/0xPolygon/polygon-edge/consensus/polybft/contractsapi"
"github.com/0xPolygon/polygon-edge/consensus/polybft/contractsapi/artifact"
"github.com/0xPolygon/polygon-edge/consensus/polybft/validator"
Expand Down Expand Up @@ -175,7 +176,7 @@ func (p *genesisParams) generatePolyBftChainConfig(o command.OutputFormatter) er
proposalQuorum = proposalQuorumMax
}

polyBftConfig := &polybft.PolyBFTConfig{
polyBftConfig := &polyCommon.PolyBFTConfig{
InitialValidatorSet: initialValidators,
BlockTime: common.Duration{Duration: p.blockTime},
EpochSize: p.epochSize,
Expand All @@ -189,13 +190,13 @@ func (p *genesisParams) generatePolyBftChainConfig(o command.OutputFormatter) er
MaxValidatorSetSize: p.maxNumValidators,
CheckpointInterval: p.checkpointInterval,
WithdrawalWaitPeriod: p.withdrawalWaitPeriod,
RewardConfig: &polybft.RewardsConfig{
RewardConfig: &polyCommon.RewardsConfig{
TokenAddress: rewardTokenAddr,
WalletAddress: walletPremineInfo.address,
WalletAmount: walletPremineInfo.amount,
},
BlockTimeDrift: p.blockTimeDrift,
GovernanceConfig: &polybft.GovernanceConfig{
GovernanceConfig: &polyCommon.GovernanceConfig{
VotingDelay: voteDelay,
VotingPeriod: votingPeriod,
ProposalThreshold: proposalThreshold,
Expand Down Expand Up @@ -369,7 +370,7 @@ func (p *genesisParams) generatePolyBftChainConfig(o command.OutputFormatter) er

func (p *genesisParams) deployContracts(
rewardTokenByteCode []byte,
polybftConfig *polybft.PolyBFTConfig,
polybftConfig *polyCommon.PolyBFTConfig,
chainConfig *chain.Chain,
burnContractAddr types.Address) (map[types.Address]*chain.GenesisAccount, error) {
type contractInfo struct {
Expand Down
7 changes: 4 additions & 3 deletions command/genesis/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/0xPolygon/polygon-edge/command"
"github.com/0xPolygon/polygon-edge/consensus/polybft"
"github.com/0xPolygon/polygon-edge/consensus/polybft/bitmap"
polyCommon "github.com/0xPolygon/polygon-edge/consensus/polybft/common"
"github.com/0xPolygon/polygon-edge/consensus/polybft/validator"
"github.com/0xPolygon/polygon-edge/consensus/polybft/wallet"
"github.com/0xPolygon/polygon-edge/helper/common"
Expand Down Expand Up @@ -124,7 +125,7 @@ func parseTrackerStartBlocks(trackerStartBlocksRaw []string) (map[types.Address]
}

// parseBurnContractInfo parses provided burn contract information and returns burn contract block and address
func parseBurnContractInfo(burnContractInfoRaw string) (*polybft.BurnContractInfo, error) {
func parseBurnContractInfo(burnContractInfoRaw string) (*polyCommon.BurnContractInfo, error) {
// <block>:<address>[:<burn destination address>]
burnContractParts := strings.Split(burnContractInfoRaw, ":")
if len(burnContractParts) < 2 || len(burnContractParts) > 3 {
Expand All @@ -144,7 +145,7 @@ func parseBurnContractInfo(burnContractInfoRaw string) (*polybft.BurnContractInf
}

if len(burnContractParts) == 2 {
return &polybft.BurnContractInfo{
return &polyCommon.BurnContractInfo{
BlockNumber: blockNum,
Address: types.StringToAddress(contractAddress),
DestinationAddress: types.ZeroAddress,
Expand All @@ -156,7 +157,7 @@ func parseBurnContractInfo(burnContractInfoRaw string) (*polybft.BurnContractInf
return nil, fmt.Errorf("failed to parse burn destination address %s: %w", destinationAddress, err)
}

return &polybft.BurnContractInfo{
return &polyCommon.BurnContractInfo{
BlockNumber: blockNum,
Address: types.StringToAddress(contractAddress),
DestinationAddress: types.StringToAddress(destinationAddress),
Expand Down
Loading
Loading