The InMessage.originalForwardFee accessor hardcodes workchain 0 when calling GETORIGINALFWDFEE, producing incorrect results for contracts deployed on masterchain.
fun onInternalMessage(in: InMessage): coins {
return in.originalForwardFee;
}
Compiles to:
PROGRAM{
0 DECLMETHOD onInternalMessage()
onInternalMessage() PROC:<{ // in.body
DROP
INMSG_BOUNCED
0 THROWIF
INMSG_FWDFEE
0 PUSHINT
GETORIGINALFWDFEE
}>
}END>c
The GETORIGINALFWDFEE instruction requires the workchain to compute the original fee based on that chain's fee configuration. Masterchain (workchain -1) has significantly higher fees than basechain (workchain 0).
A contract on masterchain using in.originalForwardFee will receive basechain fee calculations instead, causing incorrect fee accounting and potentially under-reserving funds for message forwarding.