-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:AcalaNetwork/boka
* 'master' of github.com:AcalaNetwork/boka: add pvm instructions 5.10, 5.11, 5.12 (#84) recent history tests are fixed now (#88) support offenders in safrole (#87) Recent history test (#85)
- Loading branch information
Showing
19 changed files
with
876 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import Blockchain | ||
import Codec | ||
import Foundation | ||
import Testing | ||
import Utils | ||
|
||
@testable import JAMTests | ||
|
||
struct RecentHistoryInput: Codable { | ||
var headerHash: Data32 | ||
var parentStateRoot: Data32 | ||
var accumulateRoot: Data32 | ||
var workPackages: [Data32] | ||
} | ||
|
||
struct RecentHisoryTestcase: Codable { | ||
var input: RecentHistoryInput | ||
var preState: RecentHistory | ||
var postState: RecentHistory | ||
} | ||
|
||
struct RecentHistoryTests { | ||
static func loadTests() throws -> [Testcase] { | ||
try TestLoader.getTestcases(path: "history/data", extension: "scale") | ||
} | ||
|
||
@Test(arguments: try loadTests()) | ||
func recentHistory(_ testcase: Testcase) throws { | ||
let config = ProtocolConfigRef.mainnet | ||
let testcase = try JamDecoder.decode(RecentHisoryTestcase.self, from: testcase.data, withConfig: config) | ||
|
||
var state = testcase.preState | ||
try state.update( | ||
headerHash: testcase.input.headerHash, | ||
parentStateRoot: testcase.input.parentStateRoot, | ||
accumulateRoot: testcase.input.accumulateRoot, | ||
workReportHashes: ConfigLimitedSizeArray(config: config, array: testcase.input.workPackages) | ||
) | ||
|
||
#expect(state == testcase.postState) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.