Documentation ¶
Index ¶
- func RunProgram(testFn func() error) error
- type Program
- func (p *Program) AddAll(data []byte)
- func (p *Program) Bytecode() []byte
- func (p *Program) Call(gas *big.Int, address, value, inOffset, inSize, outOffset, outSize interface{})
- func (p *Program) CallCode(gas *big.Int, address, value, inOffset, inSize, outOffset, outSize interface{})
- func (p *Program) CallF(i uint16)
- func (p *Program) CreateAndCall(code []byte, isCreate2 bool, callOp ops.OpCode)
- func (p *Program) DelegateCall(gas *big.Int, address, inOffset, inSize, outOffset, outSize interface{})
- func (p *Program) ExtcodeCopy(address, memOffset, codeOffset, length interface{})
- func (p *Program) Hex() string
- func (p *Program) InputAddressToStack(inputOffset uint32)
- func (p *Program) Jump(loc interface{})
- func (p *Program) JumpIf(loc interface{}, condition interface{})
- func (p *Program) Jumpdest() uint64
- func (p *Program) Label() uint64
- func (p *Program) MemToStorage(memStart, memSize, startSlot int)
- func (p *Program) Mstore(data []byte, memStart uint32)
- func (p *Program) Op(op ops.OpCode)
- func (p *Program) Push(val interface{}) *Program
- func (p *Program) Push0()
- func (p *Program) RJump(relOffset uint16)
- func (p *Program) RJumpI(relOffset uint16, condition interface{})
- func (p *Program) RJumpV(relOffsets []uint16)
- func (p *Program) RetF()
- func (p *Program) Return(offset, len uint32)
- func (p *Program) ReturnData(data []byte)
- func (p *Program) Size() int
- func (p *Program) Sstore(slot interface{}, value interface{})
- func (p *Program) StaticCall(gas *big.Int, address, inOffset, inSize, outOffset, outSize interface{})
- func (p *Program) Tstore(slot interface{}, value interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunProgram ¶
RunProgram parses flags (for profiling), and executes teh testFn
Types ¶
type Program ¶
type Program struct {
// contains filtered or unexported fields
}
func NewProgram ¶
func NewProgram() *Program
func (*Program) Call ¶
func (p *Program) Call(gas *big.Int, address, value, inOffset, inSize, outOffset, outSize interface{})
Call is a convenience function to make a call
func (*Program) CreateAndCall ¶
CreateAndCall calls create/create2 with the given bytecode and then checks if the returnvalue is non-zero. If so, it calls into the newly created contract with all available gas
func (*Program) DelegateCall ¶
func (p *Program) DelegateCall(gas *big.Int, address, inOffset, inSize, outOffset, outSize interface{})
DelegateCall is a convenience function to make a delegatecall
func (*Program) ExtcodeCopy ¶
func (p *Program) ExtcodeCopy(address, memOffset, codeOffset, length interface{})
func (*Program) InputAddressToStack ¶
InputToMemory stores the input (calldata) to memory as address (20 bytes).
func (*Program) Jump ¶
func (p *Program) Jump(loc interface{})
Jump pushes the destination and adds a JUMP
func (*Program) JumpIf ¶
func (p *Program) JumpIf(loc interface{}, condition interface{})
Jump pushes the destination and adds a JUMP
func (*Program) MemToStorage ¶
MemToStorage copies the given memory area into SSTORE slots, It expects data to be aligned to 32 byte, and does not zero out remainders if some data is not I.e, if given a 1-byte area, it will still copy the full 32 bytes to storage
func (*Program) Mstore ¶
MStore stores the provided data (into the memory area starting at memStart)
func (*Program) RetF ¶
func (p *Program) RetF()
RetF implements RETF (0xb1) - return from a function
func (*Program) ReturnData ¶
ReturnData loads the given data into memory, and does a return with it
func (*Program) Sstore ¶
func (p *Program) Sstore(slot interface{}, value interface{})
Sstore stores the given byte array to the given slot. OBS! Does not verify that the value indeed fits into 32 bytes If it does not, it will panic later on via pushBig
func (*Program) StaticCall ¶
func (p *Program) StaticCall(gas *big.Int, address, inOffset, inSize, outOffset, outSize interface{})
StaticCall is a convenience function to make a staticcall