-
Notifications
You must be signed in to change notification settings - Fork 376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ReserveSpenderMultiSig to the foundry migrations #11025
Comments
Exact output is:
while the test can be found here. |
For reference, the test is: test('can transferGold with multisig option', async () => {
const initialBalance = await goldToken.balanceOf(accounts[9])
await testLocally(TransferGold, [
'--from',
accounts[0],
'--value',
transferAmt.toString(10),
'--to',
accounts[9],
'--useMultiSig',
])
await testLocally(TransferGold, [
'--from',
accounts[7],
'--value',
transferAmt.toString(10),
'--to',
accounts[9],
'--useMultiSig',
])
expect(await goldToken.balanceOf(accounts[9])).toEqual(initialBalance.plus(transferAmt))
}) |
There is a comment relating to this in the migrations: celo-monorepo/packages/protocol/migrations_sol/Migration.s.sol Lines 332 to 333 in b10b77a
|
Looks like this might be the related ganache migration: celo-monorepo/packages/protocol/migrations_ts/07_reserve_spender_multisig.ts Lines 11 to 32 in b10b77a
The relevant configs are: celo-monorepo/packages/protocol/migrationsConfig.js Lines 163 to 167 in b10b77a
|
Here is a similar MultiSig deployment: In foundry: celo-monorepo/packages/protocol/migrations_sol/Migration.s.sol Lines 787 to 808 in b10b77a
celo-monorepo/packages/protocol/migrations_sol/migrationsConfig.json Lines 132 to 136 in b10b77a
In ganache: celo-monorepo/packages/protocol/migrations_ts/23_governance_approver_multisig.ts Lines 9 to 29 in b10b77a
celo-monorepo/packages/protocol/migrationsConfig.js Lines 114 to 120 in b10b77a
|
Working on the PR here: |
For visibility @shazarre, I marked this PR as ready for review and asked for a review from the primitive team: If and when it's merged to |
@shazarre this is done, and the new Let me know if the CLI test passes as expected. |
Originally posted by @shazarre in #11026 (comment) |
When I run the tests as described above, I get this error: FAIL src/commands/reserve/transfergold.test.ts
● Console
console.log
Running Checks:
at CheckBuilder.runChecks (src/utils/checks.ts:491:13)
console.log
✘ 0x5409ED021D9299bf6814279A6A1411A7e866A631 is a reserve spender
at CheckBuilder.runChecks (src/utils/checks.ts:498:15)
console.log
✘ 0x91c987bf62D25945dB517BDAa840A6c661374402 is another reserve address |
It looks like the CLI doesn't find any spenders using the async getSpenders(): Promise<Address[]> {
const spendersAdded = (
await this.getPastEvents('SpenderAdded', {
fromBlock: 0,
toBlock: 'latest',
})
).map((eventlog: EventLog) => eventlog.returnValues.spender)
const spendersRemoved = (
await this.getPastEvents('SpenderRemoved', {
fromBlock: 0,
toBlock: 'latest',
})
).map((eventlog: EventLog) => eventlog.returnValues.spender)
return spendersAdded.filter((spender) => !spendersRemoved.includes(spender))
}
} Source: contractkit/src/wrappers/Reserve.ts const spenders = useMultiSig ? await reserve.getSpenders() : []
/////////////////////// DEBUGGING ///////////////////////
console.log('spenders[] are:', spenders)
/////////////////////// DEBUGGING /////////////////////// Source: cli/src/commands/reserve/transfergold.ts git checkout shazarre/Migrate_reserve_and_releasecelo_tests_to_anvil
yarn && yarn build
yarn workspace @celo/celocli run test
console.log
spenders[] are: []
at TransferGold.run (src/commands/reserve/transfergold.ts:36:13) On the devchain, the cast logs \
"SpenderAdded(address indexed spender)" \
--from-block 0 --to-block latest \
--rpc-url=http://127.0.0.1:8546
- address: 0x0a887500E327375378edF7b7d0E85F0378b8677a
blockHash: 0xdd3366edde3433c624cf059c190e864470ee5ed423fe57393fabffc52020c242
blockNumber: 43
data: 0x
logIndex: 0
removed: false
topics: [
0x3139419c41cdd7abca84fa19dd21118cd285d3e2ce1a9444e8161ce9fa62fdcd
0x0000000000000000000000001a888d93eeacf683c68e07ad58aa43f2a5742490
]
transactionHash: 0xbf4e79a92f7c6a1be5451d1489e70278efd89c9c15c3497e968527d854f6063c
transactionIndex: 0 The cast call \
"0x0a887500E327375378edF7b7d0E85F0378b8677a" \
"isSpender(address)(bool)" \
"0x1A888D93eeAcF683c68E07Ad58Aa43f2A5742490" \
--rpc-url=http://127.0.0.1:8546
true |
Minimal reproducible example to check if the bug is related to the JSON dump or NPM version
|
That means the contractkit/src/wrappers/Reserve.ts helper function won't work with Anvil. But, there is an (anvil) devchain specific fix, which is to get the |
I'm closing this issue on that basis. |
From @shazarre:
Source: Slack
The text was updated successfully, but these errors were encountered: