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

feat: add /pallets/errors #1176

Merged
merged 15 commits into from
Jan 23, 2023
Merged

Conversation

marshacb
Copy link
Collaborator

@marshacb marshacb commented Jan 5, 2023

Summary: An endpoint that returns the errors for a given pallet

/pallets/{palletId}/errors

Query Params

  • at: Which block to query, it will default to the latest finalized block. Accepts a hash or blocknumber
  • onlyIds: boolean to return only the Ids of each error instead of the entirety of each error

Sample response for /pallets/democracy/errors?onlyIds=true

{
	"at": {
		"hash": "0x6970f8f6d53d2386f50b4360f9b3bad80bb53181bdd22ed9e4333ab9e425beb8",
		"height": "13670232"
	},
	"pallet": "democracy",
	"palletIndex": "14",
	"items": [
		"ValueLow",
		"ProposalMissing",
		"AlreadyCanceled",
		"DuplicateProposal",
		"ProposalBlacklisted",
		"NotSimpleMajority",
		"InvalidHash",
		"NoProposal",
		"AlreadyVetoed",
		"DuplicatePreimage",
		"NotImminent",
		"TooEarly",
		"Imminent",
		"PreimageMissing",
		"ReferendumInvalid",
		"PreimageInvalid",
		"NoneWaiting",
		"NotVoter",
		"NoPermission",
		"AlreadyDelegating",
		"InsufficientFunds",
		"NotDelegating",
		"VotesExist",
		"InstantNotAllowed",
		"Nonsense",
		"WrongUpperBound",
		"MaxVotesReached",
		"TooManyProposals",
		"VotingPeriodLow"
	]
}

/pallets/{palletId}/errors/{errorItemId}

Query Params

  • at: Which block to query, it will default to the latest finalized block. Accepts a hash or blocknumber
  • metadata: boolean to choose whether to include an errors metadata in the response

Sample response for /pallets/democracy/errors/ValueLow

{
	"at": {
		"hash": "0xc2550d0da7f0ad271045c201156d7cce4aa6fd461c7f1812269e763af8f6f7e1",
		"height": "13670213"
	},
	"pallet": "democracy",
	"palletIndex": "14",
	"errorItem": "valueLow"
}

@marshacb marshacb requested a review from a team as a code owner January 5, 2023 15:46
@marshacb marshacb changed the title Cameron implement pallet errors endpoint pallet errors endpoint Jan 5, 2023
@marshacb marshacb changed the title pallet errors endpoint feat: add /pallet/errors Jan 5, 2023
@marshacb marshacb changed the title feat: add /pallet/errors feat: add /pallets/errors Jan 5, 2023
@marshacb marshacb added the A0 - Please Review PR is ready for review label Jan 5, 2023
@TarikGul
Copy link
Member

TarikGul commented Jan 5, 2023

@marshacb Can you please include a detailed description in the PR about the feature, it's a bit easier to digest and compare what is expected.

docs/src/openapi-v1.yaml Show resolved Hide resolved
docs/src/openapi-v1.yaml Outdated Show resolved Hide resolved
Copy link
Member

@TarikGul TarikGul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So overall, really great PR. Just want to get your thoughts on some of the questions below. Also if we should make some sort of AbstractPalletsService for some of the logic below if it's to be reused.

@TarikGul
Copy link
Member

One more addition as well, let's add these endpoint to e2e-tests/latest/endpoints/polkadot.ts.

@marshacb marshacb requested a review from Imod7 January 12, 2023 13:48
Copy link
Member

@TarikGul TarikGul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job, just some small nits. 👍

remove newline
update latest polkadot e2e tests with PhragmentElection Pallet
@marshacb marshacb requested a review from Imod7 January 20, 2023 17:01
@marshacb marshacb requested a review from Imod7 January 23, 2023 15:04
Copy link
Contributor

@Imod7 Imod7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Great to me! 💯

@marshacb marshacb merged commit 65a0881 into master Jan 23, 2023
@marshacb marshacb deleted the cameron-implement-pallet-errors-endpoint branch January 23, 2023 15:52
@IkerAlus IkerAlus mentioned this pull request Jul 20, 2023
10 tasks
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A0 - Please Review PR is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants