Merge pull request #3600 from poanetwork/vb-prevent-update-of-validator-with-empty-name

Prevent update validator metadata with empty name from contract
pull/3601/head
Victor Baranov 4 years ago committed by GitHub
commit c6fd17b1f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 7
      apps/explorer/lib/explorer/validator/metadata_importer.ex

@ -5,6 +5,7 @@
- [#3564](https://github.com/poanetwork/blockscout/pull/3564) - Staking welcome message - [#3564](https://github.com/poanetwork/blockscout/pull/3564) - Staking welcome message
### Fixes ### Fixes
- [#3600](https://github.com/poanetwork/blockscout/pull/3600) - Prevent update validator metadata with empty name from contract
- [#3592](https://github.com/poanetwork/blockscout/pull/3592) - Contract interaction: fix nested tuples in the output view, add formatting - [#3592](https://github.com/poanetwork/blockscout/pull/3592) - Contract interaction: fix nested tuples in the output view, add formatting
- [#3583](https://github.com/poanetwork/blockscout/pull/3583) - Reduce RPC requests and DB changes by Staking DApp - [#3583](https://github.com/poanetwork/blockscout/pull/3583) - Reduce RPC requests and DB changes by Staking DApp

@ -9,7 +9,12 @@ defmodule Explorer.Validator.MetadataImporter do
def import_metadata(metadata_maps) do def import_metadata(metadata_maps) do
# Enforce Name ShareLocks order (see docs: sharelocks.md) # Enforce Name ShareLocks order (see docs: sharelocks.md)
ordered_metadata_maps = Enum.sort_by(metadata_maps, &{&1.address_hash, &1.name}) ordered_metadata_maps =
metadata_maps
|> Enum.filter(fn metadata ->
String.trim(metadata.name) !== ""
end)
|> Enum.sort_by(&{&1.address_hash, &1.name})
Repo.transaction(fn -> Enum.each(ordered_metadata_maps, &upsert_validator_metadata(&1)) end) Repo.transaction(fn -> Enum.each(ordered_metadata_maps, &upsert_validator_metadata(&1)) end)
end end

Loading…
Cancel
Save