i'm working on solidity for Dapp dev.
Let me assume this situation below, with 2 contracts, A and B.
contract A {
B contract_b;
constructor(address b_addr) {
contract_b = B(b_addr);
}
function pass() public {
contract_b.do_sth();
}
}
contract B {
constructor(address b_addr) {
//
}
function do_sth() external {
// do something state-changing stuffs //
}
}
I vaguely noticed that view function does not spend gas,
so if do_sth() is view function, then nothings' bothering.
but with debugging, i found that in processing do_sth() invoked by pass(),
msg.sender becomes the constact address of A, not the original sender.
which means, in do_sth() scope, msg.sender is changed.
Then, whose gas will be consumed for do_sth() process?