Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

global settings role to burn for all #4180

Merged
merged 21 commits into from
Jul 1, 2022
Merged

global settings role to burn for all #4180

merged 21 commits into from
Jul 1, 2022

Conversation

sasurobert
Copy link
Contributor

global settings role to burn for all

@codecov-commenter
Copy link

codecov-commenter commented Jun 8, 2022

Codecov Report

Merging #4180 (2357306) into rc/2022-july (779ac14) will increase coverage by 0.00%.
The diff coverage is 84.72%.

@@              Coverage Diff              @@
##           rc/2022-july    #4180   +/-   ##
=============================================
  Coverage         73.61%   73.62%           
=============================================
  Files               645      645           
  Lines             85227    85299   +72     
=============================================
+ Hits              62744    62804   +60     
- Misses            17809    17815    +6     
- Partials           4674     4680    +6     
Impacted Files Coverage Δ
vm/systemSmartContracts/esdt.go 83.72% <84.72%> (+0.05%) ⬆️
storage/txcache/txListBySenderMap.go 97.50% <0.00%> (-2.50%) ⬇️
p2p/libp2p/netMessenger.go 76.07% <0.00%> (-0.27%) ⬇️
debug/resolver/interceptorResolver.go 79.11% <0.00%> (+1.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 779ac14...2357306. Read the comment docs.

@iulianpascalau iulianpascalau self-requested a review June 16, 2022 12:42
dorin-iancu
dorin-iancu previously approved these changes Jun 16, 2022
@@ -5,6 +5,7 @@ package roles

import (
"encoding/hex"
"github.com/ElrondNetwork/elrond-go/config"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go imports


burnForAllExists := checkIfDefinedRoleExistsInToken(token, []byte(vmcommon.ESDTRoleBurnForAll))
if burnForAllExists {
e.eei.AddReturnMessage("cannot set burn for all as it was already set")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are 2 white spaces in the message between burn and for. Please remove one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


vmInput.CallerAddr = owner
vmInput.Arguments = [][]byte{tokenName}
output = e.Execute(vmInput)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

linter: ineffectual assignment to output (ineffassign)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -2050,6 +2160,9 @@ func (e *esdt) EpochConfirmed(epoch uint32, _ uint64) {

e.flagRegisterAndSetAllRoles.SetValue(epoch >= e.registerAndSetAllRolesEnableEpoch)
log.Debug("ESDT register and set all roles", "enabled", e.flagRegisterAndSetAllRoles.IsSet())

e.flagBurnForAll.SetValue(epoch >= e.burnForAllEnableEpoch)
log.Debug("ESDT register and set all roles", "enabled", e.flagBurnForAll.IsSet())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong log
log.Debug("ESDT burn for all", "enabled", e.flagBurnForAll.IsSet()) *

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return vmcommon.Ok
}

func (e *esdt) setBurnForAll(args *vmcommon.ContractCallInput) vmcommon.ReturnCode {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you rename it to setBurnRoleForAll ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or setBurnRoleGlobally

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


burnForAllExists := checkIfDefinedRoleExistsInToken(token, []byte(vmcommon.ESDTRoleBurnForAll))
if burnForAllExists {
e.eei.AddReturnMessage("cannot set burn for all as it was already set")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cannot set burn for all role as it was already set

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


burnForAllExists := checkIfDefinedRoleExistsInToken(token, []byte(vmcommon.ESDTRoleBurnForAll))
if !burnForAllExists {
e.eei.AddReturnMessage("cannot un set burn for all as it was not set")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cannot unset burn for all role as it was not set

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

gabi-vuls
gabi-vuls previously approved these changes Jun 17, 2022
Copy link
Collaborator

@gabi-vuls gabi-vuls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System test passed.
@@ Log scanner @@

burn-for-all

================================================================================

  • Known Warnings 14
  • New Warnings 4
  • Known Errors 0
  • New Errors 0
  • Panics 0
    ================================================================================

gabi-vuls
gabi-vuls previously approved these changes Jun 20, 2022
Copy link
Collaborator

@gabi-vuls gabi-vuls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System test passed.

dorin-iancu
dorin-iancu previously approved these changes Jun 20, 2022
iulianpascalau
iulianpascalau previously approved these changes Jun 20, 2022
@sasurobert sasurobert changed the base branch from development to rc/2022-july June 30, 2022 07:45
@@ -131,6 +133,7 @@ func NewESDTSmartContract(args ArgsNewESDTSmartContract) (*esdt, error) {
nftCreateONMultiShardEnableEpoch: args.EpochConfig.EnableEpochs.ESDTNFTCreateOnMultiShardEnableEpoch,
metaESDTEnableEpoch: args.EpochConfig.EnableEpochs.MetaESDTSetEnableEpoch,
registerAndSetAllRolesEnableEpoch: args.EpochConfig.EnableEpochs.ESDTRegisterAndSetAllRolesEnableEpoch,
checkMetaESDTOnRolesEnableEpoch: args.EpochConfig.EnableEpochs.ManagedCryptoAPIsEnableEpoch,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need a new flag for this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not the change - line 135 is the change - github is showing it wrong

return e.unSetBurnForAll(args)
case "setBurnRoleGlobally":
return e.setBurnRoleGlobally(args)
case "unsetBurnRoleGlobally":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BUG: add return e.unsetBurnRoleGlobally(args)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nevermind, only Github display issue

@@ -2177,8 +2181,11 @@ func (e *esdt) EpochConfirmed(epoch uint32, _ uint64) {
e.flagRegisterAndSetAllRoles.SetValue(epoch >= e.registerAndSetAllRolesEnableEpoch)
log.Debug("ESDT register and set all roles", "enabled", e.flagRegisterAndSetAllRoles.IsSet())

e.flagCheckMetaESDTOnRolesEnableEpoch.SetValue(epoch >= e.checkMetaESDTOnRolesEnableEpoch)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this flag used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again - github is stupid. this is already in on master.

Copy link
Collaborator

@gabi-vuls gabi-vuls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System test passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants