Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Twenty methods sign their L1 action with no vault (
sign_l1_action(..., None, ...)) but_post_actionwritesself.vault_addressinto the payload. The server hashes an L1 action with thevaultAddressof the payload, so when theExchangewas built with avault_addressit hashes something else than what was signed and recovers an address that is not the wallet._post_actionalready posts a null vault forusdClassTransferandsendAsset. This change extends that list to the action types that are signed without a vault:setReferrer,createSubAccount,subAccountTransfer,subAccountSpotTransfer,vaultTransfer,spotDeploy,perpDeploy,CSignerAction,CValidatorActionandevmUserModify. Nothing changes for anExchangewithout a vault, or for the actions that are signed for the vault.Testnet
A freshly generated, unfunded key and
Exchange(wallet, TESTNET_API_URL, vault_address=<some address>). The answer names the address the server recovered from the signature.set_referrerUser or API Wallet 0x<other> does not exist.User or API Wallet <wallet> does not exist.create_sub_account0x<other><wallet>sub_account_transfer0x<other><wallet>sub_account_spot_transfer0x<other><wallet>vault_usd_transfer0x<other><wallet>use_big_blocks0x<other><wallet>spot_deploy_*methods0x<other><wallet>perp_deploy_register_asset,perp_deploy_set_oracle0x<other><wallet>c_signer_unjail_self, the 3c_validator_*methodsVault may not perform this action.Must deposit before performing actions. User: <wallet>0x<other>was a different address on every call. The calls were not expected to succeed for an unfunded key: the point is which address the server recovers.Test
test_l1_action_posts_the_vault_address_it_signsbuilds anExchangewith a vault, records the vault address each method passes tosign_l1_actionand thevaultAddressit posts, and requires them to be equal. It covers the 20 methods above plusschedule_cancelandnoop, which sign for the vault and must keep posting it. On master the 20 fail and the 2 pass.Ran
pytest tests/(58 passed), black, isort and flake8 with the settings of.pre-commit-config.yaml.