-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework
Worker
api and make it work against recent integritee-worker…
… (aka tls directly into the enclave) (#89) * [worker] test simple websocket connection * [jest] allow any kind of certificate * [worker] update get balance to just get regular balance of incognito accounts * [network] update localDockerNetwork to be correct * [worker.spec] successfully connect to the worker. * Revert "[worker.spec] successfully connect to the worker." This reverts commit 3768996. * [worker.spec] connect to worker with original implementation; protocol changes needed. * [worker] implement new trusted rpc protocol and successfully fetch the shielding key * [worker.spec] remove primitive websocket test * [worker.spec] separate tests for encointer-specific protocol * [worker] successfully get free balance of an account * [worker] implement getting shard vault * [worker] fix return value parsing in generic cases * [worker] refactor request creation into its own file * [worker] rename getter api to sendRequest * [worker] update public getter * [worker] rename callGetter to sendRequest * [worker] more explicit naming * [worker] implement draft of trusted call balance transfer, (getting nonce fails currently) * [worker] fix getting nonce by using toHex instead of to u8a * [worker] fix signature type in trusted calls/getters * [worker] fix interpreting the result of getters * [worker] fix signature of trusted call * [worker] try to encrypt the trusted call upon sending * [worker] introduce trusted operation * [worker] fix encryption * [worker] add comment for node-rsa setting * [worker] successfully send a top to the worker. * [worker] better doc * [worker] fix sending trusted calls with `author_submitExtrinsic` * [jest] remove tls certificate config that didn't work * [jest] remove tls certificate config that didn't work * [worker] implement balance_unshield trusted call * [worker] use charlie in tests * [worker] rename interface IEncointerWorker to IIntegriteeWorker * [worker] separate encointer from integritee worker * [worker] finalize separation of workers * [worker] separate types of integritee and encointer * [worker] fix unused imports in encointer worker * [worker] skip CI that needs a worker * [worker] add todo for encointer worker
- Loading branch information
Showing
25 changed files
with
1,109 additions
and
513 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
53 changes: 53 additions & 0 deletions
53
packages/types/src/interfaces/encointerWorker/definitions.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
export default { | ||
rpc: {}, | ||
types: { | ||
EncointerGetterArgs: '(AccountId, CommunityIdentifier)', | ||
EncointerPublicGetter: { | ||
_enum: { | ||
total_issuance: 'CommunityIdentifier', | ||
participant_count: 'CommunityIdentifier', | ||
meetup_count: 'CommunityIdentifier', | ||
ceremony_reward: 'CommunityIdentifier', | ||
location_tolerance: 'CommunityIdentifier', | ||
time_tolerance: 'CommunityIdentifier', | ||
scheduler_state: 'CommunityIdentifier' | ||
} | ||
}, | ||
EncointerTrustedGetter: { | ||
_enum: { | ||
balance: '(AccountId, CommunityIdentifier)', | ||
participant_index: '(AccountId, CommunityIdentifier)', | ||
meetup_index: '(AccountId, CommunityIdentifier)', | ||
attestations: '(AccountId, CommunityIdentifier)', | ||
meetup_registry: '(AccountId, CommunityIdentifier)' | ||
} | ||
}, | ||
EncointerTrustedGetterSigned: { | ||
getter: 'EncointerTrustedGetter', | ||
signature: 'Signature' | ||
}, | ||
EncointerGetter: { | ||
_enum: { | ||
public: 'EncointerPublicGetter', | ||
trusted: 'EncointerTrustedGetterSigned' | ||
} | ||
}, | ||
EncointerTrustedCallSigned: { | ||
call: 'EncointerTrustedCall', | ||
nonce: 'u32', | ||
signature: 'Signature' | ||
}, | ||
EncointerTrustedCall: { | ||
_enum: { | ||
balance_transfer: 'EncointerBalanceTransferArgs', | ||
ceremonies_register_participant: 'RegisterParticipantArgs', | ||
ceremonies_register_attestations: 'RegisterAttestationsArgs', | ||
ceremonies_grant_reputation: 'GrantReputationArgs' | ||
} | ||
}, | ||
EncointerBalanceTransferArgs: '(AccountId, AccountId, CommunityIdentifier, BalanceType)', | ||
RegisterParticipantArgs: '(AccountId, CommunityIdentifier, Option<ProofOfAttendance<MultiSignature, AccountId>>)', | ||
RegisterAttestationsArgs: '(AccountId, Vec<Attestation<MultiSignature, AccountId, u64>>)', | ||
GrantReputationArgs: '(AccountId, CommunityIdentifier, AccountId)' | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit | ||
/* eslint-disable */ | ||
|
||
export * from './types.js'; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit | ||
/* eslint-disable */ | ||
|
||
import type { BalanceType } from '@encointer/types/interfaces/balances'; | ||
import type { Attestation, ProofOfAttendance } from '@encointer/types/interfaces/ceremony'; | ||
import type { CommunityIdentifier } from '@encointer/types/interfaces/community'; | ||
import type { Enum, Option, Struct, Vec, u32 } from '@polkadot/types-codec'; | ||
import type { ITuple } from '@polkadot/types-codec/types'; | ||
import type { Signature } from '@polkadot/types/interfaces/extrinsics'; | ||
import type { AccountId } from '@polkadot/types/interfaces/runtime'; | ||
|
||
/** @name EncointerBalanceTransferArgs */ | ||
export interface EncointerBalanceTransferArgs extends ITuple<[AccountId, AccountId, CommunityIdentifier, BalanceType]> {} | ||
|
||
/** @name EncointerGetter */ | ||
export interface EncointerGetter extends Enum { | ||
readonly isPublic: boolean; | ||
readonly asPublic: EncointerPublicGetter; | ||
readonly isTrusted: boolean; | ||
readonly asTrusted: EncointerTrustedGetterSigned; | ||
readonly type: 'Public' | 'Trusted'; | ||
} | ||
|
||
/** @name EncointerGetterArgs */ | ||
export interface EncointerGetterArgs extends ITuple<[AccountId, CommunityIdentifier]> {} | ||
|
||
/** @name EncointerPublicGetter */ | ||
export interface EncointerPublicGetter extends Enum { | ||
readonly isTotalIssuance: boolean; | ||
readonly asTotalIssuance: CommunityIdentifier; | ||
readonly isParticipantCount: boolean; | ||
readonly asParticipantCount: CommunityIdentifier; | ||
readonly isMeetupCount: boolean; | ||
readonly asMeetupCount: CommunityIdentifier; | ||
readonly isCeremonyReward: boolean; | ||
readonly asCeremonyReward: CommunityIdentifier; | ||
readonly isLocationTolerance: boolean; | ||
readonly asLocationTolerance: CommunityIdentifier; | ||
readonly isTimeTolerance: boolean; | ||
readonly asTimeTolerance: CommunityIdentifier; | ||
readonly isSchedulerState: boolean; | ||
readonly asSchedulerState: CommunityIdentifier; | ||
readonly type: 'TotalIssuance' | 'ParticipantCount' | 'MeetupCount' | 'CeremonyReward' | 'LocationTolerance' | 'TimeTolerance' | 'SchedulerState'; | ||
} | ||
|
||
/** @name EncointerTrustedCall */ | ||
export interface EncointerTrustedCall extends Enum { | ||
readonly isBalanceTransfer: boolean; | ||
readonly asBalanceTransfer: EncointerBalanceTransferArgs; | ||
readonly isCeremoniesRegisterParticipant: boolean; | ||
readonly asCeremoniesRegisterParticipant: RegisterParticipantArgs; | ||
readonly isCeremoniesRegisterAttestations: boolean; | ||
readonly asCeremoniesRegisterAttestations: RegisterAttestationsArgs; | ||
readonly isCeremoniesGrantReputation: boolean; | ||
readonly asCeremoniesGrantReputation: GrantReputationArgs; | ||
readonly type: 'BalanceTransfer' | 'CeremoniesRegisterParticipant' | 'CeremoniesRegisterAttestations' | 'CeremoniesGrantReputation'; | ||
} | ||
|
||
/** @name EncointerTrustedCallSigned */ | ||
export interface EncointerTrustedCallSigned extends Struct { | ||
readonly call: EncointerTrustedCall; | ||
readonly nonce: u32; | ||
readonly signature: Signature; | ||
} | ||
|
||
/** @name EncointerTrustedGetter */ | ||
export interface EncointerTrustedGetter extends Enum { | ||
readonly isBalance: boolean; | ||
readonly asBalance: ITuple<[AccountId, CommunityIdentifier]>; | ||
readonly isParticipantIndex: boolean; | ||
readonly asParticipantIndex: ITuple<[AccountId, CommunityIdentifier]>; | ||
readonly isMeetupIndex: boolean; | ||
readonly asMeetupIndex: ITuple<[AccountId, CommunityIdentifier]>; | ||
readonly isAttestations: boolean; | ||
readonly asAttestations: ITuple<[AccountId, CommunityIdentifier]>; | ||
readonly isMeetupRegistry: boolean; | ||
readonly asMeetupRegistry: ITuple<[AccountId, CommunityIdentifier]>; | ||
readonly type: 'Balance' | 'ParticipantIndex' | 'MeetupIndex' | 'Attestations' | 'MeetupRegistry'; | ||
} | ||
|
||
/** @name EncointerTrustedGetterSigned */ | ||
export interface EncointerTrustedGetterSigned extends Struct { | ||
readonly getter: EncointerTrustedGetter; | ||
readonly signature: Signature; | ||
} | ||
|
||
/** @name GrantReputationArgs */ | ||
export interface GrantReputationArgs extends ITuple<[AccountId, CommunityIdentifier, AccountId]> {} | ||
|
||
/** @name RegisterAttestationsArgs */ | ||
export interface RegisterAttestationsArgs extends ITuple<[AccountId, Vec<Attestation>]> {} | ||
|
||
/** @name RegisterParticipantArgs */ | ||
export interface RegisterParticipantArgs extends ITuple<[AccountId, CommunityIdentifier, Option<ProofOfAttendance>]> {} | ||
|
||
export type PHANTOM_ENCOINTERWORKER = 'encointerWorker'; |
60 changes: 60 additions & 0 deletions
60
packages/types/src/interfaces/integriteeWorker/definitions.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
export default { | ||
rpc: {}, | ||
types: { | ||
IntegriteePublicGetter: { | ||
_enum: { | ||
total_issuance: 'CommunityIdentifier', | ||
participant_count: 'CommunityIdentifier', | ||
meetup_count: 'CommunityIdentifier', | ||
ceremony_reward: 'CommunityIdentifier', | ||
location_tolerance: 'CommunityIdentifier', | ||
time_tolerance: 'CommunityIdentifier', | ||
scheduler_state: 'CommunityIdentifier' | ||
} | ||
}, | ||
IntegriteeTrustedGetter: { | ||
_enum: { | ||
free_balance: 'AccountId', | ||
reserved_balance: 'AccountId', | ||
nonce: 'AccountId', | ||
} | ||
}, | ||
IntegriteeTrustedGetterSigned: { | ||
getter: 'IntegriteeTrustedGetter', | ||
signature: 'MultiSignature' | ||
}, | ||
IntegriteeGetter: { | ||
_enum: { | ||
public: 'IntegriteePublicGetter', | ||
trusted: 'IntegriteeTrustedGetterSigned' | ||
} | ||
}, | ||
IntegriteeTrustedOperation: { | ||
_enum: { | ||
indirect_call: 'IntegriteeTrustedCallSigned', | ||
direct_call: 'IntegriteeTrustedCallSigned', | ||
get: 'IntegriteeGetter' | ||
} | ||
}, | ||
IntegriteeTrustedCallSigned: { | ||
call: 'IntegriteeTrustedCall', | ||
nonce: 'u32', | ||
signature: 'MultiSignature' | ||
}, | ||
IntegriteeTrustedCall: { | ||
_enum: { | ||
noop: 'AccountId', | ||
balance_set_balance: 'BalanceSetBalanceArgs', | ||
balance_transfer: 'BalanceTransferArgs', | ||
balance_unshield: 'BalanceUnshieldArgs', | ||
balance_shield: 'BalanceShieldArgs', | ||
timestamp_set: 'TimestampSetArgs', | ||
} | ||
}, | ||
BalanceSetBalanceArgs: '(AccountId, AccountId, BalanceType, BalanceType)', | ||
BalanceTransferArgs: '(AccountId, AccountId, BalanceType)', | ||
BalanceUnshieldArgs: '(AccountId, AccountId, BalanceType, ShardIdentifier)', | ||
BalanceShieldArgs: '(AccountId, AccountId, BalanceType, ParentchainId)', | ||
TimestampSetArgs: '(AccountId, H160, BalanceType)', | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit | ||
/* eslint-disable */ | ||
|
||
export * from './types.js'; |
Oops, something went wrong.