Skip to content

Commit

Permalink
GH3005: disable stake, unstake and moveStake
Browse files Browse the repository at this point in the history
  • Loading branch information
fbac committed Oct 16, 2024
1 parent ae6ab23 commit 4831330
Show file tree
Hide file tree
Showing 3 changed files with 899 additions and 899 deletions.
4 changes: 2 additions & 2 deletions cmd/zetae2e/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ func localE2ETest(cmd *cobra.Command, _ []string) {
precompiledContractTests = []string{
e2etests.TestPrecompilesPrototypeName,
e2etests.TestPrecompilesPrototypeThroughContractName,
e2etests.TestPrecompilesStakingName,
e2etests.TestPrecompilesStakingThroughContractName,
// e2etests.TestPrecompilesStakingName,
// e2etests.TestPrecompilesStakingThroughContractName,
e2etests.TestPrecompilesBankName,
e2etests.TestPrecompilesBankFailName,
e2etests.TestPrecompilesBankThroughContractName,
Expand Down
96 changes: 48 additions & 48 deletions precompiles/staking/staking.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,54 +414,54 @@ func (c *Contract) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) ([]byt
return nil, err
}
return res, nil
case StakeMethodName:
if readOnly {
return nil, ptypes.ErrWriteMethod{
Method: method.Name,
}
}

var res []byte
execErr := stateDB.ExecuteNativeAction(contract.Address(), nil, func(ctx sdk.Context) error {
res, err = c.Stake(ctx, evm, contract, method, args)
return err
})
if execErr != nil {
return nil, err
}
return res, nil
case UnstakeMethodName:
if readOnly {
return nil, ptypes.ErrWriteMethod{
Method: method.Name,
}
}

var res []byte
execErr := stateDB.ExecuteNativeAction(contract.Address(), nil, func(ctx sdk.Context) error {
res, err = c.Unstake(ctx, evm, contract, method, args)
return err
})
if execErr != nil {
return nil, err
}
return res, nil
case MoveStakeMethodName:
if readOnly {
return nil, ptypes.ErrWriteMethod{
Method: method.Name,
}
}

var res []byte
execErr := stateDB.ExecuteNativeAction(contract.Address(), nil, func(ctx sdk.Context) error {
res, err = c.MoveStake(ctx, evm, contract, method, args)
return err
})
if execErr != nil {
return nil, err
}
return res, nil
// case StakeMethodName:
// if readOnly {
// return nil, ptypes.ErrWriteMethod{
// Method: method.Name,
// }
// }

// var res []byte
// execErr := stateDB.ExecuteNativeAction(contract.Address(), nil, func(ctx sdk.Context) error {
// res, err = c.Stake(ctx, evm, contract, method, args)
// return err
// })
// if execErr != nil {
// return nil, err
// }
// return res, nil
// case UnstakeMethodName:
// if readOnly {
// return nil, ptypes.ErrWriteMethod{
// Method: method.Name,
// }
// }

// var res []byte
// execErr := stateDB.ExecuteNativeAction(contract.Address(), nil, func(ctx sdk.Context) error {
// res, err = c.Unstake(ctx, evm, contract, method, args)
// return err
// })
// if execErr != nil {
// return nil, err
// }
// return res, nil
// case MoveStakeMethodName:
// if readOnly {
// return nil, ptypes.ErrWriteMethod{
// Method: method.Name,
// }
// }

// var res []byte
// execErr := stateDB.ExecuteNativeAction(contract.Address(), nil, func(ctx sdk.Context) error {
// res, err = c.MoveStake(ctx, evm, contract, method, args)
// return err
// })
// if execErr != nil {
// return nil, err
// }
// return res, nil

default:
return nil, ptypes.ErrInvalidMethod{
Expand Down
Loading

0 comments on commit 4831330

Please sign in to comment.