-
Notifications
You must be signed in to change notification settings - Fork 458
Update chain to use lisk-codec with new schema - Closes #5264 #5367
Conversation
9886e56
to
08cb5b3
Compare
d8b8925
to
938539a
Compare
d1989ea
to
d1e6664
Compare
Chain build complete without state store match
fc03bef
to
c9ddd65
Compare
4f9a4bd
to
fe4c4dc
Compare
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.
LGTM, few comments
elements/lisk-chain/src/data_access/block_header_interface_adapter.ts
Outdated
Show resolved
Hide resolved
elements/lisk-chain/src/data_access/block_header_interface_adapter.ts
Outdated
Show resolved
Hide resolved
elements/lisk-chain/src/data_access/block_header_interface_adapter.ts
Outdated
Show resolved
Hide resolved
} | ||
|
||
/** End: BlockHeaders */ | ||
|
||
/** Begin: Blocks */ | ||
|
||
public async getBlockByID(id: string): Promise<BlockInstance> { | ||
const blockJSON = await this._storage.getBlockByID(id); | ||
public async getBlockByID<T>(id: Buffer): Promise<Block<T>> { |
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.
whats the purpose of generics here?
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 can specify what type of block header it's expecting
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.
but we you care not using T
anywhere.. its basically expecting same type it requested for.. so it wouldnt make difference if we remove it as well rite? you are missing this part
return this._decodeRawBlock<T>(block);
?
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.
This is mainly used outside, maybe we can remove it, but if we want to make typescript work bit better outside of chain, i think this is better?
From outside, i dont think return this._decodeRawBlock<T>(block);
matters for the type
Update generic and specific schema validation in lisk-transactions - Closes #5370
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.
Apart from one comment LGTM
export interface DefaultAsset { | ||
[key: string]: { | ||
[key: string]: BasicTypes; | ||
}; | ||
} |
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.
can't we define AccountAsset in a more granular way AccountAsset { delegate: {...}, sentVotes: {...}, unlocking: {...}}
instead of just giving it so generic. I know its corresponding to the schema provided in the LIP but once we deserialize and make an Account class object maybe we can expand the type definition withing the asset?
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 is intentionally made generic because chain doesn't know about exact account asset schema
What was the problem?
This PR resolves #5264
How was it solved?
How was it tested?