Skip to content

Commit

Permalink
Added lockups for Qi and Quai coinbase
Browse files Browse the repository at this point in the history
  • Loading branch information
jdowning100 committed Sep 27, 2024
1 parent 93133dd commit 466ae5f
Show file tree
Hide file tree
Showing 23 changed files with 589 additions and 376 deletions.
5 changes: 5 additions & 0 deletions common/internal_address.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,8 @@ func (a InternalAddress) IsInQuaiLedgerScope() bool {
// The first bit of the second byte is not set if the address is in the Quai ledger
return a.Bytes()[1] <= 127
}

func (a InternalAddress) IsInQiLedgerScope() bool {
// The first bit of the second byte is set if the address is in the Qi ledger
return a.Bytes()[1] > 127
}
2 changes: 1 addition & 1 deletion common/proto_common.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions consensus/blake3pow/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ func (blake3pow *Blake3pow) Finalize(chain consensus.ChainHeaderReader, header *
return nil, err
}
state.CreateAccount(lockupContract)
state.SetNonce(lockupContract, 1) // so it's not considered "empty"

alloc := core.ReadGenesisAlloc("genallocs/gen_alloc_quai_"+nodeLocation.Name()+".json", blake3pow.logger)
blake3pow.logger.WithField("alloc", len(alloc)).Info("Allocating genesis accounts")
Expand Down
1 change: 1 addition & 0 deletions consensus/progpow/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,7 @@ func (progpow *Progpow) Finalize(chain consensus.ChainHeaderReader, header *type
return nil, err
}
state.CreateAccount(lockupContract)
state.SetNonce(lockupContract, 1) // so it's not considered "empty"

alloc := core.ReadGenesisAlloc("genallocs/gen_alloc_quai_"+nodeLocation.Name()+".json", progpow.logger)
progpow.logger.WithField("alloc", len(alloc)).Info("Allocating genesis accounts")
Expand Down
1 change: 1 addition & 0 deletions core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ func (g *Genesis) ToBlock(startingExpansionNumber uint64) *types.WorkObject {
wo.WorkObjectHeader().SetPrimeTerminusNumber(big.NewInt(0))
wo.WorkObjectHeader().SetTime(g.Timestamp)
wo.WorkObjectHeader().SetCoinbase(common.Zero)
wo.WorkObjectHeader().SetLock(0)
wo.Header().SetExtra(g.ExtraData)
wo.Header().SetGasLimit(g.GasLimit)
wo.Header().SetGasUsed(0)
Expand Down
18 changes: 9 additions & 9 deletions core/rawdb/accessors_chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func TestHeaderStorage(t *testing.T) {
woBody := types.EmptyWorkObjectBody()
woBody.SetHeader(header)

woHeader := types.NewWorkObjectHeader(header.Hash(), common.Hash{1}, big.NewInt(1), big.NewInt(30000), big.NewInt(42), types.EmptyRootHash, types.BlockNonce{23}, 1, common.LocationFromAddressBytes([]byte{0x01, 0x01}), common.BytesToAddress([]byte{1}, common.Location{0, 0}))
woHeader := types.NewWorkObjectHeader(header.Hash(), common.Hash{1}, big.NewInt(1), big.NewInt(30000), big.NewInt(42), types.EmptyRootHash, types.BlockNonce{23}, 1, 1, common.LocationFromAddressBytes([]byte{0x01, 0x01}), common.BytesToAddress([]byte{1}, common.Location{0, 0}))

wo := types.NewWorkObject(woHeader, woBody, nil)

Expand Down Expand Up @@ -190,7 +190,7 @@ func TestPbCacheStorage(t *testing.T) {
woBody := types.EmptyWorkObjectBody()
woBody.SetHeader(types.EmptyHeader())

woHeader := types.NewWorkObjectHeader(types.EmptyRootHash, types.EmptyRootHash, big.NewInt(11), big.NewInt(30000), big.NewInt(42), types.EmptyRootHash, types.BlockNonce{23}, 1, common.LocationFromAddressBytes([]byte{0x01, 0x01}), common.BytesToAddress([]byte{1}, common.Location{0, 0}))
woHeader := types.NewWorkObjectHeader(types.EmptyRootHash, types.EmptyRootHash, big.NewInt(11), big.NewInt(30000), big.NewInt(42), types.EmptyRootHash, types.BlockNonce{23}, 1, 1, common.LocationFromAddressBytes([]byte{0x01, 0x01}), common.BytesToAddress([]byte{1}, common.Location{0, 0}))
wo := types.NewWorkObject(woHeader, woBody, nil)
WritePbCacheBody(db, common.Hash{1}, wo)

Expand Down Expand Up @@ -320,7 +320,7 @@ func TestBlockHashesIterator(t *testing.T) {
blockHeader := types.EmptyHeader()
blockBody := types.EmptyWorkObjectBody()
blockBody.SetHeader(blockHeader)
blockWoHeader := types.NewWorkObjectHeader(blockHeader.Hash(), types.EmptyHash, big.NewInt(int64(i+1)), big.NewInt(3000), big.NewInt(42), types.EmptyRootHash, types.BlockNonce{23}, 2, common.Location{0, byte(j)}, common.BytesToAddress([]byte{1}, common.Location{0, byte(j)}))
blockWoHeader := types.NewWorkObjectHeader(blockHeader.Hash(), types.EmptyHash, big.NewInt(int64(i+1)), big.NewInt(3000), big.NewInt(42), types.EmptyRootHash, types.BlockNonce{23}, 1, 2, common.Location{0, byte(j)}, common.BytesToAddress([]byte{1}, common.Location{0, byte(j)}))
block := types.NewWorkObject(blockWoHeader, blockBody, nil)
WriteWorkObject(db, block.Hash(), block, types.BlockObject, common.ZONE_CTX)
hashes[i][block.Hash()] = true
Expand All @@ -345,30 +345,30 @@ func TestCommonAncestor(t *testing.T) {
regionHeader.SetNumber(big.NewInt(1), common.REGION_CTX)
regionBody := types.EmptyWorkObjectBody()
regionBody.SetHeader(regionHeader)
regionWoHeader := types.NewWorkObjectHeader(regionHeader.Hash(), types.EmptyRootHash, big.NewInt(1), big.NewInt(3000), big.NewInt(42), types.EmptyRootHash, types.BlockNonce{23}, 1, common.Location{0}, common.BytesToAddress([]byte{0}, common.Location{0, 0}))
regionWoHeader := types.NewWorkObjectHeader(regionHeader.Hash(), types.EmptyRootHash, big.NewInt(1), big.NewInt(3000), big.NewInt(42), types.EmptyRootHash, types.BlockNonce{23}, 1, 1, common.Location{0}, common.BytesToAddress([]byte{0}, common.Location{0, 0}))
regionBlock := types.NewWorkObject(regionWoHeader, regionBody, nil)
WriteWorkObject(db, regionBlock.Hash(), regionBlock, types.BlockObject, common.REGION_CTX)

//Write one block on zone 0 context
zone0Header := types.EmptyHeader()
zone0Body := types.EmptyWorkObjectBody()
zone0Body.SetHeader(zone0Header)
zone0WoHeader := types.NewWorkObjectHeader(zone0Header.Hash(), regionBlock.Hash(), big.NewInt(2), big.NewInt(3000), big.NewInt(42), types.EmptyRootHash, types.BlockNonce{23}, 2, common.Location{0, 0}, common.BytesToAddress([]byte{0}, common.Location{0, 0}))
zone0WoHeader := types.NewWorkObjectHeader(zone0Header.Hash(), regionBlock.Hash(), big.NewInt(2), big.NewInt(3000), big.NewInt(42), types.EmptyRootHash, types.BlockNonce{23}, 1, 2, common.Location{0, 0}, common.BytesToAddress([]byte{0}, common.Location{0, 0}))
zone0Block := types.NewWorkObject(zone0WoHeader, zone0Body, nil)
WriteWorkObject(db, zone0Block.Hash(), zone0Block, types.BlockObject, common.ZONE_CTX)

//Write two blocks on zone 1 context
zone1Header1 := types.EmptyHeader()
zone1Body1 := types.EmptyWorkObjectBody()
zone1Body1.SetHeader(zone1Header1)
zone1WoHeader1 := types.NewWorkObjectHeader(zone1Header1.Hash(), regionBlock.Hash(), big.NewInt(2), big.NewInt(3000), big.NewInt(42), types.EmptyRootHash, types.BlockNonce{23}, 2, common.Location{0, 1}, common.BytesToAddress([]byte{0}, common.Location{0, 1}))
zone1WoHeader1 := types.NewWorkObjectHeader(zone1Header1.Hash(), regionBlock.Hash(), big.NewInt(2), big.NewInt(3000), big.NewInt(42), types.EmptyRootHash, types.BlockNonce{23}, 1, 2, common.Location{0, 1}, common.BytesToAddress([]byte{0}, common.Location{0, 1}))
zone1Block1 := types.NewWorkObject(zone1WoHeader1, zone1Body1, nil)
WriteWorkObject(db, zone1Block1.Hash(), zone1Block1, types.BlockObject, common.ZONE_CTX)

zone1Header2 := types.EmptyHeader()
zone1Body2 := types.EmptyWorkObjectBody()
zone1Body2.SetHeader(zone1Header2)
zone1WoHeader2 := types.NewWorkObjectHeader(zone1Header2.Hash(), zone1Block1.Hash(), big.NewInt(3), big.NewInt(3000), big.NewInt(42), types.EmptyRootHash, types.BlockNonce{23}, 3, common.Location{0, 1}, common.BytesToAddress([]byte{0}, common.Location{0, 1}))
zone1WoHeader2 := types.NewWorkObjectHeader(zone1Header2.Hash(), zone1Block1.Hash(), big.NewInt(3), big.NewInt(3000), big.NewInt(42), types.EmptyRootHash, types.BlockNonce{23}, 1, 3, common.Location{0, 1}, common.BytesToAddress([]byte{0}, common.Location{0, 1}))
zone1Block2 := types.NewWorkObject(zone1WoHeader2, zone1Body2, nil)
WriteWorkObject(db, zone1Block2.Hash(), zone1Block2, types.BlockObject, common.ZONE_CTX)

Expand Down Expand Up @@ -585,7 +585,7 @@ func createTestWorkObject() *types.WorkObject {
woBody := types.EmptyWorkObjectBody()
woBody.SetHeader(types.EmptyHeader())

woHeader := types.NewWorkObjectHeader(types.EmptyRootHash, types.EmptyRootHash, big.NewInt(11), big.NewInt(30000), big.NewInt(42), types.EmptyRootHash, types.BlockNonce{23}, 1, common.LocationFromAddressBytes([]byte{0x01, 0x01}), common.BytesToAddress([]byte{0}, common.Location{0, 0}))
woHeader := types.NewWorkObjectHeader(types.EmptyRootHash, types.EmptyRootHash, big.NewInt(11), big.NewInt(30000), big.NewInt(42), types.EmptyRootHash, types.BlockNonce{23}, 1, 1, common.LocationFromAddressBytes([]byte{0x01, 0x01}), common.BytesToAddress([]byte{0}, common.Location{0, 0}))
return types.NewWorkObject(woHeader, woBody, nil)
}

Expand Down Expand Up @@ -739,7 +739,7 @@ func createBlockWithTransactions(txs types.Transactions) *types.WorkObject {
woBody := types.EmptyWorkObjectBody()
woBody.SetHeader(types.EmptyHeader())
woBody.SetTransactions(txs)
return types.NewWorkObject(types.NewWorkObjectHeader(types.EmptyRootHash, types.EmptyRootHash, big.NewInt(0), big.NewInt(30000), big.NewInt(42), types.EmptyRootHash, types.BlockNonce{23}, 1, common.LocationFromAddressBytes([]byte{0x01, 0x01}), common.BytesToAddress([]byte{0}, common.Location{0, 0})), woBody, nil)
return types.NewWorkObject(types.NewWorkObjectHeader(types.EmptyRootHash, types.EmptyRootHash, big.NewInt(0), big.NewInt(30000), big.NewInt(42), types.EmptyRootHash, types.BlockNonce{23}, 1, 1, common.LocationFromAddressBytes([]byte{0x01, 0x01}), common.BytesToAddress([]byte{0}, common.Location{0, 0})), woBody, nil)
}

func writeBlockForReceipts(db ethdb.Database, hash common.Hash, txs types.Transactions) {
Expand Down
2 changes: 1 addition & 1 deletion core/rawdb/db.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions core/slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,7 @@ func (sl *Slice) combinePendingHeader(header *types.WorkObject, slPendingHeader
combinedPendingHeader.WorkObjectHeader().SetTxHash(header.TxHash())
combinedPendingHeader.WorkObjectHeader().SetPrimeTerminusNumber(header.PrimeTerminusNumber())
combinedPendingHeader.WorkObjectHeader().SetCoinbase(header.Coinbase())
combinedPendingHeader.WorkObjectHeader().SetLock(header.Lock())

combinedPendingHeader.Header().SetEtxRollupHash(header.EtxRollupHash())
combinedPendingHeader.Header().SetUncledEntropy(header.Header().UncledEntropy())
Expand Down Expand Up @@ -1027,8 +1028,6 @@ func (sl *Slice) NewGenesisPendingHeader(domPendingHeader *types.WorkObject, dom
localPendingHeader.WorkObjectHeader().SetCoinbase(common.Zero)
}

localPendingHeader.WorkObjectHeader().SetLocation(common.Location{0, 0})

if nodeCtx == common.PRIME_CTX {
domPendingHeader = types.CopyWorkObject(localPendingHeader)
} else {
Expand Down
70 changes: 57 additions & 13 deletions core/state_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package core
import (
"errors"
"fmt"
"math"
"math/big"
"runtime/debug"
"sync"
Expand Down Expand Up @@ -306,6 +307,9 @@ func (p *StateProcessor) Process(block *types.WorkObject, batch ethdb.Batch) (ty
emittedEtxs := make([]*types.Transaction, 0)
// create a etx for the Coinbase and all the workshares in the block
coinbase := block.Coinbase()
if _, err := coinbase.InternalAddress(); err != nil {
return nil, nil, nil, nil, 0, 0, nil, fmt.Errorf("could not get internal address for coinbase: %w", err)
}
if coinbase.IsInQiLedgerScope() { // placeholder for the coinbase
coinbaseEtx := types.NewTx(&types.ExternalTx{})
emittedEtxs = append(emittedEtxs, coinbaseEtx)
Expand All @@ -318,13 +322,17 @@ func (p *StateProcessor) Process(block *types.WorkObject, batch ethdb.Batch) (ty
for i, uncle := range block.Uncles() {
reward := misc.CalculateReward(uncle)
uncleCoinbase := uncle.Coinbase()
if _, err := uncleCoinbase.InternalAddress(); err != nil {
return nil, nil, nil, nil, 0, 0, nil, fmt.Errorf("could not get internal address for uncle coinbase: %w", err)
}
// parent hash encoding for populating into the originating tx hash for coinbase
origin := block.ParentHash(nodeCtx)
origin[0] = byte(block.Location().Region())
origin[1] = byte(block.Location().Zone())

emittedEtxs = append(emittedEtxs, types.NewTx(&types.ExternalTx{To: &uncleCoinbase, Value: reward, IsCoinbase: true, OriginatingTxHash: origin, ETXIndex: uint16(i) + 1, Sender: uncleCoinbase}))
emittedEtxs = append(emittedEtxs, types.NewTx(&types.ExternalTx{To: &uncleCoinbase, Value: reward, IsCoinbase: true, OriginatingTxHash: origin, ETXIndex: uint16(i) + 1, Sender: uncleCoinbase, Data: []byte{uncle.Lock()}}))
}
quaiCoinbaseEtxs := make(map[[21]byte]*big.Int)
var totalQiTime time.Duration
var totalEtxAppendTime time.Duration
var totalEtxCoinbaseTime time.Duration
Expand Down Expand Up @@ -403,12 +411,25 @@ func (p *StateProcessor) Process(block *types.WorkObject, batch ethdb.Batch) (ty
// 3) do not produce any receipts/logs
// 4) etx emit threshold numbers
if types.IsCoinBaseTx(tx) {
iAddr, err := tx.To().InternalAddress()
if err != nil {
return nil, nil, nil, nil, 0, 0, nil, errors.New("coinbase address is not in the chain scope")
if tx.To() == nil {
return nil, nil, nil, nil, 0, 0, nil, fmt.Errorf("coinbase tx %x has no recipient", tx.Hash())
}
if len(tx.Data()) == 0 {
return nil, nil, nil, nil, 0, 0, nil, fmt.Errorf("coinbase tx %x has no lockup byte", tx.Hash())
}
if _, err := tx.To().InternalAddress(); err != nil {
return nil, nil, nil, nil, 0, 0, nil, fmt.Errorf("coinbase tx %x has invalid recipient: %w", tx.Hash(), err)
}
lockupByte := tx.Data()[0]
if tx.To().IsInQiLedgerScope() {
value := tx.Value()
if int(lockupByte) > len(params.LockupByteToBlockDepth) {
return nil, nil, nil, nil, 0, 0, nil, fmt.Errorf("coinbase lockup byte %d is out of range", lockupByte)
}
lockup := new(big.Int).SetUint64(params.LockupByteToBlockDepth[lockupByte])
if lockup.Uint64() < params.ConversionLockPeriod {
return nil, nil, nil, nil, 0, 0, nil, fmt.Errorf("coinbase lockup period is less than the minimum lockup period of %d blocks", params.ConversionLockPeriod)
}
value := params.CalculateCoinbaseValueWithLockup(tx.Value(), lockupByte)
denominations := misc.FindMinDenominations(value)
outputIndex := uint16(0)
// Iterate over the denominations in descending order
Expand All @@ -422,28 +443,36 @@ func (p *StateProcessor) Process(block *types.WorkObject, batch ethdb.Batch) (ty
// No more gas, the rest of the denominations are lost but the tx is still valid
break
}
utxo := types.NewUtxoEntry(types.NewTxOut(uint8(denomination), tx.To().Bytes(), block.Number(nodeCtx)))
utxo := types.NewUtxoEntry(types.NewTxOut(uint8(denomination), tx.To().Bytes(), lockup))
// the ETX hash is guaranteed to be unique
if err := rawdb.CreateUTXO(batch, etx.Hash(), outputIndex, utxo); err != nil {
return nil, nil, nil, nil, 0, 0, nil, err
}
utxosCreatedDeleted.UtxosCreatedHashes = append(utxosCreatedDeleted.UtxosCreatedHashes, types.UTXOHash(etx.Hash(), outputIndex, utxo))
utxosCreatedDeleted.UtxosCreatedKeys = append(utxosCreatedDeleted.UtxosCreatedKeys, rawdb.UtxoKey(etx.Hash(), outputIndex))
p.logger.Debugf("Creating UTXO for coinbase %032x with denomination %d index %d\n", tx.Hash(), denomination, outputIndex)
p.logger.Debugf("Creating UTXO for coinbase %032x with denomination %d index %d and lock %d\n", tx.Hash(), denomination, outputIndex, lockup.Int64())
outputIndex++
}
}
} else if tx.To().IsInQuaiLedgerScope() {
// This includes the value and the fees
statedb.AddBalance(iAddr, tx.Value())
// Combine similar lockups (to address and lockup period) into a single lockup entry
coinbaseAddrWithLockup := [21]byte(append(tx.To().Bytes(), lockupByte))
if val, ok := quaiCoinbaseEtxs[coinbaseAddrWithLockup]; ok {
// Combine the values of the coinbase transactions
val.Add(val, tx.Value())
quaiCoinbaseEtxs[coinbaseAddrWithLockup] = val
} else {
// Add the new coinbase transaction to the map
quaiCoinbaseEtxs[coinbaseAddrWithLockup] = tx.Value() // this creates a new *big.Int
}
}
timeDelta := time.Since(startTimeEtx)
timeCoinbase += timeDelta
continue
}
if etx.To().IsInQiLedgerScope() {
if etx.ETXSender().Location().Equal(*etx.To().Location()) { // Quai->Qi Conversion
lock := new(big.Int).Add(header.Number(nodeCtx), big.NewInt(params.ConversionLockPeriod))
lock := new(big.Int).Add(header.Number(nodeCtx), new(big.Int).SetUint64(params.ConversionLockPeriod))
primeTerminus := p.hc.GetHeaderByHash(header.PrimeTerminusHash())
if primeTerminus == nil {
return nil, nil, nil, nil, 0, 0, nil, fmt.Errorf("could not find prime terminus header %032x", header.PrimeTerminusHash())
Expand Down Expand Up @@ -509,7 +538,7 @@ func (p *StateProcessor) Process(block *types.WorkObject, batch ethdb.Batch) (ty
continue
} else {
if etx.ETXSender().Location().Equal(*etx.To().Location()) { // Qi->Quai Conversion
msg.SetLock(new(big.Int).Add(header.Number(nodeCtx), big.NewInt(params.ConversionLockPeriod)))
msg.SetLock(new(big.Int).Add(header.Number(nodeCtx), new(big.Int).SetUint64(params.ConversionLockPeriod)))
primeTerminus := p.hc.GetHeaderByHash(header.PrimeTerminusHash())
if primeTerminus == nil {
return nil, nil, nil, nil, 0, 0, nil, fmt.Errorf("could not find prime terminus header %032x", header.PrimeTerminusHash())
Expand Down Expand Up @@ -590,14 +619,29 @@ func (p *StateProcessor) Process(block *types.WorkObject, batch ethdb.Batch) (ty
p.logger.Errorf("prevInboundEtxs: %d, oldestIndex: %d, etxHash: %s", len(prevInboundEtxs), oldestIndex.Int64(), etx.Hash().Hex())
return nil, nil, nil, nil, 0, 0, nil, fmt.Errorf("total gas used by ETXs %d is not within the range %d to %d", totalEtxGas, minimumEtxGas, maximumEtxGas)
}
lockupContractAddress := vm.LockupContractAddresses[[2]byte{nodeLocation[0], nodeLocation[1]}]
for coinbaseAddrWithLockup, value := range quaiCoinbaseEtxs {
addr := common.BytesToAddress(coinbaseAddrWithLockup[:20], nodeLocation)
lockupByte := coinbaseAddrWithLockup[20]
lockup := new(big.Int).SetUint64(params.LockupByteToBlockDepth[lockupByte])
if lockup.Uint64() < params.ConversionLockPeriod {
return nil, nil, nil, nil, 0, 0, nil, fmt.Errorf("coinbase lockup period is less than the minimum lockup period of %d blocks", params.ConversionLockPeriod)
}
value := params.CalculateCoinbaseValueWithLockup(value, lockupByte)
gasUsed, _, err := vm.AddNewLock(parent.QuaiStateSize(), statedb, addr, new(types.GasPool).AddGas(math.MaxUint64), lockup, value, lockupContractAddress)
if err != nil {
return nil, nil, nil, nil, 0, 0, nil, err
}
p.logger.Debugf("Creating Lockup for coinbase addr %s with value %d lock %d gasUsed %d\n", addr.String(), value.Uint64(), lockup.Int64(), gasUsed)
}

coinbaseReward := misc.CalculateReward(block.WorkObjectHeader())
blockReward := new(big.Int).Add(coinbaseReward, totalFees)
// parent hash encoding for populating into the originating tx hash for coinbase
origin := block.ParentHash(nodeCtx)
origin[0] = byte(block.Location().Region())
origin[1] = byte(block.Location().Zone())
emittedEtxs[0] = types.NewTx(&types.ExternalTx{To: &coinbase, Value: blockReward, IsCoinbase: true, OriginatingTxHash: origin, ETXIndex: 0, Sender: coinbase})
emittedEtxs[0] = types.NewTx(&types.ExternalTx{To: &coinbase, Value: blockReward, IsCoinbase: true, OriginatingTxHash: origin, ETXIndex: 0, Sender: coinbase, Data: []byte{block.Lock()}})

time4 := common.PrettyDuration(time.Since(start))
// Finalize the block, applying any consensus engine specific extras (e.g. block rewards)
Expand Down Expand Up @@ -1287,7 +1331,7 @@ func ApplyTransaction(config *params.ChainConfig, parent *types.WorkObject, pare
return nil, nil, err
}
if tx.Type() == types.ExternalTxType && tx.ETXSender().Location().Equal(*tx.To().Location()) { // Qi->Quai Conversion
msg.SetLock(new(big.Int).Add(header.Number(nodeCtx), big.NewInt(params.ConversionLockPeriod)))
msg.SetLock(new(big.Int).Add(header.Number(nodeCtx), new(big.Int).SetUint64(params.ConversionLockPeriod)))
var primeTerminus *types.WorkObject
if parentOrder == common.PRIME_CTX {
primeTerminus = parent
Expand Down
Loading

0 comments on commit 466ae5f

Please sign in to comment.