Skip to content

Commit

Permalink
refactor(precompile/staking): replace PackRetErr with PackRetErrV2 (#777
Browse files Browse the repository at this point in the history
)
  • Loading branch information
zakir-code authored Oct 23, 2024
1 parent 73ffde5 commit edcf0b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
11 changes: 1 addition & 10 deletions contract/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ const (
CrosschainAddress = "0x0000000000000000000000000000000000001004"
)

const (
DefaultGasCap uint64 = 30000000
)

var typeString, _ = abi.NewType("string", "", nil)
const DefaultGasCap uint64 = 30000000

var (
fip20Init = Contract{
Expand Down Expand Up @@ -95,11 +91,6 @@ func MustABIJson(str string) abi.ABI {
return j
}

func PackRetError(err error) ([]byte, error) {
pack, _ := abi.Arguments{{Type: typeString}}.Pack(err.Error())
return pack, err
}

func PackRetErrV2(err error) ([]byte, error) {
pack, _ := errorABI.Pack("Error", err.Error())
return pack, err
Expand Down
2 changes: 1 addition & 1 deletion x/staking/precompile/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (c *Contract) Run(evm *vm.EVM, vmContract *vm.Contract, readonly bool) (ret

stateDB := evm.StateDB.(evmtypes.ExtStateDB)
if err = c.govKeeper.CheckDisabledPrecompiles(stateDB.Context(), c.Address(), vmContract.Input[:4]); err != nil {
return contract.PackRetError(err)
return contract.PackRetErrV2(err)
}

ret, err = method.Run(evm, vmContract)
Expand Down

0 comments on commit edcf0b2

Please sign in to comment.