mirror of
https://github.com/luxfi/evm.git
synced 2026-09-24 00:27:44 +00:00
* Add TrieStreeTest This smart contract will append N new elements to a vector, this is a stress test to our implementation of the trie structure * Expose internal database? * Rewrite bench Make bench more generic and simpler to bootstrap * Reuse functions * Deploy contract once and reuse it * Write full blocks * Allow callee to deploy N contracts Remove gas calculation from benchmarks, gas is still calculated to make sure all contracts are deployed. stressTestTrieDb takes 3 arguments. The number of contracts to deploy, the calls for each block and the numbers of elements to append to the vector on each call * Remove all gas control * Added AddTxOrFail() This function will treat execution errors as errors as well, useful for testing. ApplyTransaction has been modified to return the ExecutionResult * Move changes to the test Breaking API changes should be avoided * Improve error handling in benchmark * Call many contracts per block * Removed duplicate code Use existing code instead, reading the receipt from the last execution instead of returning the exceutionresult struct * Use NewTx instead of NewTransaction * Better organization for files * rename & move files * Update core/trie_stress_bench_test.go Co-authored-by: aaronbuchwald <[email protected]> Signed-off-by: Cesar <[email protected]> --------- Signed-off-by: Cesar <[email protected]> Co-authored-by: Ceyhun Onur <[email protected]> Co-authored-by: aaronbuchwald <[email protected]>
23 lines
533 B
Solidity
23 lines
533 B
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.0;
|
|
|
|
contract TrieStressTest {
|
|
bytes32[] private data;
|
|
|
|
function writeValues(uint value) public {
|
|
bytes32 dataToPush = bytes32(uint256(uint160(msg.sender)) << 96);
|
|
for (uint i = 0; i < value; i++) {
|
|
data.push(dataToPush);
|
|
}
|
|
}
|
|
|
|
function getLength() public view returns (uint) {
|
|
return data.length;
|
|
}
|
|
|
|
function getData(uint index) public view returns (bytes32) {
|
|
require(index < data.length, "Index out of bound");
|
|
return data[index];
|
|
}
|
|
}
|