-
Notifications
You must be signed in to change notification settings - Fork 6
Conversation
core/execution.go
Outdated
) | ||
|
||
var ( | ||
callCreateDepthMax = 1024 // limit call/create stack | ||
errCallCreateDepth = fmt.Errorf("Max call depth exceeded (%d)", callCreateDepthMax) | ||
ErrDepth = errors.New("max call depth exceeded") |
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.
why is this needed? Can you either just make the previous line usable for both or make it so that error prints the max depth for staticcall? A side note you should probably follow casing standards and start with a lowercase for this variable if it is needed.
core/execution.go
Outdated
// Initialise a new contract and set the code that is to be used by the EVM. | ||
// The contract is a scoped environment for this execution context only. | ||
contract := vm.NewContract(caller, to, new(big.Int), gas, gasPrice).AsDelegates | ||
contract.SetCallCode(&addr, evm.StateDB.GetCodeHash(addr), evm.StateDB.GetCode(addr)) |
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.
Is this copied from ETH? I don't see many of these lines referencing ETC variables
core/execution.go
Outdated
contract.UseGas(contract.Gas) | ||
} | ||
} | ||
return ret, contract.Gas, err |
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.
function signature has (ret []byte, err error) return, should be only two values
core/vm/instructions.go
Outdated
var callStipend = big.NewInt(2300) // Free gas given at beginning of call. | ||
var ( | ||
callStipend = big.NewInt(2300) // Free gas given at beginning of call. | ||
errExecutionReverted = errors.New("evm: execution reverted") |
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.
This is for EIP140 REVERT opcode, which isn't currently implemented in development
core/vm/instructions.go
Outdated
@@ -511,6 +515,23 @@ func opDelegateCall(instr instruction, pc *uint64, env Environment, contract *Co | |||
} | |||
} | |||
|
|||
func opStaticCall(pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) ([]byte, error) { |
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.
ETC doesn't handle returns on these functions, you should match the function signature from related calls in this file to allow you to attach it to the JumpTable reference of STATICCALL
core/vm/jump_table.go
Outdated
@@ -164,6 +164,7 @@ func newJumpTable(ruleset RuleSet, blockNumber *big.Int) vmJumpTable { | |||
jumpTable[JUMP] = jumpPtr{nil, true} | |||
jumpTable[JUMPI] = jumpPtr{nil, true} | |||
jumpTable[STOP] = jumpPtr{nil, true} | |||
jumpTable[STATICCALL] = jumpPtr{nil, true} |
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.
Should attach the opStaticCall function here
Edit: also it should be targeted toward Atlantis only, which you will be able to do once the refactor PR is merged
core/vm/vm.go
Outdated
@@ -169,6 +169,9 @@ func (evm *EVM) Run(contract *Contract, input []byte) (ret []byte, err error) { | |||
fallthrough | |||
case STOP: // Stop the contract | |||
return nil, nil | |||
case STATICCALL: |
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.
STATICCALL should not exit the vm execution (or somebody correct me) these lines either way should be removed once you attach the function to JumpTable[STATICCALL]
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.
You need to also dynamically set gas and size in this file in the calculateGasAndSize(...) function
Edit: Use Call as reference, as well as the ETH implementation for calculating gas of the call
go.mod
Outdated
@@ -1,24 +1,39 @@ | |||
module github.com/eth-classic/go-ethereum | |||
|
|||
require ( | |||
github.com/allegro/bigcache v1.2.0 // indirect |
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.
Why was it necessary to update the go modules?
…ions. Added gas calc for StaticCall.
* Refactor and add config for Atlantis chain config * Typo fix * Refactor jump table setup * Changed fork config skipping functionality and removed unused configuration mappings * Fixed null pointer error with test configs * Added definitions of other blocks for correctly mapping gas table * Implemented IsAtlantis interface for vm runtime
* ci: create basic circle-ci config * ci: lower parallelism * ci: rename jobs * ci: rename jobs
…ions. Added gas calc for StaticCall.
…m into eip214-staticcall
* implemented EIP 161 logic * implemented EIP 161 logic * fixed bug * no more segfaults * Byzantium Tests Passing. Certain Homestead Failing * Fixed implementation to pass (almost) all tests * Updated testing framework to run all ETH directories * Reimpl EIP161 SUICIDE and CALL edge cases * Skip unimplemented functionality tests * proper indentation
* add go mods to bind package * attempt to fix mods * revert some dependencies
* fixed trimToImportPath for outside of go path * is this how working_directory works? * is this how working_directory works? * is this how working_directory works? * is THIS how working_directory works? * is THIS how working_directory works? * working_directory * working_directory
* Implemented EIP 140 op code framework to be tested * Added required parameters and moved protocol parameters into their own file * Removed coverage file accidentally commited * Set up testing framework for eth tests * Updated struct formatting for unmarshalling * Updated format of eth test struct and updated test files (were replaced with generated files) * Using ethereum tests submodule and updated framework for testing * Updated testing structure into subtests for better reporting and so that all test cases are tested even when one fails * Fix merge error * Removed indirect reference to ethereum/go-ethereum during rebase * Implemented EIP 140 op code framework to be tested * Added required parameters and moved protocol parameters into their own file * Removed coverage file accidentally commited * Set up testing framework for eth tests * Updated struct formatting for unmarshalling * Updated format of eth test struct and updated test files (were replaced with generated files) * Using ethereum tests submodule and updated framework for testing * Updated testing structure into subtests for better reporting and so that all test cases are tested even when one fails * Fix merge error * Removed indirect reference to ethereum/go-ethereum during rebase * WIP fixed some implementations of REVERT * Fixed more implementation details * Skipped unrelated and unimplemented tests * Implemented EIP 140 op code framework to be tested * Added required parameters and moved protocol parameters into their own file * Removed coverage file accidentally commited * Set up testing framework for eth tests * Updated struct formatting for unmarshalling * Updated format of eth test struct and updated test files (were replaced with generated files) * Using ethereum tests submodule and updated framework for testing * Updated testing structure into subtests for better reporting and so that all test cases are tested even when one fails * Fix merge error * Removed indirect reference to ethereum/go-ethereum during rebase * Implemented EIP 140 op code framework to be tested * Added required parameters and moved protocol parameters into their own file * Removed coverage file accidentally commited * Set up testing framework for eth tests * Updated struct formatting for unmarshalling * Updated format of eth test struct and updated test files (were replaced with generated files) * Using ethereum tests submodule and updated framework for testing * Updated testing structure into subtests for better reporting and so that all test cases are tested even when one fails * Fix merge error * Removed indirect reference to ethereum/go-ethereum during rebase * WIP fixed some implementations of REVERT * Fixed more implementation details * Skipped unrelated and unimplemented tests * Revert modules changes from development * Removed last gas cost variable used previously to save recalculation
* added contract size limit * added maxCodeSizeExceeded error * fixed some tests failing due to not checking for creation of contract in the OR * added IsAtlantis condition for max code size to apply. We now fail tests * removed TestETHCodeSizeLimit
…ions. Added gas calc for StaticCall.
Closing in favour of #40 |
Not able to run tests yet. Created a first draft implementation of EIP214.