-
Notifications
You must be signed in to change notification settings - Fork 11
Description
Types
- r_id (resource ID) - 32 byte string:
- Last 6 bytes reserved for chain id type (2 bytes chain type + 4 bytes chain identifier)
- Last adjacent 20 bytes are for ... (more on this in the next section).
More on r_id's
r_id's serve two purposes. Let's take the example of an anchor-update.
- There is a
r_idto method name mapping calledResourceson thesignature-bridge. - On the
anchor-handlerpallet, there is a mapping calledAnchorListthat mapsr_id's totree_id's. This is how theupdatemethod knows which anchor to update. Therefore, ther_idshould contain some uniquely identifiable information about thetree_id(or thetree_iditself). Don't think putting just thetree_idwill be enough since it just an integer...may not be unique enough. Might want to do something like the world 'ANCHOR" concatenated with thetree_id.
Overarching Schema of Proposal Data
Proposal Data:
r_id: ResourceId(32 bytes)zeroes:[u8, 4](4 bytes)nonce: T::ProposalNonce(4 bytes)call(the length of this is proposal specific)
Terminology: We will call the (r_id, zeroes, nonce) as the proposal header. The proposal header is a total of 40 bytes. We add 4 bytes of zeroes padding to match the length of the EVM/Solidity proposal header. On the EVM/Solidity side, these 4 bytes are taken up by the functionSig.
See how execute_proposal works (including pseudocode) in the comment below.
List of Proposals
1. Set Wrapping Fee Proposal
Pallet Flow: bridge/signature-bridge -> token-wrapper-handler -> token-wrapper
Proposal Data: (r_id, zeroes, nonce, call)
Total Bytes: 40 + (size of call)
Call Structure: Call::TokenWrapperHandler(Call::execute_wrapping_fee_proposal { r_id, wrapping_fee_percent, into_pool_share_id })
r_idis ther_idwrapping_fee_percentis the new token wrapping feeinto_pool_share_idis theidof the pool share we are setting the wrapping fee for (recall we have wrapping fees per pool share)
2. Add Token to Pool Share Proposal
Pallet Flow: bridge/signature-bridge -> token-wrapper-handler -> token-wrapper -> asset-registry
Proposal Data: (r_id, zeroes, nonce, call)
Total Bytes: 40 + (size of call)
Call Structure: Call::TokenWrapperHandler(Call::execute_add_token_to_pool_share { r_id, name, asset_id })
r_idis ther_idnameis the name of the pool shareasset_idis theidof the asset being added to the pool share.
3. Remove Token from Pool Share Proposal
Pallet Flow: bridge/signature-bridge -> token-wrapper-handler -> token-wrapper -> asset-registry
Proposal Data: (r_id, zeroes, nonce, call)
Total Bytes: 40 + (size of call)
Call Structure: Call::TokenWrapperHandler(Call::execute_remove_token_from_pool_share { r_id, name, asset_id })
r_idis ther_idnameis the name of the pool shareasset_idis theidof the asset being removed from the pool share.
4. Anchor Create Proposal
Pallet Flow: bridge/signature-bridge -> anchor-handler -> anchor
Proposal Data: (r_id, zeroes, nonce, call)
Total Bytes: 40 + (size of call)
Call Structure: Call::AnchorHandler(Call::execute_anchor_create_proposal { deposit_size, src_chain_id, r_id, max_edges, tree_depth, asset })
deposit_sizeis the denomination size of the anchorsrc_chain_idis theidof the source chainr_idisr_idmax_edgesis the maximum number of anchors the created anchor can have an edge totree_depthis the depth of the Merkle tree maintained by the anchorassetis the type of asset (CurrencyIdOf) that can be deposited into the created anchor
5. Anchor Update Proposal
Pallet Flow: bridge/signature-bridge -> anchor-handler -> anchor
Proposal Data: (r_id, zeroes, nonce, call)
Total Bytes: 40 + (size of call)
Call Structure: Call::AnchorHandler(Call::execute_anchor_update_proposal { r_id, anchor_metadata: EdgeMetadata { src_chain_id, root, latest_leaf_index } })
r_idis ther_idsrc_chain_idis theidof the source chainrootis the new root of the Merkle treelatest_leaf_indexis the index of the latest inserted leaf (corresponds to the updatedrootabove)
6. Register r_id Proposal
Pallet Flow: signature-bridge/bridge
Proposal Data: (r_id, zeroes, nonce, call)
Total Bytes: 40 + (size of call)
Call Structure:
7. Set fee recipient proposal
Pallet Flow: signature-bridge -> token-wrapper-handler -> token-wrapper
Proposal Data: (r_id, zeroes, nonce, call)
Total Bytes: 40 + (size of call)
Call Structure:
8. Rescue Tokens Proposal
Pallet Flow: signature-bridge -> token-wrapper-handler -> token-wrapper
Proposal Data: (r_id, zeroes, nonce, call)
Total Bytes: 40 + (size of call)
Call Structure:
Questions/Comments/Issues
- How many bytes is a call?
- How many bytes is a
T::AssetId? It seems to just be an integer, so 4 bytes should be enough to cover the different asset types we will encounter.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status