mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
sloadext
This commit is contained in:
parent
07d2d83c31
commit
069a21d972
5 changed files with 24 additions and 0 deletions
|
|
@ -365,6 +365,10 @@ func gasSLoad(gt params.GasTable, evm *EVM, contract *Contract, stack *Stack, me
|
|||
return gt.SLoad, nil
|
||||
}
|
||||
|
||||
func gasSLoadExt(gt params.GasTable, evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) {
|
||||
return gt.SLoad, nil
|
||||
}
|
||||
|
||||
func gasExp(gt params.GasTable, evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize uint64) (uint64, error) {
|
||||
expByteLen := uint64((stack.data[stack.len()-2].BitLen() + 7) / 8)
|
||||
|
||||
|
|
|
|||
|
|
@ -633,6 +633,15 @@ func opSload(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memory
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
func opSloadExt(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
|
||||
addr := common.BigToAddress(stack.pop())
|
||||
loc := stack.pop()
|
||||
|
||||
val := interpreter.evm.StateDB.GetState(addr, common.BigToHash(loc))
|
||||
loc.SetBytes(val.Bytes())
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func opSstore(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
|
||||
loc := common.BigToHash(stack.pop())
|
||||
val := stack.pop()
|
||||
|
|
|
|||
|
|
@ -513,6 +513,13 @@ func newFrontierInstructionSet() [256]operation {
|
|||
maxStack: maxStack(1, 1),
|
||||
valid: true,
|
||||
},
|
||||
SLOADEXT: {
|
||||
execute: opSload,
|
||||
dynamicGas: gasSLoad,
|
||||
minStack: minStack(2, 1),
|
||||
maxStack: maxStack(2, 1),
|
||||
valid: true,
|
||||
},
|
||||
SSTORE: {
|
||||
execute: opSstore,
|
||||
dynamicGas: gasSStore,
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ const (
|
|||
MSTORE
|
||||
MSTORE8
|
||||
SLOAD
|
||||
SLOADEXT
|
||||
SSTORE
|
||||
JUMP
|
||||
JUMPI
|
||||
|
|
@ -286,6 +287,7 @@ var opCodeToString = map[OpCode]string{
|
|||
MSTORE: "MSTORE",
|
||||
MSTORE8: "MSTORE8",
|
||||
SLOAD: "SLOAD",
|
||||
SLOADEXT: "SLOADEXT",
|
||||
SSTORE: "SSTORE",
|
||||
JUMP: "JUMP",
|
||||
JUMPI: "JUMPI",
|
||||
|
|
@ -449,6 +451,7 @@ var stringToOp = map[string]OpCode{
|
|||
"MSTORE": MSTORE,
|
||||
"MSTORE8": MSTORE8,
|
||||
"SLOAD": SLOAD,
|
||||
"SLOADEXT": SLOADEXT,
|
||||
"SSTORE": SSTORE,
|
||||
"JUMP": JUMP,
|
||||
"JUMPI": JUMPI,
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ const (
|
|||
MaximumExtraDataSize uint64 = 32 // Maximum size extra data may be after Genesis.
|
||||
ExpByteGas uint64 = 10 // Times ceil(log256(exponent)) for the EXP instruction.
|
||||
SloadGas uint64 = 50 // Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added.
|
||||
SloadExtGas uint64 = 50 // Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added.
|
||||
CallValueTransferGas uint64 = 9000 // Paid for CALL when the value transfer is non-zero.
|
||||
CallNewAccountGas uint64 = 25000 // Paid for CALL when the destination address didn't exist prior.
|
||||
TxGas uint64 = 21000 // Per transaction not creating a contract. NOTE: Not payable on data of calls between transactions.
|
||||
|
|
|
|||
Loading…
Reference in a new issue