Skip to content

Commit

Permalink
Support for new inherent digests (polkadot-js#973)
Browse files Browse the repository at this point in the history
* Support for new inherent digests

* Latest metadata

* Pull in new council & democracy types

* Update tests for new digest

* Digest logsWith/Without

* Round-up e2e tests

* Remove stray debugging log

* Update CHANGELOG.md

Co-Authored-By: Amaury Martiny <amaury.martiny@protonmail.com>
  • Loading branch information
2 people authored and ianhe8x committed Jun 17, 2019
1 parent 9ac71f8 commit 6370ac4
Show file tree
Hide file tree
Showing 19 changed files with 531 additions and 318 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 0.81.1

- Add support for new inherent digests from substrate.
- **Breaking change** Because of the new `Seal`, the old/new Seals are not compatible. If you were using the old `Seal` from the `Digest`s, you would now use `isSealV0` for the pre-substrate 1.0 version and the new `isSeal` for the current version

# 0.80.1

- Support for mortal transactions
Expand All @@ -15,7 +20,7 @@
- Introduce RuntimeVersion type overrides in api/nodeCompat.ts
- Add `api.queryMulti` and `api.query.<module>.<method>.multi`
- Convert `api.derive.*` to use multi queries
- `types/codec/Set` now extends the base JS `Set` (breaking: `set.values` -> `set.strings`)
- `types/codec/Set` now extends the base JS `Set` (**breaking change**: `set.values` -> `set.strings`)
- Breaking: rename `meta.arguments` to `meta.args` in function metadata (`arguments` is a JS reserved word)
- Add `toRawType` on all type classes (breakdown into primitive types)

Expand Down Expand Up @@ -126,7 +131,7 @@ import { Method, Signature } from '@polkadot/types';

# 0.43.1

- Intrduces support for the new keyring with sr25519 support in addition to ed25519. While this does not change the exposed API, it is considerred breaking since @polkadot/keuyring has interface changes. (Unless needed, don't rush the upgrade)
- Intrduces support for the new keyring with sr25519 support in addition to ed25519. While this does not change the exposed API, it is considerred breaking since @polkadot/keyring has interface changes. (Unless needed, don't rush the upgrade)

# 0.42.1

Expand Down
4 changes: 2 additions & 2 deletions packages/api-derive/src/type/HeaderExtended.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ export default class HeaderExtended extends Header {
slot = consensus.asAura[0];
}
} else {
item = header.digest.logs.find((log) => log.isSeal);
item = header.digest.logs.find((log) => log.isSealV0);

// extract author from the seal (pre substrate 1.0, backwards compat)
if (item) {
slot = item.asSeal.slot;
slot = item.asSealV0.slot;
}
}

Expand Down
7 changes: 7 additions & 0 deletions packages/api/test/e2e/promise-queries.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ describe.skip('Promise e2e queries', () => {
);
});

it('can retrive header by hash', async () => {
const latest = await api.rpc.chain.getHeader() as Header;
const specific = await api.rpc.chain.getHeader(latest.hash) as Header;

expect(latest.hash).toEqual(specific.hash);
});

it('makes a query at a latest block (specified)', async () => {
const header = await api.rpc.chain.getHeader() as Header;
const events = await api.query.system.events.at(header.hash) as Vector<EventRecord>;
Expand Down
3 changes: 3 additions & 0 deletions packages/types/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ These custom types implement specific types that are found as part of the Substr
| [[BftProposeOutOfTurn]] | A report for out-of-turn proposals |
| [[BlockNumber]] | A representation of a Substrate BlockNumber, implemented as a [[U64]] |
| [[CodeHash]] | The default contract code hash that is used accross the system |
| [[Conviction]] | A value denoting the strength of conviction of a vote. |
| [[Consensus]] | Log item indicating consensus |
| [[ContractInfo]] | The contract information for a given contract |
| [[ContractStorageKey]] | A representation of a storage key for contracts |
Expand All @@ -106,6 +107,7 @@ These custom types implement specific types that are found as part of the Substr
| [[KeyValueOption]] | A key/value change. Similar to the [[KeyValue]] structure, but the value can be optional |
| [[LockIdentifier]] | The Substrate LockIdentifier for staking |
| [[LockPeriods]] | A number of lock periods |
| [[MemberCount]] | A number of council members |
| [[MisbehaviorKind]] | An [[EnumType]] containing a Bft misbehaviour |
| [[MisbehaviorReport]] | A Misbehaviour report of [[MisbehavioirKind]] against a specific [[AuthorityId]] |
| [[NewAccountOutcome]] | Enum to track the outcome for creation of an [[AccountId]] |
Expand Down Expand Up @@ -136,6 +138,7 @@ These custom types implement specific types that are found as part of the Substr
| [[ValidatorPrefs]] | Validator preferences |
| [[VestingSchedule]] | Struct to encode the vesting schedule of an individual account |
| [[Vote]] | A number of lock periods, plus a vote, one way or the other |
| [[Votes]] | Info for keeping track of a council motion being voted on. |
| [[VoteIndex]] | Voting index, implemented as a [[U32]] |
| [[VoteThreshold]] | Voting threshold, used inside proposals to set change the voting tally |
| [[WithdrawReasons]] | The Substrate WithdrawReasons for staking |
Expand Down
Loading

0 comments on commit 6370ac4

Please sign in to comment.