Skip to content

Commit 7fecaf4

Browse files
bysomeonevipwzw
authored andcommitted
[[FIX]] add evm mix address fork
1 parent ebe3726 commit 7fecaf4

File tree

6 files changed

+15
-3
lines changed

6 files changed

+15
-3
lines changed

chain33.fork.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ ForkEVMFrozen=1300000
7777
ForkEVMYoloV1=9500000
7878
# EVM合约支持交易组
7979
ForkEVMTxGroup=0
80+
# EVM兼容base58及16进制地址混合调用处理
81+
ForkEVMMixAddress=0
8082

8183
[fork.sub.evmxgo]
8284
Enable=0

chain33.para.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,8 @@ ForkEVMFrozen=0
360360
ForkEVMKVHash=0
361361
ForkEVMYoloV1=0
362362
ForkEVMTxGroup=0
363+
# EVM兼容base58及16进制地址混合调用处理
364+
ForkEVMMixAddress=0
363365

364366
[fork.sub.blackwhite]
365367
Enable=0

chain33.para.toml.readme

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ ForkEVMFrozen=0
329329
ForkEVMKVHash=0
330330
ForkEVMYoloV1=0
331331
ForkEVMTxGroup=0
332+
ForkEVMMixAddress=0
332333

333334
[fork.sub.blackwhite]
334335
Enable=0

plugin/dapp/evm/executor/exec.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,8 @@ func (evm *EVMExecutor) GetMessage(tx *types.Transaction, index int, fromPtr *co
279279
from = *fromPtr
280280
}
281281

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

367368
// 从交易信息中获取交易目标地址,在创建合约交易中,此地址为空
368-
func getReceiver(action *evmtypes.EVMContractAction) *common.Address {
369+
func getReceiver(action *evmtypes.EVMContractAction, addressFork bool) *common.Address {
369370
if action.ContractAddr == "" {
370371
return nil
371372
}
372-
return common.StringToAddress(action.ContractAddr)
373+
if addressFork {
374+
common.StringToAddress(action.ContractAddr)
375+
}
376+
return common.StringToAddressLegacy(action.ContractAddr)
373377
}

plugin/dapp/evm/types/evm.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ func InitFork(cfg *types.Chain33Config) {
4242
cfg.RegisterDappFork(ExecutorName, ForkEVMYoloV1, 0)
4343
// EVM合约支持交易组
4444
cfg.RegisterDappFork(ExecutorName, ForkEVMTxGroup, 0)
45+
cfg.RegisterDappFork(ExecutorName, ForkEVMMixAddress, 0)
4546
}
4647

4748
//InitExecutor ...

plugin/dapp/evm/types/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ const (
4646
ForkEVMYoloV1 = "ForkEVMYoloV1"
4747
//ForkEVMTxGroup 交易组中的交易通过GAS检查
4848
ForkEVMTxGroup = "ForkEVMTxGroup"
49+
// ForkEVMMixAddress evm同时兼容base58及16进制地址混合调用处理
50+
ForkEVMMixAddress = "ForkEVMMixAddress"
4951
)
5052

5153
var (

0 commit comments

Comments
 (0)