-
Notifications
You must be signed in to change notification settings - Fork 458
Fix framework integration test - Closes #6640 #6959
Fix framework integration test - Closes #6640 #6959
Conversation
8705534
to
454e96f
Compare
4aea45a
to
77b1e39
Compare
- Add Integration test back - Fix forever loop for SMT - Fix block generation not executin transaction - Fix dependency injection - Fix token API saving invalid object - Fix genesis asset fixture on test - Fix fork choice time usage - Fix auth module verify to expect no data - Fix reward module to expect no initial value on init - Fix reward module to not check BFT when reward is zero :bug: Fix SMT prefix and loop fix test fixture fix fix processor test
3f79fc1
to
65682b3
Compare
@@ -22,4 +22,5 @@ export const copyBuffer = (value: Buffer): Buffer => { | |||
}; | |||
|
|||
export const toSMTKey = (value: Buffer): Buffer => | |||
Buffer.concat([value.slice(0, SMT_PREFIX_SIZE), hash(value.slice(SMT_PREFIX_SIZE))]); | |||
// First byte is the DB prefix | |||
Buffer.concat([value.slice(1, SMT_PREFIX_SIZE + 1), hash(value.slice(SMT_PREFIX_SIZE + 1))]); |
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.
Issue #6961
while (binaryKey.charAt(h) === currentNodeBinaryKey.charAt(h)) { | ||
while ( | ||
binaryKey.length > h && | ||
currentNodeBinaryKey.length > h && |
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.
Without this check, it will go into forever loop when all keys are equal
|
||
// First transaction will not have nonce | ||
try { | ||
senderAccount = await store.getWithSchema<AuthAccount>( |
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.
sending first transaction will not have auth data set
const store = context.getStore(this.id, STORE_PREFIX_AUTH); | ||
const senderExist = await store.has(transaction.senderAddress); | ||
if (!senderExist) { | ||
await store.setWithSchema( |
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.
Creating initial data was missing
@@ -54,6 +54,9 @@ export class ReportDelegateMisbehaviorCommand extends BaseCommand { | |||
this._bftAPI = args.bftAPI; | |||
this._tokenAPI = args.tokenAPI; | |||
this._validatorsAPI = args.validatorsAPI; | |||
} | |||
|
|||
public init(args: { tokenIDDPoS: TokenIDDPoS }) { |
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.
Token ID is not dependency and it's only given in the init step in the module
db: this._db, | ||
network: this._network, | ||
validatorsAPI: this._validatorAPI, | ||
generatorAddress: Buffer.alloc(0), |
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.
DB only exist in the init step, so it should be created at the init step
@@ -439,7 +446,7 @@ export class Consensus { | |||
{ id: block.header.id, height: block.header.height }, | |||
'Processing valid block', | |||
); | |||
await this._verify(block); | |||
block.validate(); |
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.
verification should happen at the later stage
@@ -100,7 +100,7 @@ export const forkChoice = ( | |||
// Current time since Lisk Epoch | |||
const receivedBFTHeader = { | |||
...blockHeader.toObject(), | |||
receivedAt: slots.timeSinceGenesis(), | |||
receivedAt: Math.floor(Date.now() / 1000), |
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.
at later stage, receivedAt is used as the received time, not time since genesis
const transactions = | ||
input.transactions ?? (await this._forgingStrategy.getTransactionsForBlock(blockHeader)); | ||
|
||
blockCtx.setTransactions(transactions); | ||
for (const tx of transactions) { |
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.
transaction execution was missing in generator
await this._stateMachine.executeTransaction(txContext); | ||
} | ||
|
||
await this._stateMachine.afterExecuteBlock(blockCtx); |
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.
Issue #6976
5499c5c
to
1bbaced
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, some minor comments
} catch (error) { | ||
return { status: VerifyStatus.FAIL }; | ||
return { status: VerifyStatus.FAIL, error: error as Error }; | ||
} |
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,
} catch (error: Error) {
return { status: VerifyStatus.FAIL, error };
}
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.
} catch (error: Error) {
doesn't work since typescript type it as any
Co-authored-by: !shan <[email protected]>
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! Some minor comment
…/github.com/LiskHQ/lisk-sdk into 6640-fix_integration_test
f20cbee
to
b7b95b3
Compare
What was the problem?
This PR resolves #6640, resolves #6961 and resolves #6976
How was it solved?
How was it tested?
Enable integration test