Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In TransferDomain handle ExtractDestination failure #2117

Merged
merged 5 commits into from
Jun 26, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/masternodes/mn_checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4013,6 +4013,11 @@ Res ValidateTransferDomain(const CTransaction &tx,
if (dest.index() == WitV16KeyEthHashType) {
return DeFiErrors::TransferDomainETHSourceAddress();
}
} else {
// Remove guard on mainnet release
if (height > static_cast<uint32_t>(consensus.ChangiIntermediateHeight3)) {
return DeFiErrors::TransferDomainETHSourceAddress();
}
}
// Check for authorization on source address
res = HasAuth(tx, coins, src.address);
Expand All @@ -4024,6 +4029,11 @@ Res ValidateTransferDomain(const CTransaction &tx,
if (dest.index() != WitV16KeyEthHashType) {
return DeFiErrors::TransferDomainDFISourceAddress();
}
} else {
// Remove guard on mainnet release
if (height > static_cast<uint32_t>(consensus.ChangiIntermediateHeight3)) {
return DeFiErrors::TransferDomainDFISourceAddress();
}
}
// Check for authorization on source address
res = HasAuth(tx, coins, src.address, AuthStrategy::EthKeyMatch);
Expand All @@ -4040,13 +4050,23 @@ Res ValidateTransferDomain(const CTransaction &tx,
if (dest.index() == WitV16KeyEthHashType) {
return DeFiErrors::TransferDomainETHDestinationAddress();
}
} else {
// Remove guard on mainnet release
if (height > static_cast<uint32_t>(consensus.ChangiIntermediateHeight3)) {
return DeFiErrors::TransferDomainETHDestinationAddress();
}
}
} else if (dst.domain == static_cast<uint8_t>(VMDomain::EVM)) {
// Reject if source address is DFI address
if (ExtractDestination(dst.address, dest)) {
if (dest.index() != WitV16KeyEthHashType) {
return DeFiErrors::TransferDomainDVMDestinationAddress();
}
} else {
// Remove guard on mainnet release
if (height > static_cast<uint32_t>(consensus.ChangiIntermediateHeight3)) {
return DeFiErrors::TransferDomainDVMDestinationAddress();
}
}
} else
return DeFiErrors::TransferDomainInvalidDestinationDomain();
Expand Down