This PR fixes a compatibility issue between V3 contracts and V2 wallets that was introduced with the tx-origin fixes.
The main thing this fix required was a consistent way to detect whether a request was using a V2 or V3 wallet. To do this we query for the versionAPI method, which was added in V3. Since the method does not exist on V2 wallets, the check needs to detect and handle the case where the method is not there. The only reliable way I found to do this requires a feature made available in Solidity 5.x, specifically that call methods now also return data.
Switching to Solidity 5.x required some significant cleanup but also increased the size of the compiled bytecode to the point where the BaseContentFactory and BaseContentSpace contracts now longer could load, due to the 24K limit on ETH contracts.
BaseContentSpace was slimmed down by factoring out KMS management into a separate contract. Note that this largely just facilitates testing right now since the currently creates spaces - particularly in PROD - will still work.
The main approach to making the content factory smaller was to remove the BaseContent code itself from the contracts, since the base binary size is under the 24K limit. The only approach I could find that worked is a bit ugly right now - the binary compiled code is added to a helper object as a string constant. Because of this, that object needs to be modified if the code for BaseContent changes. I researched and tried other approaches - including 'cloning' - but none worked.
Many small changes to comply with Solidity 5.x, esp. making most (all?) address payable.
Note that I originally changed the base contracts so that they compiled with 5.17 but Solidity 5.5 introduces new opcodes that then requires ETH Constantinople which we have not (yet?) enabled. Because of this, we are currently compiling with Solidity 5.4.
versionAPI
method, which was added in V3. Since the method does not exist on V2 wallets, the check needs to detect and handle the case where the method is not there. The only reliable way I found to do this requires a feature made available in Solidity 5.x, specifically thatcall
methods now also return data.BaseContentFactory
andBaseContentSpace
contracts now longer could load, due to the 24K limit on ETH contracts.BaseContentSpace
was slimmed down by factoring out KMS management into a separate contract. Note that this largely just facilitates testing right now since the currently creates spaces - particularly in PROD - will still work.BaseContent
code itself from the contracts, since the base binary size is under the 24K limit. The only approach I could find that worked is a bit ugly right now - the binary compiled code is added to a helper object as a string constant. Because of this, that object needs to be modified if the code forBaseContent
changes. I researched and tried other approaches - including 'cloning' - but none worked.payable
.