Skip to content

Commit

Permalink
[[FIX]] add evm mix address fork
Browse files Browse the repository at this point in the history
  • Loading branch information
bysomeone authored and vipwzw committed Jan 16, 2023
1 parent ebe3726 commit 7fecaf4
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions chain33.fork.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ ForkEVMFrozen=1300000
ForkEVMYoloV1=9500000
# EVM合约支持交易组
ForkEVMTxGroup=0
# EVM兼容base58及16进制地址混合调用处理
ForkEVMMixAddress=0

[fork.sub.evmxgo]
Enable=0
Expand Down
2 changes: 2 additions & 0 deletions chain33.para.toml
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ ForkEVMFrozen=0
ForkEVMKVHash=0
ForkEVMYoloV1=0
ForkEVMTxGroup=0
# EVM兼容base58及16进制地址混合调用处理
ForkEVMMixAddress=0

[fork.sub.blackwhite]
Enable=0
Expand Down
1 change: 1 addition & 0 deletions chain33.para.toml.readme
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ ForkEVMFrozen=0
ForkEVMKVHash=0
ForkEVMYoloV1=0
ForkEVMTxGroup=0
ForkEVMMixAddress=0

[fork.sub.blackwhite]
Enable=0
Expand Down
10 changes: 7 additions & 3 deletions plugin/dapp/evm/executor/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ func (evm *EVMExecutor) GetMessage(tx *types.Transaction, index int, fromPtr *co
from = *fromPtr
}

to := getReceiver(&action)
addressFork := evm.GetAPI().GetConfig().IsDappFork(evm.GetHeight(), "evm", evmtypes.ForkEVMMixAddress)
to := getReceiver(&action, addressFork)
if to == nil {
return msg, types.ErrInvalidAddress
}
Expand Down Expand Up @@ -365,9 +366,12 @@ func getCaller(tx *types.Transaction) common.Address {
}

// 从交易信息中获取交易目标地址,在创建合约交易中,此地址为空
func getReceiver(action *evmtypes.EVMContractAction) *common.Address {
func getReceiver(action *evmtypes.EVMContractAction, addressFork bool) *common.Address {
if action.ContractAddr == "" {
return nil
}
return common.StringToAddress(action.ContractAddr)
if addressFork {
common.StringToAddress(action.ContractAddr)
}
return common.StringToAddressLegacy(action.ContractAddr)
}
1 change: 1 addition & 0 deletions plugin/dapp/evm/types/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func InitFork(cfg *types.Chain33Config) {
cfg.RegisterDappFork(ExecutorName, ForkEVMYoloV1, 0)
// EVM合约支持交易组
cfg.RegisterDappFork(ExecutorName, ForkEVMTxGroup, 0)
cfg.RegisterDappFork(ExecutorName, ForkEVMMixAddress, 0)
}

//InitExecutor ...
Expand Down
2 changes: 2 additions & 0 deletions plugin/dapp/evm/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ const (
ForkEVMYoloV1 = "ForkEVMYoloV1"
//ForkEVMTxGroup 交易组中的交易通过GAS检查
ForkEVMTxGroup = "ForkEVMTxGroup"
// ForkEVMMixAddress evm同时兼容base58及16进制地址混合调用处理
ForkEVMMixAddress = "ForkEVMMixAddress"
)

var (
Expand Down

0 comments on commit 7fecaf4

Please sign in to comment.