Skip to content

Commit

Permalink
delete opGetDelegate (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
geekres committed May 9, 2019
1 parent 3f93383 commit 0518a87
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 37 deletions.
2 changes: 0 additions & 2 deletions params/gas_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ type GasTable struct {
DestroyAsset uint64
AddAsset uint64
GetAccountID uint64
GetDelegate uint64
CryptoCalc uint64
CryptoByte uint64
DeductGas uint64
Expand Down Expand Up @@ -72,7 +71,6 @@ var (
DestroyAsset: 200,
AddAsset: 200,
GetAccountID: 200,
GetDelegate: 200,
CryptoCalc: 20000,
CryptoByte: 1000,
DeductGas: 200,
Expand Down
3 changes: 0 additions & 3 deletions processor/vm/gas_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,6 @@ func gasDeductGas(gt params.GasTable, evm *EVM, contract *Contract, stack *Stack
return gt.DeductGas, nil
}

func gasGetDelegate(gt params.GasTable, evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) {
return gt.GetDelegate, nil
}
func gasAddAsset(gt params.GasTable, evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) {

return gt.AddAsset, nil
Expand Down
23 changes: 0 additions & 23 deletions processor/vm/instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,29 +476,6 @@ func opGetAssetAmount(pc *uint64, evm *EVM, contract *Contract, memory *Memory,
return nil, nil
}

func opGetDelegate(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
time, account := stack.pop(), stack.pop()
t := time.Uint64()
userID := account.Uint64()

acct, err := evm.AccountDB.GetAccountById(userID)
if err == nil {
if acct != nil {
name := acct.GetName()
if dbalance, err := evm.Context.GetDelegatedByTime(evm.StateDB, name.String(), t); err == nil {
stack.push(dbalance)
}
} else {
err = errors.New("account object is null")
}
}

if err != nil {
stack.push(evm.interpreter.intPool.getZero())
}
evm.interpreter.intPool.put(time, account)
return nil, nil
}
func opSnapBalance(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
opt, time, assetId, account := stack.pop(), stack.pop(), stack.pop(), stack.pop()
o := opt.Uint64()
Expand Down
8 changes: 0 additions & 8 deletions processor/vm/jump_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,6 @@ func NewByzantiumInstructionSet() [256]operation {
returns: true,
}

instructionSet[GETDELEGATE] = operation{
execute: opGetDelegate,
gasCost: gasGetDelegate,
validateStack: makeStackFunc(2, 1),
valid: true,
returns: true,
}

instructionSet[ASSETAMOUNT] = operation{
execute: opGetAssetAmount,
gasCost: gasGetAssetAmount,
Expand Down
1 change: 0 additions & 1 deletion processor/vm/opcodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ const (
DESTROYASSET = 0xc8
GETACCOUNTID = 0xc9

GETDELEGATE = 0xca
GETACCOUNTTIME = 0xcb
CRYPTOCALC = 0xcc
DEDUCTGAS = 0xcd
Expand Down

0 comments on commit 0518a87

Please sign in to comment.