Skip to content

Conversation

@nkuba
Copy link
Member

@nkuba nkuba commented Mar 29, 2022

To reduce RandomBeacon contract size we made Relay a linked library.

Contract Size

 ·--------------------------|-------------|---------------·
 |  Contract Name           ·  Size (KB)  ·  Change (KB)  │
 ···························|·············|················
 |  RandomBeacon            ·     19.431  ·       -2.269  │
 ···························|·············|················
 |  RandomBeaconStub        ·     20.798  ·       -2.269  │
 ···························|·············|················
 |  Relay                   ·      4.849  ·       +4.530  │
 ···························|·············|················
 |  RelayStub               ·      0.830  ·       -0.082  │
 ·--------------------------|-------------|---------------·

Functions Execution Costs

BEFORE

·------------------------------------------------------|---------------------------|-------------|-----------------------------·
|                 Solc version: 0.8.9                  ·  Optimizer enabled: true  ·  Runs: 200  ·  Block limit: 30000000 gas  │
·······················································|···························|·············|······························
|  Methods                                                                                                                     │
·····················|·································|·············|·············|·············|···············|··············
|  Contract          ·  Method                         ·  Min        ·  Max        ·  Avg        ·  # calls      ·  eur (avg)  │
·····················|·································|·············|·············|·············|···············|··············
|  RandomBeaconStub  ·  requestRelayEntry              ·     130855  ·     144308  ·     134891  ·           10  ·          -  │
·····················|·································|·············|·············|·············|···············|··············
|  RandomBeaconStub  ·  submitRelayEntry               ·     192038  ·     238889  ·     210778  ·            5  ·          -  │
·····················|·································|·············|·············|·············|···············|··············
|  RandomBeaconStub  ·  submitRelayEntry               ·     214078  ·     495171  ·     354625  ·            8  ·          -  │
·------------------------------------------------------|-------------|-------------|-------------|---------------|-------------·

AFTER

·------------------------------------------------------|---------------------------|-------------|-----------------------------·
|                 Solc version: 0.8.9                  ·  Optimizer enabled: true  ·  Runs: 200  ·  Block limit: 30000000 gas  │
·······················································|···························|·············|······························
|  Methods                                                                                                                     │
·····················|·································|·············|·············|·············|···············|··············
|  Contract          ·  Method                         ·  Min        ·  Max        ·  Avg        ·  # calls      ·  eur (avg)  │
·····················|·································|·············|·············|·············|···············|··············
|  RandomBeaconStub  ·  requestRelayEntry              ·     134086  ·     147539  ·     138122  ·           10  ·          -  │
·····················|·································|·············|·············|·············|···············|··············
|  RandomBeaconStub  ·  submitRelayEntry               ·     195572  ·     242420  ·     214311  ·            5  ·          -  │
·····················|·································|·············|·············|·············|···············|··············
|  RandomBeaconStub  ·  submitRelayEntry               ·     217790  ·     498849  ·     358320  ·            8  ·          -  │
·------------------------------------------------------|-------------|-------------|-------------|---------------|-------------·

To reduce RandomBeacon contract size we made Relay a linked library.
@pdyraga
Copy link
Member

pdyraga commented Mar 29, 2022

What is the before & after contract size for RandomBeacon and what is the gas cost impact for relay request/entry functions? Was it a problem with RandomBeaconStub or the RandomBeacon?

@nkuba
Copy link
Member Author

nkuba commented Mar 29, 2022

What is the before & after contract size for RandomBeacon

Contract size change was provided in the description.

what is the gas cost impact for relay request/entry functions?

I'm working on gathering data at the moment

@nkuba
Copy link
Member Author

nkuba commented Mar 29, 2022

@pdyraga added functions execution costs to the description.

@nkuba
Copy link
Member Author

nkuba commented Mar 29, 2022

We can hold with merging this PR and focus on #2906. It should be enough for #2903 for now.

@nkuba
Copy link
Member Author

nkuba commented Mar 30, 2022

Closing for now as it seems like #2906 solved the problems we were facing.

@nkuba nkuba closed this Mar 30, 2022
@pdyraga pdyraga added this to the solidity/v2.0.0 milestone Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants