Skip to content

Commit

Permalink
✅ Test: Add vm test coverage (#1284)
Browse files Browse the repository at this point in the history
## Description

_Concise description of proposed changes_

## Testing

Explain the quality checks that have been done on the code changes

## Additional Information

- [ ] I read the [contributing docs](../docs/contributing.md) (if this
is your first contribution)

Your ENS/address:



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added ability to generate 32 random bytes through a new utility
function.
- Introduced various test cases to validate transaction execution,
hardforks, block rewards, and address warming in the virtual machine
environment.

- **Enhancements**
	- Improved utility exports with `GWEI_TO_WEI` and `randomBytes`.
	- Updated `validateRunTx` function for better block handling.
- Reorganized and streamlined code structure in block and transaction
handling.

- **Tests**
- Added extensive test coverage for functions like `execHardfork`,
`runTx`, `createBaseVm`, and more.
- Ensured various transaction scenarios and virtual machine state
behaviors are properly validated.

- **Dependencies**
- Added `@tevm/contract` as a new development dependency in the VM
package.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: William Cory <[email protected]>
  • Loading branch information
roninjin10 and William Cory authored Jul 7, 2024
1 parent 6c7b07f commit 7af1917
Show file tree
Hide file tree
Showing 83 changed files with 4,582 additions and 673 deletions.
5 changes: 5 additions & 0 deletions .changeset/thick-monkeys-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@tevm/utils": minor
---

Added randomBytes to `@tevm/utils`. randomBytes(32) will generate 32 random bytes.
25 changes: 25 additions & 0 deletions packages/utils/docs/functions/randomBytes.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/utils/docs/globals.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions packages/utils/docs/variables/GWEI_TO_WEI.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/utils/src/ethereumjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export {
ecrecover,
ecsign,
zeros,
randomBytes,
AsyncEventEmitter,
} from '@ethereumjs/util'
2 changes: 2 additions & 0 deletions packages/utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ export {
ecsign,
zeros,
AsyncEventEmitter,
GWEI_TO_WEI,
randomBytes,
} from './ethereumjs.js'
export type {
GenesisState,
Expand Down
26 changes: 13 additions & 13 deletions packages/vm/docs/classes/BlockBuilder.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/vm/docs/functions/accumulateParentBlockHash.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions packages/vm/docs/functions/applyBlock.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions packages/vm/docs/functions/applyDAOHardfork.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions packages/vm/docs/functions/applyTransactions.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions packages/vm/docs/functions/assignBlockRewards.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions packages/vm/docs/functions/assignWithdrawals.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/vm/docs/functions/calculateMinerReward.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7af1917

Please sign in to comment.