Skip to content

parseFee and parseTypeConfig mutate input config param #1

@minhnhathoang

Description

@minhnhathoang

Problem

subarray() returns a view. reverse() mutates original config in-place.

Impact

In handler, entity.config gets corrupted:

  entity.config = event.params.poolKey.config    // same reference

  entity.fee = parseFee(event.params.poolKey.config)         // bytes reversed
  const raw = parseTypeConfig(event.params.poolKey.config)   // bytes reversed

  entity.save()  // entity.config now has corrupted bytes

Fix

Clone before reversing in parseFee() and parseTypeConfig()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions