-
Notifications
You must be signed in to change notification settings - Fork 90
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
Support archive_unstable_body #864
Conversation
packages/e2e/src/chain.test.ts
Outdated
@@ -42,6 +42,13 @@ describe('chain rpc', () => { | |||
await check(api.rpc.chain.getBlock(hash0)).toMatchSnapshot() | |||
await check(api.rpc.chain.getBlock(hash1000)).toMatchSnapshot() | |||
|
|||
expect(await api.rpc('archive_unstable_body', hash1000)).toEqual( | |||
expect.arrayContaining([ | |||
'0x280401000be3da72cc7d01', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's most probably not ok to hardcode these. How can I access the lower parts of a snapshot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine. Block 100 isn't going to change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason to not use match snapshot of the whole body?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the thing is that archive_unstable_body
only responds with the extrinsics array. However toMatchSnapshot
is for the body
, the header
etc. So if I could have selected juste the extrinsics
from this snaptshot, it would have been ideal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you misunderstood how snapshot works. it is for any shapes of data. run yarn vitest -u file/name.ts
to generate/update snapshots
https://vitest.dev/guide/snapshot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, I have indeed no idea, and was definitely looking for help. I'll check it out in the morning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the guidance, it's now using a snapshot
* | ||
* @return Block extrinsics | ||
*/ | ||
export const archive_unstable_body: Handler<[HexString], HexString[]> = async (context, [hash]) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you like me to create a new archive
folder, and put this function there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up to you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will make finding things a bit easier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, I also moved the archive alias.
closes #860
This adds support for
archive_unstable_body
which answers an array of extrinsics.Please let me know what's the best way to test this without hardcoding the extrinsics