Skip to content
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

ICS-27-v2 #1122

Draft
wants to merge 33 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
98904c2
set base file
sangier Jun 12, 2024
e8551dc
base skeleton
sangier Jun 14, 2024
7881e4f
wip ica-registration
sangier Jun 17, 2024
40ad2e2
SendTx, RegisterInterchainAccount-host-controller
sangier Jun 18, 2024
22342ac
refactor
sangier Jun 21, 2024
7f7f0d0
wip onRecv
sangier Jun 21, 2024
467e04f
checkpoint
sangier Jun 25, 2024
03fdbb3
skeleton refactor
sangier Jun 28, 2024
704de98
register flow
sangier Jul 1, 2024
072ec67
fixes register flow
sangier Jul 2, 2024
fe079dc
restructure + fixes
sangier Jul 3, 2024
2c2eb11
fixes
sangier Jul 3, 2024
63bf1ec
add register and controlling flow in words
sangier Jul 4, 2024
2a285f7
minor fixes
sangier Jul 4, 2024
607912a
function signature fixes
sangier Jul 4, 2024
7ed54fb
fixes
sangier Jul 4, 2024
8929479
fix markdown lists
sangier Jul 4, 2024
bf944b3
fix markdown
sangier Jul 4, 2024
0044c9d
fixes
sangier Jul 4, 2024
8236aa4
Moved README.md from ics-027-interchain-accounts to ics-027-interchai…
sangier Jul 4, 2024
4429420
adding v2 readme file into new folder structure
sangier Jul 4, 2024
cc9a816
del old folder structure
sangier Jul 4, 2024
e9ce56f
mod history
sangier Jul 4, 2024
b4fc551
grammar fixes
sangier Jul 8, 2024
3e1b64b
add host chain blacklist support
sangier Jul 8, 2024
33a5b5f
started encoding
sangier Jul 8, 2024
1938b46
split chan lifecycle for controller and host
sangier Jul 9, 2024
1ef9d4d
minor fixes
sangier Jul 10, 2024
5e7b576
fix channel management
sangier Jul 10, 2024
d7a171e
add v1-v2 differences summary - fix links
sangier Jul 10, 2024
d39222a
fix v1 links
sangier Jul 10, 2024
435cbb9
fix timeoutTimestamp
sangier Jul 10, 2024
73030d4
add test mermaid diagram
sangier Jul 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add host chain blacklist support
sangier committed Jul 8, 2024
commit 3e1b64b5be0e09a8cd7699c2faa685370a7a1bdc
54 changes: 22 additions & 32 deletions spec/app/ics-027-interchain-accounts/README.md
Original file line number Diff line number Diff line change
@@ -330,21 +330,7 @@ interface ModuleState {
##### Utility functions

```typescript
/*
// This function probably could be deleted and not used
function InitInterchainAccountAddress(portId: string, channelId: string, icaOwnerAddress:string, hostAccountId:uint64) returns (error) {

// Abort if hostAccountAddress at the specified keys already exist.
if(getInterchainAccountAddress(portId,channelId,icaOwnerAddress,hostAccountId)!=="") {
error={"intechainAccountKeys already used"}
return error
}
// Initialize in module mapping to hostAccount Data
// Address set to init during intialization. The address will be generated by the host chain and returned in the acknowledgment.
hostAccounts[portId][channelId][icaOwnerAddress][hostAccountId].hostAccountAddress=""
return nil
}
*/

// Stores the address of the interchain account in state.
function setInterchainAccountAddress(portId: string, channelId: string, icaOwnerAccount: string, hostAccountId: uint64, address: string) : string {

@@ -592,26 +578,14 @@ function setup() {

The interchain account module on the host chain must track the `hostAccounts` and should track the blacklist of msgs associated with a particular controller account in the state. Fields of the `ModuleState` are assumed to be in scope.

// TODO

// NOTE Need to inspect how to TODO blacklist mechanisms. Do the controller chain need to know which msg are blacklisted? Probably not. Thus the blacklist couldbe a module state in host chain that can be modified by an ad hoc
function

```typescript
interface blacklistedMessages{
portId: Identifier,
channelId: Identifier,
msgs: []Any, // Msg Type?
}
```

// Should be the blacklist icaOwnerAccounts specific?

```typescript
interface ModuleState {
hostAccounts: Map<portId, Map <channelId, Map <icaOwnerAddress, Map<hostAccountId, hostAccount>>>>,
//hostAccounts: Map<hostAccount.sequenceNumber, hostAccount.address>,
//TODO blacklist: [] blacklistedMessages
// Generic msg blacklist. It can be icaOwnerAddress specific, or only portId,channelId specific.
msgBlackList: Map<portId, Map <channelId, Map <icaOwnerAddress, set(msg)>>>,

}
```

@@ -687,9 +661,21 @@ function executeTx(hostAccount: string, msg Any) : (resultString, error) {
}
```

##### **BlacklistMsg**
##### **msgBlacklist**

The `addMessageToBlacklist` can be called by the host chain to blacklist certain types of msgs.

// TODO BlackList Function for Host writing into module state blacklisted msgs
```typescript
function addMessageToBlacklist(portId: string, channelId: string, icaOwnerAddress: string, msgType: string): error {

if(msgType.isIn(msgBlacklist[portId][channelId][icaOwnerAddress])==false){
msgBlacklist[portId][channelId][icaOwnerAddress].add(msgType)
return nil
} else {
return "Message type already blacklisted"
}
}
```

##### Packet relay

@@ -750,6 +736,10 @@ function onRecvPacket(packet Packet) {

for msg in msgs{
// TODO Include check for blacklisted message.
if(msg.type.isIn(msgBlackList[portId][channelId][icaOwnerAddress])){
return NewErrorAcknowledgement("The controller chain is trying to execute a message that has been blacklisted from the host chain.")
}

executingAddress = msg.expectedSigner()
// Verify that the expectedSigner is in the set of host addresses constructed for this IBC tx.
// Here the idea is that we confirm that the expected signer is part of a set of the hostAccountsAddress set constructed with the hostSequencesIds passed in by the icaOwnerAddress. Is this enough?