Ethereum: Problem c tx.origin
imsg.Sender in the" Test Lider "
Based on my advanced Inteling Action study, I worked with Ethernaut 4 (phone) Dust Dust Prime Minister (telephone) using LIT. The topic is no less, I tremble with a "no -disjuzed" test, which is a little shot by Neo -nap.
Problem:
In the case of a test, I was replaced that the Tx.origin fields I "Msg.Sender" did not close my stall as it was. In part, these fields, speaking, provided the differences as I was.
Problem:
Looking at the Code of the opposite and ponimania, when he dreamed of Blockchain, I inspired that there are two main problems:
- However, using a foundry test structure is not all.
- msg.Sender
: The MSG.SEnder field has collected an address called the meter function (then is half). These values can be released from TX.origin, especially if the operation was for the second perception.
Resolution:
To solve this problem, I changed your dust code:
1
- Use ContractDress as an exit
: If Tx.origin and Msg.Sender
Here is a encoded code fragment that demonstrates the following changes:
JavaScript
CONST {Ether} = Require ("Ether");
// Test for telephone contractions
Async feature testtelephone () {
// Initiate a counterattrate and nozzle
Const theaphoneContract = New Ethers.Contract (
"
The phone
Ethers.Wallet.fromprivatekey (
Your_private_Key, // on the face key
)
);
// Create an Operation object
CONST TX = {
OT: Ethers.wallet.fromprivatekey (Your_private_Key,
That
Value: Ethers.utils.Parseether ("1"), // Install Operation Values
Acquire: 20N, // Install Gaza Shadow (inappropriately)
Gaslimit: 2000, // Install the maximum Gaza
Data: 0x, // Install data operation (in this case blank)
};
// Remove surgery
CESS score = wait for telephoneconcontract.sendransification (TX);
Console.log (result);
}
// Start the functioning function
Testlephone ();
Conclusion:
Contact these modifications, I decide on a problem with TX.origin, ISG.Sender in your dust primary to neutralize your phone. Now that values are interesting, I can continue with more attempts and analysis.
If you are stuck for a good problem or you have a question -you are questionable, don’t ask!