From fef2481f10a0f1f9fc2cdb24f54e9dc8ce5a820b Mon Sep 17 00:00:00 2001 From: cdamian <17934949+cdamian@users.noreply.github.com> Date: Fri, 9 Sep 2022 11:58:17 +0300 Subject: [PATCH 1/2] events: Add VoterList events --- types/event_record.go | 3 +++ types/events.go | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/types/event_record.go b/types/event_record.go index 390ee3133..77f3b2c53 100644 --- a/types/event_record.go +++ b/types/event_record.go @@ -427,6 +427,9 @@ type EventRecords struct { Vesting_VestingCompleted []EventVestingVestingCompleted `test-gen-blockchain:"centrifuge-parachain"` Vesting_VestingUpdated []EventVestingVestingUpdated `test-gen-blockchain:"centrifuge-parachain"` + VoterList_Rebagged []EventVoterListRebagged `test-gen-blockchain:"polkadot"` + VoterList_ScoreUpdated []EventVoterListScoreUpdated `test-gen-blockchain:"polkadot"` + Whitelist_CallWhitelisted []EventWhitelistCallWhitelisted `test-gen-skip:"true"` Whitelist_WhitelistedCallRemoved []EventWhitelistWhitelistedCallRemoved `test-gen-skip:"true"` Whitelist_WhitelistedCallDispatched []EventWhitelistWhitelistedCallRemoved `test-gen-skip:"true"` diff --git a/types/events.go b/types/events.go index c33947351..e138b27ce 100644 --- a/types/events.go +++ b/types/events.go @@ -2109,6 +2109,23 @@ type EventVestingVestingUpdated struct { Topics []Hash } +// EventVoterListRebagged is emitted when an account is moved from one bag to another. +type EventVoterListRebagged struct { + Phase Phase + Who AccountID + From U64 + To U64 + Topics []Hash +} + +// EventVoterListScoreUpdated is emitted when the score of an account is updated to the given amount. +type EventVoterListScoreUpdated struct { + Phase Phase + Who AccountID + NewScore U64 + Topics []Hash +} + // EventWhitelistCallWhitelisted is emitted when a call has been whitelisted. type EventWhitelistCallWhitelisted struct { Phase Phase From 6e6f4cccc69011803f252a9029c471f48709c154 Mon Sep 17 00:00:00 2001 From: cdamian <17934949+cdamian@users.noreply.github.com> Date: Mon, 29 Aug 2022 21:44:57 +0300 Subject: [PATCH 2/2] types: Use [4]U8 for module error --- types/errors.go | 5 +---- types/errors_test.go | 6 +++--- types/event_record_test.go | 4 ++-- types/events_test.go | 22 ---------------------- 4 files changed, 6 insertions(+), 31 deletions(-) diff --git a/types/errors.go b/types/errors.go index 9739de57b..7b959523f 100644 --- a/types/errors.go +++ b/types/errors.go @@ -21,10 +21,7 @@ import "github.com/centrifuge/go-substrate-rpc-client/v4/scale" type ModuleError struct { Index U8 - // The 1 byte error is considered legacy however it seems that it's still used. - // - // Error [4]U8 - Error U8 + Error [4]U8 } func (m *ModuleError) Decode(decoder scale.Decoder) error { diff --git a/types/errors_test.go b/types/errors_test.go index 531df42fb..4e5bf7a2b 100644 --- a/types/errors_test.go +++ b/types/errors_test.go @@ -38,7 +38,7 @@ var ( IsModule: true, ModuleError: ModuleError{ Index: 4, - Error: 5, + Error: [4]U8{5, 0, 0, 0}, }, } testDispatchError5 = DispatchError{ @@ -163,7 +163,7 @@ func TestDispatchError_Encode(t *testing.T) { {testDispatchError1, MustHexDecodeString("0x00")}, {testDispatchError2, MustHexDecodeString("0x01")}, {testDispatchError3, MustHexDecodeString("0x02")}, - {testDispatchError4, MustHexDecodeString("0x030405")}, + {testDispatchError4, MustHexDecodeString("0x030405000000")}, {testDispatchError5, MustHexDecodeString("0x04")}, {testDispatchError6, MustHexDecodeString("0x05")}, {testDispatchError7, MustHexDecodeString("0x06")}, @@ -178,7 +178,7 @@ func TestDispatchError_Decode(t *testing.T) { {MustHexDecodeString("0x00"), testDispatchError1}, {MustHexDecodeString("0x01"), testDispatchError2}, {MustHexDecodeString("0x02"), testDispatchError3}, - {MustHexDecodeString("0x030405"), testDispatchError4}, + {MustHexDecodeString("0x030405000000"), testDispatchError4}, {MustHexDecodeString("0x04"), testDispatchError5}, {MustHexDecodeString("0x05"), testDispatchError6}, {MustHexDecodeString("0x06"), testDispatchError7}, diff --git a/types/event_record_test.go b/types/event_record_test.go index 5e777d2c0..74da1fb2f 100644 --- a/types/event_record_test.go +++ b/types/event_record_test.go @@ -260,7 +260,7 @@ func TestEventRecordsRaw_Decode(t *testing.T) { "0001" + // System_ExtrinsicFailed "03" + // HasModule "0b" + // Module - "00" + // Error + "01020304" + // Error "1027000000000000" + // Weight "01" + // DispatchClass: Operational "00" + // PaysFees @@ -311,7 +311,7 @@ func TestEventRecordsRaw_Decode(t *testing.T) { Balances_ReserveRepatriated: []EventBalancesReserveRepatriated(nil), Grandpa_NewAuthorities: []EventGrandpaNewAuthorities(nil), Grandpa_Paused: []EventGrandpaPaused(nil), - Grandpa_Resumed: []EventGrandpaResumed(nil), ImOnline_HeartbeatReceived: []EventImOnlineHeartbeatReceived(nil), ImOnline_AllGood: []EventImOnlineAllGood(nil), ImOnline_SomeOffline: []EventImOnlineSomeOffline(nil), Indices_IndexAssigned: []EventIndicesIndexAssigned{EventIndicesIndexAssigned{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, AccountID: AccountID{0x8e, 0xaf, 0x4, 0x15, 0x16, 0x87, 0x73, 0x63, 0x26, 0xc9, 0xfe, 0xa1, 0x7e, 0x25, 0xfc, 0x52, 0x87, 0x61, 0x36, 0x93, 0xc9, 0x12, 0x90, 0x9c, 0xb2, 0x26, 0xaa, 0x47, 0x94, 0xf2, 0x6a, 0x48}, AccountIndex: 0x3039, Topics: []Hash(nil)}}, Indices_IndexFreed: []EventIndicesIndexFreed{EventIndicesIndexFreed{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, AccountIndex: 0x3039, Topics: []Hash(nil)}}, Indices_IndexFrozen: []EventIndicesIndexFrozen(nil), Offences_Offence: []EventOffencesOffence{EventOffencesOffence{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, Kind: Bytes16{0x69, 0x6d, 0x2d, 0x6f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x3a, 0x6f, 0x66, 0x66, 0x6c, 0x69, 0x6e}, OpaqueTimeSlot: Bytes{0xc5, 0x0, 0x0, 0x0}, Topics: []Hash(nil)}}, Session_NewSession: []EventSessionNewSession{EventSessionNewSession{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, SessionIndex: 0xc6, Topics: []Hash(nil)}}, Staking_EraPaid: []EventStakingEraPaid{EventStakingEraPaid{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, EraIndex: 0xc6, ValidatorPayout: NewU128(*big.NewInt(4586363775847)), Remainder: NewU128(*big.NewInt(0)), Topics: []Hash(nil)}}, Staking_Rewarded: []EventStakingRewarded(nil), Staking_Slashed: []EventStakingSlashed(nil), Staking_OldSlashingReportDiscarded: []EventStakingOldSlashingReportDiscarded(nil), Staking_StakersElected: []EventStakingStakersElected(nil), Staking_Bonded: []EventStakingBonded(nil), Staking_Unbonded: []EventStakingUnbonded(nil), Staking_Withdrawn: []EventStakingWithdrawn(nil), System_ExtrinsicSuccess: []EventSystemExtrinsicSuccess{EventSystemExtrinsicSuccess{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, DispatchInfo: DispatchInfo{Weight: 0x2710, Class: DispatchClass{IsNormal: false, IsOperational: true}, PaysFee: Pays{IsYes: true}}, Topics: []Hash(nil)}, EventSystemExtrinsicSuccess{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x1, IsFinalization: false}, DispatchInfo: DispatchInfo{Weight: 0x2710, Class: DispatchClass{IsNormal: true, IsOperational: false}, PaysFee: Pays{IsYes: true}}, Topics: []Hash(nil)}}, System_ExtrinsicFailed: []EventSystemExtrinsicFailed{EventSystemExtrinsicFailed{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x2, IsFinalization: false}, DispatchError: DispatchError{IsModule: true, ModuleError: ModuleError{Index: 0xb, Error: 0x0}}, DispatchInfo: DispatchInfo{Weight: 0x2710, Class: DispatchClass{IsNormal: false, IsOperational: true}, PaysFee: Pays{IsYes: true}}, Topics: []Hash(nil)}}, System_CodeUpdated: []EventSystemCodeUpdated{EventSystemCodeUpdated{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, Topics: []Hash(nil)}}, System_NewAccount: []EventSystemNewAccount{EventSystemNewAccount{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, Who: AccountID{0x8e, 0xaf, 0x4, 0x15, 0x16, 0x87, 0x73, 0x63, 0x26, 0xc9, 0xfe, 0xa1, 0x7e, 0x25, 0xfc, 0x52, 0x87, 0x61, 0x36, 0x93, 0xc9, 0x12, 0x90, 0x9c, 0xb2, 0x26, 0xaa, 0x47, 0x94, 0xf2, 0x6a, 0x48}, Topics: []Hash(nil)}}, System_KilledAccount: []EventSystemKilledAccount{EventSystemKilledAccount{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, Who: AccountID{0x8e, 0xaf, 0x4, 0x15, 0x16, 0x87, 0x73, 0x63, 0x26, 0xc9, 0xfe, 0xa1, 0x7e, 0x25, 0xfc, 0x52, 0x87, 0x61, 0x36, 0x93, 0xc9, 0x12, 0x90, 0x9c, 0xb2, 0x26, 0xaa, 0x47, 0x94, 0xf2, 0x6a, 0x48}, Topics: []Hash(nil)}}, Assets_Issued: []EventAssetIssued(nil), Assets_Transferred: []EventAssetTransferred(nil), Assets_Destroyed: []EventAssetDestroyed(nil), Democracy_Proposed: []EventDemocracyProposed(nil), Democracy_Tabled: []EventDemocracyTabled(nil), Democracy_ExternalTabled: []EventDemocracyExternalTabled(nil), Democracy_Started: []EventDemocracyStarted(nil), Democracy_Passed: []EventDemocracyPassed(nil), Democracy_NotPassed: []EventDemocracyNotPassed(nil), Democracy_Cancelled: []EventDemocracyCancelled(nil), Democracy_Executed: []EventDemocracyExecuted(nil), Democracy_Delegated: []EventDemocracyDelegated(nil), Democracy_Undelegated: []EventDemocracyUndelegated(nil), Democracy_Vetoed: []EventDemocracyVetoed(nil), Democracy_PreimageNoted: []EventDemocracyPreimageNoted(nil), Democracy_PreimageUsed: []EventDemocracyPreimageUsed(nil), Democracy_PreimageInvalid: []EventDemocracyPreimageInvalid(nil), Democracy_PreimageMissing: []EventDemocracyPreimageMissing(nil), Democracy_PreimageReaped: []EventDemocracyPreimageReaped(nil), Council_Proposed: []EventCouncilProposed(nil), Council_Voted: []EventCouncilVoted(nil), Council_Approved: []EventCouncilApproved(nil), Council_Disapproved: []EventCouncilDisapproved(nil), Council_Executed: []EventCouncilExecuted(nil), Council_MemberExecuted: []EventCouncilMemberExecuted(nil), Council_Closed: []EventCouncilClosed(nil), TechnicalCommittee_Proposed: []EventTechnicalCommitteeProposed(nil), TechnicalCommittee_Voted: []EventTechnicalCommitteeVoted(nil), TechnicalCommittee_Approved: []EventTechnicalCommitteeApproved(nil), TechnicalCommittee_Disapproved: []EventTechnicalCommitteeDisapproved(nil), TechnicalCommittee_Executed: []EventTechnicalCommitteeExecuted(nil), TechnicalCommittee_MemberExecuted: []EventTechnicalCommitteeMemberExecuted(nil), TechnicalCommittee_Closed: []EventTechnicalCommitteeClosed(nil), Elections_NewTerm: []EventElectionsNewTerm(nil), Elections_EmptyTerm: []EventElectionsEmptyTerm(nil), Elections_MemberKicked: []EventElectionsMemberKicked(nil), Elections_Renounced: []EventElectionsRenounced(nil), Identity_IdentitySet: []EventIdentitySet(nil), Identity_IdentityCleared: []EventIdentityCleared(nil), Identity_IdentityKilled: []EventIdentityKilled(nil), Identity_JudgementRequested: []EventIdentityJudgementRequested(nil), Identity_JudgementUnrequested: []EventIdentityJudgementUnrequested(nil), Identity_JudgementGiven: []EventIdentityJudgementGiven(nil), Identity_RegistrarAdded: []EventIdentityRegistrarAdded(nil), Identity_SubIdentityAdded: []EventIdentitySubIdentityAdded(nil), Identity_SubIdentityRemoved: []EventIdentitySubIdentityRemoved(nil), Identity_SubIdentityRevoked: []EventIdentitySubIdentityRevoked(nil), Society_Founded: []EventSocietyFounded(nil), Society_Bid: []EventSocietyBid(nil), Society_Vouch: []EventSocietyVouch(nil), Society_AutoUnbid: []EventSocietyAutoUnbid(nil), Society_Unbid: []EventSocietyUnbid(nil), Society_Unvouch: []EventSocietyUnvouch(nil), Society_Inducted: []EventSocietyInducted(nil), Society_SuspendedMemberJudgement: []EventSocietySuspendedMemberJudgement(nil), Society_CandidateSuspended: []EventSocietyCandidateSuspended(nil), Society_MemberSuspended: []EventSocietyMemberSuspended(nil), Society_Challenged: []EventSocietyChallenged(nil), Society_Vote: []EventSocietyVote(nil), Society_DefenderVote: []EventSocietyDefenderVote(nil), Society_NewMaxMembers: []EventSocietyNewMaxMembers(nil), Society_Unfounded: []EventSocietyUnfounded(nil), Society_Deposit: []EventSocietyDeposit(nil), Recovery_RecoveryCreated: []EventRecoveryCreated(nil), Recovery_RecoveryInitiated: []EventRecoveryInitiated(nil), Recovery_RecoveryVouched: []EventRecoveryVouched(nil), Recovery_RecoveryClosed: []EventRecoveryClosed(nil), Recovery_AccountRecovered: []EventRecoveryAccountRecovered(nil), Recovery_RecoveryRemoved: []EventRecoveryRemoved(nil), Vesting_VestingUpdated: []EventVestingVestingUpdated(nil), Vesting_VestingCompleted: []EventVestingVestingCompleted(nil), Scheduler_Scheduled: []EventSchedulerScheduled(nil), Scheduler_Canceled: []EventSchedulerCanceled(nil), Scheduler_Dispatched: []EventSchedulerDispatched(nil), Proxy_ProxyExecuted: []EventProxyProxyExecuted(nil), Proxy_AnonymousCreated: []EventProxyAnonymousCreated(nil), Sudo_Sudid: []EventSudoSudid(nil), Sudo_KeyChanged: []EventSudoKeyChanged(nil), Sudo_SudoAsDone: []EventSudoAsDone(nil), Treasury_Proposed: []EventTreasuryProposed(nil), Treasury_Spending: []EventTreasurySpending(nil), Treasury_Awarded: []EventTreasuryAwarded(nil), Treasury_Rejected: []EventTreasuryRejected(nil), Treasury_Burnt: []EventTreasuryBurnt(nil), Treasury_Rollover: []EventTreasuryRollover(nil), Treasury_Deposit: []EventTreasuryDeposit(nil), Tips_NewTip: []EventTipsNewTip(nil), Tips_TipClosing: []EventTipsTipClosing(nil), Tips_TipClosed: []EventTipsTipClosed(nil), Tips_TipRetracted: []EventTipsTipRetracted(nil), Contracts_Instantiated: []EventContractsInstantiated(nil), Contracts_ContractEmitted: []EventContractsContractEmitted(nil), Contracts_ContractCodeUpdated: []EventContractsContractCodeUpdated(nil), Contracts_CodeStored: []EventContractsCodeStored(nil), Utility_BatchInterrupted: []EventUtilityBatchInterrupted(nil), Utility_BatchCompleted: []EventUtilityBatchCompleted(nil), Multisig_NewMultisig: []EventMultisigNewMultisig(nil), Multisig_MultisigApproval: []EventMultisigApproval(nil), Multisig_MultisigExecuted: []EventMultisigExecuted(nil), Multisig_MultisigCancelled: []EventMultisigCancelled(nil)} + Grandpa_Resumed: []EventGrandpaResumed(nil), ImOnline_HeartbeatReceived: []EventImOnlineHeartbeatReceived(nil), ImOnline_AllGood: []EventImOnlineAllGood(nil), ImOnline_SomeOffline: []EventImOnlineSomeOffline(nil), Indices_IndexAssigned: []EventIndicesIndexAssigned{EventIndicesIndexAssigned{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, AccountID: AccountID{0x8e, 0xaf, 0x4, 0x15, 0x16, 0x87, 0x73, 0x63, 0x26, 0xc9, 0xfe, 0xa1, 0x7e, 0x25, 0xfc, 0x52, 0x87, 0x61, 0x36, 0x93, 0xc9, 0x12, 0x90, 0x9c, 0xb2, 0x26, 0xaa, 0x47, 0x94, 0xf2, 0x6a, 0x48}, AccountIndex: 0x3039, Topics: []Hash(nil)}}, Indices_IndexFreed: []EventIndicesIndexFreed{EventIndicesIndexFreed{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, AccountIndex: 0x3039, Topics: []Hash(nil)}}, Indices_IndexFrozen: []EventIndicesIndexFrozen(nil), Offences_Offence: []EventOffencesOffence{EventOffencesOffence{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, Kind: Bytes16{0x69, 0x6d, 0x2d, 0x6f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x3a, 0x6f, 0x66, 0x66, 0x6c, 0x69, 0x6e}, OpaqueTimeSlot: Bytes{0xc5, 0x0, 0x0, 0x0}, Topics: []Hash(nil)}}, Session_NewSession: []EventSessionNewSession{EventSessionNewSession{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, SessionIndex: 0xc6, Topics: []Hash(nil)}}, Staking_EraPaid: []EventStakingEraPaid{EventStakingEraPaid{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, EraIndex: 0xc6, ValidatorPayout: NewU128(*big.NewInt(4586363775847)), Remainder: NewU128(*big.NewInt(0)), Topics: []Hash(nil)}}, Staking_Rewarded: []EventStakingRewarded(nil), Staking_Slashed: []EventStakingSlashed(nil), Staking_OldSlashingReportDiscarded: []EventStakingOldSlashingReportDiscarded(nil), Staking_StakersElected: []EventStakingStakersElected(nil), Staking_Bonded: []EventStakingBonded(nil), Staking_Unbonded: []EventStakingUnbonded(nil), Staking_Withdrawn: []EventStakingWithdrawn(nil), System_ExtrinsicSuccess: []EventSystemExtrinsicSuccess{EventSystemExtrinsicSuccess{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, DispatchInfo: DispatchInfo{Weight: 0x2710, Class: DispatchClass{IsNormal: false, IsOperational: true}, PaysFee: Pays{IsYes: true}}, Topics: []Hash(nil)}, EventSystemExtrinsicSuccess{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x1, IsFinalization: false}, DispatchInfo: DispatchInfo{Weight: 0x2710, Class: DispatchClass{IsNormal: true, IsOperational: false}, PaysFee: Pays{IsYes: true}}, Topics: []Hash(nil)}}, System_ExtrinsicFailed: []EventSystemExtrinsicFailed{EventSystemExtrinsicFailed{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x2, IsFinalization: false}, DispatchError: DispatchError{IsModule: true, ModuleError: ModuleError{Index: 0xb, Error: [4]U8{1, 2, 3, 4}}}, DispatchInfo: DispatchInfo{Weight: 0x2710, Class: DispatchClass{IsNormal: false, IsOperational: true}, PaysFee: Pays{IsYes: true}}, Topics: []Hash(nil)}}, System_CodeUpdated: []EventSystemCodeUpdated{EventSystemCodeUpdated{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, Topics: []Hash(nil)}}, System_NewAccount: []EventSystemNewAccount{EventSystemNewAccount{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, Who: AccountID{0x8e, 0xaf, 0x4, 0x15, 0x16, 0x87, 0x73, 0x63, 0x26, 0xc9, 0xfe, 0xa1, 0x7e, 0x25, 0xfc, 0x52, 0x87, 0x61, 0x36, 0x93, 0xc9, 0x12, 0x90, 0x9c, 0xb2, 0x26, 0xaa, 0x47, 0x94, 0xf2, 0x6a, 0x48}, Topics: []Hash(nil)}}, System_KilledAccount: []EventSystemKilledAccount{EventSystemKilledAccount{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, Who: AccountID{0x8e, 0xaf, 0x4, 0x15, 0x16, 0x87, 0x73, 0x63, 0x26, 0xc9, 0xfe, 0xa1, 0x7e, 0x25, 0xfc, 0x52, 0x87, 0x61, 0x36, 0x93, 0xc9, 0x12, 0x90, 0x9c, 0xb2, 0x26, 0xaa, 0x47, 0x94, 0xf2, 0x6a, 0x48}, Topics: []Hash(nil)}}, Assets_Issued: []EventAssetIssued(nil), Assets_Transferred: []EventAssetTransferred(nil), Assets_Destroyed: []EventAssetDestroyed(nil), Democracy_Proposed: []EventDemocracyProposed(nil), Democracy_Tabled: []EventDemocracyTabled(nil), Democracy_ExternalTabled: []EventDemocracyExternalTabled(nil), Democracy_Started: []EventDemocracyStarted(nil), Democracy_Passed: []EventDemocracyPassed(nil), Democracy_NotPassed: []EventDemocracyNotPassed(nil), Democracy_Cancelled: []EventDemocracyCancelled(nil), Democracy_Executed: []EventDemocracyExecuted(nil), Democracy_Delegated: []EventDemocracyDelegated(nil), Democracy_Undelegated: []EventDemocracyUndelegated(nil), Democracy_Vetoed: []EventDemocracyVetoed(nil), Democracy_PreimageNoted: []EventDemocracyPreimageNoted(nil), Democracy_PreimageUsed: []EventDemocracyPreimageUsed(nil), Democracy_PreimageInvalid: []EventDemocracyPreimageInvalid(nil), Democracy_PreimageMissing: []EventDemocracyPreimageMissing(nil), Democracy_PreimageReaped: []EventDemocracyPreimageReaped(nil), Council_Proposed: []EventCouncilProposed(nil), Council_Voted: []EventCouncilVoted(nil), Council_Approved: []EventCouncilApproved(nil), Council_Disapproved: []EventCouncilDisapproved(nil), Council_Executed: []EventCouncilExecuted(nil), Council_MemberExecuted: []EventCouncilMemberExecuted(nil), Council_Closed: []EventCouncilClosed(nil), TechnicalCommittee_Proposed: []EventTechnicalCommitteeProposed(nil), TechnicalCommittee_Voted: []EventTechnicalCommitteeVoted(nil), TechnicalCommittee_Approved: []EventTechnicalCommitteeApproved(nil), TechnicalCommittee_Disapproved: []EventTechnicalCommitteeDisapproved(nil), TechnicalCommittee_Executed: []EventTechnicalCommitteeExecuted(nil), TechnicalCommittee_MemberExecuted: []EventTechnicalCommitteeMemberExecuted(nil), TechnicalCommittee_Closed: []EventTechnicalCommitteeClosed(nil), Elections_NewTerm: []EventElectionsNewTerm(nil), Elections_EmptyTerm: []EventElectionsEmptyTerm(nil), Elections_MemberKicked: []EventElectionsMemberKicked(nil), Elections_Renounced: []EventElectionsRenounced(nil), Identity_IdentitySet: []EventIdentitySet(nil), Identity_IdentityCleared: []EventIdentityCleared(nil), Identity_IdentityKilled: []EventIdentityKilled(nil), Identity_JudgementRequested: []EventIdentityJudgementRequested(nil), Identity_JudgementUnrequested: []EventIdentityJudgementUnrequested(nil), Identity_JudgementGiven: []EventIdentityJudgementGiven(nil), Identity_RegistrarAdded: []EventIdentityRegistrarAdded(nil), Identity_SubIdentityAdded: []EventIdentitySubIdentityAdded(nil), Identity_SubIdentityRemoved: []EventIdentitySubIdentityRemoved(nil), Identity_SubIdentityRevoked: []EventIdentitySubIdentityRevoked(nil), Society_Founded: []EventSocietyFounded(nil), Society_Bid: []EventSocietyBid(nil), Society_Vouch: []EventSocietyVouch(nil), Society_AutoUnbid: []EventSocietyAutoUnbid(nil), Society_Unbid: []EventSocietyUnbid(nil), Society_Unvouch: []EventSocietyUnvouch(nil), Society_Inducted: []EventSocietyInducted(nil), Society_SuspendedMemberJudgement: []EventSocietySuspendedMemberJudgement(nil), Society_CandidateSuspended: []EventSocietyCandidateSuspended(nil), Society_MemberSuspended: []EventSocietyMemberSuspended(nil), Society_Challenged: []EventSocietyChallenged(nil), Society_Vote: []EventSocietyVote(nil), Society_DefenderVote: []EventSocietyDefenderVote(nil), Society_NewMaxMembers: []EventSocietyNewMaxMembers(nil), Society_Unfounded: []EventSocietyUnfounded(nil), Society_Deposit: []EventSocietyDeposit(nil), Recovery_RecoveryCreated: []EventRecoveryCreated(nil), Recovery_RecoveryInitiated: []EventRecoveryInitiated(nil), Recovery_RecoveryVouched: []EventRecoveryVouched(nil), Recovery_RecoveryClosed: []EventRecoveryClosed(nil), Recovery_AccountRecovered: []EventRecoveryAccountRecovered(nil), Recovery_RecoveryRemoved: []EventRecoveryRemoved(nil), Vesting_VestingUpdated: []EventVestingVestingUpdated(nil), Vesting_VestingCompleted: []EventVestingVestingCompleted(nil), Scheduler_Scheduled: []EventSchedulerScheduled(nil), Scheduler_Canceled: []EventSchedulerCanceled(nil), Scheduler_Dispatched: []EventSchedulerDispatched(nil), Proxy_ProxyExecuted: []EventProxyProxyExecuted(nil), Proxy_AnonymousCreated: []EventProxyAnonymousCreated(nil), Sudo_Sudid: []EventSudoSudid(nil), Sudo_KeyChanged: []EventSudoKeyChanged(nil), Sudo_SudoAsDone: []EventSudoAsDone(nil), Treasury_Proposed: []EventTreasuryProposed(nil), Treasury_Spending: []EventTreasurySpending(nil), Treasury_Awarded: []EventTreasuryAwarded(nil), Treasury_Rejected: []EventTreasuryRejected(nil), Treasury_Burnt: []EventTreasuryBurnt(nil), Treasury_Rollover: []EventTreasuryRollover(nil), Treasury_Deposit: []EventTreasuryDeposit(nil), Tips_NewTip: []EventTipsNewTip(nil), Tips_TipClosing: []EventTipsTipClosing(nil), Tips_TipClosed: []EventTipsTipClosed(nil), Tips_TipRetracted: []EventTipsTipRetracted(nil), Contracts_Instantiated: []EventContractsInstantiated(nil), Contracts_ContractEmitted: []EventContractsContractEmitted(nil), Contracts_ContractCodeUpdated: []EventContractsContractCodeUpdated(nil), Contracts_CodeStored: []EventContractsCodeStored(nil), Utility_BatchInterrupted: []EventUtilityBatchInterrupted(nil), Utility_BatchCompleted: []EventUtilityBatchCompleted(nil), Multisig_NewMultisig: []EventMultisigNewMultisig(nil), Multisig_MultisigApproval: []EventMultisigApproval(nil), Multisig_MultisigExecuted: []EventMultisigExecuted(nil), Multisig_MultisigCancelled: []EventMultisigCancelled(nil)} //nolint:lll assert.Equal(t, exp, events) diff --git a/types/events_test.go b/types/events_test.go index 5b9649d37..f28c10acb 100644 --- a/types/events_test.go +++ b/types/events_test.go @@ -79,28 +79,6 @@ var ( ) func TestDispatchResult_Decode(t *testing.T) { - // ok - decoder := scale.NewDecoder(bytes.NewReader([]byte{0})) - var res DispatchResult - err := decoder.Decode(&res) - assert.NoError(t, err) - assert.True(t, res.Ok) - - // Dispatch Error - decoder = scale.NewDecoder(bytes.NewReader([]byte{1, 3, 1, 1})) - res = DispatchResult{} - assert.NoError(t, decoder.Decode(&res)) - - assert.False(t, res.Ok) - assert.True(t, res.Error.IsModule) - assert.Equal(t, res.Error.ModuleError.Index, U8(1)) - assert.Equal(t, res.Error.ModuleError.Error, U8(1)) - - // decoder error - decoder = scale.NewDecoder(bytes.NewReader([]byte{1, 3, 1})) - res = DispatchResult{} - assert.Error(t, decoder.Decode(&res)) - assertRoundTripFuzz[DispatchResult](t, 100, dispatchResultFuzzOpts...) assertDecodeNilData[DispatchResult](t) assertEncodeEmptyObj[DispatchResult](t, 1)