Skip to content
This repository was archived by the owner on Nov 10, 2023. It is now read-only.

Conversation

@iamacook
Copy link
Contributor

@iamacook iamacook commented Jan 17, 2022

What it solves

Resolves #3311

How this PR fixes it

Contracts were being instantiated via the web3 object, meaning that the chainId could be stale, i.e. the user is connected to Rinkeby but the unified app is on Avalanche.

Instead of relying on the chainId from the web3 object, _chainId (a local mirror of that from the store) is used instead. This is kept in sync with the current network displayed in the UI via the config middleware (where the contracts are initiated).

How to test it

  1. Open a Safe on Rinkeby.
  2. Create a MultiSend transaction via the Transaction Builder.
  3. Switch to Avalanche (which uses a different addressed MultiSendOnly contract when compared to Rinkeby) via the network selector in the top right but do not connect via MetaMask.
  4. Submit the transaction and observe that it does not show an unexpected deligate call, instead the known one.

Screenshots

image

@github-actions
Copy link

github-actions bot commented Jan 17, 2022

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 3 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@coveralls
Copy link

coveralls commented Jan 17, 2022

Pull Request Test Coverage Report for Build 1711915775

  • 9 of 34 (26.47%) changed or added relevant lines in 6 files are covered.
  • 3 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.02%) to 32.385%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/components/Root/index.tsx 0 1 0.0%
src/logic/safe/utils/safeVersion.ts 0 1 0.0%
src/routes/opening/index.tsx 0 1 0.0%
src/logic/contracts/safeContracts.ts 2 4 50.0%
src/logic/wallets/store/middlewares/providerWatcher.ts 6 26 23.08%
Files with Coverage Reduction New Missed Lines %
src/logic/contracts/safeContracts.ts 1 36.84%
src/components/App/index.tsx 2 0%
Totals Coverage Status
Change from base Build 1687885328: 0.02%
Covered Lines: 3117
Relevant Lines: 8561

💛 - Coveralls

@github-actions
Copy link

Deployment links

🟠 Safe Rinkeby Safe Mainnet 🟣 Safe Polygon 🟡 Safe BSC Safe Arbitrum 🟢 Safe xDai

@github-actions
Copy link

github-actions bot commented Jan 17, 2022

E2E Tests Failed
Check the results here: https://github.com/gnosis/safe-react-e2e-tests/actions/runs/1711950216

Failed tests:

  • ❌ Add an existing safe Add an existing safe
  • ❌ Safe Balances Safe Balances

@iamacook iamacook requested a review from katspaugh January 17, 2022 11:20
@liliya-soroka
Copy link
Member

@iamacook , for rinkeby -> avalanche I can not reproduce, but for avalanche->xdai I still see the issue
image
Avalanche multisendonly contract is used for xdai after network switching

@iamacook iamacook requested a review from katspaugh January 17, 2022 14:31
@iamacook iamacook marked this pull request as draft January 17, 2022 15:09
@iamacook iamacook marked this pull request as ready for review January 17, 2022 17:03
watcherInterval = setInterval(async () => {
const web3 = getWeb3()
const providerInfo = await getProviderInfo(web3)
instantiateSafeContracts()
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

@katspaugh katspaugh left a comment

Choose a reason for hiding this comment

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

💪

Copy link
Contributor

@usame-algan usame-algan left a comment

Choose a reason for hiding this comment

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

🚀

@katspaugh katspaugh mentioned this pull request Jan 18, 2022
@francovenica
Copy link
Contributor

looks good.
I kept switching between rinkeby, xdai, avalanche, optimism and arbitrum.
Optimism and avalanche use 0xA1dabEF33b3B82c7814B6D82A79e50F4AC44102B
Rinkeby, Xdai and arbitrum use 0x40A2aCCbd92BCA938b02010E17A5b8929b49130D

I created multisend tx with the Tx builder and checking in the MM popUp that the correct address was showing
01-18-2022_x(3981)

Created 2 tx, one in xdai and the very next one in optimism and they both have the correct multisend address
image
image

Kept going back and forth, creating tx in rinkeby, then avalanche, then xdai, then optimism. Basically going from a network with one address to another network with the other address. It worked fine

@katspaugh katspaugh merged commit 2b67598 into main Jan 18, 2022
@katspaugh katspaugh deleted the instantiate-contracts-via-chains branch January 18, 2022 17:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] transaction builder on AVAX uses mainnet deployment of MultiSend not the AVAX deployment

7 participants