diff --git a/vm/systemSmartContracts/delegation.go b/vm/systemSmartContracts/delegation.go index d51ac64623..21638c168e 100644 --- a/vm/systemSmartContracts/delegation.go +++ b/vm/systemSmartContracts/delegation.go @@ -1,3 +1,4 @@ +//go:generate protoc -I=proto -I=$GOPATH/src -I=$GOPATH/src/github.com/ElrondNetwork/protobuf/protobuf --gogoslick_out=. delegation.proto package systemSmartContracts import ( @@ -240,27 +241,15 @@ func (d *delegation) init(args *vmcommon.ContractCallInput) vmcommon.ReturnCode return vmcommon.UserError } - withDelegationCap := true - if maxDelegationCap.Cmp(zero) == 0 { - withDelegationCap = false - } - initialOwnerFunds := big.NewInt(0).Set(args.CallValue) - if initialOwnerFunds.Cmp(maxDelegationCap) > 0 && withDelegationCap { - d.eei.AddReturnMessage("call value is higher than max delegation cap") - return vmcommon.UserError - } - ownerAddress = args.CallerAddr d.eei.SetStorage([]byte(core.DelegationSystemSCKey), []byte(core.DelegationSystemSCKey)) d.eei.SetStorage([]byte(ownerKey), ownerAddress) + d.eei.SetStorage([]byte(serviceFeeKey), big.NewInt(0).SetUint64(serviceFee).Bytes()) dConfig := &DelegationConfig{ - OwnerAddress: ownerAddress, - ServiceFee: serviceFee, MaxDelegationCap: maxDelegationCap, InitialOwnerFunds: initialOwnerFunds, AutomaticActivation: false, - WithDelegationCap: withDelegationCap, ChangeableServiceFee: true, CreatedNonce: d.eei.BlockChainHook().CurrentNonce(), UnBondPeriod: d.unBondPeriod, @@ -273,59 +262,116 @@ func (d *delegation) init(args *vmcommon.ContractCallInput) vmcommon.ReturnCode } dStatus := &DelegationContractStatus{ - Delegators: [][]byte{ownerAddress}, + Delegators: [][]byte{}, StakedKeys: make([]*NodesData, 0), NotStakedKeys: make([]*NodesData, 0), UnStakedKeys: make([]*NodesData, 0), } - err = d.saveDelegationStatus(dStatus) + + globalFund := &GlobalFundData{ + ActiveFunds: make([][]byte, 0), + UnStakedFunds: make([][]byte, 0), + TotalUnStakedFromNodes: big.NewInt(0), + TotalUnBondedFromNodes: big.NewInt(0), + TotalActive: big.NewInt(0), + TotalUnStaked: big.NewInt(0), + } + + err = d.saveGlobalFundData(globalFund) if err != nil { d.eei.AddReturnMessage(err.Error()) return vmcommon.UserError } - var fundKey []byte - fundKey, err = d.createAndSaveNextFund(ownerAddress, args.CallValue, active) + return d.delegateUser(initialOwnerFunds, ownerAddress, args.RecipientAddr, dStatus) +} + +func (d *delegation) delegateUser( + callValue *big.Int, + callerAddr []byte, + recipientAddr []byte, + dStatus *DelegationContractStatus, +) vmcommon.ReturnCode { + dConfig, err := d.getDelegationContractConfig() if err != nil { d.eei.AddReturnMessage(err.Error()) return vmcommon.UserError } - - delegator := &DelegatorData{ - ActiveFund: fundKey, - UnStakedFunds: make([][]byte, 0), - RewardsCheckpoint: d.eei.BlockChainHook().CurrentEpoch(), - UnClaimedRewards: big.NewInt(0), + globalFund, err := d.getGlobalFundData() + if err != nil { + d.eei.AddReturnMessage(err.Error()) + return vmcommon.UserError } - globalFund := &GlobalFundData{ - ActiveFunds: make([][]byte, 1), - UnStakedFunds: make([][]byte, 0), - TotalUnStakedFromNodes: big.NewInt(0), - TotalUnBondedFromNodes: big.NewInt(0), - TotalActive: big.NewInt(0).Set(args.CallValue), - TotalUnStaked: big.NewInt(0), + newTotalActive := big.NewInt(0).Add(globalFund.TotalActive, callValue) + withDelegationCap := dConfig.MaxDelegationCap.Cmp(zero) != 0 + if withDelegationCap && newTotalActive.Cmp(dConfig.MaxDelegationCap) > 0 { + d.eei.AddReturnMessage("total delegation cap reached, no more space to accept") + return vmcommon.UserError } - globalFund.ActiveFunds[0] = fundKey - err = d.saveGlobalFundData(globalFund) + + globalFund.TotalActive.Set(newTotalActive) + isNew, delegator, err := d.getOrCreateDelegatorData(callerAddr) if err != nil { d.eei.AddReturnMessage(err.Error()) return vmcommon.UserError } - err = d.saveDelegatorData(ownerAddress, delegator) + if isNew { + delegator.RewardsCheckpoint = d.eei.BlockChainHook().CurrentEpoch() + 1 + delegator.UnClaimedRewards = big.NewInt(0) + } else { + err = d.computeAndUpdateRewards(callerAddr, delegator) + if err != nil { + d.eei.AddReturnMessage(err.Error()) + return vmcommon.UserError + } + } + + if len(delegator.ActiveFund) == 0 { + var fundKey []byte + fundKey, err = d.createAndSaveNextKeyFund(callerAddr, callValue, active) + if err != nil { + d.eei.AddReturnMessage(err.Error()) + return vmcommon.UserError + } + + delegator.ActiveFund = fundKey + d.addNewFundToGlobalData(globalFund, fundKey, active) + if isNew { + err = d.addNewDelegatorToList(dStatus, callerAddr) + if err != nil { + d.eei.AddReturnMessage(err.Error()) + return vmcommon.UserError + } + } + } else { + err = d.addValueToFund(delegator.ActiveFund, callValue) + if err != nil { + d.eei.AddReturnMessage(err.Error()) + return vmcommon.UserError + } + } + + vmOutput, err := d.executeOnAuctionSC(recipientAddr, "stake", nil, callValue) if err != nil { d.eei.AddReturnMessage(err.Error()) return vmcommon.UserError } + if vmOutput.ReturnCode != vmcommon.Ok { + return vmOutput.ReturnCode + } - vmOutput, err := d.executeOnAuctionSC(args.RecipientAddr, "stake", [][]byte{}, args.CallValue) + err = d.saveGlobalFundData(globalFund) if err != nil { d.eei.AddReturnMessage(err.Error()) return vmcommon.UserError } - if vmOutput.ReturnCode != vmcommon.Ok { - return vmOutput.ReturnCode + + err = d.saveDelegatorData(callerAddr, delegator) + if err != nil { + d.eei.AddReturnMessage(err.Error()) + return vmcommon.UserError } return vmcommon.Ok @@ -405,11 +451,16 @@ func (d *delegation) setAutomaticActivation(args *vmcommon.ContractCallInput) vm } func (d *delegation) changeServiceFee(args *vmcommon.ContractCallInput) vmcommon.ReturnCode { - dConfig, returnCode := d.basicArgCheckForConfigChanges(args) + returnCode := d.checkOwnerCallValueGasAndDuplicates(args) if returnCode != vmcommon.Ok { return returnCode } + if len(args.Arguments) != 1 { + d.eei.AddReturnMessage("invalid number of arguments") + return vmcommon.FunctionWrongSignature + } + newServiceFeeBigInt, okConvert := big.NewInt(0).SetString(string(args.Arguments[0]), conversionBase) if !okConvert { d.eei.AddReturnMessage("invalid new service fee") @@ -422,12 +473,7 @@ func (d *delegation) changeServiceFee(args *vmcommon.ContractCallInput) vmcommon return vmcommon.UserError } - dConfig.ServiceFee = newServiceFee - err := d.saveDelegationContractConfig(dConfig) - if err != nil { - d.eei.AddReturnMessage(err.Error()) - return vmcommon.UserError - } + d.eei.SetStorage([]byte(serviceFeeKey), big.NewInt(0).SetUint64(newServiceFee).Bytes()) return vmcommon.Ok } @@ -456,7 +502,6 @@ func (d *delegation) modifyTotalDelegationCap(args *vmcommon.ContractCallInput) } dConfig.MaxDelegationCap = newTotalDelegationCap - dConfig.WithDelegationCap = dConfig.MaxDelegationCap.Cmp(zero) != 0 err = d.saveDelegationContractConfig(dConfig) if err != nil { @@ -850,96 +895,16 @@ func (d *delegation) delegate(args *vmcommon.ContractCallInput) vmcommon.ReturnC return vmcommon.OutOfGas } - dConfig, err := d.getDelegationContractConfig() - if err != nil { - d.eei.AddReturnMessage(err.Error()) - return vmcommon.UserError - } - globalFund, err := d.getGlobalFundData() - if err != nil { - d.eei.AddReturnMessage(err.Error()) - return vmcommon.UserError - } - - newTotalActive := big.NewInt(0).Add(globalFund.TotalActive, args.CallValue) - if dConfig.WithDelegationCap && newTotalActive.Cmp(dConfig.MaxDelegationCap) > 0 { - d.eei.AddReturnMessage("total delegation cap reached, no more space to accept") - return vmcommon.UserError - } - - globalFund.TotalActive.Set(newTotalActive) - isNew, delegator, err := d.getOrCreateDelegatorData(args.CallerAddr) - if err != nil { - d.eei.AddReturnMessage(err.Error()) - return vmcommon.UserError - } - - if isNew { - delegator.RewardsCheckpoint = d.eei.BlockChainHook().CurrentEpoch() + 1 - delegator.UnClaimedRewards = big.NewInt(0) - } else { - err = d.computeAndUpdateRewards(args.CallerAddr, delegator) - if err != nil { - d.eei.AddReturnMessage(err.Error()) - return vmcommon.UserError - } - } - - if len(delegator.ActiveFund) == 0 { - var fundKey []byte - fundKey, err = d.createAndSaveNextFund(args.CallerAddr, args.CallValue, active) - if err != nil { - d.eei.AddReturnMessage(err.Error()) - return vmcommon.UserError - } - - delegator.ActiveFund = fundKey - d.addNewFundToGlobalData(globalFund, fundKey, active) - if isNew { - err = d.addNewDelegatorToList(args.CallerAddr) - if err != nil { - d.eei.AddReturnMessage(err.Error()) - return vmcommon.UserError - } - } - } else { - err = d.addValueToFund(delegator.ActiveFund, args.CallValue) - if err != nil { - d.eei.AddReturnMessage(err.Error()) - return vmcommon.UserError - } - } - - vmOutput, err := d.executeOnAuctionSC(args.RecipientAddr, "stake", nil, args.CallValue) - if err != nil { - d.eei.AddReturnMessage(err.Error()) - return vmcommon.UserError - } - if vmOutput.ReturnCode != vmcommon.Ok { - return vmOutput.ReturnCode - } - - err = d.saveGlobalFundData(globalFund) - if err != nil { - d.eei.AddReturnMessage(err.Error()) - return vmcommon.UserError - } - - err = d.saveDelegatorData(args.CallerAddr, delegator) + dStatus, err := d.getDelegationStatus() if err != nil { d.eei.AddReturnMessage(err.Error()) return vmcommon.UserError } - return vmcommon.Ok + return d.delegateUser(args.CallValue, args.CallerAddr, args.RecipientAddr, dStatus) } -func (d *delegation) addNewDelegatorToList(address []byte) error { - dStatus, err := d.getDelegationStatus() - if err != nil { - return err - } - +func (d *delegation) addNewDelegatorToList(dStatus *DelegationContractStatus, address []byte) error { dStatus.Delegators = append(dStatus.Delegators, address) return d.saveDelegationStatus(dStatus) @@ -1106,7 +1071,7 @@ func (d *delegation) unDelegate(args *vmcommon.ContractCallInput) vmcommon.Retur return vmcommon.UserError } - unStakedFundKey, err := d.createAndSaveNextFund(args.CallerAddr, actualUserUnStake, unStaked) + unStakedFundKey, err := d.createAndSaveNextKeyFund(args.CallerAddr, actualUserUnStake, unStaked) if err != nil { d.eei.AddReturnMessage(err.Error()) return vmcommon.UserError @@ -1670,7 +1635,7 @@ func (d *delegation) getContractConfig(args *vmcommon.ContractCallInput) vmcommo } withDelegationCap := "false" - if delegationConfig.WithDelegationCap { + if delegationConfig.MaxDelegationCap.Cmp(zero) != 0 { withDelegationCap = "true" } @@ -1679,8 +1644,11 @@ func (d *delegation) getContractConfig(args *vmcommon.ContractCallInput) vmcommo changeableServiceFee = "true" } - d.eei.Finish(delegationConfig.OwnerAddress) - d.eei.Finish(big.NewInt(0).SetUint64(delegationConfig.ServiceFee).Bytes()) + ownerAddress := d.eei.GetStorage([]byte(ownerKey)) + serviceFee := d.eei.GetStorage([]byte(serviceFeeKey)) + + d.eei.Finish(ownerAddress) + d.eei.Finish(serviceFee) d.eei.Finish(delegationConfig.MaxDelegationCap.Bytes()) d.eei.Finish(delegationConfig.InitialOwnerFunds.Bytes()) d.eei.Finish([]byte(automaticActivation)) @@ -1849,7 +1817,6 @@ func (d *delegation) saveDelegationContractConfig(dConfig *DelegationConfig) err } d.eei.SetStorage([]byte(delegationConfigKey), marshaledData) - d.eei.SetStorage([]byte(serviceFeeKey), big.NewInt(0).SetUint64(dConfig.ServiceFee).Bytes()) return nil } @@ -1920,8 +1887,8 @@ func (d *delegation) getFund(key []byte) (*Fund, error) { return dFund, nil } -func (d *delegation) createAndSaveNextFund(address []byte, value *big.Int, fundType uint32) ([]byte, error) { - fundKey, fund := d.createNextFund(address, value, fundType) +func (d *delegation) createAndSaveNextKeyFund(address []byte, value *big.Int, fundType uint32) ([]byte, error) { + fundKey, fund := d.createNextKeyFund(address, value, fundType) err := d.saveFund(fundKey, fund) if err != nil { return nil, err @@ -1946,13 +1913,13 @@ func (d *delegation) saveFund(key []byte, dFund *Fund) error { return nil } -func (d *delegation) createNextFund(address []byte, value *big.Int, fundType uint32) ([]byte, *Fund) { - nextKey := big.NewInt(1).Bytes() +func (d *delegation) createNextKeyFund(address []byte, value *big.Int, fundType uint32) ([]byte, *Fund) { + nextKey := big.NewInt(1) lastKey := d.eei.GetStorage([]byte(lastFundKey)) if len(lastKey) > len(fundKeyPrefix) { lastIndex := big.NewInt(0).SetBytes(lastKey[len(fundKeyPrefix):]) lastIndex.Add(lastIndex, big.NewInt(1)) - nextKey = lastIndex.Bytes() + nextKey = lastIndex } fund := &Fund{ @@ -1962,7 +1929,7 @@ func (d *delegation) createNextFund(address []byte, value *big.Int, fundType uin Type: fundType, } - fundKey := append([]byte(fundKeyPrefix), nextKey...) + fundKey := append([]byte(fundKeyPrefix), nextKey.Bytes()...) return fundKey, fund } diff --git a/vm/systemSmartContracts/delegation.pb.go b/vm/systemSmartContracts/delegation.pb.go index b019226e0b..758ad6e903 100644 --- a/vm/systemSmartContracts/delegation.pb.go +++ b/vm/systemSmartContracts/delegation.pb.go @@ -147,15 +147,12 @@ func (m *DelegationContractList) GetAddresses() [][]byte { } type DelegationConfig struct { - OwnerAddress []byte `protobuf:"bytes,1,opt,name=OwnerAddress,proto3" json:"OwnerAddress"` - ServiceFee uint64 `protobuf:"varint,2,opt,name=ServiceFee,proto3" json:"ServiceFee"` - MaxDelegationCap *math_big.Int `protobuf:"bytes,3,opt,name=MaxDelegationCap,proto3,casttypewith=math/big.Int;github.com/ElrondNetwork/elrond-go/data.BigIntCaster" json:"MaxDelegationCap"` - InitialOwnerFunds *math_big.Int `protobuf:"bytes,4,opt,name=InitialOwnerFunds,proto3,casttypewith=math/big.Int;github.com/ElrondNetwork/elrond-go/data.BigIntCaster" json:"InitialOwnerFunds"` - AutomaticActivation bool `protobuf:"varint,5,opt,name=AutomaticActivation,proto3" json:"AutomaticActivation"` - WithDelegationCap bool `protobuf:"varint,6,opt,name=WithDelegationCap,proto3" json:"WithDelegationCap"` - ChangeableServiceFee bool `protobuf:"varint,7,opt,name=ChangeableServiceFee,proto3" json:"ChangeableServiceFee"` - CreatedNonce uint64 `protobuf:"varint,8,opt,name=CreatedNonce,proto3" json:"CreatedNonce"` - UnBondPeriod uint64 `protobuf:"varint,9,opt,name=UnBondPeriod,proto3" json:"UnBondPeriod"` + MaxDelegationCap *math_big.Int `protobuf:"bytes,1,opt,name=MaxDelegationCap,proto3,casttypewith=math/big.Int;github.com/ElrondNetwork/elrond-go/data.BigIntCaster" json:"MaxDelegationCap"` + InitialOwnerFunds *math_big.Int `protobuf:"bytes,2,opt,name=InitialOwnerFunds,proto3,casttypewith=math/big.Int;github.com/ElrondNetwork/elrond-go/data.BigIntCaster" json:"InitialOwnerFunds"` + AutomaticActivation bool `protobuf:"varint,3,opt,name=AutomaticActivation,proto3" json:"AutomaticActivation"` + ChangeableServiceFee bool `protobuf:"varint,4,opt,name=ChangeableServiceFee,proto3" json:"ChangeableServiceFee"` + CreatedNonce uint64 `protobuf:"varint,5,opt,name=CreatedNonce,proto3" json:"CreatedNonce"` + UnBondPeriod uint64 `protobuf:"varint,6,opt,name=UnBondPeriod,proto3" json:"UnBondPeriod"` } func (m *DelegationConfig) Reset() { *m = DelegationConfig{} } @@ -186,20 +183,6 @@ func (m *DelegationConfig) XXX_DiscardUnknown() { var xxx_messageInfo_DelegationConfig proto.InternalMessageInfo -func (m *DelegationConfig) GetOwnerAddress() []byte { - if m != nil { - return m.OwnerAddress - } - return nil -} - -func (m *DelegationConfig) GetServiceFee() uint64 { - if m != nil { - return m.ServiceFee - } - return 0 -} - func (m *DelegationConfig) GetMaxDelegationCap() *math_big.Int { if m != nil { return m.MaxDelegationCap @@ -221,13 +204,6 @@ func (m *DelegationConfig) GetAutomaticActivation() bool { return false } -func (m *DelegationConfig) GetWithDelegationCap() bool { - if m != nil { - return m.WithDelegationCap - } - return false -} - func (m *DelegationConfig) GetChangeableServiceFee() bool { if m != nil { return m.ChangeableServiceFee @@ -634,77 +610,74 @@ func init() { func init() { proto.RegisterFile("delegation.proto", fileDescriptor_b823c7d67e95582e) } var fileDescriptor_b823c7d67e95582e = []byte{ - // 1115 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xcf, 0x6b, 0xe3, 0x46, - 0x14, 0xb6, 0xfc, 0x23, 0x9b, 0x4c, 0xe2, 0x34, 0x99, 0xcd, 0x6e, 0x4d, 0x29, 0x52, 0x30, 0x14, - 0x02, 0x65, 0x1d, 0xb6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0x8e, 0xa2, 0xd0, 0x4a, 0x10, 0x92, 0x3c, 0xd5, 0xed, 0xa8, 0xc5, - 0x5d, 0x8f, 0x39, 0x47, 0x81, 0x9b, 0x74, 0x22, 0xb8, 0x1d, 0x4d, 0x40, 0x32, 0x1d, 0x56, 0x2f, - 0xf3, 0xe8, 0x5e, 0x5c, 0x12, 0x75, 0xd1, 0x1f, 0x0c, 0x25, 0x1c, 0x26, 0xf0, 0xa9, 0xef, 0x0c, - 0x74, 0x37, 0x29, 0x96, 0x63, 0xb1, 0xcf, 0x03, 0xe9, 0xf3, 0xf6, 0x50, 0x8e, 0x7b, 0xe8, 0x0b, - 0x75, 0x54, 0x2f, 0x70, 0x67, 0x13, 0x82, 0x45, 0xcc, 0xb3, 0xf2, 0xe7, 0x5f, 0x97, 0xfc, 0xe9, - 0x5b, 0x5f, 0xe1, 0xbf, 0x6e, 0x7d, 0x76, 0xf3, 0xf2, 0xda, 0xcc, 0x5d, 0x5d, 0x9b, 0xb9, 0x57, - 0xd7, 0xa6, 0xf1, 0xf5, 0xc8, 0x34, 0x7e, 0x1e, 0x99, 0xc6, 0x6f, 0x23, 0xd3, 0xb8, 0x1c, 0x99, - 0xc6, 0xd5, 0xc8, 0x34, 0xfe, 0x1a, 0x99, 0xc6, 0xdf, 0x23, 0x33, 0xf7, 0x6a, 0x64, 0x1a, 0xdf, - 0xdf, 0x98, 0xb9, 0xcb, 0x1b, 0x33, 0x77, 0x75, 0x63, 0xe6, 0x9e, 0x6f, 0x05, 0x17, 0x81, 0x64, - 0xfd, 0x56, 0x9f, 0xfa, 0x72, 0xf2, 0x4f, 0xa5, 0xbd, 0x04, 0xe7, 0xde, 0xfb, 0xff, 0x06, 0x00, - 0x00, 0xff, 0xff, 0x13, 0x51, 0x1f, 0xaf, 0x4f, 0x0d, 0x00, 0x00, + // 1070 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0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x20, 0x9e, 0x0e, 0x6b, 0x57, 0x0b, 0x70, + 0x3f, 0x39, 0x12, 0x0d, 0x31, 0x18, 0x06, 0x52, 0x5d, 0x26, 0xea, 0x53, 0x3f, 0x18, 0x70, 0x2f, + 0x3d, 0x2c, 0xc7, 0xe2, 0x80, 0xf9, 0xd2, 0x63, 0xdd, 0x40, 0x8e, 0x7b, 0xe8, 0xcb, 0xf8, 0x96, + 0x9d, 0xe3, 0x2e, 0x26, 0x05, 0xf3, 0x98, 0xf3, 0xe5, 0x5f, 0xf8, 0xbf, 0xca, 0x5f, 0x07, 0x98, + 0x79, 0x48, 0x27, 0x37, 0xe1, 0xf4, 0x39, 0xa0, 0x8d, 0xed, 0xf6, 0xd5, 0x8d, 0x59, 0xba, 0xbe, + 0x31, 0x4b, 0x6f, 0x6e, 0x4c, 0xe3, 0xdb, 0x91, 0x69, 0xfc, 0x3a, 0x32, 0x8d, 0xdf, 0x47, 0xa6, + 0x71, 0x35, 0x32, 0x8d, 0xeb, 0x91, 0x69, 0xfc, 0x35, 0x32, 0x8d, 0xbf, 0x47, 0x66, 0xe9, 0xcd, + 0xc8, 0x34, 0x7e, 0xbc, 0x35, 0x4b, 0x57, 0xb7, 0x66, 0xe9, 0xfa, 0xd6, 0x2c, 0xbd, 0xd8, 0xf6, + 0x2f, 0x7d, 0x49, 0x07, 0x9d, 0x01, 0xf1, 0xe4, 0xe4, 0xf9, 0xdf, 0x5d, 0x56, 0xf7, 0xde, 0x47, + 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x3c, 0x08, 0xdf, 0x92, 0xa4, 0x0c, 0x00, 0x00, } func (this *DelegationManagement) Equal(that interface{}) bool { @@ -800,12 +773,6 @@ func (this *DelegationConfig) Equal(that interface{}) bool { } else if this == nil { return false } - if !bytes.Equal(this.OwnerAddress, that1.OwnerAddress) { - return false - } - if this.ServiceFee != that1.ServiceFee { - return false - } { __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} if !__caster.Equal(this.MaxDelegationCap, that1.MaxDelegationCap) { @@ -821,9 +788,6 @@ func (this *DelegationConfig) Equal(that interface{}) bool { if this.AutomaticActivation != that1.AutomaticActivation { return false } - if this.WithDelegationCap != that1.WithDelegationCap { - return false - } if this.ChangeableServiceFee != that1.ChangeableServiceFee { return false } @@ -1118,14 +1082,11 @@ func (this *DelegationConfig) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 13) + s := make([]string, 0, 10) s = append(s, "&systemSmartContracts.DelegationConfig{") - s = append(s, "OwnerAddress: "+fmt.Sprintf("%#v", this.OwnerAddress)+",\n") - s = append(s, "ServiceFee: "+fmt.Sprintf("%#v", this.ServiceFee)+",\n") s = append(s, "MaxDelegationCap: "+fmt.Sprintf("%#v", this.MaxDelegationCap)+",\n") s = append(s, "InitialOwnerFunds: "+fmt.Sprintf("%#v", this.InitialOwnerFunds)+",\n") s = append(s, "AutomaticActivation: "+fmt.Sprintf("%#v", this.AutomaticActivation)+",\n") - s = append(s, "WithDelegationCap: "+fmt.Sprintf("%#v", this.WithDelegationCap)+",\n") s = append(s, "ChangeableServiceFee: "+fmt.Sprintf("%#v", this.ChangeableServiceFee)+",\n") s = append(s, "CreatedNonce: "+fmt.Sprintf("%#v", this.CreatedNonce)+",\n") s = append(s, "UnBondPeriod: "+fmt.Sprintf("%#v", this.UnBondPeriod)+",\n") @@ -1345,12 +1306,12 @@ func (m *DelegationConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m.UnBondPeriod != 0 { i = encodeVarintDelegation(dAtA, i, uint64(m.UnBondPeriod)) i-- - dAtA[i] = 0x48 + dAtA[i] = 0x30 } if m.CreatedNonce != 0 { i = encodeVarintDelegation(dAtA, i, uint64(m.CreatedNonce)) i-- - dAtA[i] = 0x40 + dAtA[i] = 0x28 } if m.ChangeableServiceFee { i-- @@ -1360,17 +1321,7 @@ func (m *DelegationConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0 } i-- - dAtA[i] = 0x38 - } - if m.WithDelegationCap { - i-- - if m.WithDelegationCap { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x30 + dAtA[i] = 0x20 } if m.AutomaticActivation { i-- @@ -1380,7 +1331,7 @@ func (m *DelegationConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0 } i-- - dAtA[i] = 0x28 + dAtA[i] = 0x18 } { __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} @@ -1392,7 +1343,7 @@ func (m *DelegationConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintDelegation(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 + dAtA[i] = 0x12 { __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} size := __caster.Size(m.MaxDelegationCap) @@ -1403,19 +1354,7 @@ func (m *DelegationConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintDelegation(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a - if m.ServiceFee != 0 { - i = encodeVarintDelegation(dAtA, i, uint64(m.ServiceFee)) - i-- - dAtA[i] = 0x10 - } - if len(m.OwnerAddress) > 0 { - i -= len(m.OwnerAddress) - copy(dAtA[i:], m.OwnerAddress) - i = encodeVarintDelegation(dAtA, i, uint64(len(m.OwnerAddress))) - i-- - dAtA[i] = 0xa - } + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -1835,13 +1774,6 @@ func (m *DelegationConfig) Size() (n int) { } var l int _ = l - l = len(m.OwnerAddress) - if l > 0 { - n += 1 + l + sovDelegation(uint64(l)) - } - if m.ServiceFee != 0 { - n += 1 + sovDelegation(uint64(m.ServiceFee)) - } { __caster := &github_com_ElrondNetwork_elrond_go_data.BigIntCaster{} l = __caster.Size(m.MaxDelegationCap) @@ -1855,9 +1787,6 @@ func (m *DelegationConfig) Size() (n int) { if m.AutomaticActivation { n += 2 } - if m.WithDelegationCap { - n += 2 - } if m.ChangeableServiceFee { n += 2 } @@ -2070,12 +1999,9 @@ func (this *DelegationConfig) String() string { return "nil" } s := strings.Join([]string{`&DelegationConfig{`, - `OwnerAddress:` + fmt.Sprintf("%v", this.OwnerAddress) + `,`, - `ServiceFee:` + fmt.Sprintf("%v", this.ServiceFee) + `,`, `MaxDelegationCap:` + fmt.Sprintf("%v", this.MaxDelegationCap) + `,`, `InitialOwnerFunds:` + fmt.Sprintf("%v", this.InitialOwnerFunds) + `,`, `AutomaticActivation:` + fmt.Sprintf("%v", this.AutomaticActivation) + `,`, - `WithDelegationCap:` + fmt.Sprintf("%v", this.WithDelegationCap) + `,`, `ChangeableServiceFee:` + fmt.Sprintf("%v", this.ChangeableServiceFee) + `,`, `CreatedNonce:` + fmt.Sprintf("%v", this.CreatedNonce) + `,`, `UnBondPeriod:` + fmt.Sprintf("%v", this.UnBondPeriod) + `,`, @@ -2518,59 +2444,6 @@ func (m *DelegationConfig) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OwnerAddress", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDelegation - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthDelegation - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthDelegation - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OwnerAddress = append(m.OwnerAddress[:0], dAtA[iNdEx:postIndex]...) - if m.OwnerAddress == nil { - m.OwnerAddress = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceFee", wireType) - } - m.ServiceFee = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDelegation - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ServiceFee |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MaxDelegationCap", wireType) } @@ -2608,7 +2481,7 @@ func (m *DelegationConfig) Unmarshal(dAtA []byte) error { } } iNdEx = postIndex - case 4: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field InitialOwnerFunds", wireType) } @@ -2646,7 +2519,7 @@ func (m *DelegationConfig) Unmarshal(dAtA []byte) error { } } iNdEx = postIndex - case 5: + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field AutomaticActivation", wireType) } @@ -2666,27 +2539,7 @@ func (m *DelegationConfig) Unmarshal(dAtA []byte) error { } } m.AutomaticActivation = bool(v != 0) - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field WithDelegationCap", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDelegation - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.WithDelegationCap = bool(v != 0) - case 7: + case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ChangeableServiceFee", wireType) } @@ -2706,7 +2559,7 @@ func (m *DelegationConfig) Unmarshal(dAtA []byte) error { } } m.ChangeableServiceFee = bool(v != 0) - case 8: + case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field CreatedNonce", wireType) } @@ -2725,7 +2578,7 @@ func (m *DelegationConfig) Unmarshal(dAtA []byte) error { break } } - case 9: + case 6: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field UnBondPeriod", wireType) } diff --git a/vm/systemSmartContracts/delegationManager_test.go b/vm/systemSmartContracts/delegationManager_test.go index 918cff4636..c6884e4d9d 100644 --- a/vm/systemSmartContracts/delegationManager_test.go +++ b/vm/systemSmartContracts/delegationManager_test.go @@ -398,8 +398,10 @@ func TestDelegationManagerSystemSC_ExecuteCreateNewDelegationContract(t *testing delegationSc := systemSc.(*delegation) eei.scAddress = createNewAddress(vm.FirstDelegationSCAddress) dContractConfig, _ := delegationSc.getDelegationContractConfig() - assert.Equal(t, vmInput.CallerAddr, dContractConfig.OwnerAddress) - assert.Equal(t, uint64(10), dContractConfig.ServiceFee) + retrievedOwnerAddress := eei.GetStorage([]byte(ownerKey)) + retrievedServiceFee := eei.GetStorage([]byte(serviceFeeKey)) + assert.Equal(t, vmInput.CallerAddr, retrievedOwnerAddress) + assert.Equal(t, []byte{10}, retrievedServiceFee) assert.Equal(t, big.NewInt(250), dContractConfig.MaxDelegationCap) } diff --git a/vm/systemSmartContracts/delegation_test.go b/vm/systemSmartContracts/delegation_test.go index b81d9c3c35..afebe9922d 100644 --- a/vm/systemSmartContracts/delegation_test.go +++ b/vm/systemSmartContracts/delegation_test.go @@ -354,13 +354,13 @@ func TestDelegationSystemSC_ExecuteInitCallValueHigherThanMaxDelegationCapShould output := d.Execute(vmInput) assert.Equal(t, vmcommon.UserError, output) - assert.True(t, strings.Contains(eei.returnMessage, "call value is higher than max delegation cap")) + assert.True(t, strings.Contains(eei.returnMessage, "total delegation cap reached, no more space to accept")) } func TestDelegationSystemSC_ExecuteInitShouldWork(t *testing.T) { t.Parallel() - ownerAddr := []byte("owner") + ownerAddr := []byte("ownerAddr") maxDelegationCap := []byte{250} serviceFee := []byte{10} createdNonce := uint64(150) @@ -384,17 +384,20 @@ func TestDelegationSystemSC_ExecuteInitShouldWork(t *testing.T) { vmInput := getDefaultVmInputForFunc(core.SCDeployInitFunctionName, [][]byte{maxDelegationCap, serviceFee}) vmInput.CallValue = callValue vmInput.RecipientAddr = createNewAddress(vm.FirstDelegationSCAddress) + vmInput.CallerAddr = ownerAddr output := d.Execute(vmInput) assert.Equal(t, vmcommon.Ok, output) + retrievedOwnerAddress := d.eei.GetStorage([]byte(ownerKey)) + retrievedServiceFee := d.eei.GetStorage([]byte(serviceFeeKey)) + dConf, err := d.getDelegationContractConfig() assert.Nil(t, err) - assert.Equal(t, ownerAddr, dConf.OwnerAddress) + assert.Equal(t, ownerAddr, retrievedOwnerAddress) assert.Equal(t, big.NewInt(250), dConf.MaxDelegationCap) - assert.Equal(t, big.NewInt(10).Uint64(), dConf.ServiceFee) + assert.Equal(t, []byte{10}, retrievedServiceFee) assert.Equal(t, createdNonce, dConf.CreatedNonce) assert.Equal(t, big.NewInt(20).Uint64(), dConf.UnBondPeriod) - assert.True(t, dConf.WithDelegationCap) dStatus, err := d.getDelegationStatus() assert.Nil(t, err) @@ -1434,7 +1437,13 @@ func TestDelegationSystemSC_ExecuteDelegateWrongInit(t *testing.T) { output := d.Execute(vmInput) assert.Equal(t, vmcommon.UserError, output) - expectedErr := fmt.Errorf("%w delegation contract config", vm.ErrDataNotFoundUnderKey) + expectedErr := fmt.Errorf("%w delegation status", vm.ErrDataNotFoundUnderKey) + assert.True(t, strings.Contains(eei.returnMessage, expectedErr.Error())) + + _ = d.saveDelegationStatus(&DelegationContractStatus{}) + output = d.Execute(vmInput) + assert.Equal(t, vmcommon.UserError, output) + expectedErr = fmt.Errorf("%w delegation contract config", vm.ErrDataNotFoundUnderKey) assert.True(t, strings.Contains(eei.returnMessage, expectedErr.Error())) _ = d.saveDelegationContractConfig(&DelegationConfig{}) @@ -1466,8 +1475,7 @@ func TestDelegationSystemSC_ExecuteDelegate(t *testing.T) { _ = d.saveDelegationStatus(&DelegationContractStatus{}) _ = d.saveDelegationContractConfig(&DelegationConfig{ - WithDelegationCap: true, - MaxDelegationCap: big.NewInt(100), + MaxDelegationCap: big.NewInt(100), }) _ = d.saveGlobalFundData(&GlobalFundData{ TotalActive: big.NewInt(100), @@ -1862,16 +1870,9 @@ func TestDelegationSystemSC_ExecuteChangeServiceFeeUserErrors(t *testing.T) { vmInput.Arguments = [][]byte{newServiceFee, []byte("wrong arg")} output = d.Execute(vmInput) - assert.Equal(t, vmcommon.UserError, output) + assert.Equal(t, vmcommon.FunctionWrongSignature, output) assert.True(t, strings.Contains(eei.returnMessage, "invalid number of arguments")) - vmInput.Arguments = [][]byte{newServiceFee} - output = d.Execute(vmInput) - assert.Equal(t, vmcommon.UserError, output) - expectedErr := fmt.Errorf("%w delegation contract config", vm.ErrDataNotFoundUnderKey) - assert.True(t, strings.Contains(eei.returnMessage, expectedErr.Error())) - - _ = d.saveDelegationContractConfig(&DelegationConfig{}) vmInput.Arguments = [][]byte{[]byte("service fee")} output = d.Execute(vmInput) assert.Equal(t, vmcommon.UserError, output) @@ -1913,8 +1914,8 @@ func TestDelegationSystemSC_ExecuteChangeServiceFee(t *testing.T) { output := d.Execute(vmInput) assert.Equal(t, vmcommon.Ok, output) - dConfig, _ := d.getDelegationContractConfig() - assert.Equal(t, uint64(70), dConfig.ServiceFee) + retrievedServiceFee := d.eei.GetStorage([]byte(serviceFeeKey)) + assert.Equal(t, []byte{70}, retrievedServiceFee) } func TestDelegationSystemSC_ExecuteModifyTotalDelegationCapUserErrors(t *testing.T) { @@ -2019,7 +2020,6 @@ func TestDelegationSystemSC_ExecuteModifyTotalDelegationCap(t *testing.T) { dConfig, _ := d.getDelegationContractConfig() assert.Equal(t, big.NewInt(1500), dConfig.MaxDelegationCap) - assert.Equal(t, true, dConfig.WithDelegationCap) } func TestDelegation_getSuccessAndUnSuccessKeysAllUnSuccess(t *testing.T) { @@ -3357,16 +3357,15 @@ func TestDelegation_ExecuteGetContractConfig(t *testing.T) { createdNonce := uint64(100) unBondPeriod := uint64(144000) _ = d.saveDelegationContractConfig(&DelegationConfig{ - OwnerAddress: ownerAddress, - ServiceFee: serviceFee, MaxDelegationCap: maxDelegationCap, InitialOwnerFunds: initialOwnerFunds, AutomaticActivation: false, - WithDelegationCap: true, ChangeableServiceFee: true, CreatedNonce: createdNonce, UnBondPeriod: unBondPeriod, }) + eei.SetStorage([]byte(ownerKey), ownerAddress) + eei.SetStorage([]byte(serviceFeeKey), big.NewInt(0).SetUint64(serviceFee).Bytes()) output := d.Execute(vmInput) assert.Equal(t, vmcommon.Ok, output) diff --git a/vm/systemSmartContracts/proto/delegation.proto b/vm/systemSmartContracts/proto/delegation.proto index 33c414c37e..ab569270a5 100644 --- a/vm/systemSmartContracts/proto/delegation.proto +++ b/vm/systemSmartContracts/proto/delegation.proto @@ -21,15 +21,12 @@ message DelegationContractList { } message DelegationConfig { - bytes OwnerAddress = 1 [(gogoproto.jsontag) = "OwnerAddress"]; - uint64 ServiceFee = 2 [(gogoproto.jsontag) = "ServiceFee"]; - bytes MaxDelegationCap = 3 [(gogoproto.jsontag) = "MaxDelegationCap", (gogoproto.casttypewith) = "math/big.Int;github.com/ElrondNetwork/elrond-go/data.BigIntCaster"]; - bytes InitialOwnerFunds = 4 [(gogoproto.jsontag) = "InitialOwnerFunds", (gogoproto.casttypewith) = "math/big.Int;github.com/ElrondNetwork/elrond-go/data.BigIntCaster"]; - bool AutomaticActivation = 5 [(gogoproto.jsontag) = "AutomaticActivation"]; - bool WithDelegationCap = 6 [(gogoproto.jsontag) = "WithDelegationCap"]; - bool ChangeableServiceFee = 7 [(gogoproto.jsontag) = "ChangeableServiceFee"]; - uint64 CreatedNonce = 8 [(gogoproto.jsontag) = "CreatedNonce"]; - uint64 UnBondPeriod = 9 [(gogoproto.jsontag) = "UnBondPeriod"]; + bytes MaxDelegationCap = 1 [(gogoproto.jsontag) = "MaxDelegationCap", (gogoproto.casttypewith) = "math/big.Int;github.com/ElrondNetwork/elrond-go/data.BigIntCaster"]; + bytes InitialOwnerFunds = 2 [(gogoproto.jsontag) = "InitialOwnerFunds", (gogoproto.casttypewith) = "math/big.Int;github.com/ElrondNetwork/elrond-go/data.BigIntCaster"]; + bool AutomaticActivation = 3 [(gogoproto.jsontag) = "AutomaticActivation"]; + bool ChangeableServiceFee = 4 [(gogoproto.jsontag) = "ChangeableServiceFee"]; + uint64 CreatedNonce = 5 [(gogoproto.jsontag) = "CreatedNonce"]; + uint64 UnBondPeriod = 6 [(gogoproto.jsontag) = "UnBondPeriod"]; } message DelegationContractStatus {