Skip to content

Commit

Permalink
apply code review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fbac committed Aug 20, 2024
1 parent dbe971c commit 906c438
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 52 deletions.
2 changes: 2 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,8 @@ func (app *App) BlockedAddrs() map[string]bool {
blockList[addr.String()] = v
}

// Each enabled precompiled stateful contract should be added as a BlockedAddrs.
// That way it's marked as non payable by the bank keeper.
for addr, enabled := range precompiles.EnabledStatefulContracts {
if enabled {
blockList[addr.String()] = enabled
Expand Down
5 changes: 4 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@

* [2654](https://github.com/zeta-chain/node/pull/2654) - add validation for authorization list in when validating genesis state for authorization module

### Tests

* [2703](https://github.com/zeta-chain/node/pull/2703) - add e2e tests for stateful precompiled contracts

## v19.0.0

### Breaking Changes
Expand Down Expand Up @@ -115,7 +119,6 @@
* [2415](https://github.com/zeta-chain/node/pull/2415) - add e2e test for upgrade and test admin functionalities
* [2440](https://github.com/zeta-chain/node/pull/2440) - Add e2e test for TSS migration
* [2473](https://github.com/zeta-chain/node/pull/2473) - add e2e tests for most used admin transactions
* [2703](https://github.com/zeta-chain/node/pull/2703) - add e2e tests for stateful precompiled contracts

### Fixes

Expand Down
14 changes: 6 additions & 8 deletions cmd/zetae2e/local/precompiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ func statefulPrecompilesTestRoutine(
testNames ...string,
) func() error {
return func() (err error) {
account := conf.AdditionalAccounts.UserERC20
account := conf.AdditionalAccounts.UserPrecompile

// initialize runner for erc20 test
erc20Runner, err := initTestRunner(
precompileRunner, err := initTestRunner(
"precompiles",
conf,
deployerRunner,
Expand All @@ -33,23 +32,22 @@ func statefulPrecompilesTestRoutine(
return err
}

erc20Runner.Logger.Print("🏃 starting stateful precompiled contracts tests")
precompileRunner.Logger.Print("🏃 starting stateful precompiled contracts tests")
startTime := time.Now()

// run erc20 test
testsToRun, err := erc20Runner.GetE2ETestsToRunByName(
testsToRun, err := precompileRunner.GetE2ETestsToRunByName(
e2etests.AllE2ETests,
testNames...,
)
if err != nil {
return fmt.Errorf("precompiled contracts tests failed: %v", err)
}

if err := erc20Runner.RunE2ETests(testsToRun); err != nil {
if err := precompileRunner.RunE2ETests(testsToRun); err != nil {
return fmt.Errorf("precompiled contracts tests failed: %v", err)
}

erc20Runner.Logger.Print("🍾 precompiled contracts tests completed in %s", time.Since(startTime).String())
precompileRunner.Logger.Print("🍾 precompiled contracts tests completed in %s", time.Since(startTime).String())

return err
}
Expand Down
86 changes: 44 additions & 42 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,57 +22,59 @@ coverage:
- pkg

comment:
layout: "reach, diff, files"
layout: 'reach, diff, files'
behavior: default
require_changes: true

flags:
zetacore:
paths:
- "x/"
- 'x/'
zetaclient:
paths:
- "zetaclient/"
- 'zetaclient/'
pkg:
paths:
- "pkg/"
- 'pkg/'

ignore:
- "x/**/client/**/*"
- "x/**/keeper/keeper.go"
- "x/**/keeper/msg_server.go"
- "x/**/keeper/grpc_query_params.go"
- "x/**/types/codec.go"
- "x/**/types/errors.go"
- "x/**/types/keys.go"
- "x/**/types/key_*.go"
- "x/**/types/types.go"
- "x/**/types/expected_keepers.go"
- "x/**/module.go"
- "x/**/events.go"
- "x/**/migrator.go"
- "x/**/module_simulation.go"
- "x/**/simulation/**/*"
- "**/*.proto"
- "**/*.md"
- "**/*.yml"
- "**/*.yaml"
- "**/*.pb.go"
- "**/*.pb.gw.go"
- "**/*_legacy.go"
- "**/*.json"
- "zetaclient/testdata/**/*"
- "zetaclient/testutils/**/*"
- ".github"
- "app"
- "cmd"
- "contrib"
- "docs"
- "e2e"
- "proto"
- "rpc"
- "scripts"
- "server"
- "testutil"
- "tool"
- "typescript/**/*"
- 'x/**/client/**/*'
- 'x/**/keeper/keeper.go'
- 'x/**/keeper/msg_server.go'
- 'x/**/keeper/grpc_query_params.go'
- 'x/**/types/codec.go'
- 'x/**/types/errors.go'
- 'x/**/types/keys.go'
- 'x/**/types/key_*.go'
- 'x/**/types/types.go'
- 'x/**/types/expected_keepers.go'
- 'x/**/module.go'
- 'x/**/events.go'
- 'x/**/migrator.go'
- 'x/**/module_simulation.go'
- 'x/**/simulation/**/*'
- '**/*.proto'
- '**/*.md'
- '**/*.yml'
- '**/*.yaml'
- '**/*.pb.go'
- '**/*.pb.gw.go'
- '**/*_legacy.go'
- '**/*.json'
- 'zetaclient/testdata/**/*'
- 'zetaclient/testutils/**/*'
- '.github'
- 'app'
- 'cmd'
- 'contrib'
- 'docs'
- 'e2e'
- 'proto'
- 'rpc'
- 'scripts'
- 'server'
- 'testutil'
- 'tool'
- 'typescript/**/*'
- 'precompiles/**/bindings.go'
- 'precompiles/prototype/IPrototype.*'
1 change: 1 addition & 0 deletions e2e/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ type AdditionalAccounts struct {
UserMisc Account `yaml:"user_misc"`
UserAdmin Account `yaml:"user_admin"`
UserMigration Account `yaml:"user_migration"`
UserPrecompile Account `yaml:"user_precompile"`
}

type PolicyAccounts struct {
Expand Down
2 changes: 1 addition & 1 deletion e2e/e2etests/e2etests.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const (
/*
Stateful precompiled contracts tests
*/
TestZetaPrecompilesPrototypeName = "precompiles_contract_prototype"
TestZetaPrecompilesPrototypeName = "precompile_contracts_prototype"
)

// AllE2ETests is an ordered list of all e2e tests
Expand Down

0 comments on commit 906c438

Please sign in to comment.