starknet.js icon indicating copy to clipboard operation
starknet.js copied to clipboard

Upgraded Braavos account do not work in starknet.js

Open PhilippeR26 opened this issue 11 months ago • 3 comments

Describe the bug In the past, the ArgentX and Braavos account contract where both with a proxy. It means that there where :

  • a proxy contract at the account address, written in Cairo 0.
  • an implementation class of the account, written also in Cairo 0.

When you upgrade an old ArgentX account, the proxy contract is replaced by a Cairo 1 account contract, so no more proxy. When you upgrade an old Braavos account, the Cairo 0 implementation class is replaced by a Cairo 1 account contract. So, you have still a Cairo 0 proxy, with a Cairo 1 implementation. When Starknet.js is trying to identify the Cairo version of a such account, it will check the contract at the account address, here the proxy. As the proxy is Cairo 0, Starknet.js concludes falsely that the account is Cairo 0 version. If you try to perform a transaction, you have as a result the classical error Input too long for arguments.

To Reproduce I have one account in Goerli Testnet in this situation : addr : 0x06b7d99f2621f1fb2d3263d7a085de5d5f40751c6d1055a0a6c8105038fd44d2

Expected behavior I have identified 2 solutions :

  • Ask to the user to force to Cairo 1 :
const account0 = new Account(provider, account0Address, privateKey0,"1");
  • Modify Starknet.js to take into account the presence of a proxy.

Screenshots N/A

Desktop (please complete the following information):

  • Browser & version [e.g. chrome, safari, webworker]
  • Node version [e.g. 16.0.1]
  • Starknet.js version v6
  • Network [devnet, testnet] any

Additional context Add any other context about the problem here.

PhilippeR26 avatar Mar 01 '24 14:03 PhilippeR26

Waiting a decision for the strategy to adopt...

PhilippeR26 avatar Mar 01 '24 14:03 PhilippeR26

@PhilippeR26 is this work assignable?

Jemiiah avatar Apr 16 '24 17:04 Jemiiah

Hello, In fact, I am handling this one from start to finish.

PhilippeR26 avatar Apr 16 '24 19:04 PhilippeR26