Skip to content

Commit

Permalink
Merge branch 'develop' into jesse/nightly-loadtest-workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
gatsbyz authored Apr 5, 2023
2 parents 18fac25 + 99166f0 commit 981ff2a
Show file tree
Hide file tree
Showing 24 changed files with 786 additions and 76 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/fuzz-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: Fuzz tests
on: # yamllint disable-line rule:truthy
push:
branches:
- main
- develop
workflow_dispatch:
workflow_call:
outputs:
workflow_output:
description: "Fuzz output"
value: ${{ jobs.build.outputs.fuzz_output_failure }}


jobs:
fuzz_test:
name: Polygon Edge
runs-on: ubuntu-latest
outputs:
fuzz_output_failure: ${{ steps.run_fuzz_failure.outputs.test_output }}
steps:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.18.x

- name: Checkout Code
uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Dependencies
run: ./setup-ci.sh

- name: Run Fuzz Test
run: make fuzz-test

- name: Run fuzz tests failed
if: failure()
id: run_fuzz_failure
run: echo "test_output=false" >> $GITHUB_OUTPUT

18 changes: 15 additions & 3 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,16 @@ jobs:
ANSIBLE_PRIVATE_SSH: ${{ secrets.ANSIBLE_PRIVATE_SSH }}
with:
environment: devnet


fuzz:
name: Fuzz Tests
uses: ./.github/workflows/fuzz-test.yml
needs: build

notification:
name: Nightly Notifications
runs-on: ubuntu-latest
needs: [build, test, e2e, property, loadtest]
needs: [build, test, e2e, property, fuzz, loadtest]
if: success() || failure()
steps:
- name: Notify Slack
Expand Down Expand Up @@ -112,6 +117,13 @@ jobs:
"text": "E2E tests ${{ needs.e2e.outputs.workflow_output == '' && ':white_check_mark:' || ':x: `failed`' }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Fuzz tests ${{ needs.fuzz.outputs.workflow_output == '' && ':white_check_mark:' || ':x: `failed`' }}"
}
},
{
"type": "section",
"text": {
Expand All @@ -130,4 +142,4 @@ jobs:
}
}
]
}
}
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ generate-bsd-licenses:
test:
go test -coverprofile coverage.out -timeout 20m `go list ./... | grep -v e2e`

.PHONY: fuzz-test
fuzz-test:
./scripts/fuzzAll

.PHONY: test-e2e
test-e2e:
# We need to build the binary with the race flag enabled
Expand All @@ -57,6 +61,7 @@ test-e2e-polybft:
env EDGE_BINARY=${PWD}/artifacts/polygon-edge E2E_TESTS=true E2E_LOGS=true E2E_TESTS_TYPE=integration \
go test -v -timeout=45m ./e2e-polybft/e2e/...

.PHONY: test-property-polybft
test-property-polybft:
# We can not build with race because of a bug in boltdb dependency
go build -o artifacts/polygon-edge .
Expand Down
3 changes: 2 additions & 1 deletion chain/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ type Params struct {
BlockGasTarget uint64 `json:"blockGasTarget"`

// AllowList configuration
ContractDeployerAllowList *AllowListConfig `json:"contractDeployerAllowListConfig,omitempty"`
ContractDeployerAllowList *AllowListConfig `json:"contractDeployerAllowList,omitempty"`
TransactionsAllowList *AllowListConfig `json:"transactionsAllowList,omitempty"`
}

type AllowListConfig struct {
Expand Down
18 changes: 16 additions & 2 deletions command/genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,17 +219,31 @@ func setFlags(cmd *cobra.Command) {
{
cmd.Flags().StringArrayVar(
&params.contractDeployerAllowListAdmin,
contractDeployedAllowListAdminFlag,
contractDeployerAllowListAdminFlag,
[]string{},
"list of addresses to use as admin accounts in the contract deployer allow list",
)

cmd.Flags().StringArrayVar(
&params.contractDeployerAllowListEnabled,
contractDeployedAllowListEnabledFlag,
contractDeployerAllowListEnabledFlag,
[]string{},
"list of addresses to enable by default in the contract deployer allow list",
)

cmd.Flags().StringArrayVar(
&params.transactionsAllowListAdmin,
transactionsAllowListAdminFlag,
[]string{},
"list of addresses to use as admin accounts in the transactions allow list",
)

cmd.Flags().StringArrayVar(
&params.transactionsAllowListEnabled,
transactionsAllowListEnabledFlag,
[]string{},
"list of addresses to enable by default in the transactions allow list",
)
}
}

Expand Down
5 changes: 4 additions & 1 deletion command/genesis/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ type genesisParams struct {
// allowlist
contractDeployerAllowListAdmin []string
contractDeployerAllowListEnabled []string
mintableNativeToken bool
transactionsAllowListAdmin []string
transactionsAllowListEnabled []string

mintableNativeToken bool
}

func (p *genesisParams) validateFlags() error {
Expand Down
35 changes: 33 additions & 2 deletions command/genesis/polybft_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ const (
defaultBridge = false
defaultEpochReward = 1

contractDeployedAllowListAdminFlag = "contract-deployer-allow-list-admin"
contractDeployedAllowListEnabledFlag = "contract-deployer-allow-list-enabled"
contractDeployerAllowListAdminFlag = "contract-deployer-allow-list-admin"
contractDeployerAllowListEnabledFlag = "contract-deployer-allow-list-enabled"
transactionsAllowListAdminFlag = "transactions-allow-list-admin"
transactionsAllowListEnabledFlag = "transactions-allow-list-enabled"

bootnodePortStart = 30301
)
Expand Down Expand Up @@ -213,6 +215,15 @@ func (p *genesisParams) generatePolyBftChainConfig(o command.OutputFormatter) er
}
}

if len(p.transactionsAllowListAdmin) != 0 {
// only enable allow list if there is at least one address as **admin**, otherwise
// the allow list could never be updated
chainConfig.Params.TransactionsAllowList = &chain.AllowListConfig{
AdminAddresses: stringSliceToAddressSlice(p.transactionsAllowListAdmin),
EnabledAddresses: stringSliceToAddressSlice(p.transactionsAllowListEnabled),
}
}

return helper.WriteGenesisConfigToDisk(chainConfig, params.genesisPath)
}

Expand Down Expand Up @@ -243,6 +254,26 @@ func (p *genesisParams) deployContracts(totalStake *big.Int) (map[types.Address]
artifact: contractsapi.ChildERC20Predicate,
address: contracts.ChildERC20PredicateContract,
},
{
// ChildERC721 token contract
artifact: contractsapi.ChildERC721,
address: contracts.ChildERC721Contract,
},
{
// ChildERC721Predicate token contract
artifact: contractsapi.ChildERC721Predicate,
address: contracts.ChildERC721PredicateContract,
},
{
// ChildERC1155 contract
artifact: contractsapi.ChildERC1155,
address: contracts.ChildERC1155Contract,
},
{
// ChildERC1155Predicate token contract
artifact: contractsapi.ChildERC1155Predicate,
address: contracts.ChildERC1155PredicateContract,
},
{
// BLS contract
artifact: contractsapi.BLS,
Expand Down
Loading

0 comments on commit 981ff2a

Please sign in to comment.