Skip to content

Commit 570634b

Browse files
gballets1na
andcommitted
Let users select their fixture in basic evm test. (#62)
* Let users select their fixture in basic evm test. * Update src/relayer/basic-evm.ts Co-Authored-By: Sina Mahmoodi <[email protected]> * fix linter issue * add an SLOAD+MSTORE8 Co-authored-by: Sina Mahmoodi <[email protected]>
1 parent c211f43 commit 570634b

File tree

3 files changed

+40
-4
lines changed

3 files changed

+40
-4
lines changed

src/relayer/basic-evm.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ import {
1212
} from './lib'
1313
const Trie = require('merkle-patricia-tree/secure')
1414

15-
export async function basicEvmTestSuite(): Promise<TestSuite> {
15+
export async function basicEvmTestSuite(p: string = 'fixture/add.json'): Promise<TestSuite> {
1616
const trie = new Trie()
1717

18-
const test = JSON.parse(fs.readFileSync(path.join(__dirname, 'fixture/add.json'), 'utf-8'))
18+
const test = JSON.parse(fs.readFileSync(path.join(__dirname, p), 'utf-8'))
1919
const [accounts, codeHashes, bytecode] = await getTestsAccounts(trie, test)
2020

2121
const preStateRoot = trie.root

src/relayer/bin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ async function main() {
4343
const rpcData = JSON.parse(fs.readFileSync(process.argv[3]))
4444
const testSuite = await generateRealisticTestSuite(rpcData)
4545
writeScoutConfig(testSuite, 'turbo-token-realistic.yaml', 'build/token_with_keccak.wasm')
46-
} else if (args.length === 3 && args[2] === '--basicEvm') {
47-
const testSuite = await basicEvmTestSuite()
46+
} else if (args.length >= 3 && args[2] === '--basicEvm') {
47+
const testSuite = await basicEvmTestSuite(args[3])
4848
writeScoutConfig(testSuite, 'basic-evm.yaml', 'build/evm_with_keccak.wasm')
4949
} else {
5050
const testSuite = await generateTestSuite()

src/relayer/fixture/add_store.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"_comment": "ADD two values, SSTORE result, and RETURN",
3+
"returnValue": "0x05",
4+
"pre" : {
5+
"0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
6+
"balance" : "0x0de0b6b3a7640000",
7+
"code" : "0x600260030160005560005460005360016000f3",
8+
"nonce" : "0x00",
9+
"storage" : {
10+
"0x00": "0x01"
11+
}
12+
},
13+
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
14+
"balance" : "0x0de0b6b3a7640000",
15+
"code" : "0x",
16+
"nonce" : "0x00",
17+
"storage" : {
18+
}
19+
}
20+
},
21+
"transaction" : {
22+
"data" : [
23+
"0x"
24+
],
25+
"gasLimit" : [
26+
"0x061a80"
27+
],
28+
"gasPrice" : "0x01",
29+
"nonce" : "0x00",
30+
"secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
31+
"to" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87",
32+
"value" : [
33+
"0x0186a0"
34+
]
35+
}
36+
}

0 commit comments

Comments
 (0)