Skip to content

Get rid of "extrinsic for call failed: Pallet error: Revive::AccountAlreadyMapped" #2451

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

Closed
cmichi opened this issue Mar 24, 2025 · 2 comments · Fixed by #2483
Closed

Get rid of "extrinsic for call failed: Pallet error: Revive::AccountAlreadyMapped" #2451

cmichi opened this issue Mar 24, 2025 · 2 comments · Fixed by #2483
Assignees

Comments

@cmichi
Copy link
Collaborator

cmichi commented Mar 24, 2025

The pallet-revive requires a mapped account for many functions. In our E2E tests we are currently doing a very naive thing of just always trying to map the account, whilst continuing anyway if that operation fails.

That's why you currently see those in the log:

$ cd ink/integration-tests/public/contract-transfer
$ cargo +nightly test --all-features e2e_     
test give_me::e2e_tests::e2e_contract_must_transfer_value_to_sender ... ok
2025-03-24T20:59:16.926664Z ERROR ink_e2e: [test: e2e_sending_value_to_give_me_must_fail] extrinsic for call failed: Pallet error: Revive::AccountAlreadyMapped
2025-03-24T20:59:16.959847Z ERROR ink_e2e: [test: e2e_sending_value_to_give_me_must_fail] extrinsic for call failed: Pallet error: Revive::AccountAlreadyMapped
2025-03-24T20:59:16.976303Z ERROR ink_e2e: [test: e2e_sending_value_to_give_me_must_fail] extrinsic for call failed: Pallet error: Revive::ContractReverted
test give_me::e2e_tests::e2e_sending_value_to_give_me_must_fail ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 4 filtered out; finished in 145.85s

What we should do instead is to check if the account has already been mapped and only if not map it. I believe the best way to check is to calculate the storage key that the mapping should be at and then doing a storage lookup for that key.

I believe this code from cargo-contract could be reused. You have to derive the H160 first and then you could check for the storage key. The derivation can be taken from here. It's also already in ink! here.

@cmichi cmichi converted this from a draft issue Mar 24, 2025
@cmichi cmichi moved this to Backlog in ink! + `cargo-contract` v6 Apr 1, 2025
@chungquantin
Copy link
Contributor

Hi @cmichi, you can assign it to me, I can work on this!

@chungquantin
Copy link
Contributor

PR: #2483

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants