Commit 1c444966 authored by Litian's avatar Litian Committed by 33cn

fix vet

parent 857935cb
...@@ -98,9 +98,9 @@ func (evm *EVMExecutor) Exec(tx *types.Transaction, index int) (*types.Receipt, ...@@ -98,9 +98,9 @@ func (evm *EVMExecutor) Exec(tx *types.Transaction, index int) (*types.Receipt,
// 从状态机中获取数据变更和变更日志 // 从状态机中获取数据变更和变更日志
data, logs := evm.mStateDB.GetChangedData(curVer.GetId()) data, logs := evm.mStateDB.GetChangedData(curVer.GetId())
contractReceipt := &evmtypes.ReceiptEVMContract{msg.From().String(), execName, contractAddr.String(), usedGas, ret} contractReceipt := &evmtypes.ReceiptEVMContract{Caller: msg.From().String(), ContractName: execName, ContractAddr: contractAddr.String(), UsedGas: usedGas, Ret: ret}
logs = append(logs, &types.ReceiptLog{evmtypes.TyLogCallContract, types.Encode(contractReceipt)}) logs = append(logs, &types.ReceiptLog{Ty: evmtypes.TyLogCallContract, Log: types.Encode(contractReceipt)})
logs = append(logs, evm.mStateDB.GetReceiptLogs(contractAddr.String())...) logs = append(logs, evm.mStateDB.GetReceiptLogs(contractAddr.String())...)
if types.IsDappFork(evm.GetHeight(), "evm", "ForkEVMKVHash") { if types.IsDappFork(evm.GetHeight(), "evm", "ForkEVMKVHash") {
...@@ -190,7 +190,7 @@ func (evm *EVMExecutor) calcKVHash(addr common.Address, logs []*types.ReceiptLog ...@@ -190,7 +190,7 @@ func (evm *EVMExecutor) calcKVHash(addr common.Address, logs []*types.ReceiptLog
if len(hashes) > 0 { if len(hashes) > 0 {
hash := common.ToHash(hashes) hash := common.ToHash(hashes)
return &types.KeyValue{getDataHashKey(addr), hash.Bytes()} return &types.KeyValue{Key: getDataHashKey(addr), Value: hash.Bytes()}
} }
return nil return nil
} }
......
...@@ -27,7 +27,7 @@ func Transfer(db state.StateDB, sender, recipient common.Address, amount uint64) ...@@ -27,7 +27,7 @@ func Transfer(db state.StateDB, sender, recipient common.Address, amount uint64)
func GetHashFn(api client.QueueProtocolAPI) func(blockHeight uint64) common.Hash { func GetHashFn(api client.QueueProtocolAPI) func(blockHeight uint64) common.Hash {
return func(blockHeight uint64) common.Hash { return func(blockHeight uint64) common.Hash {
if api != nil { if api != nil {
reply, err := api.GetBlockHash(&types.ReqInt{int64(blockHeight)}) reply, err := api.GetBlockHash(&types.ReqInt{Height: int64(blockHeight)})
if nil != err { if nil != err {
log.Error("Call GetBlockHash Failed.", err) log.Error("Call GetBlockHash Failed.", err)
} }
......
...@@ -79,11 +79,11 @@ func scanTestData(basePath string) { ...@@ -79,11 +79,11 @@ func scanTestData(basePath string) {
// 检查两个文件是否都存在 // 检查两个文件是否都存在
if _, err := os.Stat(keyFile); os.IsNotExist(err) { if _, err := os.Stat(keyFile); os.IsNotExist(err) {
fmt.Errorf("test template file:%s, not exists!", keyFile) fmt.Println(fmt.Errorf("test template file:%s, not exists!", keyFile))
return nil return nil
} }
if _, err := os.Stat(dataFile); os.IsNotExist(err) { if _, err := os.Stat(dataFile); os.IsNotExist(err) {
fmt.Errorf("test data file:%s, not exists!", dataFile) fmt.Println(fmt.Errorf("test data file:%s, not exists!", dataFile))
return nil return nil
} }
testmap[keyFile] = dataFile testmap[keyFile] = dataFile
......
...@@ -201,7 +201,7 @@ func (in *Interpreter) Run(contract *Contract, input []byte) (ret []byte, err er ...@@ -201,7 +201,7 @@ func (in *Interpreter) Run(contract *Contract, input []byte) (ret []byte, err er
// 目前只按需构造必要的参数,理论上GasFun进行Gas计算时可以使用Contract中的所有参数 // 目前只按需构造必要的参数,理论上GasFun进行Gas计算时可以使用Contract中的所有参数
// 后继视需要修改GasParam结构 // 后继视需要修改GasParam结构
func buildGasParam(contract *Contract) *params.GasParam { func buildGasParam(contract *Contract) *params.GasParam {
return &params.GasParam{contract.Gas, contract.Address()} return &params.GasParam{Gas: contract.Gas, Address: contract.Address()}
} }
// 从EVM构造参数传递给GasFunc逻辑使用 // 从EVM构造参数传递给GasFunc逻辑使用
......
...@@ -72,7 +72,6 @@ func (logger *JSONLogger) CaptureState(env *EVM, pc uint64, op OpCode, gas, cost ...@@ -72,7 +72,6 @@ func (logger *JSONLogger) CaptureState(env *EVM, pc uint64, op OpCode, gas, cost
func formatStack(data []*big.Int) (res []string) { func formatStack(data []*big.Int) (res []string) {
for _, v := range data { for _, v := range data {
res = append(res, v.Text(16)) res = append(res, v.Text(16))
v.String()
} }
return return
} }
......
...@@ -248,7 +248,7 @@ func (self *ContractAccount) BuildDataLog() (log *types.ReceiptLog) { ...@@ -248,7 +248,7 @@ func (self *ContractAccount) BuildDataLog() (log *types.ReceiptLog) {
log15.Error("marshal contract data error!", "addr", self.Addr, "error", err) log15.Error("marshal contract data error!", "addr", self.Addr, "error", err)
return return
} }
return &types.ReceiptLog{evmtypes.TyLogContractData, datas} return &types.ReceiptLog{Ty: evmtypes.TyLogContractData, Log: datas}
} }
// 构建变更日志 // 构建变更日志
...@@ -259,7 +259,7 @@ func (self *ContractAccount) BuildStateLog() (log *types.ReceiptLog) { ...@@ -259,7 +259,7 @@ func (self *ContractAccount) BuildStateLog() (log *types.ReceiptLog) {
return return
} }
return &types.ReceiptLog{evmtypes.TyLogContractState, datas} return &types.ReceiptLog{Ty: evmtypes.TyLogContractState, Log: datas}
} }
func (self *ContractAccount) GetDataKey() []byte { func (self *ContractAccount) GetDataKey() []byte {
......
...@@ -54,7 +54,6 @@ func (evm EvmType) ActionName(tx *types.Transaction) string { ...@@ -54,7 +54,6 @@ func (evm EvmType) ActionName(tx *types.Transaction) string {
} else { } else {
return "callEvmContract" return "callEvmContract"
} }
return "unknown"
} }
func (evm *EvmType) GetTypeMap() map[string]int32 { func (evm *EvmType) GetTypeMap() map[string]int32 {
...@@ -79,7 +78,6 @@ func (evm EvmType) Amount(tx *types.Transaction) (int64, error) { ...@@ -79,7 +78,6 @@ func (evm EvmType) Amount(tx *types.Transaction) (int64, error) {
func (evm EvmType) CreateTx(action string, message json.RawMessage) (*types.Transaction, error) { func (evm EvmType) CreateTx(action string, message json.RawMessage) (*types.Transaction, error) {
elog.Debug("evm.CreateTx", "action", action) elog.Debug("evm.CreateTx", "action", action)
var tx *types.Transaction
if action == "CreateCall" { if action == "CreateCall" {
var param CreateCallTx var param CreateCallTx
err := json.Unmarshal(message, &param) err := json.Unmarshal(message, &param)
...@@ -91,8 +89,6 @@ func (evm EvmType) CreateTx(action string, message json.RawMessage) (*types.Tran ...@@ -91,8 +89,6 @@ func (evm EvmType) CreateTx(action string, message json.RawMessage) (*types.Tran
} else { } else {
return nil, types.ErrNotSupport return nil, types.ErrNotSupport
} }
return tx, nil
} }
func (evm *EvmType) GetLogMap() map[int64]*types.LogInfo { func (evm *EvmType) GetLogMap() map[int64]*types.LogInfo {
......
...@@ -42,9 +42,9 @@ var ( ...@@ -42,9 +42,9 @@ var (
UserPrefix = []byte(EvmPrefix) UserPrefix = []byte(EvmPrefix)
logInfo = map[int64]*types.LogInfo{ logInfo = map[int64]*types.LogInfo{
TyLogCallContract: {reflect.TypeOf(ReceiptEVMContract{}), "LogCallContract"}, TyLogCallContract: {Ty: reflect.TypeOf(ReceiptEVMContract{}), Name: "LogCallContract"},
TyLogContractData: {reflect.TypeOf(EVMContractData{}), "LogContractData"}, TyLogContractData: {Ty: reflect.TypeOf(EVMContractData{}), Name: "LogContractData"},
TyLogContractState: {reflect.TypeOf(EVMContractState{}), "LogContractState"}, TyLogContractState: {Ty: reflect.TypeOf(EVMContractState{}), Name: "LogContractState"},
TyLogEVMStateChangeItem: {reflect.TypeOf(EVMStateChangeItem{}), "LogEVMStateChangeItem"}, TyLogEVMStateChangeItem: {Ty: reflect.TypeOf(EVMStateChangeItem{}), Name: "LogEVMStateChangeItem"},
} }
) )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment