Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions core/types/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"hash"
"math/big"
"reflect"
"sync/atomic"
"testing"
"time"

Expand Down Expand Up @@ -68,8 +67,6 @@ func TestBlockEncoding(t *testing.T) {
},
uncles: nil,
transactions: Transactions{tx1},
hash: atomic.Value{},
size: atomic.Value{},
td: nil,
ReceivedAt: time.Time{},
ReceivedFrom: nil,
Expand Down
5 changes: 4 additions & 1 deletion core/vm/cvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,10 @@ func (cvm *CVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,

// Ensure there's no existing contract already at the designated address
contractHash := cvm.StateDB.GetCodeHash(address)
if cvm.StateDB.GetNonce(address) != 0 || (contractHash != (common.Hash{}) && contractHash != types.EmptyCodeHash) {
storageRoot := cvm.StateDB.GetStorageRoot(address)
if cvm.StateDB.GetNonce(address) != 0 ||
(contractHash != (common.Hash{}) && contractHash != types.EmptyCodeHash) || // non-empty code
(storageRoot != (common.Hash{}) && storageRoot != types.EmptyRootHash) { // non-empty storage
return nil, common.Address{}, 0, nil, ErrContractAddressCollision
}
// Create a new account on the state
Expand Down
11 changes: 6 additions & 5 deletions core/vm/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ var (
ErrNoCompatibleInterpreter = errors.New("no compatible interpreter")
ErrInvalidMetaAuthor = errors.New("invalid meta author")

ErrGasUintOverflow = errors.New("gas uint64 overflow")
ErrInvalidJump = errors.New("invalid jump destination")
ErrWriteProtection = errors.New("write protection")
ErrInvalidRetsub = errors.New("invalid retsub")
ErrReturnStackExceeded = errors.New("return stack limit reached")
ErrMaxInitCodeSizeExceeded = errors.New("max initcode size exceeded")
ErrGasUintOverflow = errors.New("gas uint64 overflow")
ErrInvalidJump = errors.New("invalid jump destination")
ErrWriteProtection = errors.New("write protection")
ErrInvalidRetsub = errors.New("invalid retsub")
ErrReturnStackExceeded = errors.New("return stack limit reached")

ErrDownloading = errors.New("downloading")
ErrFileNotExist = errors.New("file not exist")
Expand Down
3 changes: 2 additions & 1 deletion core/vm/gas_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package vm

import (
"errors"
"math"
"math/big"
"testing"
Expand Down Expand Up @@ -94,7 +95,7 @@ func TestEIP2200(t *testing.T) {
vmenv := NewCVM(vmctx, TxContext{}, statedb, params.AllCuckooProtocolChanges, Config{ExtraEips: []int{2200}})

_, gas, _, err := vmenv.Call(AccountRef(common.Address{}), address, nil, tt.gaspool, new(big.Int))
if err != tt.failure {
if !errors.Is(err, tt.failure) {
t.Errorf("test %d: failure mismatch: have %v, want %v", i, err, tt.failure)
}
if used := tt.gaspool - gas; used != tt.used {
Expand Down
1 change: 1 addition & 0 deletions core/vm/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ type StateDB interface {

GetState(common.Address, common.Hash) common.Hash
SetState(common.Address, common.Hash, common.Hash)
GetStorageRoot(addr common.Address) common.Hash

GetSolidityBytes(common.Address, common.Hash) ([]byte, error)

Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ module github.com/CortexFoundation/CortexTheseus

go 1.22

toolchain go1.22.1

require (
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.1
github.com/CortexFoundation/inference v1.0.2-0.20230307032835-9197d586a4e8
Expand Down