Closed boolafish closed 5 years ago
Wrote a quick test in my own branch to get the numbers:
So App
is the second layer on top of Framework
. App would mimic the ExitGame and ExitProcessor.
All the results are saving and getting data with the following structure:
struct Data {
uint256 exitId;
uint8 exitType;
bool exitable;
bytes32 outputHash;
address token;
address exitTarget;
uint256 amount;
}
Following is what dumps from my terminal, will see the gas cost first and then the description of the execution. The difference of the "Total gas used" and "Execution gas" is a basic call to a dummy function in framework layer.
Contract: AppAbiV2
Using struct data and ABIEncoderV2
-----
Total gas used: 191277
Execution gas: 169872
✓ save struct data to framework storage for the first time (93ms)
-----
Total gas used: 71277
Execution gas: 49872
✓ save same struct data to the same slot the second time (176ms)
-----
Total gas used: 56299
Execution gas: 34894
✓ save struct data with different flag to the same slot (121ms)
-----
Total gas used: 33540
Execution gas: 12135
✓ get struct data from framework storage (112ms)
-----
Total gas used: 25672
Execution gas: 4267
✓ proxies from framework to app (41ms)
Contract: APP
Using native data without ABIEncoderV2
-----
Total gas used: 190158
Execution gas: 168753
✓ save data to framework storage for the first time (56ms)
-----
Total gas used: 70158
Execution gas: 48753
✓ save same data to the same slot the second time (90ms)
-----
Total gas used: 55092
Execution gas: 33687
✓ save data with different flag to the same slot (91ms)
-----
Total gas used: 30384
Execution gas: 8979
✓ get data from framework storage (81ms)
-----
Total gas used: 25650
Execution gas: 4245
✓ proxies from framework to app
true
to false
, and it does not take space for false
as a data in struct, so it is optimized.linked to the parent story and to doc. closing this.
Main story of this originally wanted to compare the POC with current MoreVP implementation on gas cost. However, as the prototype is really nor securely implemented and mainly focused on has something rough to display the idea, it doesn't work to compare directly IMHO.
Would just collect some data of the gas cost of extra actions from the communications of different layers:
ABIEncoderV2
and not using that.