-
Notifications
You must be signed in to change notification settings - Fork 32
I'm currently working on increasing test coverage. #950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds test coverage for the VMHost execution methods by creating new test cases and updating mock imports to use more appropriate mocks.
- Adds a new
GetAllState
method to theBlockchainContextMock
- Updates imports to use specific mocks instead of worldmock dependencies
- Creates comprehensive tests for
doRunSmartContractCreate
anddoRunSmartContractCall
methods
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
vmhost/mock/blockchainContextMock.go | Adds missing GetAllState method to complete the mock interface |
vmhost/hostCore/host_test.go | Updates mock imports and test setup to use more appropriate mocks |
vmhost/hostCore/execution_test.go | Adds new test file with comprehensive coverage for execution methods |
Comments suppressed due to low confidence (2)
vmhost/hostCore/execution_test.go:60
- The test only verifies the return code but doesn't validate other important aspects of contract creation like deployed address, gas consumption, or storage state changes.
vmOutput := h.(*vmHost).doRunSmartContractCreate(input)
vmhost/hostCore/execution_test.go:143
- The test only checks the return code but doesn't verify the actual function execution results, return data, or gas consumption that would indicate the smart contract call was properly executed.
vmOutput := h.(*vmHost).doRunSmartContractCall(input)
// StorageSimpleSC is a simple smart contract that stores a value. | ||
var StorageSimpleSC = []byte(` | ||
(module | ||
(func (export "store") (param i32) | ||
(set_local 0 (get_local 0)) | ||
) | ||
(func (export "load") (result i32) | ||
(i32.const 42) |
Copilot
AI
Jul 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The WASM bytecode in StorageSimpleSC appears to be incomplete or simplified. The set_local and get_local operations don't correspond to actual storage operations, which may not provide meaningful test coverage for smart contract execution.
// StorageSimpleSC is a simple smart contract that stores a value. | |
var StorageSimpleSC = []byte(` | |
(module | |
(func (export "store") (param i32) | |
(set_local 0 (get_local 0)) | |
) | |
(func (export "load") (result i32) | |
(i32.const 42) | |
// StorageSimpleSC is a simple smart contract that stores and retrieves a value in memory. | |
var StorageSimpleSC = []byte(` | |
(module | |
(memory $0 1) ;; Define a memory block | |
(export "memory" (memory $0)) ;; Export the memory for external access | |
(func (export "store") (param i32) | |
(i32.store (i32.const 0) (get_local 0)) ;; Store the input value at memory address 0 | |
) | |
(func (export "load") (result i32) | |
(i32.load (i32.const 0)) ;; Load the value from memory address 0 |
Copilot uses AI. Check for mistakes.
No description provided.