Skip to content

test(contracts): easily set storageXOR values in prestate#879

Merged
maurelian merged 1 commit intodevelopfrom
maurelian/op-564-easy-storageXOR-in-test-runner
May 16, 2021
Merged

test(contracts): easily set storageXOR values in prestate#879
maurelian merged 1 commit intodevelopfrom
maurelian/op-564-easy-storageXOR-in-test-runner

Conversation

@maurelian
Copy link
Copy Markdown
Contributor

@maurelian maurelian commented May 14, 2021

Description
A small change to the test-runner setup code making it possible to specify contractStorage values in the prestate using the special setPlaceholderStrings().

ie. Imagine you want to store an address which is deployed in the beforeEach hook. You'd have to run the tests, console.log the address which results in an INVALID_STATE_ACCESS, then paste it here:

contractStorage: {
        [predeploys.OVM_SafetyCache]: {
          '0x0000000000000000000000000000000000000000000000000000000000000000': getStorageXOR(
               0x.......someAddress
          ),
        },

After:

contractStorage: {
        [predeploys.OVM_SafetyCache]:
           [ethers.constants.HashZero]: {
              getStorageXOR: true,
              value: '$OVM_SAFETY_CHECKER' // we can get away with just putting this here!
           },
}

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented May 14, 2021

⚠️ No Changeset found

Latest commit: 8313d61

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replacing the addresses with members of the predeploys object is somewhat orthogonal to the theme of this PR, but seemed like a pretty safe change to include.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only section of existing code affected by this change, but the Safety Cache tests which are WIP will make heavy use of it.

@maurelian maurelian force-pushed the maurelian/op-564-easy-storageXOR-in-test-runner branch from c70d32e to 6cdad5c Compare May 14, 2021 19:18
@maurelian maurelian force-pushed the maurelian/op-564-easy-storageXOR-in-test-runner branch from 6cdad5c to 8313d61 Compare May 16, 2021 18:33
@maurelian maurelian merged commit cc209be into develop May 16, 2021
@maurelian maurelian deleted the maurelian/op-564-easy-storageXOR-in-test-runner branch May 16, 2021 19:10
InoMurko pushed a commit to omgnetwork/optimism that referenced this pull request May 25, 2021
theochap pushed a commit that referenced this pull request Dec 10, 2025
OptimismBot pushed a commit that referenced this pull request Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants