diff --git a/src/relayer/basic-evm.ts b/src/relayer/basic-evm.ts index 91091c1..0a8c7c4 100644 --- a/src/relayer/basic-evm.ts +++ b/src/relayer/basic-evm.ts @@ -12,10 +12,10 @@ import { } from './lib' const Trie = require('merkle-patricia-tree/secure') -export async function basicEvmTestSuite(): Promise { +export async function basicEvmTestSuite(p: string = 'fixture/add.json'): Promise { const trie = new Trie() - const test = JSON.parse(fs.readFileSync(path.join(__dirname, 'fixture/add.json'), 'utf-8')) + const test = JSON.parse(fs.readFileSync(path.join(__dirname, p), 'utf-8')) const [accounts, codeHashes, bytecode] = await getTestsAccounts(trie, test) const preStateRoot = trie.root diff --git a/src/relayer/bin.ts b/src/relayer/bin.ts index 02b3b8c..5eb4c23 100644 --- a/src/relayer/bin.ts +++ b/src/relayer/bin.ts @@ -43,8 +43,8 @@ async function main() { const rpcData = JSON.parse(fs.readFileSync(process.argv[3])) const testSuite = await generateRealisticTestSuite(rpcData) writeScoutConfig(testSuite, 'turbo-token-realistic.yaml', 'build/token_with_keccak.wasm') - } else if (args.length === 3 && args[2] === '--basicEvm') { - const testSuite = await basicEvmTestSuite() + } else if (args.length >= 3 && args[2] === '--basicEvm') { + const testSuite = await basicEvmTestSuite(args[3]) writeScoutConfig(testSuite, 'basic-evm.yaml', 'build/evm_with_keccak.wasm') } else { const testSuite = await generateTestSuite() diff --git a/src/relayer/fixture/add_store.json b/src/relayer/fixture/add_store.json new file mode 100644 index 0000000..b1a42fd --- /dev/null +++ b/src/relayer/fixture/add_store.json @@ -0,0 +1,36 @@ +{ + "_comment": "ADD two values, SSTORE result, and RETURN", + "returnValue": "0x05", + "pre" : { + "0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x0de0b6b3a7640000", + "code" : "0x600260030160005560005460005360016000f3", + "nonce" : "0x00", + "storage" : { + "0x00": "0x01" + } + }, + "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x0de0b6b3a7640000", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + } + }, + "transaction" : { + "data" : [ + "0x" + ], + "gasLimit" : [ + "0x061a80" + ], + "gasPrice" : "0x01", + "nonce" : "0x00", + "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : [ + "0x0186a0" + ] + } +}