forked from hashgraph/hedera-mirror-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix address(this) resolution when mirror address is passed in the call (
hashgraph#7984) There is an inconsistency on call address(this) function depending on the **to** parameter in a contract call request. Address(this) will return whatever is specified as the 'to' parameter in the http request. If a contract is created via ethereum transaction on hedera it will have a canonical ethereum address. It will also have the long zero address. So in our contract call request we can put in the **to** parameter either the canonical evm address or the long zero and it should return the same response. Currently if we call address(this) of a contract that has a canonical evm address but we pass it's long zero address in the contract call request it will return long zero address in the response. But we actually want the evm address returned. This **PR** adds a check to see if a long zero address in passed in the request and will make the following verification: If the address is long zero verify that there might be a canonical evm address. If there exists a canonical evm address use it instead of the long zero. Otherwise use the long zero. Services uses similar approach -> ``` if (relayerId == null) { result = evmTxProcessor.execute( sender, receiver.canonicalAddress(), op.getGas(), op.getAmount(), callData, txnCtx.consensusTime()); } ``` This PR modifies: `MirrorEvmTxProcessorImpl` adds a new method to determine the correct **to** address. Added integration test for address function in `ContractCallDynamicCallsTest` --------- Signed-off-by: Kristiyan Selveliev <[email protected]>
- Loading branch information
1 parent
9f02648
commit 46f9b03
Showing
12 changed files
with
107 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
hedera-mirror-web3/src/test/resources/contracts/DynamicEthCalls/DynamicEthCalls.bin
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
hedera-mirror-web3/src/test/resources/contracts/TestContractAddress/TestAddressThis.bin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
60806040526000309050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610078576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161006f906100db565b60405180910390fd5b506100fb565b600082825260208201905092915050565b7f5a65726f20616464726573732e00000000000000000000000000000000000000600082015250565b60006100c5600d8361007e565b91506100d08261008f565b602082019050919050565b600060208201905081810360008301526100f4816100b8565b9050919050565b6101648061010a6000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806341de2c4e14610030575b600080fd5b61003861003a565b005b6000309050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036100ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100a59061010e565b60405180910390fd5b50565b600082825260208201905092915050565b7f5a65726f20616464726573732e00000000000000000000000000000000000000600082015250565b60006100f8600d836100b1565b9150610103826100c2565b602082019050919050565b60006020820190508181036000830152610127816100eb565b905091905056fea2646970667358221220cfb72597ca3ad2667cec512e862fc68bba53097afe7258045f34bed0b1f2fc7164736f6c63430008120033 | ||
608060405234801561001057600080fd5b50600436106100365760003560e01c80630a83b9a61461003b57806341de2c4e14610059575b600080fd5b610043610063565b6040516100509190610123565b60405180910390f35b61006161006b565b005b600030905090565b6000309050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036100df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100d69061019b565b60405180910390fd5b50565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061010d826100e2565b9050919050565b61011d81610102565b82525050565b60006020820190506101386000830184610114565b92915050565b600082825260208201905092915050565b7f5a65726f20616464726573732e00000000000000000000000000000000000000600082015250565b6000610185600d8361013e565b91506101908261014f565b602082019050919050565b600060208201905081810360008301526101b481610178565b905091905056fea2646970667358221220d1bf301106861c636eb4ce94ec71f03f9d02995361aa602aafcae9a5521663db64736f6c63430008120033 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
hedera-mirror-web3/src/test/resources/contracts/TestContractAddress/TestAddressThisInit.bin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
60806040526000309050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610078576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161006f906100db565b60405180910390fd5b506100fb565b600082825260208201905092915050565b7f5a65726f20616464726573732e00000000000000000000000000000000000000600082015250565b60006100c5600d8361007e565b91506100d08261008f565b602082019050919050565b600060208201905081810360008301526100f4816100b8565b9050919050565b6101f18061010a6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80630a83b9a61461003b57806341de2c4e14610059575b600080fd5b610043610063565b6040516100509190610123565b60405180910390f35b61006161006b565b005b600030905090565b6000309050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036100df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100d69061019b565b60405180910390fd5b50565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061010d826100e2565b9050919050565b61011d81610102565b82525050565b60006020820190506101386000830184610114565b92915050565b600082825260208201905092915050565b7f5a65726f20616464726573732e00000000000000000000000000000000000000600082015250565b6000610185600d8361013e565b91506101908261014f565b602082019050919050565b600060208201905081810360008301526101b481610178565b905091905056fea2646970667358221220d1bf301106861c636eb4ce94ec71f03f9d02995361aa602aafcae9a5521663db64736f6c63430008120033 |