Gas is sent with signed transactions. It arrives at a function, say Sample2(addressSample2).try()
.
Since you did not specify an amount of gas with your call
, all remaining gas is sent to Sample(addressSample).test2()
. When it is finished, control returns to Sample2(addressSample2).try()
along with any unspent/remaining gas. No gas remains in Sample(addressSample)
.
Since Sample2(addressSample2).try()
is also done, the remaining gas returns to the sender. No surplus gas remains in either contract which is just as well, because cannot presently pay for their own gas.
Sample(address).test2()
emits an event with the remaining gas at that moment, but processing will continue as described above. So, some additional gas will be burned before the transaction completes.
In case it isn't clear, there are assembly-level OPCODES that still need to run before everything will be wrapped up as summarized above. It's probably enough to know that there's still housekeeping to attend to because the function hasn't (technically) finished. If you're so inclined, you can step over the OPCODES in Remix to study what it does near the end.
Hope it helps.