Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@latticexyz/gas-report

Package Overview
Dependencies
Maintainers
0
Versions
1194
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@latticexyz/gas-report - npm Package Versions

1
118

2.0.0-main-fd4995e6

Diff

alvarius
published 2.0.0-main-9993e889 •

alvarius
published 2.0.0-main-aa96d4cc •

alvarius
published 2.0.0-main-c0aba569 •

alvarius
published 2.0.0-next.7 •

Changelog

Source

Version 2.0.0-next.7

Major changes

feat(store,world): more granularity for onchain hooks (#1399) (@latticexyz/store, @latticexyz/world)

  • The onSetRecord hook is split into onBeforeSetRecord and onAfterSetRecord and the onDeleteRecord hook is split into onBeforeDeleteRecord and onAfterDeleteRecord. The purpose of this change is to allow more fine-grained control over the point in the lifecycle at which hooks are executed.

    The previous hooks were executed before modifying data, so they can be replaced with the respective onBefore hooks.

    - function onSetRecord(
    + function onBeforeSetRecord(
        bytes32 table,
        bytes32[] memory key,
        bytes memory data,
        Schema valueSchema
      ) public;
    
    - function onDeleteRecord(
    + function onBeforeDeleteRecord(
        bytes32 table,
        bytes32[] memory key,
        Schema valueSchema
      ) public;
    
  • It is now possible to specify which methods of a hook contract should be called when registering a hook. The purpose of this change is to save gas by avoiding to call no-op hook methods.

    function registerStoreHook(
      bytes32 tableId,
    - IStoreHook hookAddress
    + IStoreHook hookAddress,
    + uint8 enabledHooksBitmap
    ) public;
    
    function registerSystemHook(
      bytes32 systemId,
    - ISystemHook hookAddress
    + ISystemHook hookAddress,
    + uint8 enabledHooksBitmap
    ) public;
    

    There are StoreHookLib and SystemHookLib with helper functions to encode the bitmap of enabled hooks.

    import { StoreHookLib } from "@latticexyz/store/src/StoreHook.sol";
    
    uint8 storeHookBitmap = StoreBookLib.encodeBitmap({
      onBeforeSetRecord: true,
      onAfterSetRecord: true,
      onBeforeSetField: true,
      onAfterSetField: true,
      onBeforeDeleteRecord: true,
      onAfterDeleteRecord: true
    });
    
    import { SystemHookLib } from "@latticexyz/world/src/SystemHook.sol";
    
    uint8 systemHookBitmap = SystemHookLib.encodeBitmap({
      onBeforeCallSystem: true,
      onAfterCallSystem: true
    });
    
  • The onSetRecord hook call for emitEphemeralRecord has been removed to save gas and to more clearly distinguish ephemeral tables as offchain tables.

Patch changes

fix(abi-ts): remove cwd join (#1418) (@latticexyz/abi-ts)

Let glob handle resolving the glob against the current working directory.

feat(world): allow callFrom from own address without explicit delegation (#1407) (@latticexyz/world)

Allow callFrom with the own address as delegator without requiring an explicit delegation


alvarius
published 2.0.0-main-18d3aea5 •

alvarius
published 2.0.0-main-2459e15f •

alvarius
published 2.0.0-main-c4d5eb4e •

alvarius
published 2.0.0-main-5408f61b •

alvarius
published 2.0.0-main-f70869ed •

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc