Skip to content

Commit

Permalink
Gas accounting
Browse files Browse the repository at this point in the history
  • Loading branch information
jzimmerman committed Dec 2, 2019
1 parent ec2ee39 commit 229d989
Show file tree
Hide file tree
Showing 14 changed files with 434 additions and 149 deletions.
12 changes: 8 additions & 4 deletions src/systems/filecoin_markets/deal/deal.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ package deal
import actor "github.com/filecoin-project/specs/systems/filecoin_vm/actor"
import block "github.com/filecoin-project/specs/systems/filecoin_blockchain/struct/block"

const MIN_PROVIDER_DEAL_COLLATERAL_PER_EPOCH = actor.TokenAmount(1) // TODO: Placeholder
const MIN_CLIENT_DEAL_COLLATERAL_PER_EPOCH = actor.TokenAmount(1) // TODO: Placeholder
const MIN_DEAL_DURATION = block.ChainEpoch(0) // TODO: Placeholder
const MIN_DEAL_PRICE = actor.TokenAmount(0) // TODO: Placeholder
import util "github.com/filecoin-project/specs/util"

var IMPL_FINISH = util.IMPL_FINISH

var MIN_PROVIDER_DEAL_COLLATERAL_PER_EPOCH = actor.TokenAmount_Placeholder()
var MIN_CLIENT_DEAL_COLLATERAL_PER_EPOCH = actor.TokenAmount_Placeholder()
var MIN_DEAL_DURATION = block.ChainEpoch(0) // TODO: Placeholder
var MIN_DEAL_PRICE = actor.TokenAmount_Placeholder()

func (d *StorageDeal_I) Proposal() StorageDealProposal {
// extract from d.ProposalMessage
Expand Down
7 changes: 7 additions & 0 deletions src/systems/filecoin_vm/actor/actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import filcrypto "github.com/filecoin-project/specs/algorithms/crypto"
import ipld "github.com/filecoin-project/specs/libraries/ipld"
import util "github.com/filecoin-project/specs/util"

var TODO = util.TODO

type Serialization = util.Serialization

const (
Expand Down Expand Up @@ -67,6 +69,11 @@ func (x ActorSubstateCID) Ref() *ActorSubstateCID {
return &x
}

func TokenAmount_Placeholder() TokenAmount {
TODO()
panic("")
}

// Interface for runtime/VMContext functionality (to avoid circular dependency in Go imports)
type Has_AbortArg interface {
AbortArg()
Expand Down
2 changes: 1 addition & 1 deletion src/systems/filecoin_vm/actor/actor.id
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import ipld "github.com/filecoin-project/specs/libraries/ipld"
// TokenAmount is an amount of Filecoin tokens. This type is used within
// the VM in message execution, to account movement of tokens, payment
// of VM gas, and more.
type TokenAmount UVarint // TODO: bigint or varint?
type TokenAmount Int // TODO: should be BigInt (attoFIL)

// MethodNum is an integer that represents a particular method
// in an actor's function table. These numbers are used to compress
Expand Down
7 changes: 7 additions & 0 deletions src/systems/filecoin_vm/actor/address/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,10 @@ func Address_Make_ActorExec(net Address_NetworkID, hash ActorExecHash) Address {
Data_: Address_Data_Make_ActorExec(hash),
}
}

type Address_Ptr = *Address

func (a *Address_I) Ref() Address_Ptr {
var ret Address = a
return &ret
}
1 change: 1 addition & 0 deletions src/systems/filecoin_vm/actor/address/address.id
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type Address struct {
String() AddressString
IsKeyType() bool
Equals(Address) bool
Ref() Address_Ptr
}

// ActorID is a sequential number assigned to actors in a Filecoin Chain.
Expand Down
Loading

0 comments on commit 229d989

Please sign in to comment.