good morning!!!!

Skip to content
Snippets Groups Projects
Select Git revision
  • de86403f330e68df8fc4aee00df98374b7842d0d
  • master default protected
  • v0.2.16-candidate
  • shivam/rpcAddBorTx
  • default-cli-config
  • shivam/minerRecommitFix
  • vcastellm/pos-296-bump-go-version-in-bor-and-heimdall
  • shivam/ethstats-backend-fix
  • v0.2.16-beta1-candidate
  • v0.2.15-beta3-candidate
  • shivam/newCli-IPC
  • v0.3.0-dev
  • checkpoint-whitelist-master
  • shivam/codecov
  • jdkanani/fix-typo-log
  • shivam/hardcoded-spans-v0.2.14
  • shivam/hardcoded-spans
  • shivam/fast-state-sync
  • shivam/fast-state-sync-master
  • gethv1.10.15-merge
  • fix-txpool-2
  • v0.2.14-tmp-span-hotfix
  • v0.2.15-beta2
  • v0.2.15-beta1
  • v0.3.0-beta3
  • v0.3.0-beta2
  • v0.3.0-beta1
  • v0.2.14
  • v0.2.13
  • v0.2.13-beta2
  • v0.2.13-beta1
  • v0.2.12
  • v0.2.12-beta3
  • v0.2.12-beta1
  • v0.2.12-beta2
  • v0.2.11
  • v0.2.10
  • v0.2.10-beta2
  • v0.2.9
  • v0.2.9-beta1
  • v0.2.8
41 results

asm.go

Blame
  • Forked from github / maticnetwork / bor
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    common.go 1.48 KiB
    package vm
    
    import (
    	"math/big"
    
    	"github.com/ethereum/go-ethereum/ethutil"
    	"github.com/ethereum/go-ethereum/logger"
    )
    
    var vmlogger = logger.NewLogger("VM")
    
    type Type int
    
    const (
    	StandardVmTy Type = iota
    	DebugVmTy
    
    	MaxVmTy
    )
    
    var (
    	GasStep         = big.NewInt(1)
    	GasSha          = big.NewInt(10)
    	GasSLoad        = big.NewInt(20)
    	GasSStore       = big.NewInt(100)
    	GasSStoreRefund = big.NewInt(100)
    	GasBalance      = big.NewInt(20)
    	GasCreate       = big.NewInt(100)
    	GasCall         = big.NewInt(20)
    	GasCreateByte   = big.NewInt(5)
    	GasSha3Byte     = big.NewInt(10)
    	GasSha256Byte   = big.NewInt(50)
    	GasRipemdByte   = big.NewInt(50)
    	GasMemory       = big.NewInt(1)
    	GasData         = big.NewInt(5)
    	GasTx           = big.NewInt(500)
    	GasLog          = big.NewInt(32)
    	GasSha256       = big.NewInt(50)
    	GasRipemd       = big.NewInt(50)
    	GasEcrecover    = big.NewInt(500)
    
    	Pow256 = ethutil.BigPow(2, 256)
    
    	LogTyPretty byte = 0x1
    	LogTyDiff   byte = 0x2
    
    	U256 = ethutil.U256
    	S256 = ethutil.S256
    )
    
    const MaxCallDepth = 1024
    
    func calcMemSize(off, l *big.Int) *big.Int {
    	if l.Cmp(ethutil.Big0) == 0 {
    		return ethutil.Big0
    	}
    
    	return new(big.Int).Add(off, l)
    }
    
    // Simple helper
    func u256(n int64) *big.Int {
    	return big.NewInt(n)
    }
    
    // Mainly used for print variables and passing to Print*
    func toValue(val *big.Int) interface{} {
    	// Let's assume a string on right padded zero's
    	b := val.Bytes()
    	if b[0] != 0 && b[len(b)-1] == 0x0 && b[len(b)-2] == 0x0 {
    		return string(b)
    	}
    
    	return val
    }