If there's a dapp running in optimistic rollup that lets users mint new ERC20 and ERC721 tokens. How can ETH main chain know about the new minted tokens?
This seems to be a fair alternative -as of today- to run transactions (such as minting tokens) using Optimistic Rollup:
Optimistic Rollup refers to a type of rollup that is optimistic such that when an assertion is posted, it does not contain an accompanying proof guaranteeing its validity. Instead, when the assertion is posted on-chain, the validator making that assertion posts a bond, and there is a time window in which anyone can post their own bond and challenge the assertion, if they think it’s wrong. This is sometimes called a “fraud proof”.
There is a specific optimistic rollup protocol named as Arbitrum. It is another option. In the Arbitrum protocol it is possible to pass messages between L1 and L2 to move assets from Ethereum to an Arbitrum chain and back. Any asset / asset type can in principle be bridged, including Ether, ERC20 tokens, ERC-721 tokens, etc. Please find the GitHub repository of the Arbitrum token bridge SDK here that can use used for bridging ERC 20 and ERC 721 tokens.