Skip to content

Commit

Permalink
refactor: rename unbingingepoch to unbondingPeriod
Browse files Browse the repository at this point in the history
  • Loading branch information
trestinlsd committed May 30, 2024
1 parent 3366e38 commit 3df137e
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 475 deletions.
2 changes: 1 addition & 1 deletion precompiles/avs/abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
{
"internalType": "uint64",
"name": "unbondingEpochs",
"name": "unbondingPeriod",
"type": "uint64"
}
],
Expand Down
2 changes: 1 addition & 1 deletion precompiles/avs/avs.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface IAVSManager {
string[] memory assetID,
uint64 action,
uint64 minimumDelegation,
uint64 unbondingEpochs
uint64 unbondingPeriod
) external returns (bool success);


Expand Down
6 changes: 3 additions & 3 deletions precompiles/avs/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ func (p Precompile) GetAVSParamsFromInputs(_ sdk.Context, args []interface{}) (*
}
avsParams.MinimumDelegation = minimumDelegation

unbondingEpochs, ok := args[6].(uint64)
unbondingPeriod, ok := args[6].(uint64)
if !ok || (action != avstypes.RegisterAction && action != avstypes.DeRegisterAction) {
return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 6, "uint64", unbondingEpochs)
return nil, xerrors.Errorf(exocmn.ErrContractInputParaOrType, 6, "uint64", unbondingPeriod)
}
avsParams.UnbondingEpochs = unbondingEpochs
avsParams.UnbondingPeriod = unbondingPeriod

return avsParams, nil
}
2 changes: 1 addition & 1 deletion precompiles/avsTask/task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (s *TaskPrecompileTestSuite) TestRunRegTaskinfo() {
SlashAddr: slashAddress,
AvsOwnerAddress: avsOwnerAddress,
AssetId: assetID,
AvsUnbondingEpochs: uint32(7),
AvsUnbondingPeriod: uint32(7),
MinimumDelegation: sdk.NewIntFromUint64(10),
AvsEpoch: nil,
OperatorAddress: nil,
Expand Down
15 changes: 1 addition & 14 deletions proto/exocore/avs/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ message AVSInfo {
// asset_basic_info is all the basic asset information of the avs.
repeated string asset_id = 5;
// unbonding duration of avs.
uint32 avs_unbonding_epochs = 6;
uint32 avs_unbonding_period = 6;
// the operator minimum delegation amount.
string minimum_delegation = 7
[
Expand All @@ -34,19 +34,6 @@ message AVSInfo {
// registered operator of avs
repeated string operator_address = 9;
}
// The information of OperatorBindingAVSInfo in opt-in avs
message OperatorBindingAVSInfo {
// name of Operator
string name = 1;
// address of Operator
string operator_address = 2;
// publicKey of Operator
string bls_public_key =3 ;
// reg flag
bool is_registered =4;
// status of operator
string status = 5;
}

// EpochInfo defines the message interface containing the relevant informations aboutt
// an epoch.
Expand Down
8 changes: 4 additions & 4 deletions x/avs/keeper/avs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (suite *AVSTestSuite) TestAVS() {
SlashAddr: slashAddress,
AvsOwnerAddress: avsOwnerAddress,
AssetId: assetID,
AvsUnbondingEpochs: uint32(7),
AvsUnbondingPeriod: uint32(7),
MinimumDelegation: sdk.NewIntFromUint64(10),
AvsEpoch: nil,
OperatorAddress: nil,
Expand Down Expand Up @@ -48,7 +48,7 @@ func (suite *AVSTestSuite) TestAVSInfoUpdate_Register() {
AvsOwnerAddress: avsOwnerAddress,
AssetID: assetID,
MinimumDelegation: uint64(10),
UnbondingEpochs: uint64(7),
UnbondingPeriod: uint64(7),
SlashContractAddr: slashAddress,
OperatorAddress: nil,
}
Expand Down Expand Up @@ -79,7 +79,7 @@ func (suite *AVSTestSuite) TestAVSInfoUpdate_DeRegister() {
AvsOwnerAddress: avsOwnerAddress,
AssetID: assetID,
MinimumDelegation: uint64(10),
UnbondingEpochs: uint64(7),
UnbondingPeriod: uint64(7),
SlashContractAddr: slashAddress,
OperatorAddress: nil,
}
Expand Down Expand Up @@ -147,7 +147,7 @@ func (suite *AVSTestSuite) TestAVSInfoUpdateWithOperator_Register() {
AvsOwnerAddress: avsOwnerAddress,
AssetID: assetID,
MinimumDelegation: uint64(10),
UnbondingEpochs: uint64(7),
UnbondingPeriod: uint64(7),
SlashContractAddr: slashAddress,
OperatorAddress: nil,
}
Expand Down
8 changes: 4 additions & 4 deletions x/avs/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ func (k Keeper) AVSInfoUpdate(ctx sdk.Context, params *AVSRegisterOrDeregisterPa
SlashAddr: params.SlashContractAddr,
AvsOwnerAddress: params.AvsOwnerAddress,
AssetId: params.AssetID,
AvsUnbondingEpochs: uint32(params.MinimumDelegation),
MinimumDelegation: sdk.NewIntFromUint64(params.UnbondingEpochs),
MinimumDelegation: sdk.NewIntFromUint64(params.MinimumDelegation),
AvsUnbondingPeriod: uint32(params.UnbondingPeriod),
AvsEpoch: nil,
OperatorAddress: nil,
}
Expand All @@ -73,8 +73,8 @@ func (k Keeper) AVSInfoUpdate(ctx sdk.Context, params *AVSRegisterOrDeregisterPa
return errorsmod.Wrap(types.ErrUnregisterNonExistent, fmt.Sprintf("the error input arg is:%s", avsInfo))
}

//TODO:if avs DeRegisterAction check UnbondingEpochs
// if avsInfo.Info.AvsUnbondingEpochs < currenUnbondingEpoch - regUnbondingEpoch {
//TODO:if avs DeRegisterAction check UnbondingPeriod
// if avsInfo.Info.AvsUnbondingPeriod < currenUnbondingPeriod - regUnbondingPeriod {
// return errorsmod.Wrap(err, fmt.Sprintf("not qualified to deregister %s", avsInfo))
//}
return k.DeleteAVSInfo(ctx, params.AvsAddress)
Expand Down
2 changes: 1 addition & 1 deletion x/avs/keeper/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type AVSRegisterOrDeregisterParams struct {
AssetID []string

MinimumDelegation uint64
UnbondingEpochs uint64
UnbondingPeriod uint64
SlashContractAddr string
OperatorAddress []string
}
Expand Down
Loading

0 comments on commit 3df137e

Please sign in to comment.