-
Notifications
You must be signed in to change notification settings - Fork 8
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
Fixes issues in #96 #100
Closed
Closed
Fixes issues in #96 #100
Changes from 20 commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
f605e60
Updated
18aaddy 2291d91
Revert "Updated"
18aaddy 025f101
Modified go.mod and go.sum
18aaddy 313a7a0
Updated
18aaddy 020954f
Revert "Updated"
18aaddy a8fae8a
Initial Commit
18aaddy 6e8ee83
Updated
18aaddy 1e1d769
Update
18aaddy b09b233
Update
18aaddy 8bbedbe
Tests working locally
18aaddy 6635d26
Added test file
18aaddy 6402277
Update
18aaddy 2da2aa2
Commented CreateAccessListTest
18aaddy b137762
Update
18aaddy 460629c
fix for #96
ABD-AZE efb93d5
json error resolved from createaccess list
ABD-AZE 4a05db6
resolved warnings
ABD-AZE 664b81d
tests passing
ABD-AZE ad0e041
final warnings resolved
ABD-AZE c76a2a2
edit common/types.go
ABD-AZE 826916b
Running workflow again
ABD-AZE a28f2d1
Tests passing
ABD-AZE 5778b54
type consistency maintained
ABD-AZE 8aa8dc0
refactoring
ABD-AZE 5898174
.gitignore
ABD-AZE ee4a0f0
Delete go.mod
ABD-AZE 8d8156d
Delete go.sum
ABD-AZE f52b2a9
Update consensus.go
DarkLord017 4325390
Update consensus_core.go
DarkLord017 60d1a76
Create serde_utils.go
DarkLord017 69e5dc9
Update utils.go
DarkLord017 231cfd4
Update consensus_rpc.go
DarkLord017 7c5644e
Update consensus_rpc_test.go
DarkLord017 ede23f9
Update mock_rpc.go
DarkLord017 a01bad1
Update mock_rpc_test.go
DarkLord017 dd5efbf
Update nimbus_rpc.go
DarkLord017 58af92e
Update nimbus_rpc_test.go
DarkLord017 f57d83a
Update go.mod
DarkLord017 95b027a
Update go.sum
DarkLord017 b3bf300
Create consensus_test.go
DarkLord017 13982ab
Refactor consensus/rpc/consensus_rpc.go
DarkLord017 e240988
Refactor mock_rpc.go
DarkLord017 5feb1aa
Refactor nimbus_rpc.go
DarkLord017 a25749a
Update consensus_rpc.go
DarkLord017 069c873
Update consensus.go
DarkLord017 c9023e8
Removed duplicated types and structs in basic.go
DarkLord017 dbcf04a
Refactor beacon.go to remove duplicxatoed types and structs
DarkLord017 468590d
Update consensus_core.go to remove import cycle errors after refactor…
DarkLord017 de838bd
Update basic.go
DarkLord017 cb66bee
Resolved builder errors
0d1c3eb
Create tests consensus/database_test.go
DarkLord017 5e0ccf7
Update consensus.go to correctly use rlp unmarsahalling and handle le…
DarkLord017 bb46c01
Update serde_utils.go to correctly handle unmarsahhlihng
DarkLord017 c3fb924
Update consensus_test.go to handle block Tests
DarkLord017 dbca377
Update mock_rpc_test.go to handle Blocks
DarkLord017 7704238
Update nimbus_rpc_test.go to handle Blocks
DarkLord017 512f8c4
Update consensus_core.go to handle Transactions correctly
DarkLord017 ce5cb70
Updated
18aaddy fc21118
Revert "Updated"
18aaddy d1a2886
Modified go.mod and go.sum
18aaddy 5f61b96
Updated
18aaddy e48119b
Revert "Updated"
18aaddy 4e55d9c
Update
18aaddy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package execution | ||
|
||
import ( | ||
"errors" | ||
"testing" | ||
|
||
"github.com/BlocSoc-iitr/selene/consensus/consensus_core" | ||
"github.com/BlocSoc-iitr/selene/consensus/types" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestExecutionErrors(t *testing.T) { | ||
// Test InvalidAccountProofError | ||
address := types.Address{0x01, 0x02} | ||
err := NewInvalidAccountProofError(address) | ||
assert.EqualError(t, err, "invalid account proof for string: [1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]") | ||
|
||
// Test InvalidStorageProofError | ||
slot := consensus_core.Bytes32{0x0a} | ||
err = NewInvalidStorageProofError(address, slot) | ||
assert.EqualError(t, err, "invalid storage proof for string: [1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], slot: [10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]") | ||
|
||
// Test CodeHashMismatchError | ||
found := consensus_core.Bytes32{0x03} | ||
expected := consensus_core.Bytes32{0x04} | ||
err = NewCodeHashMismatchError(address, found, expected) | ||
assert.EqualError(t, err, "code hash mismatch for string: [1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], found: [3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], expected: [4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]") | ||
|
||
// Test ReceiptRootMismatchError | ||
tx := consensus_core.Bytes32{0x05} | ||
err = NewReceiptRootMismatchError(tx) | ||
assert.EqualError(t, err, "receipt root mismatch for tx: [5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]") | ||
|
||
// Test MissingTransactionError | ||
err = NewMissingTransactionError(tx) | ||
assert.EqualError(t, err, "missing transaction for tx: [5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]") | ||
|
||
// Test MissingLogError | ||
err = NewMissingLogError(tx, 3) | ||
assert.EqualError(t, err, "missing log for transaction: [5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], index: 3") | ||
|
||
// Test TooManyLogsToProveError | ||
err = NewTooManyLogsToProveError(5000, 1000) | ||
assert.EqualError(t, err, "too many logs to prove: 5000, current limit is: 1000") | ||
|
||
// Test InvalidBaseGasFeeError | ||
err = NewInvalidBaseGasFeeError(1000, 2000, 123456) | ||
assert.EqualError(t, err, "Invalid base gas fee selene 1000 vs rpc endpoint 2000 at block 123456") | ||
|
||
// Test BlockNotFoundError | ||
err = NewBlockNotFoundError(123456) | ||
assert.EqualError(t, err, "Block 123456 not found") | ||
|
||
// Test EmptyExecutionPayloadError | ||
err = NewEmptyExecutionPayloadError() | ||
assert.EqualError(t, err, "Selene Execution Payload is empty") | ||
} | ||
|
||
func TestEvmErrors(t *testing.T) { | ||
// Test RevertError | ||
data := []byte{0x08, 0xc3, 0x79, 0xa0} | ||
err := NewRevertError(data) | ||
assert.EqualError(t, err, "execution reverted: [8 195 121 160]") | ||
|
||
// Test GenericError | ||
err = NewGenericError("generic error") | ||
assert.EqualError(t, err, "evm error: generic error") | ||
|
||
// Test RpcError | ||
rpcErr := errors.New("rpc connection failed") | ||
err = NewRpcError(rpcErr) | ||
assert.EqualError(t, err, "rpc error: rpc connection failed") | ||
} | ||
|
||
func TestDecodeRevertReason(t *testing.T) { | ||
// Test successful revert reason decoding | ||
reasonData := []byte{0x08, 0xc3, 0x79, 0xa0} | ||
reason := DecodeRevertReason(reasonData) | ||
assert.NotEmpty(t, reason, "Revert reason should be decoded") | ||
|
||
// Test invalid revert data | ||
invalidData := []byte{0x00} | ||
reason = DecodeRevertReason(invalidData) | ||
assert.Contains(t, reason, "invalid data for unpacking") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
There is some build error because of access of either null pointer or an invalid memory access, please check that. Mostly coming from
GetBlock
function