Vyper: Performance issue in event logging implementation

Created on 29 Mar 2018  路  3Comments  路  Source: vyperlang/vyper

Judging by the code, event arguments that are not byte arrays are packed twice. 2nd packing rewrites the 1st packing. This adds complexity and affects gas consumption.

Related to https://github.com/ethereum/vyper/issues/730

1st place:
https://github.com/ethereum/vyper/blob/9eebb7c575545fcf880d815b9c888665dccbea51/vyper/parser/parser.py#L834

2nd place:
https://github.com/ethereum/vyper/blob/9eebb7c575545fcf880d815b9c888665dccbea51/vyper/parser/parser.py#L854

bug

Most helpful comment

Yes I know that. You only need to compute the size of static part in the first run, not to actually pack it. And it would be cleaner to just re-use the code for packing method parameters. The format is the same, and code for methods doesn't pack twice.

All 3 comments

@denis-bogdanas there is a specific reason though. We have two sections that need to be potentially packed. One Handles static part of the logging format, the next section packs the dynamic part ( for example if it's a bytearray).

https://solidity.readthedocs.io/en/develop/abi-spec.html#use-of-dynamic-types

Yes I know that. You only need to compute the size of static part in the first run, not to actually pack it. And it would be cleaner to just re-use the code for packing method parameters. The format is the same, and code for methods doesn't pack twice.

Thanks again for all the bugs vyper-semantics picks up ! :smile_cat:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ben-kaufman picture ben-kaufman  路  3Comments

michwill picture michwill  路  3Comments

yudetamago picture yudetamago  路  4Comments

jacqueswww picture jacqueswww  路  3Comments

fubuloubu picture fubuloubu  路  3Comments